<!-- fq -->
<%= form_tag(:controller => 'bids', :action => "show_project", :method => :get) do %>
<div class="project-search-block">
	<table width="100%" valign="center">
		<tr>
			<td ><span style="margin-left:0px"><%= l(:label_task_plural)%>(<%= @homework_list.count%>)</span></td>
            <td align="right">
			<div class="project-search">
				<%= text_field_tag 'student_id', params[:student_id], :size => 30 %>
				<%= submit_tag l(:label_search_by_student_id), :class => "small", :name => nil %>	
			</div></td>
		</tr>
	</table>
</div>
<% end %>
<% display_id = im_watching_student_id? @bid%>
<%= link_to "作业打包下载", zipdown_assort_path(obj_class: @bid.class, obj_id: @bid), remote: false, class: "button_submit button_submit_font_white", style: "margin: 5px 10px;display: inline-block;" if(
			User.current.admin? || 
			!(User.current.roles_for_project(@bid.courses.first).map(&:id) & ([7,9])).empty? ) || 
			(Rails.env.development?) %>
<% @homework_list.each do |homework|%>
	<% if homework.attachments.any?%>
	<table width="660px" border="0" align="center">
		<tr>		
			<td colspan="2" valign="top" width="50" ><%= image_tag(url_to_avatar(homework.user), :class => "avatar")%></td>		
			<td>
				<table width="580px" border="0">
					<tr>
						<td colspan="1" valign="top"><strong> <%= link_to homework.user, user_path(homework.user)%></strong>  <span class="font_lighter">已提交</span></td>
						<td valign="top" align="right">
							<% if Time.parse(@bid.deadline.to_s) < Time.parse(homework.attachments[0].created_on.to_s) %>
								<span class="required">迟交</span>
							<% end %>
						</td>
					</tr>
					<tr>
						<td colspan="2" valign="top">&nbsp;
						<% if display_id %>
						<strong><%= l(:label_bidding_user_studentcode) %> ：<%= homework.user.user_extensions.student_id%></strong>
						<% end %>
						</td>
					</tr>
					<tr>
						<td colspan="2" width="580px" >					
					<% if (User.current == homework.user) || (!Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.nil? && (Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.roles&Role.where('id = ? or id = ? or id =?',3,7, 9)).size >0) %>
							<p class="font_description">
								<% options = {:author => true, :deletable => attach_delete(homework)} %>
								<%= render :partial => 'attachments/links',
								:locals => {:attachments => homework.attachments, :options => options} %>
							</p>
					<% end %>					
						</td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
	<div class="line_under"></div>			
	<% end %>
<% end %>
