|
|
|
@ -665,4 +665,30 @@ module CoursesHelper
|
|
|
|
|
count = get_course_activity([course],course_activity_count)[course.id]
|
|
|
|
|
count.nil? ? 0 : count
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#重启、关闭课程按钮
|
|
|
|
|
def set_course_time course
|
|
|
|
|
id = "finish_course_#{course.id}"
|
|
|
|
|
linkPath = course_endTime_timeout?(course) ? restartcourse_course_path(course) : finishcourse_course_path(course, format: :js)
|
|
|
|
|
desc = course_endTime_timeout?(course) ? l(:label_course_reload) : l(:label_course_closed)
|
|
|
|
|
link_to "<span class='pr_close'></span>#{desc}".html_safe, linkPath, :remote => true, :method => :post, :id => id, :confirm => l(:label_course_closed_tips, :desc => desc), :class => "pr_join_a"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def join_in_course_header(course, user, options=[])
|
|
|
|
|
if user.logged?
|
|
|
|
|
joined = user.member_of_course? course
|
|
|
|
|
text = joined ? ("<em class='pr_arrow'></em>".html_safe + l(:label_course_exit_student)) : ("<em class='pr_add'></em>".html_safe + l(:label_course_join_student))
|
|
|
|
|
url = joined ? join_path(:object_id => course.id) : try_join_path(:object_id => course.id)
|
|
|
|
|
method = joined ? 'delete' : 'post'
|
|
|
|
|
if joined
|
|
|
|
|
link = "<span class='pr_join_span' ><em class='pr_add'></em>#{l(:label_course_join_student)}</span>" + link_to(text, url, :remote => true, :method => method, :class => "pr_join_a", :id => "#{course.id}", :confirm => l(:text_are_you_sure_out))
|
|
|
|
|
else
|
|
|
|
|
link = link_to(text, url, :remote => true, :method => method, :id => "#{course.id}", :class => "pr_join_a") + "<span class='pr_join_span' ><em class='pr_arrow'></em>#{l(:label_course_exit_student)}</span>".html_safe
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
link = "<span class='pr_join_span' ><em class='pr_add'></em>#{l(:label_course_join_student)}</span>" +
|
|
|
|
|
"<span class='pr_join_span' ><em class='pr_arrow'></em>#{l(:label_course_exit_student)}</span>"
|
|
|
|
|
end
|
|
|
|
|
link.html_safe
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|