<?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 scoreValue = document.getElementById("scoreValue").value;
            if(scoreValue == ""){
                alert("请输入成绩得分...");
                document.getElementById("scoreValue").focus();
                return false;
            }
            else if (!re.test(scoreValue))
            {
                alert("成绩得分请输入数字");
                document.getElementById("scoreValue").focus();
                //input.rate.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="scoreInfoAddForm"
				action="/controller/ScoreInfoAction.php?action=add"
				enctype="multipart/form-data">
				<br />
				<p>
					学生对象:&nbsp;
					<select name="scoreInfo[studentNumber]">
					<?php
						require_once '../service/StudentService.class.php';
						$studentService = new StudentService ();
						$student_res = $studentService->QueryAllStudent ();
						for($i = 0; $i < count ( $student_res ); $i ++) {
						  $row = $student_res [$i];
						  echo "<option value={$row['studentNumber']}>{$row['studentName']}</option>";
						}
					?>
					</select>
				</p>

				<p>
					课程对象:&nbsp;
					<select name="scoreInfo[courseNumber]">
					<?php
						require_once '../service/CourseInfoService.class.php';
						$courseinfoService = new CourseInfoService ();
						$courseinfo_res = $courseinfoService->QueryAllCourseInfo ();
						for($i = 0; $i < count ( $courseinfo_res ); $i ++) {
						  $row = $courseinfo_res [$i];
						  echo "<option value={$row['courseNumber']}>{$row['courseName']}</option>";
						}
					?>
					</select>
				</p>

				<p>
					成绩得分:&nbsp; <input id="scoreValue" class="text" type="text" style="width: 60px" value="" name="scoreInfo[scoreValue]" />
					<font color=red>*</font>
				</p>
				<p>
					学生评价: &nbsp;
					<input id="studentEvaluate" class="text" type="text" style="width: 300px" value="" name="scoreInfo[studentEvaluate]" />
				</p>
				<p>
					<input type="button" style="cursor: hand;" class="btn" value="添加" onClick="CheckForm();" />
				</p>

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