2016-07-01 11:11:53 +08:00
|
|
|
# encoding: utf-8
|
2016-06-14 10:38:11 +08:00
|
|
|
module SyllabusesHelper
|
2016-06-28 15:13:04 +08:00
|
|
|
def get_syllabuses_by_tag(tag_name)
|
|
|
|
Syllabus.tagged_with(tag_name).order('updated_at desc')
|
|
|
|
end
|
2016-06-30 10:44:11 +08:00
|
|
|
|
|
|
|
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
|
2016-07-01 11:11:53 +08:00
|
|
|
|
|
|
|
#课程性质下拉框
|
|
|
|
def syllabus_type
|
|
|
|
type = []
|
|
|
|
option1 = []
|
|
|
|
option2 = []
|
|
|
|
option3 = []
|
|
|
|
option4 = []
|
|
|
|
option5 = []
|
|
|
|
option6 = []
|
|
|
|
|
|
|
|
option1 << "请选择"
|
2016-07-01 21:38:37 +08:00
|
|
|
option1 << 0
|
2016-07-01 11:11:53 +08:00
|
|
|
option2 << "公共必修课"
|
2016-07-01 21:38:37 +08:00
|
|
|
option2 << 1
|
2016-07-01 11:11:53 +08:00
|
|
|
option3 << "学科必修课"
|
2016-07-01 21:38:37 +08:00
|
|
|
option3 << 2
|
2016-07-01 11:11:53 +08:00
|
|
|
option4 << "专业选修课"
|
2016-07-01 21:38:37 +08:00
|
|
|
option4 << 3
|
2016-07-01 11:11:53 +08:00
|
|
|
option5 << "实践必修课"
|
2016-07-01 21:38:37 +08:00
|
|
|
option5 << 4
|
2016-07-01 11:11:53 +08:00
|
|
|
option6 << "实践选修课"
|
2016-07-01 21:38:37 +08:00
|
|
|
option6 << 5
|
2016-07-01 11:11:53 +08:00
|
|
|
|
|
|
|
type << option1
|
|
|
|
type << option2
|
|
|
|
type << option3
|
|
|
|
type << option4
|
|
|
|
type << option5
|
|
|
|
type << option6
|
|
|
|
|
|
|
|
type
|
|
|
|
end
|
2016-06-14 10:38:11 +08:00
|
|
|
end
|