 <?php
    require_once '../service/StudentService.class.php';
    require_once '../phpbean/Student.class.php';
    $studentNumber = $_GET['studentNumber'];
    $studentService = new StudentService();
    $student = $studentService->GetStudent($studentNumber);
 ?>
<html>
<head>
<title>查看学生信息</title>
<link href="/css/add_modify.css" rel="stylesheet" type="text/css" />
<script src="/js/util.js" type="text/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 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">
			<table width="100%" border="0" cellpadding="0" cellspacing="2" align="center">
				<tr>
					<td height="21"><img src="../images/ico/ico29.gif" width="32" height="32" hspace="2" vspace="2" align="absmiddle">
					    <strong> 学生信息修改 </strong>
					</td>
				</tr>
			</table>
		</div>

		<div id="content">
			<form id="form1" method="post" action="/controller/StudentAction.php?action=update" enctype="multipart/form-data">
				<p>
					学号: &nbsp;
					<input id="studentNumber" class="text" type="text" readOnly style="width: 300px" value="<?php echo $student->getSTUDENTNUMBER()?>" name="student[studentNumber]" />
					<font color=red>*</font>
				</p>
				<p>
					姓名: &nbsp;
					<input id="studentName" class="text" type="text" style="width: 120px" value="<?php echo $student->getStudentName()?>" name="student[studentName]" />
					<font color=red>*</font>
				</p>
				<p>
					登录密码: &nbsp;
					<input id="studentPassword" class="text" type="text" style="width: 300px" value="<?php echo $student->getStudentPassword()?>" name="student[studentPassword]" />
					<font color=red>*</font>
				</p>
				<p>
					性别: &nbsp;
					<input id="studentSex" class="text" type="text" style="width: 20px" value="<?php echo $student->getStudentSex()?>" 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];
						  if($row['classNumber'] == $student->getStudentClassNumber())
						    echo "<option selected value={$row['classNumber']}>{$row['className']}</option>";
						  else
						    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]" value="<?php echo date("Y-m-d",strtotime($student->getStudentBirthday()));?>" onclick="setDay(this);" />
					<font color=red>*</font>
				</p>
				<p>
					政治面貌: &nbsp;
					<input id="studentState" class="text" type="text" style="width: 200px" value="<?php echo $student->getStudentState()?>" name="student[studentState]" />
				</p>
				<p>
					学生照片:&nbsp; <img src="<?php echo $student->getStudentPhoto()?>" width="200px" border="0px" /><br/>
				</p>
				<p>
					联系电话: &nbsp;
					<input id="studentTelephone" class="text" type="text" style="width: 200px" value="<?php echo $student->getStudentTelephone()?>" name="student[studentTelephone]" />
				</p>
				<p>
					学生邮箱: &nbsp;
					<input id="studentEmail" class="text" type="text" style="width: 300px" value="<?php echo $student->getStudentEmail()?>" name="student[studentEmail]" />
				</p>
				<p>
					联系qq: &nbsp;
					<input id="studentQQ" class="text" type="text" style="width: 200px" value="<?php echo $student->getStudentQQ()?>" name="student[studentQQ]" />
				</p>
				<p>
					家庭地址: &nbsp;
					<input id="studentAddress" class="text" type="text" style="width: 1000px" value="<?php echo $student->getStudentAddress()?>" name="student[studentAddress]" />
				</p>
				<p>
					附加信息: &nbsp;
					<input id="studentMemo" class="text" type="text" style="width: 1000px" value="<?php echo $student->getStudentMemo()?>" name="student[studentMemo]" />
				</p>
			</form>
		</div>
	</div>
</body>
</html>
