<%@page import="com.zky.para.Para"%>
<%@include file="/auth.jsp"%>
<%@page language="java" contentType="text/html;charset=utf-8"%>
<jsp:useBean id="getPara" scope="application"
	class="com.zky.para.SyncPara" />
<%
	Login login = (Login) request.getSession().getAttribute("login");
	String operate = (String) request.getParameter("operate");
	String trainId = Common.convertNull(request
			.getParameter("train_id"));
	String empid = Common.convertNull(request.getParameter("empid"));
	String trainState = request.getParameter("trainState");
	String trainType = Common.convertNull(request
			.getParameter("trainType"));
	String trainSubject = Common.convertNull(request
			.getParameter("trainSubject"));
	String sj = Common.convertNull(request.getParameter("sj"));
	String qj = Common.convertNull(request.getParameter("qj"));
	String pcs = Common.convertNull(request.getParameter("pcs"));
	String user = Common.convertNull(request.getParameter("user"));
	Login loginObj = (Login) session.getAttribute("login");
	String optrid = loginObj.optrid;
	String optrname = getPara.getDesc("TAB_EMPLOYEE", "EMPID",
			"EMPNAME", optrid);
	String optrjob = getPara.getDesc("TAB_EMPLOYEE", "EMPID", "EMPJOB",
			optrid);
%>
<html>
<head>
<title>培训管理</title>
<link rel="stylesheet" type="text/css" href="../../../css/font.css">
<script src="../../../js/check.js"></script>
<link rel="stylesheet" type="text/css" href="../../../js/2k3Grid.css">
<link rel="stylesheet" type="text/css" href="../../../js/2k3Menu.css">
<link rel="stylesheet" type="text/css" href="../../../js/2k3Dialog.css">
<style type="text/css">
html {
	overflow-x: hidden;
	overflow-y: hidden;
}

select {
	width: 155px;
}
</style>
<script>
	function setValue() {
<%if (!Common.isNull(trainId)) {
				out.println("form1.trainId.value='" + trainId + "';");
			}
			if (!Common.isNull(qj)) {
				out.println("form1.qj.value='" + qj + "';");
			}
			if (!Common.isNull(user)) {
				out.println("form1.user.value='" + user + "';");
			}
			if (!Common.isNull(sj)) {
				out.println("form1.sj.value='" + sj + "';");
			}
			if (!Common.isNull(pcs)) {
				out.println("form1.pcs.value='" + pcs + "';");
			}
			if (!Common.isNull(operate)) {
				out.println("form1.operate.value='" + operate + "';");
			}
			if (!Common.isNull(trainState)) {
				out.println("form1.trainState.value='" + trainState + "';");
			}
			if (!Common.isNull(trainType)) {
				out.println("form1.trainType.value='" + trainType + "';");
			}%>
	}
	function check(operate, trainId) {
		if (operate == "addTrain") {
			form1.action = "/zhyw/smry/rypx/TrainEdit.jsp";
		}
		if (operate == "queryTrainById") {
			form1.action = "/servlet/TrainManage?operate=queryTrainById&trainId="
					+ trainId;
		}
		if (operate == "queryTrainBydelete") {
			if (!confirm("您确定要删除此信息吗?"))
				return;
			form1.action = "/servlet/TrainManage?operate=queryTrainBydelete&trainId="
					+ trainId;
		}
		if (operate == "queryTrainStId") {
			form1.action = "/servlet/TrainManage?operate=queryTrainStId&trainId="
					+ trainId;
		}
		if (operate == "queryTrain") {

			form1.action = "/servlet/TrainManage?operate=queryTrain";
		}
		return true;
		form1.button1.disabled = true;
		form1.button2.disabled = true;
		if (form1.button3) {
			form1.button3.disabled = false;
		}
		form1.submit();
	}

	function selectChange(i) {
		form1.action = "/zhyw/smry/rypx/TrainManage.jsp";
		form1.submit();
	}
</script>
</head>
<body onload="setValue();" scroll="no">
	<form name="form1" method="post" action="/servlet/TrainManage">
		<input type="hidden" name="operate" value="" />
		<table width="99%" border="0" align="center" cellpadding="0"
			cellspacing="1" class="box">
			<tr>
				<td valign="top">
					<table width="99%" height="23" border="0" cellpadding="0"
						cellspacing="0">
						<tr>
							<td width="25%" background="/images/tab_search_01.jpg">
								<table width="80%" height="23" border="0" align="left"
									cellpadding="0" cellspacing="0">
									<tr>
										<td width="3%"><img src="/images/little_red.jpg"
											width="12" height="12"></td>
										<td width="97%" class="font12b">&nbsp;<b>涉密人员培训</b></td>
									</tr>
								</table>
							</td>
							<td width="82%" background="/images/tab_search_03.jpg"><img
								src="/images/tab_search_02.jpg" width="12" height="23"></td>
						</tr>
					</table>
					<table width="99%" border="0" align="center" cellpadding="2"
						cellspacing="1" class="table02">
						<tr bgcolor="#FFFFFF">
							<td class="cell1">所属地市</td>
							<td class="cell2" width="10%"><select class='aselect'
								name="sj" setValue="<%=sj%>" onChange="selectChange(1);">
									<%=Para.getSj(getPara)%>
							</select></td>
							<td class="cell1">所属区县</td>
							<td class="cell2" width="10%"><select class='aselect'
								name="qj" setValue="<%=qj%>" <%if (sj.equals("0930")) {%>
								disabled="disabled" <%}%> onChange="selectChange(1);">
									<%=Para.getQj(getPara, sj)%>
							</select></td>
							<td class="cell1">所属单位</td>
							<td class="cell2" width="10%"><select class='aselect'
								name="pcs" setValue="<%=pcs%>">
									<%
										if (sj.equals("0930")) {
									%>
									<%=Para.getXx1(getPara, sj)%>
									<%
										} else {
									%>
									<%=Para.getXx(getPara, qj)%>
									<%
										}
									%>
							</select></td>
							<td class="cell1">培训人员</td>
							<td class="cell2" width="10%"><input type="text" name="user"
								setValue="<%=user%>"></td>
							<td colspan="2"><input border="0" type="image"
								src="../../../images1/cx.png" val="查询" name="button1"
								onclick="return check('queryTrain');" />&nbsp;&nbsp;</td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
		<table width="99%" align="center">
			<tr align="left">
				<td>
					<%
						if (login.getSanyuan().equals("0")) {
					%> <input border="0"
					type="image" src="../../../images1/tj.png" val="添加" name="button2"
					onclick="return check('addTrain');" /> <%
 	} else if (login.getSanyuan().equals("1")) {
 %>
					<%
						} else {
					%> <input border="0" type="image"
					src="../../../images1/tj.png" val="添加" name="button2"
					onclick="return check('addTrain');" /> <%
 	}
 %>


				</td>
			</tr>
		</table>
		<%
			HashFmlBuf buf = (HashFmlBuf) request.getAttribute("train_info");
			if (buf != null) {
				int rowcount = buf.getRowCount();
		%>
		<table width="99%" border="0" align="center" cellpadding="0"
			cellspacing="1" class="box">
			<tr>
				<td>
					<div style="width: 100%; height: 385px; overflow: auto;">
						<div id="myGrid" class="2k3Grid" borderWidth="0"
							contextMenu="mnuGridContextMenu" altRowColor="oldLace">
							<div class="gridHead">
								<!--div align="left"><span width="5%">共检索到<%=rowcount%>条记录</span></div-->
								<div class="gridRow">
									<span width="5px"><b>序号</b></span> <span width="10px"><b>培训状态</b></span>
									<span width="10px"><b>审批人</b></span> <span width="7px"><b>培训人员姓名</b></span>
									<span width="10px"><b>培训类型</b></span> <span width="10px"><b>培训对象</b></span>
									<span width="10px"><b>培训开始日期</b></span> <span width="10px"><b>培训结束日期</b></span>
									<span width="15px"><b>培训地点</b></span> <span width="13px">
										<b>操作</b>
									</span>
								</div>
							</div>
							<div class="gridBody">
								<%
									for (int i = 0; i < rowcount; i++) {
											String disabled = "";
											String tempTrainid = buf.fget("train_id", i);
											String tempType = buf.fget("train_type", i);
											String tempState = buf.fget("train_state", i);
											String tempSubject = buf.fget("train_subject", i);
											String tempempid=buf.fget("empid",i);
											String employid=login.getEmpid();
											if (tempType.equals("0")) {
												tempType = "资料学习";
												disabled = "";
											} else if (tempType.equals("1")) {
												tempType = "视频学习";
												disabled = "disabled";
											} else if (tempType.equals("2")) {
												tempType = "音频学习";
												disabled = "disabled";
											}

											if (tempState.equals("0")) {
												tempState = "通过";
												disabled = "";
											} else {
												tempState = "不通过";
												disabled = "disabled";
											}

											if (tempSubject.equals("0")) {
												tempSubject = "涉密文件";
												disabled = "";
											} else if (tempSubject.equals("1")) {
												tempSubject = "涉密设备";
												disabled = "disabled";
											} else if (tempSubject.equals("2")) {
												tempSubject = "涉密资产";
												disabled = "disabled";
											} else if (tempSubject.equals("3")) {
												tempSubject = "涉密人员";
												disabled = "disabled";
											}
								%>
								<div class="gridRow">
									<span width="5px" style="text-align: center;"><%=i + 1%></span> <span>
										<%
											if (tempState.equals("通过")) {
										%> <img src="../../../images1/pass.png" width="16" height="16"
										alt="通过" style="cursor: pointer;"> 
										<%  	} else {
											 %> <img src="../../../images1/nopass.png" width="16" height="16"
										alt="未通过" style="cursor: pointer;"> <%
 	}
 %>
									</span> <span><%=buf.fget("empid", i)%></span> <span><%=buf.fget("train_name", i)%></span>
									<span name="trainSubject"><%=tempType%></span> <span><%=tempSubject%></span>
									<span><%=buf.fget("train_time", i)%></span> <span><%=buf.fget("train_timeend", i)%></span>
									<span><%=buf.fget("TRAIN_ADDRESS", i)%></span> <span width="12px"> 
										<% if (login.getSanyuan().equals("0")) { %> 
										<a href="	/servlet/TrainManage?operate=queryTrainShowById&trainId=<%=tempTrainid%>"><img
											border="0" src="../../../images1/read_document.png" ALT="查看"
											style="cursor: pointer;" /></a> &nbsp;&nbsp; <a
										href="	/servlet/TrainManage?operate=queryTrainById&trainId=<%=tempTrainid%>"><img
											border="0" src="../../../images1/edit.gif" ALT="修改"
											style="cursor: pointer;" /></a> &nbsp;&nbsp; <input border="0"
										type="image" src="../../../images1/delete.gif" ALT="删除"
										style="cursor: pointer;" name="button2"
										onclick="check('queryTrainBydelete','<%=tempTrainid%>');" />&nbsp;&nbsp;
										<%
											if (tempState.equals("不通过")) {
										%> <input border="0" type="image"
										src="../../../images1/car_apply.png" alt="未审核"
										style="cursor: pointer;" name="button2"
										onclick="check('queryTrainStId','<%=tempTrainid%>');" /> 
										<% } else {  %>
										<img src="../../../images1/1.png" alt="已审核"
										style="cursor: pointer;" name="button2" /> 
										<%	} %> 
	<%
 	} else if (login.getSanyuan().equals("1")) {
 %>
										<a
										href="	/servlet/TrainManage?operate=queryTrainShowById&trainId=<%=tempTrainid%>"><img
											border="0" src="../../../images1/read_document.png" ALT="查看"
											style="cursor: pointer;" /></a> &nbsp;&nbsp; <%
 	if (tempState.equals("不通过")) {
 %> <input border="0" type="image"
										src="../../../images1/car_apply.png" alt="未审核"
										style="cursor: pointer;" name="button2"
										onclick="check('queryTrainStId','<%=tempTrainid%>');" /> <%
 	} else {
 %>
										<img src="../../../images1/1.png" alt="已审核"
										style="cursor: pointer;" name="button2" /> <%
 	}
 %> <%
 	} else {
 %> <a
										href="	/servlet/TrainManage?operate=queryTrainShowById&trainId=<%=tempTrainid%>"><img
											border="0" src="../../../images1/read_document.png" ALT="查看"
											style="cursor: pointer;" /></a> &nbsp;&nbsp; <a
										href="	/servlet/TrainManage?operate=queryTrainById&trainId=<%=tempTrainid%>"><img
											border="0" src="../../../images1/edit.gif" ALT="修改"
											style="cursor: pointer;" /></a> &nbsp;&nbsp; <input border="0"
										type="image" src="../../../images1/delete.gif" ALT="删除"
										style="cursor: pointer;" name="button2"
										onclick="check('queryTrainBydelete','<%=tempTrainid%>');" />&nbsp;&nbsp;
										<%
											}
										%>

									</span>
								</div>
								<%
									}
								%>
							</div>
							<!-- gridBody end -->
						</div>
						<!-- myGrid end -->
					</div> <tag:PageLinkTag operate="queryTrain" scope="request" width="100%"
						align="center" /> <%	
	}
%>
				
			<tr>
				<td>
		</table>
	</form>
	<%@include file="/foot.jsp"%>
</body>
</html>