<%= 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 ">&nbsp;&nbsp;&nbsp;</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')%> &nbsp;
      <%= 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 %>
&nbsp;
<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>
      <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.user_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.user_id)) %>
            <% else %>
                <%= link_to(teacher.try(:realname), user_path(teacher.user_id)) %>
            <% end %>
          </td>
          <td align="center">
            <%= link_to(teacher.login, user_path(teacher.user_id)) %>
          </td>
          <td align="center">
            老师
          </td>
          <td align="center">
                <%= teacher.school_id.nil? ? "" : (School.find teacher.school_id).try(:name) %>
          </td>
        </tr>
    <% end %>
    </tbody>
  </table>
</div>
<div class="pagination">
  <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
</div>

<% html_title(l(:label_latest_login_teacher_list)) -%>