@org_activities=OrgActivity.where("(org_act_type='OrgDocumentComment'and org_act_id in (#{@org_subfield_ids.join(",")})) || (container_type='OrgSubfield' and container_id=#{@org_subfield.id})").order('updated_at desc').page(params[:page]||1).per(10)
shield_project_ids=ShieldActivity.where("container_type='Organization' and container_id=#{@organization.id} and shield_type='Project'").map(&:shield_id)
shield_course_ids=ShieldActivity.where("container_type='Organization' and container_id=#{@organization.id} and shield_type='Course'").map(&:shield_id)
@org_activities=OrgActivity.where("container_type = 'Project' and org_act_type = 'Issue' and container_id in (#{project_ids.join(',')})").order('updated_at desc').page(params[:page]||1).per(10)
when'project_message'
@org_activities=OrgActivity.where("container_type = 'Project' and org_act_type = 'Message' and container_id in (#{project_ids.join(',')})").order('updated_at desc').page(params[:page]||1).per(10)
when'org'
@org_activities=OrgActivity.where("container_id =? and container_type =?",@organization.id,'Organization').order('updated_at desc').page(params[:page]||1).per(10)
when'course_homework'
@org_activities=OrgActivity.where("container_type = 'Course' and org_act_type = 'HomeworkCommon' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page]||1).per(10)
when'course_news'
@org_activities=OrgActivity.where("container_type = 'Course' and org_act_type = 'News' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page]||1).per(10)
when'course_message'
@org_activities=OrgActivity.where("container_type = 'Course' and org_act_type = 'Message' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page]||1).per(10)
when'course_poll'
@org_activities=OrgActivity.where("container_type = 'Course' and org_act_type = 'Poll' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page]||1).per(10)
sameName=@config_page?Organization.where('name = ? and id != ?',params[:org_name],params[:org_id].to_i).count==0:Organization.where('name = ?',params[:org_name]).count==0
sql="select courses.* from courses inner join members on courses.id = members.course_id where members.user_id = #{User.current.id} and courses.name like '#{condition}'"+
"and courses.id not in (select distinct org_courses.course_id from org_courses where org_courses.organization_id = #{@organization.id})"
sql="select projects.* from projects inner join members on projects.id = members.project_id where members.user_id = #{User.current.id} and projects.status != 9 and projects.name like '#{condition}'"+
" and projects.id not in (select org_projects.project_id from org_projects where organization_id = #{@organization.id})"