Branch_szzh
lizanle 10 years ago
parent 375c016783
commit ae6260571b

@ -1106,25 +1106,25 @@ class UsersController < ApplicationController
#确定container_type #确定container_type
# @user = User.find(params[:id]) # @user = User.find(params[:id])
if(params[:type].nil? || params[:type] == "1") #全部 if(params[:type].nil? || params[:type] == "1") #全部
if User.current.id == params[:id] if User.current.id.to_i == params[:id].to_i
@attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon') ").order("created_on desc") @attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon') ").order("created_on desc")
else else
@attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon') ").order("created_on desc") @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon') ").order("created_on desc")
end end
elsif params[:type] == "2" #课程资源 elsif params[:type] == "2" #课程资源
if User.current.id == params[:id] if User.current.id.to_i == params[:id].to_i
@attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Course'").order("created_on desc") @attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Course'").order("created_on desc")
else else
@attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type = 'Course' ").order("created_on desc") @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type = 'Course' ").order("created_on desc")
end end
elsif params[:type] == "3" #项目资源 elsif params[:type] == "3" #项目资源
if User.current.id == params[:id] if User.current.id.to_i == params[:id].to_i
@attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Project'").order("created_on desc") @attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Project'").order("created_on desc")
else else
@attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type = 'Project' ").order("created_on desc") @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type = 'Project' ").order("created_on desc")
end end
elsif params[:type] == "4" #附件 elsif params[:type] == "4" #附件
if User.current.id == params[:id] if User.current.id.to_i == params[:id].to_i
@attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Project','Issue','Document','Message','News','StudentWorkScore','HomewCommon')").order("created_on desc") @attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Project','Issue','Document','Message','News','StudentWorkScore','HomewCommon')").order("created_on desc")
else else
@attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon')").order("created_on desc") @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon')").order("created_on desc")

Loading…
Cancel
Save