| Current Path : /var/www/cesa.co.za/cesanet/ |
| Current File : /var/www/cesa.co.za/cesanet/evaluations.php |
<?php
include("inc_functions.php");
if (!isset($_SESSION["StudentID"]) || empty($_SESSION["StudentID"]))
header("Location: /cesanet/login.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>CESAnet</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<!--[if IE 5]>
<style type="text/css">
/* place css box model fixes for IE 5* in this conditional comment */
.twoColFixLtHdr #sidebar1 { width: 230px; }
</style>
<![endif]--><!--[if IE]>
<style type="text/css">
/* place css fixes for all versions of IE in this conditional comment */
.twoColFixLtHdr #sidebar1 { padding-top: 30px; }
.twoColFixLtHdr #mainContent { zoom: 1; }
/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */
</style>
<![endif]-->
</head>
<body class="twoColFixLtHdr">
<div id="container">
<?php include("inc_header.php"); ?>
<?php include("inc_sidebar.php"); ?>
<div id="mainContent">
<h1>Evaluation Forms</h1>
<h1> Upload Evaluation Form</h1>
<?php
if (!CurrentStudent()) {
echo "<p><b>Only available to current students.</b></p>";
die();
}
if (isset($_REQUEST["go"]) && ($_REQUEST["go"] == 1)) {
$uploaddir = '../cceadmin/documents/';
$uploadfilename1 = "";
if (isset($_FILES['file1'])) {
$uploadfilename1 = strtolower(str_replace(array("'", "\"", "(", ")", "#", " "), "_", basename(stripslashes($_FILES['file1']['name']))));
$uploadfile1 = $uploaddir . $uploadfilename1;
$ifilenum = 1;
while (file_exists($uploadfile1) && !empty($uploadfilename1)) {
$uploadfile1 = $uploaddir . $ifilenum . "_" . $uploadfilename1;
$ifilenum++;
}
move_uploaded_file($_FILES['file1']['tmp_name'], $uploadfile1);
$sql = "INSERT INTO CCEUploads (CCEStudentID, DocFile, DocName, UploadCategory, DateUploaded, UploadedBy)
VALUES ('" . $_SESSION["StudentID"] . "', '" . str_replace('../cceadmin/documents/', '', $uploadfile1) . "',
'BCE " . date("Y") . " Evaluation" . " " . $_REQUEST["DocName"] . "', 'Contact Session Evaluation', NOW(), 'Student')";
mysql_query($sql);
$sql = "SELECT * FROM CCEStudents WHERE CCEStudentID=" . $_SESSION["StudentID"];
$rec = mysql_query($sql);
if ($row = mysql_fetch_assoc($rec))
mail("brenda@cesa.co.za", "BCE Contact Session Evaluation Form loaded by " . $row["FirstName"] . " " . $row["Surname"], $row["FirstName"] . " " . $row["Surname"] . " has loaded a form for session: " . $_REQUEST["DocName"] . "." . "\r\n\r\n" . "http://www.cesa.co.za/cceadmin/documents/" . str_replace('../cceadmin/documents/', '', $uploadfile1), "From: sce@cesa.co.za");
?>
<p><b>Thank you for uploading your evaluation form.</b></p>
<?php
} else {
?>
<p><b>Error: please upload a file.</b></p>
<?php
}
}
?>
<form action="evaluations.php" method="post" enctype="multipart/form-data" name="form1" id="form1">
<input type="hidden" name="go" value="1" />
<p><b>Please note the following instructions:</b><br />
<ul>
<li>Please do not use unusual characters, especially subscripts, superscripts and symbols, when naming your files. File names may contain letters, numbers, spaces, hyphens and underscores, but no other characters are allowed.<br />
</li>
</ul></p>
<?php
?>
<p>Session: <select name="DocName">
<?php
$sql = "SELECT CCESessions.CCESessionName, StartDate, EndDate FROM CCESessions JOIN CCESessionSchedules USING (CCESessionID) WHERE CCESessionSchedules.EndDate>='" . date("Y") . "-01-01' AND CCESessionSchedules.StartDate<='" . date("Y-m-d") . "' ORDER BY CCESessions.CCESessionOrder DESC";
$rec = mysql_query($sql);
while ($row = mysql_fetch_assoc($rec)) {
for ($i = 11; $i >= 0; $i--) {
$iDate = strtotime("+" . $i . " week", strtotime($row["StartDate"]));
if (($iDate <= time()) && ($iDate <= strtotime($row["EndDate"]))) {
?>
<option value="<?php echo $row["CCESessionName"] . " " . date("Y-m-d", $iDate); ?>"><?php echo $row["CCESessionName"] . " " . date("Y-m-d", $iDate); ?></option>
<?php
}
}
}
?>
</select></p>
<p>
File: <input type="file" name="file1" id="file1" />
</p>
<p>
<label>
<input type="submit" name="button" id="button" value="Submit" />
</label>
</p>
</form>
<p> </p>
<p>You have previously uploaded the following evaluation forms:</p>
<ul>
<?php
$sql = "SELECT * FROM CCEUploads WHERE CCEStudentID=" . $_SESSION["StudentID"] . " AND UploadCategory='Contact Session Evaluation' AND UploadedBy='Student' ORDER BY DateUploaded DESC";
$rec = mysql_query($sql);
if (mysql_num_rows($rec) == 0)
echo "<li>None.</li>";
while ($row = mysql_fetch_assoc($rec)) {
?>
<li><?php echo $row["DocName"]; ?> - uploaded on <?php echo date("Y-m-d", strtotime($row["DateUploaded"])); ?></li>
<?php
}
?>
</ul>
</div>
<?php include("inc_footer.php"); ?>
</div>
</body>
</html>