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}")
attachments=Attachment.where("is_publish = 1 and is_public = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course') and (filename like :p)",:p=>search).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') and (filename like :p)",:p=>search).order("#{order.nil??'created_on':order}#{score}")
end
# 获取我的资源
@ -2748,15 +2748,15 @@ 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}")
attachments=Attachment.where("id in (#{apply_ids.empty??'0':apply_ids.join(',')}) and container_type in(#{resource_type}) 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 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
# 获取我的项目资源
@ -2791,12 +2791,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
# 获取我上传的附件
@ -2814,13 +2814,13 @@ class UsersController < ApplicationController
@ -2835,12 +2835,12 @@ class UsersController < ApplicationController
# 获取我的用户类型资源
defget_principal_resources_publicorder,score
attchments=Attachment.where("container_type = 'Principal' and is_public =1 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").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
# 资源库 分为全部 课程资源 项目资源 附件
@ -2882,18 +2882,18 @@ class UsersController < ApplicationController