<h3>
  <%=l(:label_user_homework)%>
</h3>

<div class="autoscroll">
  <table class="list" style="width: 100%;table-layout: fixed">
    <thead>
    <tr>
      <th style="width: 30px;">
        序号
      </th>
      <th style="width: 120px;">
        作业名称
      </th>
      <th style="width: 120px;">
        课程名称
      </th>
      <th style="width: 50px;">
        作者
      </th>
      <th style="width: 50px;">
        提交作品数
      </th>
      <th style="width: 70px;">
        作业发布日期
      </th>
    </tr>
    </thead>
    <tbody>
      <%@count=@page*30 %>
      <% for homework in @homework do %>
          <% unless homework.nil? %>
          <% @count+=1 %>
          <tr>
            <td align="center">
              <%=@count %>
            </td>
            <td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=homework.name%>'>
              <%=link_to(homework.try(:name), student_work_index_path(:homework => homework.id))%>
            </td>
            <% if homework.course %>
            <td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=homework.course.name%>'>
              <%= link_to(homework.course.name, course_path(homework.course.id)) %>
            </td>
            <% end %>
            <td align="center" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<% if homework.try(:user).try(:realname) == ' '%><%= homework.try(:user)%><% else %><%=homework.try(:user).try(:realname) %><% end %>'>
              <% if homework.try(:user).try(:realname) == ' '%>
                  <%= link_to(homework.try(:user), user_path(homework.user_id)) %>
              <% else %>
                  <%= link_to(homework.try(:user).try(:realname), user_path(homework.user_id)) %>
              <% end %>
            </td>
            <td align="center">
              <%=link_to(StudentWork.where('homework_common_id=?',homework.id).count, student_work_index_path(:homework => homework.id))%>
            </td>
            <td align="center">
              <%=format_date( homework.created_at ) %>
            </td>
          </tr>
          <% end %>
      <% end %>
    </tbody>
  </table>
</div>

<div class="pagination">
  <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
</div>

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