You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pgfqe6ch8/app/helpers/syllabuses_helper.rb

84 lines
2.2 KiB

# 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_option
content = []
option0 = []
option0 << "请选择课程性质"
option0 << 0
option1 = []
option1 << "专业选修课"
option1 << 3
option2 = []
option2 << "学科必修课"
option2 << 2
option3 = []
option3 << "公共必修课"
option3 << 1
option4 = []
option4 << "实践选修课"
option4 << 5
option5 = []
option5 << "实践必修课"
option5 << 4
content << option0
content << option1
content << option2
content << option3
content << option4
content << option5
content
end
end