Your IP : 216.73.217.117


Current Path : /var/www/cesa.co.za/cesanet/
Upload File :
Current File : /var/www/cesa.co.za/cesanet/submittedassignments.php

<?php
include("inc_functions.php");

//ini_set('display_errors', 1);
//error_reporting(E_ALL);

if (!isset($_SESSION["StudentID"]) || empty($_SESSION["StudentID"]) || $_SESSION["StudentID"] == null)
    header("Location: /cesanet/login.php");

include_once($_SERVER['DOCUMENT_ROOT'] . "/cesanet/includes/html_begin.php");

$cceUploadedFileService = new CceUploadedFileService();
$studentId = intval($_SESSION['StudentID']);
?>
<h1> Submitted Assignments</h1>
<?php
$sql = "SELECT CCEAssignments.*, CCEModules.ModuleName
	FROM CCEAssignments INNER JOIN CCEModules USING (CCEModuleID)
	WHERE EXISTS (SELECT * FROM CCEStudentAssignments WHERE CCEStudentAssignments.CCEAssignmentID=CCEAssignments.CCEAssignmentID AND CCEStudentAssignments.CCEStudentID=" . $_SESSION["StudentID"] . ")
	ORDER BY RefNum, ArchiveYear";
//	echo $sql;
$rec = mysql_query($sql);
if (mysql_num_rows($rec) > 0) {
    ?>
    <table border="1" cellpadding="2" cellspacing="0" width="700">
        <tr><td width="250"><b>Module</b></td><td width="250"><b>Assignment</b></td><td><b>Submissions</b></td></tr>
        <?php
        while ($row = mysql_fetch_assoc($rec)) {
            ?>
            <tr><td><?php echo $row["ModuleName"]; ?></td>
                <td><?php
                    echo $row["RefNum"];
                    if (!empty($row["ArchiveYear"]))
                        echo " (" . $row["ArchiveYear"] . ") ";
                    echo ": " . $row["AssignmentName"];
                    ?></td>
                <td><table width="100%" border="1" cellpadding="2" cellspacing="0"><?php
                        $sql = "SELECT CCEStudentAssignments.*, CCERulingCodes.Ruling
		FROM CCEStudentAssignments LEFT JOIN CCERulingCodes USING (RulingCode)
		WHERE CCEStudentAssignments.CCEStudentID=" . $_SESSION["StudentID"] . "
		AND CCEStudentAssignments.CCEAssignmentID=" . $row["CCEAssignmentID"] . "
		ORDER BY CCEStudentAssignments.CCEStudentAssigID";
                        //	echo $sql;
                        $rec2 = mysql_query($sql);
                        $iNumSub = 0;
                        while ($row2 = mysql_fetch_assoc($rec2)) {
                            $iNumSub++;
                            ?>
                            <tr><td width="10"><?php echo $iNumSub; ?></td><td width=50><?php
                                    if (!empty($row2["AssignmentFile1"])) {
                                        $fileUrl = $cceUploadedFileService->buildStudentAssignmentFileUrl(
                                            intval($row2['CCEAssignmentID']),
                                            $studentId,
                                            1,
                                            $row2['AssignmentFile1']
                                        );
                                        echo "<a href='" . htmlspecialchars((string) $fileUrl) . "' target='_blank' rel='noopener'>File 1</a><br>";
                                    }
                                    if (!empty($row2["AssignmentFile2"])) {
                                        $fileUrl = $cceUploadedFileService->buildStudentAssignmentFileUrl(
                                            intval($row2['CCEAssignmentID']),
                                            $studentId,
                                            2,
                                            $row2['AssignmentFile2']
                                        );
                                        echo "<a href='" . htmlspecialchars((string) $fileUrl) . "' target='_blank' rel='noopener'>File 2</a><br>";
                                    }
                                    if (!empty($row2["AssignmentFile3"])) {
                                        $fileUrl = $cceUploadedFileService->buildStudentAssignmentFileUrl(
                                            intval($row2['CCEAssignmentID']),
                                            $studentId,
                                            3,
                                            $row2['AssignmentFile3']
                                        );
                                        echo "<a href='" . htmlspecialchars((string) $fileUrl) . "' target='_blank' rel='noopener'>File 3</a><br>";
                                    }
                                    if (!empty($row2["AssignmentFile4"])) {
                                        $fileUrl = $cceUploadedFileService->buildStudentAssignmentFileUrl(
                                            intval($row2['CCEAssignmentID']),
                                            $studentId,
                                            4,
                                            $row2['AssignmentFile4']
                                        );
                                        echo "<a href='" . htmlspecialchars((string) $fileUrl) . "' target='_blank' rel='noopener'>File 4</a><br>";
                                    }
                                    if (!empty($row2["AssignmentFile5"])) {
                                        $fileUrl = $cceUploadedFileService->buildStudentAssignmentFileUrl(
                                            intval($row2['CCEAssignmentID']),
                                            $studentId,
                                            5,
                                            $row2['AssignmentFile5']
                                        );
                                        echo "<a href='" . htmlspecialchars((string) $fileUrl) . "' target='_blank' rel='noopener'>File 5</a><br>";
                                    }
                                    ?></td>
                                <td style="<?php
                                if ($row2["Passed"] == 2) {
                                    echo "background-color:#FFCC99";
                                } elseif (($row2["Passed"] == 1) && ($row2["RulingCode"] == "NE")) {
                                    echo "background-color:#FFFF99";
                                }
                                ?>">
                                        <?php
                                        if (($row2["Passed"] == 1) || ($row2["Passed"] == 2))
                                            echo $row2["Ruling"];
                                        if ($row2["Passed"] == 0)
                                            echo "Not Yet Evaluated";
                                        if ($row2["Passed"] == 3)
                                            echo "Added to PoE";
                                        if ($iNumSub == mysql_num_rows($rec2)) {
                                            ?>
                                            <?php
                                            if ($row2["RulingCode"] == "R") {
                                                echo "<br><a href='assignmentadd.php?id=" . $row["CCEAssignmentID"] . "'>Upload resubmission</a>";
                                                echo "<br>Due by " . GetResubDate($row["CCEAssignmentID"]);
                                            }
                                            ?>
                                            <?php if ($row2["RulingCode"] == "NE") echo "<br><a href='assignmentadd.php?id=" . $row["CCEAssignmentID"] . "'>Upload enhancement</a>"; ?>
                                            <?php
                                        }
                                        ?>
                                </td></tr>
                            <?php
                        }
                        ?>
                    </table></td></tr>
            <?php
        }
        ?>
    </table>
    <?php
} else {
    echo "No assignments have yet been completed.";
}

include_once($_SERVER['DOCUMENT_ROOT'] . "/cesanet/includes/html_end.php");