@ -649,7 +649,7 @@ class UsersController < ApplicationController
@user_activities=UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Message'").order('created_at desc').limit(10).offset(@page*10)
else
@user_activities=UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids}) and act_type in #{course_types}").order('created_at desc').limit(10).offset(@page*10)
end
end
else
@user_activities=UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids}) and act_type in #{course_types}").order('created_at desc').limit(10).offset(@page*10)
end
@ -1004,6 +1004,12 @@ class UsersController < ApplicationController
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")
end
elsifparams[:type]=="5"#附件
ifUser.current.id.to_i==params[:id].to_i
@attachments=Attachment.where("author_id = #{params[:id]} and container_type ='Principal'").order("created_on desc")
else
@attachments=Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type ='Principal'").order("created_on desc")
end
end
@type=params[:type]||1
@limit=25
@ -1060,6 +1066,12 @@ class UsersController < ApplicationController
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")
end
elsifparams[:type]=="5"#用户资源
ifUser.current.id.to_i==params[:id].to_i
@attachments=Attachment.where("author_id = #{params[:id]} and container_type ='Principal'").order("created_on desc")
else
@attachments=Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type ='Principal'").order("created_on desc")
end
end
@type=params[:type]
@limit=25
@ -1464,6 +1476,12 @@ class UsersController < ApplicationController
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")
end
elsifparams[:type]=="5"#用户资源
ifUser.current.id.to_i==params[:id].to_i
@attachments=Attachment.where("author_id = #{params[:id]} and container_type = 'Principal'").order("created_on desc")
else
@attachments=Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type = 'Principal'").order("created_on desc")
end
end
@type=params[:type]
@limit=25
@ -1516,6 +1534,12 @@ class UsersController < ApplicationController
else
@attachments=Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon') and (filename like '%#{search}%')").order("created_on desc")
end
elsifparams[:type]=="5"#用户资源
ifUser.current.id.to_i==params[:id].to_i
@attachments=Attachment.where("author_id = #{params[:id]} and container_type = 'Principal' and (filename like '%#{search}%')").order("created_on desc")
else
@attachments=Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type = 'Principal' and (filename like '%#{search}%')").order("created_on desc")
<% courses = @user.courses.visible.select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5)%>
<% projects = @user.projects.visible.select("projects.*,(SELECT MAX(created_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(5)%>