课程修正为只有的教师才能查看学生学号

This commit is contained in:
nwb 2014-05-15 17:36:39 +08:00
parent fa7227931d
commit 4f7087f9ae
2 changed files with 12 additions and 1 deletions

View File

@ -812,6 +812,8 @@ class ProjectsController < ApplicationController
@render_file = 'member_list'
# 判断是否课程
if @project.project_type == Project::ProjectType_course
@teachers= searchTeacherAndAssistant(@project)
@canShowCode = isCourseTeacher(User.current.id)
case params[:role]
when '1'
@subPage_title = l :label_teacher_list
@ -833,6 +835,15 @@ class ProjectsController < ApplicationController
render :layout => 'base_courses' if @project.project_type == 1
end
#判断指定用户是否为课程教师
def isCourseTeacher(id)
result = false
if @teachers.find_by_user_id(id) != nil
result = true
end
result
end
def sort_project_members project, members
#userGrade = UserGrade.where(:project_id => project.id)
users = UserGrade.where(:project_id => project.id).

View File

@ -12,7 +12,7 @@
<% if @project.project_type == 1 %>
<% unless member.user.user_extensions.identity ==0 %>
<!-- added by bai 加学号 -->
<% if User.current.logged? && (!Member.where('user_id = ? and project_id = ?', User.current.id, @project.id).first.nil?) %>
<%if @canShowCode# if User.current.logged? && (!Member.where('user_id = ? and project_id = ?', User.current.id, @project.id).first.nil?) %>
<%= content_tag "p", "#{l(:label_bidding_user_studentcode)}#{' : '}#{member.user.user_extensions.student_id}", :class => "nomargin avatar_name" %>
<% end %>
<% end %>