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

require("DB.php");
require("asstHeader.php");

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

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

?>
<html><body>

<table border = 2><tr><th width=765> UNR Projects</th></table><br>

<table border = 1>
<form action="addProject.php" method = "post">
<tr><td colspan = 9><h4>Projects</h4></td>
<? if($eProject==1){
	echo"<tr><td colspan=9><font color=\"red\">Please fill in a project name, a sponsor, and a year.</font>
	</td></tr>";
	$eProject=0;
	session_register('eProject');
   }
?>
<tr><td>Project Name</td><td><input type="text" name ="form[project]" value = ""></td>
<td>Student Number</td><td><? print $st_id; ?></td>
<input type="hidden" name="e_id" value="<?print $st_id;?>">
<td>Sponsor</td><td><input type="text" name = "form[sponsor] value = ""></td>
<td>Semester</td>
<td><select name = "form[pSemester]">
<option>Fall
<option>Spring
<option>Summer
<option>Winter</select></td>
<td>Year</td><td><input type="text" name="form[pYear]" value=""></td>
<td><input type = "submit" value = "Add Project"></td>
</form>
</table><br>

<table border = 1>
<tr><td> Project Name</td><td>Semester</td><td>Sponsor</td>

<?
$projectList = array();
$projectList = $db->getProjectList($st_id);
foreach($projectList as $output){
	print "<tr><td>$output->projectName</td> 
		<td>$output->sponsor</td>
		<td>$output->pSemester</td>";
	print "<td><a href=\"javascript: if (window.confirm('Delete project from database?')) 
			document.location = 'dCourseProject.php?student_id=$st_id&actionflag=2&
			st_projectName=$output->projectName&st_sponsor=$output->sponsor&
			st_pSemester=$output->pSemester';\">";
	print "delete</a></td>";
}
?>
</table><br>
</body></html>
