diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index d26cf698e..a120394ef 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -198,7 +198,7 @@ class ProjectsController < ApplicationController @project_type = params[:project_type] @school_id = params[:school_id] per_page_option = 10 - if @school_id == "0" or @school.nil? + if @school_id == "0" or @school_id.nil? @projects_all = Project.active.visible. joins("LEFT JOIN #{ProjectStatus.table_name} ON #{Project.table_name}.id = #{ProjectStatus.table_name}.project_id"). where("#{Project.table_name}.project_type = ? ", Project::ProjectType_course) diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 5bd677bdf..bddf9d0d4 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -62,33 +62,33 @@ module ProjectsHelper content_tag('div', content, :class => "tabs_enterprise") end - def sort_course(state, project_type) + def sort_course(state, project_type, school_id) content = ''.html_safe case state when 0 - content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type), :class=>"selected"), :class=>"selected") - content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type))) + content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type), :school_id => school_id, :class=>"selected"), :class=>"selected") + content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type, :school_id => school_id))) # content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type))) - content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type))) + content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type, :school_id => school_id))) when 1 - content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type))) - content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type), :class=>"selected"), :class=>"selected") + content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type, :school_id => school_id))) + content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type, :school_id => school_id), :class=>"selected"), :class=>"selected") # content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type))) - content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type))) + content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type, :school_id => school_id))) when 2 - content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type))) - content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type))) + content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type, :school_id => school_id))) + content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type, :school_id => school_id))) # content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type), :class=>"selected"), :class=>"selected") - content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type))) + content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type, :school_id => school_id))) #gcm when 3 - content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type))) - content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type))) + content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type, :school_id => school_id))) + content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type, :school_id => school_id))) # content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type))) - content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type), :class=>"selected"), :class=>"selected") + content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type, :school_id => school_id), :class=>"selected"), :class=>"selected") end #gcmend diff --git a/app/helpers/welcome_helper.rb b/app/helpers/welcome_helper.rb index ed435fe6d..e05f789a9 100644 --- a/app/helpers/welcome_helper.rb +++ b/app/helpers/welcome_helper.rb @@ -154,6 +154,12 @@ module WelcomeHelper sort_course_by_hot limit end + def find_all_new_hot_course limit = 9 + #sort_project_by_hot_rails 1, 'course_ac_para DESC', limit + time_now = Time.new.strftime("%Y"); + Project.visible.joins(:project_status).where("#{Project.table_name}.project_type = ? and #{Project.table_name}.created_on like '%#{time_now}%'", 1).order("course_ac_para DESC").limit(limit).all + end + def find_all_hot_bid sort_bid_by_hot end diff --git a/app/views/projects/course.html.erb b/app/views/projects/course.html.erb index 1359b8bea..98228c168 100644 --- a/app/views/projects/course.html.erb +++ b/app/views/projects/course.html.erb @@ -30,7 +30,7 @@ <% end %> -<%= sort_course(@s_type, @project_type)%> +<%= sort_course(@s_type, @project_type, @school_id)%>
- 该学校未开设任何课程,您可以查看其他学校课程 -
- - <% find_all_hot_course(9).map do |project| %> -+ 该学校未开设任何课程,您可以查看其他学校课程 +
+ + <% find_all_new_hot_course(9).map do |project| %> +当前网站状态 | -活跃课程: <%=@courseCount%> | -高校: 2个 | -教师: <%=@teacherCount%> 名 | -学生: <%=@studentCount%> 名 | - |
当前网站状态 | +活跃课程: <%=@courseCount%> | +高校: 2个 | +教师: <%=@teacherCount%> 名 | +学生: <%=@studentCount%> 名 | + |