<?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 studentNumber = document.getElementById("studentNumber").value;
            if (studentNumber == "") {
                alert("请输入学号...");
                document.getElementById("studentNumber").focus();
                return false;
            }

            var studentName = document.getElementById("studentName").value;
            if (studentName == "") {
                alert("请输入姓名...");
                document.getElementById("studentName").focus();
                return false;
            }

            var studentPassword = document.getElementById("studentPassword").value;
            if (studentPassword == "") {
                alert("请输入登录密码...");
                document.getElementById("studentPassword").focus();
                return false;
            }

            var studentSex = document.getElementById("studentSex").value;
            if (studentSex == "") {
                alert("请输入性别...");
                document.getElementById("studentSex").focus();
                return false;
            }

            var studentBirthday = document.getElementById("studentBirthday").value;
            if (studentBirthday == "") {
                alert("请输入出生日期...");
                document.getElementById("studentBirthday").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="studentAddForm"
				action="/controller/StudentAction.php?action=add"
				enctype="multipart/form-data">
				<br />
				<p>
					学号: &nbsp;
					<input id="studentNumber" class="text" type="text" style="width: 300px" value="" name="student[studentNumber]" />
					<font color=red>*</font>
				</p>
				<p>
					姓名: &nbsp;
					<input id="studentName" class="text" type="text" style="width: 120px" value="" name="student[studentName]" />
					<font color=red>*</font>
				</p>
				<p>
					登录密码: &nbsp;
					<input id="studentPassword" class="text" type="text" style="width: 300px" value="" name="student[studentPassword]" />
					<font color=red>*</font>
				</p>
				<p>
					性别: &nbsp;
					<input id="studentSex" class="text" type="text" style="width: 20px" value="" name="student[studentSex]" />
					<font color=red>*</font>
				</p>
				<p>
					所在班级:&nbsp;
					<select name="student[studentClassNumber]">
					<?php
						require_once '../service/ClassInfoService.class.php';
						$classinfoService = new ClassInfoService ();
						$classinfo_res = $classinfoService->QueryAllClassInfo ();
						for($i = 0; $i < count ( $classinfo_res ); $i ++) {
						  $row = $classinfo_res [$i];
						  echo "<option value={$row['classNumber']}>{$row['className']}</option>";
						}
					?>
					</select>
				</p>

				<p>

					出生日期:&nbsp; <input id="studentBirthday" type="text" class="text" readonly id="student[studentBirthday]" name="student[studentBirthday]" onclick="setDay(this);" />
					<font color=red>*</font>
				</p>
				<p>
					政治面貌: &nbsp;
					<input id="studentState" class="text" type="text" style="width: 200px" value="" name="student[studentState]" />
				</p>
				<p>
					学生照片:&nbsp; <input class="text" type="file" style="width: 200px" value="" name="studentPhoto" />
				</p>
				<p>
					联系电话: &nbsp;
					<input id="studentTelephone" class="text" type="text" style="width: 200px" value="" name="student[studentTelephone]" />
				</p>
				<p>
					学生邮箱: &nbsp;
					<input id="studentEmail" class="text" type="text" style="width: 300px" value="" name="student[studentEmail]" />
				</p>
				<p>
					联系qq: &nbsp;
					<input id="studentQQ" class="text" type="text" style="width: 200px" value="" name="student[studentQQ]" />
				</p>
				<p>
					家庭地址: &nbsp;
					<input id="studentAddress" class="text" type="text" style="width: 1000px" value="" name="student[studentAddress]" />
				</p>
				<p>
					附加信息: &nbsp;
					<input id="studentMemo" class="text" type="text" style="width: 1000px" value="" name="student[studentMemo]" />
				</p>
				<p>
					<input type="button" style="cursor: hand;" class="btn" value="添加" onClick="CheckForm();" />
				</p>

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