课程老师、学生接口
This commit is contained in:
parent
1494821b67
commit
6dc057d03c
|
@ -207,19 +207,21 @@ class CoursesController < ApplicationController
|
|||
def member
|
||||
## 有角色参数的才是课程,没有的就是项目
|
||||
@render_file = 'member_list'
|
||||
@teachers= searchTeacherAndAssistant(@course)
|
||||
#@teachers= searchTeacherAndAssistant(@course)
|
||||
@canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1'
|
||||
case params[:role]
|
||||
when '1'
|
||||
@subPage_title = l :label_teacher_list
|
||||
@members = searchTeacherAndAssistant(@course)
|
||||
#@members = searchTeacherAndAssistant(@course)
|
||||
when '2'
|
||||
@subPage_title = l :label_student_list
|
||||
@members = searchStudent(@course)
|
||||
#@members = searchStudent(@course)
|
||||
else
|
||||
@subPage_title = ''
|
||||
@members = @course.member_principals.includes(:roles, :principal).all.sort
|
||||
#@members = @course.member_principals.includes(:roles, :principal).all.sort
|
||||
end
|
||||
cs = CoursesService.new
|
||||
@members = cs.course_teacher_or_student_list(params,@course)
|
||||
@members = paginateHelper @members
|
||||
render :layout => 'base_courses'
|
||||
end
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
class CoursesService
|
||||
include ApplicationHelper
|
||||
include CoursesHelper
|
||||
#参数school_id为0或不传时返回所有课程,否则返回对应学校的课程
|
||||
#参数per_page_count分页功能,每页显示的课程数
|
||||
#参数page分页功能,当前页码
|
||||
|
@ -47,4 +48,22 @@ class CoursesService
|
|||
url_to_avatar(obj)
|
||||
end
|
||||
|
||||
#课程老师或课程学生列表
|
||||
def course_teacher_or_student_list params,course
|
||||
@teachers= searchTeacherAndAssistant(course)
|
||||
#@canShowCode = isCourseTeacher(User.current.id,course) && params[:role] != '1'
|
||||
case params[:role]
|
||||
when '1'
|
||||
#@subPage_title = l :label_teacher_list
|
||||
@members = searchTeacherAndAssistant(course)
|
||||
when '2'
|
||||
#@subPage_title = l :label_student_list
|
||||
@members = searchStudent(course)
|
||||
else
|
||||
#@subPage_title = ''
|
||||
@members = @course.member_principals.includes(:roles, :principal).all.sort
|
||||
end
|
||||
@members
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in New Issue