<?
session_start();
if($userType != 'm')
	header("Location: logout.php");

/**********************************************************************************
*Name: addCourseForm.php
*Purpose: 1)An input form to add a course to the list of courses.
*Version information
*Date: December 2, 2001
*Copyright notice
***********************************************************************************/
require("DB.php");
require("asstHeader.php");

$st_id = $event_id;
session_register('st_id');

$db=new DB("andromeda", "gradinfo");
$db->connect();

?>

<html><body>
<form action="addCourse.php" method = "post">
<table border = 2><tr><th width=765> UNR Courses</th></table><br> 
<table border = 1>
<td>Student Number</td><td><? print $st_id;?></td>
<input type="hidden" name="eid" value="<?print $st_id;?>">
<td>Cummulative GPA</td><td><input type="text" name="form[ucGPA]" value=""></td>
<? if($eCourse==1){
	echo"<tr><td colspan=2><font color=\"red\">Please fill in Course Name and Year.</font>
	</td></tr>";
	$eCourse=0;
	session_register('eCourse');
   }
?>
<tr><td colspan = 7><h4>Student courses</h4></td>     
<tr><td size="15">Course Name</td>
<td>Semester</td>
<td size="10">Year</td>
<td>Grade</td>
<td>Course Status</td>
<td>Course Type</td>
<tr>
<td><input type="text" name = "form[course]" value = "" size = "15" maxlength=5></td>
<td><select name="form[semester]">
<option>Fall
<option>Spring
<option>Summer
<option>Winter</select></td>
<td><input type="text" name="form[year]" value="" size="10"></td>
<td><select name ="form[grade]">
<option>N/A
<option>A
<option>A-
<option>B+
<option>B
<option>B-
<option>C+
<option>C
<option>C-
<option>D+
<option>D
<option>D-
<option>F</select></td>
<td><select name = "form[courseStatus]">
<option>Currently Enrolled
<option>Completed
<option>Incomplete
<option>Withdraw</select></td>
<td><select name=type>
<option>CS / CE Prerequisite
<option>CS / CE Core
<option>CS / CE Specialty
<option>General Elective</select></td>
<td><input type = "submit" value = "Add Course"></td>
</table><br>
</form>

<table border = 1>
<tr><td> Course Name</td><td>Course Grade</td><td>Semester</td><td>Course Status</td><td>Course Type</td>
<?
$cList = $db->getCourseList($st_id);
foreach($cList as $output){
	print "<tr><td>".$output->course."</td> 
		<td>$output->grade</td>
		<td>$output->semester</td>
		<td>$output->courseStatus</td>
		<td>$output->type</td>";

	print "<td><a href=\"javascript: 
			if (window.confirm('Delete course from database?')) 
				document.location = 'dCourseProject.php?actionflag=1&
				st_sem=$output->semester&student_id=$st_id&
				st_course=$output->course&st_grade=$output->grade&
				dummy=0';\" >";
	
	/*print "<td><a href=\"javascript: if (window.confirm('Delete course from database?')) 
			document.location = '$GLOBALS[PHP_SELF]?student_id=$st_id&
			st_course=$output->course&st_grade=$output->grade&
			st_semester=$output->semester&st_courseStatus=$output->courseStatus&
			st_type=$output->type&actionflag=1';\">";*/
	print "delete</a></td>";

}
//$db->disconnect();
?>
</table><br>
</body></html>
<?/*&  //st_courseStatus=$output->courseStatus&
			st_type=$output->type
*/?>
