<% is_teacher = is_course_teacher(User.current,@bid.courses.first) %>
<% is_my_homework ||= false %>
<% is_student_batch_homework ||= false %>
<% is_batch_homeworks ||= false %>
<% not_batch_homework ||= false %>
<% is_all_homeworks ||= false %>
<% unless is_my_homework || is_student_batch_homework %>
    <div class="code_list">
      <span>
        <%= l(:label_homework_list)%>
        (<font color="#CC0000">
        <%= homeworks.count%>
      </font>)
        <%
           url= get_batch_homeworks_homework_attach_index_path(:bid_id => @bid.id) if is_batch_homeworks
           url= get_not_batch_homework_homework_attach_index_path(:bid_id => @bid.id) if not_batch_homework
           url= get_homeworks_homework_attach_index_path(:bid_id => @bid.id) if is_all_homeworks
        %>

        <%= link_to l(:label_export_excel), get_batch_homeworks_homework_attach_index_path(:bid_id => @bid.id,:format => 'xls'),:class=>'xls' if is_batch_homeworks%>
        <%= link_to l(:label_export_excel), get_not_batch_homework_homework_attach_index_path(:bid_id => @bid.id,:format => 'xls'),:class=>'xls' if not_batch_homework%>
        <%= link_to l(:label_export_excel), get_homeworks_homework_attach_index_path(:bid_id => @bid.id,:format => 'xls'),:class=>'xls' if is_all_homeworks%>
        <input type="text" id="homework_member_search" placeholder="登录名、学号、姓名搜索" class="min_search ml10" value="<%= @search_name%>" >
        <a href="javascript:void(0)" class="member_search" onclick="search_homework_member('<%= url%>');">搜索</a>
      </span>
      <span class="fr">
        按&nbsp;
        <%= link_to l(:label_anonymous_comments), sort_homework_path(@bid, 's_socre', @direction), {:remote => true}%>
        &nbsp;/&nbsp;
        <%= link_to l(:label_teacher_score), sort_homework_path(@bid, 't_socre', @direction), {:remote => true}%>
        &nbsp;/&nbsp;
        <%= link_to l(:label_time), sort_homework_path(@bid, 'time', @direction), {:remote => true}%>
        &nbsp;<%= l(:label_sort)  %>
      </span>
    </div>
<% end %>
<div class="cl"></div>

<div class="to_top" id="goTopBtn" style="display: none;">
    返<br/>回<br/>顶<br/>部
</div>
<div class="cl"></div>

<% unless homeworks.nil? %>
    <% if !is_teacher && is_my_homework && homeworks.empty?  %>
        <!-- 是学生，我的作业，且作业列表为空，即我未提交作业 -->
        <ul>
          <li class="pic_head">
            <%= link_to image_tag(url_to_avatar(User.current), :width => "40", :height => "40"), user_path(User.current) %>
            <span>
              <%= link_to User.current.login, user_path(User.current), :title => User.current.login%>
            </span>
          </li>
          <li class="c_red" style="margin:25px 0 0 20px;"> 您还没提交作品，请点击提交作品按钮：）</li>
              <li class="wping" style="float: right;">
                <%= link_to "提交作品", new_exercise_book_path(@bid), :style => "margin:20px 20px 0 0;width:80px;" %>
              </li>
        </ul>
        <div class="cl"></div>
    <% end %>

    <% homeworks.each do |homework| %>
        <ul id="homework_li_<%= homework.id%>">
          <%= render :partial => 'homework_attach/homework',
                     :locals => {:homework => homework,  :is_student_batch_homework => is_student_batch_homework,
                                 :is_my_homework => is_my_homework, :is_teacher => is_teacher}%>
        </ul>
        <div class="cl"></div>
    <% end %>
<% else %>
<% end %>
<!-- 如果是我的作业或者匿评列表界面不现实分页控件 -->
<%# unless is_my_homework || is_student_batch_homework %>
    <!--<ul class="wlist">-->
      <%#= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => remote, :flag => true%>
    <!--</ul>-->
<%# end %>

<% if is_teacher %>
    <span style="color: red;">
      <%= anonymous_comment_notice(@bid, @bid.courses.first)  %>
    </span>
<% end %>
