@ -967,7 +967,8 @@ class UsersController < ApplicationController
end
elsifparams[:type]=="2"#课程资源
ifUser.current.id.to_i==params[:id].to_i
@attachments=Attachment.where("(author_id = #{params[:id]} and container_type = 'Course') ").order("created_on desc")
user_course_ids=User.current.courses.map{|c|c.id}
@attachments=Attachment.where("(author_id = #{params[:id]} and container_type = 'Course') or (container_type = 'Course' and container_id in (#{user_course_ids.join(',')})) ").order("created_on desc")
@attachments=Attachment.where("(author_id = #{params[:id]} and is_public = 1 and container_type = 'Course')"+
@ -1382,7 +1383,8 @@ class UsersController < ApplicationController
end
elsifparams[:type]=="2"#课程资源
ifUser.current.id.to_i==params[:id].to_i
@attachments=Attachment.where("(author_id = #{params[:id]} and container_type = 'Course') ").order("created_on desc")
user_course_ids=User.current.courses.map{|c|c.id}
@attachments=Attachment.where("(author_id = #{params[:id]} and container_type = 'Course') or (container_type = 'Course' and container_id in (#{user_course_ids.join(',')})) ").order("created_on desc")
@attachments=Attachment.where("(author_id = #{params[:id]} and is_public = 1 and container_type = 'Course')"+
@ -1432,7 +1434,8 @@ class UsersController < ApplicationController
end
elsifparams[:type]=="2"#课程资源
ifUser.current.id.to_i==params[:id].to_i
@attachments=Attachment.where("author_id = #{params[:id]} and container_type = 'Course' and (filename like '%#{search}%')").order("created_on desc")
user_course_ids=User.current.courses.map{|c|c.id}
@attachments=Attachment.where("(author_id = #{params[:id]} and container_type = 'Course') or (container_type = 'Course' and container_id in (#{user_course_ids.join(',')})) ").order("created_on desc")
<span style="font-weight:normal;font-size:12px;color:#FF5722;">(<%=Attachment.where("(author_id = #{@user.id} and is_public = 1 and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) or (container_type = 'Course' and is_public = 1 and container_id in (#{@user.courses.visible.map{|c| c.id}.join(',')}))").count%>)</span>
<!--<span style="font-weight:normal;font-size:12px;color:#FF5722;">(<%#=Attachment.where("(author_id = #{@user.id} and is_public = 1 and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) or (container_type = 'Course' and is_public = 1 and container_id in (#{@user.courses.visible.map{|c| c.id}.join(',')}))").count%>)</span>-->