attachments=Attachment.where("(author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type in('OrgSubfield','Principal','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty??'0':user_course_ids.join(',')}) and is_publish = 1 and container_id is not null)"+
"or (container_type = 'Project' and container_id in (#{user_project_ids.empty??'0':user_project_ids.join(',')}) and is_publish = 1 and container_id is not null)").order("#{order.nil??'created_on':order}#{score}")
@ -2628,7 +2625,6 @@ class UsersController < ApplicationController
@attachments=Attachment.where("((author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty??'0':user_course_ids.join(',')}) and is_publish = 1 and container_id is not null)"+
"or (container_type = 'Project' and container_id in (#{user_project_ids.empty??'0':user_project_ids.join(',')}) and is_publish = 1 and container_id is not null)) and (filename like :p)",:p=>search).order("#{order.nil??'created_on':order}#{score}")
@ -2636,7 +2632,6 @@ class UsersController < ApplicationController
@ -2688,14 +2680,12 @@ class UsersController < ApplicationController
# 获取我上传的附件
defget_attch_resourcesauthor_id,order,score
author_id=User.find_by_login(author_id).id
attchments=Attachment.where("(author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course','Issue',
attchments=Attachment.where("(author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course','Issue',
@ -2714,13 +2704,11 @@ class UsersController < ApplicationController
# 获取我的用户类型资源
defget_principal_resourcesauthor_id,order,score
author_id=User.find_by_login(author_id).id
attchments=Attachment.where("author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type = 'Principal'").order("#{order.nil??'created_on':order}#{score}")
attchments=Attachment.where("(author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type = 'Principal') and (filename like :p)",:p=>search).order("#{order.nil??'created_on':order}#{score}")