|
|
@ -396,7 +396,7 @@ class CoursesController < ApplicationController
|
|
|
|
def teachers
|
|
|
|
def teachers
|
|
|
|
@search_str = params[:search].present? ? params[:search].strip : ""
|
|
|
|
@search_str = params[:search].present? ? params[:search].strip : ""
|
|
|
|
|
|
|
|
|
|
|
|
if @course.try(:id) != 1309 || current_user.admin? || current_user.try(:id) == 15582
|
|
|
|
if @course.try(:id) != 1309 || current_user.admin_or_business? || current_user.try(:id) == 15582
|
|
|
|
@teacher_list = @course.course_members.joins(:user).where("course_members.role in (1, 2, 3)
|
|
|
|
@teacher_list = @course.course_members.joins(:user).where("course_members.role in (1, 2, 3)
|
|
|
|
and LOWER(concat(users.lastname, users.firstname)) LIKE ?", "%#{@search_str}%")
|
|
|
|
and LOWER(concat(users.lastname, users.firstname)) LIKE ?", "%#{@search_str}%")
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -441,7 +441,7 @@ class CoursesController < ApplicationController
|
|
|
|
@applications = CourseMessage.unhandled_join_course_requests_by_course(@course).
|
|
|
|
@applications = CourseMessage.unhandled_join_course_requests_by_course(@course).
|
|
|
|
joins("join users on course_messages.course_message_id=users.id").
|
|
|
|
joins("join users on course_messages.course_message_id=users.id").
|
|
|
|
where("LOWER(concat(users.lastname, users.firstname)) LIKE ?", "%#{search_str}%")
|
|
|
|
where("LOWER(concat(users.lastname, users.firstname)) LIKE ?", "%#{search_str}%")
|
|
|
|
if @course.try(:id) != 1309 || current_user.admin? || current_user.try(:id) == 15582
|
|
|
|
if @course.try(:id) != 1309 || current_user.admin_or_business? || current_user.try(:id) == 15582
|
|
|
|
teacher_list = @course.course_members.where("course_members.role in (1, 2, 3)")
|
|
|
|
teacher_list = @course.course_members.where("course_members.role in (1, 2, 3)")
|
|
|
|
else
|
|
|
|
else
|
|
|
|
teacher_list = @course.course_members.where("(course_members.role in (1, 3) or (course_members.user_id = #{current_user.id}
|
|
|
|
teacher_list = @course.course_members.where("(course_members.role in (1, 3) or (course_members.user_id = #{current_user.id}
|
|
|
@ -838,7 +838,7 @@ class CoursesController < ApplicationController
|
|
|
|
|
|
|
|
|
|
|
|
# 已通过职业认证的教师复制课堂
|
|
|
|
# 已通过职业认证的教师复制课堂
|
|
|
|
def duplicate_course
|
|
|
|
def duplicate_course
|
|
|
|
return tip_exception("没有复制权限") unless current_user.admin? || current_user.is_teacher? || current_user.teacher_of_course?(@course)
|
|
|
|
return tip_exception("没有复制权限") unless current_user.admin_or_business? || current_user.is_teacher? || current_user.teacher_of_course?(@course)
|
|
|
|
return tip_exception("教师职业认证未通过") unless current_user.pro_certification?
|
|
|
|
return tip_exception("教师职业认证未通过") unless current_user.pro_certification?
|
|
|
|
|
|
|
|
|
|
|
|
new_course = @course.self_duplicate
|
|
|
|
new_course = @course.self_duplicate
|
|
|
@ -1404,7 +1404,7 @@ class CoursesController < ApplicationController
|
|
|
|
# Use callbacks to share common setup or constraints between actions.
|
|
|
|
# Use callbacks to share common setup or constraints between actions.
|
|
|
|
def set_course
|
|
|
|
def set_course
|
|
|
|
@course = Course.find_by!(id: params[:id])
|
|
|
|
@course = Course.find_by!(id: params[:id])
|
|
|
|
tip_exception(404, "") if @course.is_delete == 1 && !current_user.admin?
|
|
|
|
tip_exception(404, "") if @course.is_delete == 1 && !current_user.admin_or_business?
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
# Never trust parameters from the scary internet, only allow the white list through.
|
|
|
|
# Never trust parameters from the scary internet, only allow the white list through.
|
|
|
|