attachments=Attachment.where("(is_publish = 1 and is_public =1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course')) ").order("#{order.nil??'created_on':order}#{score}")
attachments=Attachment.where("(is_publish = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course')) ").order("#{order.nil??'created_on':order}#{score}")
end
# 获取公共资源搜索
@ -2637,6 +2695,17 @@ class UsersController < ApplicationController
attachments=Attachment.where("id in (#{apply_ids.empty??'0':apply_ids.join(',')}) and container_type in(#{resource_type})").order("#{order.nil??'created_on':order}#{score}")
attchments=Attachment.where("(container_type = 'Course'and container_id is not null and is_publish = 1 and is_public =1)").order("#{order.nil??'created_on':order}#{score}")
attchments=Attachment.where("(container_type = 'Course'and container_id is not null and is_publish = 1)").order("#{order.nil??'created_on':order}#{score}")
attchments=Attachment.where("(container_type = 'Course'and container_id is not null and is_publish = 1 and is_public =1) and (filename like :p)",:p=>search).order("#{order.nil??'created_on':order}#{score}")
attchments=Attachment.where("(container_type = 'Course'and container_id is not null and is_publish = 1) and (filename like :p)",:p=>search).order("#{order.nil??'created_on':order}#{score}")
end
# 获取我的项目资源
@ -2670,12 +2739,12 @@ class UsersController < ApplicationController
attchments=Attachment.where("container_type = 'Project' and container_id is not null and is_public =1").order("#{order.nil??'created_on':order}#{score}")
attchments=Attachment.where("container_type = 'Project' and container_id is not null").order("#{order.nil??'created_on':order}#{score}")
attchments=Attachment.where("(container_type = 'Project' and container_id is not null and is_public =1) and (filename like :p)",:p=>search).order("#{order.nil??'created_on':order}#{score}")
attchments=Attachment.where("(container_type = 'Project' and container_id is not null) and (filename like :p)",:p=>search).order("#{order.nil??'created_on':order}#{score}")
end
# 获取我上传的附件
@ -2693,13 +2762,13 @@ class UsersController < ApplicationController
@ -2714,12 +2783,12 @@ class UsersController < ApplicationController
# 获取我的用户类型资源
defget_principal_resources_publicorder,score
attchments=Attachment.where("container_type = 'Principal'and container_id is not null and is_public =1").order("#{order.nil??'created_on':order}#{score}")
attchments=Attachment.where("container_type = 'Principal'and container_id is not null").order("#{order.nil??'created_on':order}#{score}")
attchments=Attachment.where("(container_type = 'Principal'and container_id is not null and is_public =1) and (filename like :p)",:p=>search).order("#{order.nil??'created_on':order}#{score}")
attchments=Attachment.where("(container_type = 'Principal'and container_id is not null) and (filename like :p)",:p=>search).order("#{order.nil??'created_on':order}#{score}")
end
# 资源库 分为全部 课程资源 项目资源 附件
@ -2761,6 +2830,20 @@ class UsersController < ApplicationController