<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %> <% teacher_num = TeacherAndAssistantCount(@course) %> <% student_num = studentCount(@course) %> <% course_file_num = visable_attachemnts_incourse(@course).count %>

<%= link_to(@course.teacher.show_name, user_path(@course.teacher), :title => '主讲老师', :class => 'sy_cgrey') %>  >  <% if @course.syllabus %> <%=link_to @course.syllabus.title, syllabus_path(@course.syllabus_id), :class => 'sy_cgrey', :title => '课程名称' %>  >  <% end %> <%=link_to @course.name, course_path(@course), :class => 'sy_cgrey' %>

<% if is_teacher %>
<% elsif User.current.logged? && User.current.member_of_course?(@course) %>
<% end %>

邀 请 码
<% if @course.invite_code_halt == 0 %> <% if User.current.admin? || User.current.member_of_course?(@course) %> <%=@course.generate_invite_code %> <% else %> 请询问老师 <% end %> <% else %> 已停用 <% end %>

<%=@course.name %>

学期:<%= current_time_and_term @course %> 教师:<%= course_teacher_link teacher_num %> 学生:<%= course_student_link student_num %>

单位:<%= get_occupation_from_user(@course.teacher).blank? ? '无' : get_occupation_from_user(@course.teacher) %>

<% is_TA = get_user_member_roles_course @course, User.current, 7 %> <% is_TE = get_user_member_roles_course @course, User.current, 9 %> <% is_ST = get_user_member_roles_course @course, User.current, 10 %> <% if !is_teacher && is_TE %> <%= link_to '教师身份', switch_role_course_path(@course, :user_id => User.current.id, :curr_role => 10, :tar_role => (is_TA ? 7 : 9)), :class => "sy_btn_orange mr10 fl", :title => "由学生身份切换至教师身份" %> <% elsif !is_teacher && is_TA %> <%= link_to '助教身份', switch_role_course_path(@course, :user_id => User.current.id, :curr_role => 10, :tar_role => (is_TA ? 7 : 9)), :class => "sy_btn_orange mr10 fl", :title => "由学生身份切换至教师身份" %> <% elsif is_teacher && is_ST %> <%= link_to '学生身份', switch_role_course_path(@course, :user_id => User.current.id, :curr_role => (is_TA ? 7 : 9), :tar_role => 10), :class => "sy_btn_orange mr10 fl", :title => "由教师身份切换至学生身份" %> <% end %> <% unless (is_teacher || is_TA || is_TE || is_ST) %>
<%= join_in_course_header(@course, User.current) %>
<% end %>
<% if is_teacher %>

<%= @course.invite_code_halt == 0 ? "请将邀请码告诉成员" : "邀请码已停用" %>

<%= @course.invite_code_halt == 0 ? "他们可以主动加入" : "暂时停止成员主动加入" %>

<% end %>