diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 98483bb64..4747469cf 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -159,6 +159,10 @@ class OrganizationsController < ApplicationController end def teachers + unless @organization.allow_set_teachers + render_403 + return + end q = params[:search].nil? ? "" : "#{params[:search].strip}" if params[:type] == "courses" || params[:type].nil? @org_teachers = User.find_by_sql("select u.*, ue.technical_title, ue.school_id,(select count(*) from courses where courses.tea_id = u.id) as course_count @@ -169,6 +173,9 @@ class OrganizationsController < ApplicationController elsif params[:type] == "resources" @org_teachers = User.find_by_sql("select u.*, ue.technical_title, ue.school_id,(select count(*) from attachments where attachments.author_id = u.id) as course_count from users u, user_extensions ue where u.id = ue.user_id and ue.identity=0 and concat(lastname,firstname,login) like '%#{q}%' order by course_count desc") + elsif params[:type] == "famous" + @org_teachers = User.find_by_sql("select u.*, ue.technical_title, ue.school_id,(select count(*) from courses where courses.tea_id = u.id) as course_count + from users u, user_extensions ue where u.id = ue.user_id and ue.identity=0 and u.excellent_teacher =1 and concat(lastname,firstname,login) like '%#{q}%' order by course_count desc") end limit = 10 # @is_remote = true diff --git a/app/views/organizations/_org_subfield_rightM2.html.erb b/app/views/organizations/_org_subfield_rightM2.html.erb index 567df26d9..17a485583 100644 --- a/app/views/organizations/_org_subfield_rightM2.html.erb +++ b/app/views/organizations/_org_subfield_rightM2.html.erb @@ -1,5 +1,7 @@