Merge branch 'linchun' into develop

ouyang
cxt 10 years ago
commit 98f7ad19f6

@ -51,6 +51,37 @@ class AdminController < ApplicationController
end end
end end
#管理员界面精品课程列表
def excellent_courses
@courses = Course.where("is_excellent =? or excellent_option =?", 1, 1 )
respond_to do |format|
format.html
end
end
#管理员界面课程资源列表
def course_resource_list
@resource = Attachment.where(:container_type => 'Course')
@resource = paginateHelper @resource,30
@page = (params['page'] || 1).to_i - 1
respond_to do |format|
format.html
end
end
#管理员界面項目资源列表
def project_resource_list
@pro_resource = Attachment.where(:container_type => 'Project')
@pro_resource = paginateHelper @pro_resource,30
@page = (params['page'] || 1).to_i - 1
respond_to do |format|
format.html
end
end
def users def users
sort_init 'login', 'asc' sort_init 'login', 'asc'
sort_update %w(login firstname lastname mail admin created_on last_login_on) sort_update %w(login firstname lastname mail admin created_on last_login_on)

@ -71,6 +71,11 @@ module CoursesHelper
project.members.count project.members.count
end end
# 统计课程中作品的数量
def student_works_num course
StudentWork.find_by_sql("SELECT * FROM student_works WHERE homework_common_id IN (SELECT id FROM homework_commons WHERE course_id = '#{course.id}')").count
end
# 返回教师数量即roles表中定义的Manager # 返回教师数量即roles表中定义的Manager
def teacherCount project def teacherCount project
project ? project.members.count - studentCount(project).to_i : 0 project ? project.members.count - studentCount(project).to_i : 0

@ -0,0 +1,64 @@
<h3><%=l(:label_course_resource_list)%></h3>
<div class="autoscroll">
<table class="list" style="width: 100%;table-layout: fixed">
<thead>
<tr>
<th style="width: 60px;">
资源名称
</th>
<th style="width: 30px;">
资源大小
</th>
<th style="width: 25px;">
资源类型
</th>
<th style="width: 23px;">
上传时间
</th>
<th style="width: 15px;">
下载次数
</th>
<th style="width: 20px;">
上传者
</th>
<th style="width: 35px;">
所属课程
</th>
</tr>
</thead>
<tbody>
<% @resource.each do |resource| %>
<tr class="<%= cycle("odd", "even") %>">
<td style="text-align: left;">
<%= link_to truncate(resource.filename, :length => 18), download_named_attachment_path(resource.id, resource.filename ), :title => resource.filename,:class=>'resourcesBlack'%>
</td>
<td style=" text-align: center;">
<%= number_to_human_size(resource.filesize)%>
</td>
<td style=" text-align: center;">
课程资源
</td>
<td style=" text-align: center;">
<%= format_date(resource.created_on)%>
</td>
<td style=" text-align: center;">
<%= resource.downloads %>
</td>
<td style=" text-align: center;">
<%= link_to(User.find(resource.author_id).realname, user_path(User.find(resource.author_id)) ) %>
</td>
<td style=" text-align: center;">
<%=link_to truncate(Course.find(resource.container_id).name, :length => 10), course_path(Course.find(resource.container_id)), :title => Course.find(resource.container_id).name, :class => "hidden fl w170" %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<div class="pagination">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
</div>

@ -0,0 +1,75 @@
<h3>
<%=l(:label_excellent_courses_list)%>
</h3>
<div class="autoscroll">
<table class="list" style="width: 100%;table-layout: fixed">
<thead>
<tr>
<th style="width: 25px;">
序号
</th>
<th style="width: 120px;">
课程名
</th>
<th style="width: 50px;">
主讲老师
</th>
<th style="width: 30px;">
学生数
</th>
<th style="width: 25px;">
作业数
</th>
<th style="width: 25px;">
作品数
</th>
<th style="width: 25px;">
资源数
</th>
<th style="width: 70px;">
帖子数
</th>
<th style="width: 70px;">
动态数
</th>
</tr>
</thead>
<tbody>
<% @courses.each do |course| %>
<tr class="<%= cycle("odd", "even") %>">
<td style="text-align: center;">
<%= course.id %>
</td>
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=course.name%>'>
<span>
<%= link_to(course.name, course_path(course.id)) %>
</span>
</td>
<td align="center">
<%= link_to(course.try(:teacher).try(:realname).truncate(6, omission: '...'), user_path(course.teacher)) %>
</td>
<td align="center">
<%= studentCount(course) %>
</td>
<td class="center">
<%= course.homework_commons.count%>
</td>
<td class="center">
<%= student_works_num(course) %>
</td>
<td class="center">
<%= visable_attachemnts_incourse(course).count%>
</td>
<td class="center">
<%= course.boards.first.topics.count + Message.where("board_id =? and parent_id is not ?", course.boards.first.id, nil).count %>
</td>
<td class="center">
<%= course.course_activities.count%>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>

@ -0,0 +1,64 @@
<h3><%=l(:label_project_resource_list)%></h3>
<div class="autoscroll">
<table class="list" style="width: 100%;table-layout: fixed">
<thead>
<tr>
<th style="width: 60px;">
资源名称
</th>
<th style="width: 30px;">
资源大小
</th>
<th style="width: 25px;">
资源类型
</th>
<th style="width: 23px;">
上传时间
</th>
<th style="width: 15px;">
下载次数
</th>
<th style="width: 20px;">
上传者
</th>
<th style="width: 35px;">
所属项目
</th>
</tr>
</thead>
<tbody>
<% @pro_resource.each do |pro_resource| %>
<tr class="<%= cycle("odd", "even") %>">
<td style="text-align: left;">
<%= link_to truncate(pro_resource.filename, :length => 18), download_named_attachment_path(pro_resource.id, pro_resource.filename ), :title => pro_resource.filename,:class=>'resourcesBlack'%>
</td>
<td style=" text-align: center;">
<%= number_to_human_size(pro_resource.filesize)%>
</td>
<td style=" text-align: center;">
项目资源
</td>
<td style=" text-align: center;">
<%= format_date(pro_resource.created_on)%>
</td>
<td style=" text-align: center;">
<%= pro_resource.downloads %>
</td>
<td style=" text-align: center;">
<%= link_to(User.find(pro_resource.author_id).realname, user_path(User.find(pro_resource.author_id)) ) %>
</td>
<td style=" text-align: center;">
<%=link_to truncate(Project.find(pro_resource.container_id).name, :length => 10), project_path(Project.find(pro_resource.container_id)), :title => Project.find(pro_resource.container_id).name, :class => "hidden fl w170" %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<div class="pagination">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
</div>

@ -21,6 +21,6 @@
</ul> </ul>
<% end %> <% end %>
<div class="pageRoll"> <div class="pageRoll">
<%= paginate attachments,:params => {:controller => 'welcome', :action => 'search',:search_type=>'attachment'}%> <!%= paginate attachments,:params => {:controller => 'welcome', :action => 'search',:search_type=>'attachment'}%>
</div> </div>
<% end %> <% end %>

@ -1520,6 +1520,9 @@ en:
label_submit_comments: Submit_comments label_submit_comments: Submit_comments
label_course_empty_select: You have not selected course label_course_empty_select: You have not selected course
label_enterprise_page_made: enterprise_page label_enterprise_page_made: enterprise_page
label_excellent_courses_list: excellent_courses
label_course_resource_list: course_resource_list
label_project_resource_list: project_resource_list
#api #api
label_recently_updated_notification: Recently updated notification label_recently_updated_notification: Recently updated notification

@ -483,6 +483,9 @@ zh:
label_requirement: 需求 label_requirement: 需求
label_new_course: 课程列表 label_new_course: 课程列表
label_course_all: 课程列表 label_course_all: 课程列表
label_excellent_courses_list: 精品课程列表
label_course_resource_list: 课程资源列表
label_project_resource_list: 項目资源列表
label_teacher_all: 所有教师 label_teacher_all: 所有教师
label_requirement_enterprise_list: 众包列表 label_requirement_enterprise_list: 众包列表
label_new_homework: 作业 label_new_homework: 作业

@ -939,6 +939,9 @@ RedmineApp::Application.routes.draw do
match 'admin', :to => 'admin#index', :via => :get match 'admin', :to => 'admin#index', :via => :get
match 'admin/projects', :via => :get match 'admin/projects', :via => :get
get 'admin/courses' get 'admin/courses'
get 'admin/excellent_courses'
get 'admin/course_resource_list'
get 'admin/project_resource_list'
match 'admin/users', :via => :get match 'admin/users', :via => :get
match 'admin/messages', :via => :get match 'admin/messages', :via => :get
match 'admin/first_page_made', as: :first_page_made match 'admin/first_page_made', as: :first_page_made

@ -11,7 +11,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20160311072819) do ActiveRecord::Schema.define(:version => 20160225031230) do
create_table "activities", :force => true do |t| create_table "activities", :force => true do |t|
t.integer "act_id", :null => false t.integer "act_id", :null => false
@ -435,8 +435,6 @@ ActiveRecord::Schema.define(:version => 20160311072819) do
t.datetime "created_at", :null => false t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
t.integer "total_score" t.integer "total_score"
t.integer "homework_journal_num", :default => 0
t.integer "news_num", :default => 0
end end
create_table "course_groups", :force => true do |t| create_table "course_groups", :force => true do |t|
@ -508,7 +506,6 @@ ActiveRecord::Schema.define(:version => 20160311072819) do
t.integer "is_excellent", :default => 0 t.integer "is_excellent", :default => 0
t.integer "excellent_option", :default => 0 t.integer "excellent_option", :default => 0
t.integer "is_copy", :default => 0 t.integer "is_copy", :default => 0
t.integer "visits", :default => 0
end end
create_table "custom_fields", :force => true do |t| create_table "custom_fields", :force => true do |t|
@ -1285,7 +1282,6 @@ ActiveRecord::Schema.define(:version => 20160311072819) do
t.datetime "created_at", :null => false t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
t.boolean "allow_guest_download", :default => true t.boolean "allow_guest_download", :default => true
t.integer "visits", :default => 0
end end
create_table "phone_app_versions", :force => true do |t| create_table "phone_app_versions", :force => true do |t|
@ -1445,7 +1441,6 @@ ActiveRecord::Schema.define(:version => 20160311072819) do
t.integer "acts_count", :default => 0 t.integer "acts_count", :default => 0
t.integer "journals_count", :default => 0 t.integer "journals_count", :default => 0
t.integer "boards_reply_count", :default => 0 t.integer "boards_reply_count", :default => 0
t.integer "visits", :default => 0
end end
add_index "projects", ["lft"], :name => "index_projects_on_lft" add_index "projects", ["lft"], :name => "index_projects_on_lft"
@ -1905,7 +1900,6 @@ ActiveRecord::Schema.define(:version => 20160311072819) do
t.string "mail_notification", :default => "", :null => false t.string "mail_notification", :default => "", :null => false
t.string "salt", :limit => 64 t.string "salt", :limit => 64
t.integer "gid" t.integer "gid"
t.integer "visits", :default => 0
end end
add_index "users", ["auth_source_id"], :name => "index_users_on_auth_source_id" add_index "users", ["auth_source_id"], :name => "index_users_on_auth_source_id"
@ -2019,6 +2013,11 @@ ActiveRecord::Schema.define(:version => 20160311072819) do
add_index "wikis", ["project_id"], :name => "wikis_project_id" add_index "wikis", ["project_id"], :name => "wikis_project_id"
create_table "wlcs", :force => true do |t|
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "workflows", :force => true do |t| create_table "workflows", :force => true do |t|
t.integer "tracker_id", :default => 0, :null => false t.integer "tracker_id", :default => 0, :null => false
t.integer "old_status_id", :default => 0, :null => false t.integer "old_status_id", :default => 0, :null => false

@ -391,6 +391,9 @@ Redmine::MenuManager.map :admin_menu do |menu|
menu.push :messages_list, {:controller => 'admin', :action => 'messages_list'}, :caption => :label_message_plural menu.push :messages_list, {:controller => 'admin', :action => 'messages_list'}, :caption => :label_message_plural
menu.push :notices, {:controller => 'admin', :action => 'notices'}, :caption => :label_notification_list menu.push :notices, {:controller => 'admin', :action => 'notices'}, :caption => :label_notification_list
menu.push :latest_login_users, {:controller => 'admin', :action => 'latest_login_users'}, :caption => :label_latest_login_user_list menu.push :latest_login_users, {:controller => 'admin', :action => 'latest_login_users'}, :caption => :label_latest_login_user_list
menu.push :excellent_courses, {:controller => 'admin', :action => 'excellent_courses'}, :caption => :label_excellent_courses_list
menu.push :course_resource_list, {:controller => 'admin', :action => 'course_resource_list'}, :caption => :label_course_resource_list
menu.push :project_resource_list, {:controller => 'admin', :action => 'project_resource_list'}, :caption => :label_project_resource_list
menu.push :homework, {:controller => 'admin', :action => 'homework'}, :caption => :label_user_homework menu.push :homework, {:controller => 'admin', :action => 'homework'}, :caption => :label_user_homework
end end

Loading…
Cancel
Save