<?php
	require_once '../controller/CheckLoginState.php';
?>
<html>
<head>
<title>班级信息登记</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="../css/add_modify.css" rel="stylesheet" type="text/css" />
<script src="../js/util.js" language="JavaScript"></script>
<script src="../js/calendar.js"></script>
<script type="text/javascript">
        function CheckForm() {
            var re = /^[0-9]+.?[0-9]*$/;
            var resc=/^[1-9]+[0-9]*]*$/ ;
            var classNumber = document.getElementById("classNumber").value;
            if (classNumber == "") {
                alert("请输入班级编号...");
                document.getElementById("classNumber").focus();
                return false;
            }

            var className = document.getElementById("className").value;
            if (className == "") {
                alert("请输入班级名称...");
                document.getElementById("className").focus();
                return false;
            }

            var classBirthDate = document.getElementById("classBirthDate").value;
            if (classBirthDate == "") {
                alert("请输入成立日期...");
                document.getElementById("classBirthDate").focus();
                return false;
            }

            document.forms[0].submit();
       } 
    </script>
</head>
<body>
	<div id="container">
		<div id="title">
			<img src="../images/ADD.gif" />班级信息录入 (带*号的为必填项)
		</div>
		<div id="content">
			<form method="post" name="classInfoAddForm"
				action="/controller/ClassInfoAction.php?action=add"
				enctype="multipart/form-data">
				<br />
				<p>
					班级编号: &nbsp;
					<input id="classNumber" class="text" type="text" style="width: 200px" value="" name="classInfo[classNumber]" />
					<font color=red>*</font>
				</p>
				<p>
					班级名称: &nbsp;
					<input id="className" class="text" type="text" style="width: 200px" value="" name="classInfo[className]" />
					<font color=red>*</font>
				</p>
				<p>
					所属专业:&nbsp;
					<select name="classInfo[classSpecialFieldNumber]">
					<?php
						require_once '../service/SpecialFieldInfoService.class.php';
						$specialfieldinfoService = new SpecialFieldInfoService ();
						$specialfieldinfo_res = $specialfieldinfoService->QueryAllSpecialFieldInfo ();
						for($i = 0; $i < count ( $specialfieldinfo_res ); $i ++) {
						  $row = $specialfieldinfo_res [$i];
						  echo "<option value={$row['specialFieldNumber']}>{$row['specialFieldName']}</option>";
						}
					?>
					</select>
				</p>

				<p>

					成立日期:&nbsp; <input id="classBirthDate" type="text" class="text" readonly id="classInfo[classBirthDate]" name="classInfo[classBirthDate]" onclick="setDay(this);" />
					<font color=red>*</font>
				</p>
				<p>
					班主任: &nbsp;
					<input id="classTeacherCharge" class="text" type="text" style="width: 120px" value="" name="classInfo[classTeacherCharge]" />
				</p>
				<p>
					联系电话: &nbsp;
					<input id="classTelephone" class="text" type="text" style="width: 200px" value="" name="classInfo[classTelephone]" />
				</p>
				<p>
					附加信息: &nbsp;
					<input id="classMemo" class="text" type="text" style="width: 1000px" value="" name="classInfo[classMemo]" />
				</p>
				<p>
					<input type="button" style="cursor: hand;" class="btn" value="添加" onClick="CheckForm();" />
				</p>

			</form>
		</div>
	</div>
</body>
</html>
