超级管理员的最近登录用户列表添加老师列表
This commit is contained in:
parent
d409b14916
commit
e3e2c37f12
|
@ -469,6 +469,23 @@ class AdminController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#最近登录老师列表
|
||||||
|
def latest_login_teachers
|
||||||
|
scope = User.find_by_sql("SELECT * FROM users,user_extensions WHERE users.id = user_extensions.user_id AND user_extensions.identity=0 ORDER BY last_login_on DESC")
|
||||||
|
if params[:startdate].present?
|
||||||
|
scope = User.find_by_sql("SELECT * FROM users,user_extensions WHERE users.id = user_extensions.user_id AND user_extensions.identity=0 and last_login_on>= '#{params[:startdate]} 00:00:00' ORDER BY last_login_on DESC")
|
||||||
|
end
|
||||||
|
if params[:enddate].present?
|
||||||
|
scope = User.find_by_sql("SELECT * FROM users,user_extensions WHERE users.id = user_extensions.user_id AND user_extensions.identity=0 and last_login_on <= '#{params[:enddate]} 23:59:59' ORDER BY last_login_on DESC")
|
||||||
|
end
|
||||||
|
@teachers = scope
|
||||||
|
@teachers = paginateHelper @teachers,30
|
||||||
|
@page = (params['page'] || 1).to_i - 1
|
||||||
|
respond_to do |format|
|
||||||
|
format.html
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
#作业
|
#作业
|
||||||
def homework
|
def homework
|
||||||
@homework = HomeworkCommon.order('end_time desc')
|
@homework = HomeworkCommon.order('end_time desc')
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><%= link_to '用户', {:action => 'latest_login_users'}, class: "#{current_page?(latest_login_users_path)? 'selected' : nil }" %></li>
|
||||||
|
<li><%= link_to '老师', {:action => 'latest_login_teachers'}, class: "#{current_page?(latest_login_teachers_path)? 'selected' : nil }" %></li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</div>
|
|
@ -0,0 +1,84 @@
|
||||||
|
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', :media => 'all' %>
|
||||||
|
<h3>
|
||||||
|
<%=l(:label_latest_login_user_list)%>
|
||||||
|
</h3>
|
||||||
|
<%= render 'tab_users' %>
|
||||||
|
|
||||||
|
<h3>
|
||||||
|
最近登录老师列表
|
||||||
|
</h3>
|
||||||
|
<%= form_tag({}, :method => :get) do %>
|
||||||
|
<fieldset>
|
||||||
|
<legend>
|
||||||
|
<%= l(:label_filter_plural) %>
|
||||||
|
</legend>
|
||||||
|
<label style="float:left">开始日期:</label>
|
||||||
|
<%= text_field_tag 'startdate', params[:startdate], :size => 15, :onchange=>"$('#ui-datepicker-div').hide()", :style=>"float:left"%>
|
||||||
|
<%= calendar_for('startdate')%><span style="float: left "> </span>
|
||||||
|
<label style="float:left">结束日期:</label>
|
||||||
|
<%= text_field_tag 'enddate', params[:enddate], :size => 15, :onchange =>"$('#ui-datepicker-div').hide()", :style=>"float:left"%>
|
||||||
|
<%= calendar_for('enddate')%>
|
||||||
|
<%= submit_tag l(:button_apply), :class => "small", :name => nil %>
|
||||||
|
<%= link_to l(:button_clear), {:controller => 'admin', :action => 'latest_login_teachers'}, :class => 'icon icon-reload' %>
|
||||||
|
</fieldset>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<div class="autoscroll">
|
||||||
|
<table class="list" style="width: 100%;table-layout: fixed">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th style="width: 30px;">
|
||||||
|
序号
|
||||||
|
</th>
|
||||||
|
<th style="width: 70px;">
|
||||||
|
登录时间
|
||||||
|
</th>
|
||||||
|
<th style="width: 30px;">
|
||||||
|
用户id
|
||||||
|
</th>
|
||||||
|
<th style="width: 50px;">
|
||||||
|
用户姓名
|
||||||
|
</th>
|
||||||
|
<th style="width: 50px;">
|
||||||
|
用户登录名
|
||||||
|
</th>
|
||||||
|
<th style="width: 50px;">
|
||||||
|
用户身份
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% @count=@page * 30 %>
|
||||||
|
<% for teacher in @teachers do %>
|
||||||
|
<tr>
|
||||||
|
<% @count +=1 %>
|
||||||
|
<td align="center">
|
||||||
|
<%=@count %>
|
||||||
|
</td>
|
||||||
|
<td align="center">
|
||||||
|
<%=format_time(teacher.last_login_on) %>
|
||||||
|
</td>
|
||||||
|
<td align="center">
|
||||||
|
<%=teacher.id %>
|
||||||
|
</td>
|
||||||
|
<td align="center" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<% if teacher.try(:realname) == ' '%><%= teacher.login%><% else %><%=teacher.try(:realname) %><% end %>'>
|
||||||
|
<% if teacher.try(:realname) == ' '%>
|
||||||
|
<%= link_to(teacher.login, user_path(teacher)) %>
|
||||||
|
<% else %>
|
||||||
|
<%= link_to(teacher.try(:realname), user_path(teacher)) %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
<td align="center">
|
||||||
|
<%=link_to(teacher.login, user_path(teacher)) %>
|
||||||
|
</td>
|
||||||
|
<td align="center">
|
||||||
|
老师
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="pagination">
|
||||||
|
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
|
||||||
|
</div>
|
|
@ -2,7 +2,10 @@
|
||||||
<h3>
|
<h3>
|
||||||
<%=l(:label_latest_login_user_list)%>
|
<%=l(:label_latest_login_user_list)%>
|
||||||
</h3>
|
</h3>
|
||||||
|
<%= render 'tab_users' %>
|
||||||
|
<h3>
|
||||||
|
<%=l(:label_latest_login_user_list)%>
|
||||||
|
</h3>
|
||||||
<%= form_tag({}, :method => :get) do %>
|
<%= form_tag({}, :method => :get) do %>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>
|
<legend>
|
||||||
|
|
|
@ -954,7 +954,8 @@ RedmineApp::Application.routes.draw do
|
||||||
match 'admin/project_messages', as: :project_messages
|
match 'admin/project_messages', as: :project_messages
|
||||||
match'admin/course_messages', as: :course_messages
|
match'admin/course_messages', as: :course_messages
|
||||||
get 'admin/notices'
|
get 'admin/notices'
|
||||||
get 'admin/latest_login_users'
|
match 'admin/latest_login_users', as: :latest_login_users
|
||||||
|
match 'admin/latest_login_teachers', as: :latest_login_teachers
|
||||||
get 'admin/homework'
|
get 'admin/homework'
|
||||||
|
|
||||||
resources :auth_sources do
|
resources :auth_sources do
|
||||||
|
|
Loading…
Reference in New Issue