@field=params[:org_subfield_id].nil??OrgSubfield.where("organization_id =? and field_type =?",params[:id].to_i,"Comptec").first:OrgSubfield.find(params[:org_subfield_id])
@field=params[:org_subfield_id].nil??OrgSubfield.where("organization_id =? and field_type =?",params[:id].to_i,"Comptec").first:OrgSubfield.find(params[:org_subfield_id])
@type=params[:type]
@type=params[:type]
@ -187,10 +184,6 @@ class OrganizationsController < ApplicationController
@field=params[:org_subfield_id].nil??OrgSubfield.where("organization_id =? and field_type =?",params[:id].to_i,"Compstu").first:OrgSubfield.find(params[:org_subfield_id])
@field=params[:org_subfield_id].nil??OrgSubfield.where("organization_id =? and field_type =?",params[:id].to_i,"Compstu").first:OrgSubfield.find(params[:org_subfield_id])
@type=params[:type]
@type=params[:type]
@ -214,6 +207,56 @@ class OrganizationsController < ApplicationController
@field=params[:org_subfield_id].nil??OrgSubfield.where("organization_id =? and field_type =?",params[:id].to_i,"Comppro").first:OrgSubfield.find(params[:org_subfield_id])
@type=params[:type]
if@type.nil?
@containers=Project.find_by_sql("SELECT * FROM `projects` where status = 1 and is_public = 1 and name like '%#{q}%' order by updated_on desc;")
elsif@type=="famous"
@containers=Project.find_by_sql("SELECT * FROM `projects` where status =1 and is_public = 1 and hot = 1 and name like '%#{q}%' order by updated_on desc;")
@field=params[:org_subfield_id].nil??OrgSubfield.where("organization_id =? and field_type =?",params[:id].to_i,"Compstu").first:OrgSubfield.find(params[:org_subfield_id])
@type=params[:type]
if@type.nil?
@containers=Course.find_by_sql("SELECT * FROM `courses` where is_delete = 0 and is_public = 1 and name like '%#{q}%' order by updated_at desc;")
elsif@type=="famous"
@containers=Course.find_by_sql("SELECT * FROM `courses` where is_delete = 0 and is_public = 1 and hot = 1 and name like '%#{q}%' order by updated_at desc;")
@field=params[:org_subfield_id].nil??OrgSubfield.where("organization_id =? and field_type =?",params[:id].to_i,"Compstu").first:OrgSubfield.find(params[:org_subfield_id])
@type=params[:type]
if@type=="courses"||@type.nil?
@org_students=User.find_by_sql("select u.*, ue.student_id, ue.school_id,(select count(*) from courses where courses.tea_id = u.id) as course_count
acts=UserActivity.find_by_sql("SELECT * FROM `user_activities` where act_type in ('HomeworkCommon', 'news', 'message', 'Issue') and (container_type = 'Course' or container_type = 'Project') order by created_at limit 10;")
end
deforg_teacher_resource_countuser
deforg_teacher_resource_countuser
results=Attachment.find_by_sql("SELECT * FROM attachments where author_id = #{user.id};").count
results=Attachment.find_by_sql("SELECT * FROM attachments where author_id = #{user.id};").count