课程老师、学生接口

This commit is contained in:
z9hang 2014-12-10 20:53:41 +08:00
parent 1494821b67
commit 6dc057d03c
2 changed files with 25 additions and 4 deletions

View File

@ -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

View File

@ -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