<%@ page language="java" pageEncoding="utf-8"%>
<%@ taglib uri="/WEB-INF/taglib/c.tld" prefix="c"%>
<%@ taglib uri="/WEB-INF/taglib/fmt.tld" prefix="fmt" %>
<%@ include file="../common/init.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%@ include file="../common/top.jsp"%>
</head>
<body class="easyui-layout">
	<%@ include file="../common/header.jsp"%>
	<%@ include file="../leftMenu/exam-admin.jsp"%>
	<div data-options="region:'center',title:'首页 -【考试管理】- 考试列表'">
		<div class="easyui-layout" data-options="fit:true,border:false">
			<div data-options="region:'north',border:false" class="domain">
				<%@ include file="../common/message.jsp"%>
				<form class="form-inline" action="${ctx}/admin/exam/list" method="post" id="search-form">
					<input type="hidden" name="pageNumber" value="${query.pageNumber}" /> 
					<input type="hidden" name="pageSize" value="${query.pageSize}" /> 
					
					<c:if test="${web_user.user.schoolId>0}">
					<span class="help-inline">类型：</span> 
					<select class="select-medium" name="scope">
						<option value="0" <c:if test="${query.scope==0}">selected</c:if>>学习中心考试</option>
						<option value="1" <c:if test="${query.scope==1}">selected</c:if>>校考</option>
					</select>
					</c:if>
					<c:if test="${web_user.user.schoolId>0}">
					<input type="hidden" name="scope" value="1" /> 
					</c:if>
					
					<span class="help-inline">名称：</span> 
					<input class="input-medium" name="name" type="text" value="${query.name}"/> 
					<button type="submit" class="btn">
						<i class="icon-search"></i> 查询
					</button>
					<a href="${ctx}/admin/exam/add" class="btn btn-success"> 
						<i class="icon-plus icon-white"></i> 新建考试 
					</a>
				</form>
			</div>
			
			<div class="border" data-options="region:'center'">
				<div class="table-container col5">
					<div class="tab-header"> 
						<i class="list-text"><strong>考试ID</strong></i>
						<i class="list-text"><strong>考试名称</strong></i>
						<i class="list-text"><strong>考试时间</strong></i>
						<i class="list-text"><strong>状态</strong></i>
						<i class="list-edit"><strong>操作</strong></i>
					</div>
					<c:if test="${examList!=null}">
					<c:forEach var="exam" items="${examList}">
					<div class="tab-list" data-id="${exam.id}">
						<i class="list-text">${exam.id}</i>
						<i class="list-text">${exam.name}</i>
						<i class="list-text"><fmt:formatDate value="${exam.examTime}" pattern="yyyy-MM-dd" /></i>
						<i class="list-text">${exam.status.name}</i>
						<p class="list-edit">
							<a href="${ctx}/admin/exam/view/${exam.id}" class="btn btn-small">详情</a>
						</p>
					</div>
					</c:forEach>
					</c:if>
					
					<c:set var="pageNumber" value="${query.pageNumber}"></c:set>
					<%@ include file="../common/paginator.jsp"%>
				</div>
			</div>
		</div>
	</div>
</body>
<script type="text/javascript">
$(document).ready(function(){
	$('.pagination a').click(function(){
		var pageNumber = $(this).attr('data-page');
		if(pageNumber!=undefined && pageNumber>0){
			$('#search-form input[name="pageNumber"]').val(pageNumber);
			$('#search-form').submit();
		}
	});
});	
</script>
</html>
