87 lines
2.2 KiB
Ruby
87 lines
2.2 KiB
Ruby
# encoding: utf-8
|
|
module SyllabusesHelper
|
|
def get_syllabuses_by_tag(tag_name)
|
|
Syllabus.tagged_with(tag_name).order('updated_at desc')
|
|
end
|
|
|
|
def find_user_not_in_current_syllabus_by_name syllabus
|
|
if params[:q] && params[:q].lstrip.rstrip != ""
|
|
scope = Principal.active.sorted.not_member_of_syllabus(syllabus).like(params[:q])
|
|
else
|
|
scope = []
|
|
end
|
|
principals = paginateHelper scope,10
|
|
s = content_tag('ul', project_member_check_box_tags_ex('membership[user_ids][]', principals), :id => 'principals', :class => 'sy_new_tchlist')
|
|
links = pagination_links_full(@obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true){|text, parameters, options|
|
|
link_to text, host_with_protocol + "/syllabus_member/syl_member_autocomplete?" + parameters.merge(:q => params[:q],:flag => true,:syllabus=> syllabus, :format => 'js').to_query, :remote => true
|
|
}
|
|
s + content_tag('ul', links,:class => 'wlist',:style=>'float:left !important', :id => "syllabus_member_pagination_links" )
|
|
end
|
|
|
|
def teacher_count syllabus
|
|
count = 0
|
|
courses = syllabus.courses
|
|
unless courses.empty?
|
|
courses.each do |c|
|
|
count += TeacherAndAssistantCount c
|
|
end
|
|
end
|
|
count
|
|
end
|
|
|
|
def student_count syllabus
|
|
count = 0
|
|
courses = syllabus.courses
|
|
unless courses.empty?
|
|
courses.each do |c|
|
|
count += studentCount c
|
|
end
|
|
end
|
|
count
|
|
end
|
|
|
|
def file_count syllabus
|
|
count = 0
|
|
courses = syllabus.courses
|
|
unless courses.empty?
|
|
courses.each do |c|
|
|
count += visable_attachemnts_incourse(c).count
|
|
end
|
|
end
|
|
count
|
|
end
|
|
|
|
#课程性质下拉框
|
|
def syllabus_type
|
|
type = []
|
|
option1 = []
|
|
option2 = []
|
|
option3 = []
|
|
option4 = []
|
|
option5 = []
|
|
option6 = []
|
|
|
|
option1 << "请选择"
|
|
option1 << 0
|
|
option2 << "公共必修课"
|
|
option2 << 1
|
|
option3 << "学科必修课"
|
|
option3 << 2
|
|
option4 << "专业选修课"
|
|
option4 << 3
|
|
option5 << "实践必修课"
|
|
option5 << 4
|
|
option6 << "实践选修课"
|
|
option6 << 5
|
|
|
|
type << option1
|
|
type << option2
|
|
type << option3
|
|
type << option4
|
|
type << option5
|
|
type << option6
|
|
|
|
type
|
|
end
|
|
end
|