Courses.php: format code
parent
09301d84ca
commit
39cc069301
76
Courses.php
76
Courses.php
|
@ -73,8 +73,8 @@ include 'Header.php';
|
|||
ON users_table.User_ID=courses_table.Lecturer_User_ID
|
||||
WHERE URL='$course_url' ");
|
||||
|
||||
if(mysqli_num_rows($result)==0)
|
||||
{} else { while($row = mysqli_fetch_assoc($result)) {
|
||||
if(mysqli_num_rows($result) > 0) {
|
||||
while ($row = mysqli_fetch_assoc($result)) {
|
||||
$name = $row['Course_Name'];
|
||||
$code = $row['Course_Code'];
|
||||
$faculty = $row['Faculty'];
|
||||
|
@ -88,7 +88,6 @@ include 'Header.php';
|
|||
<small> Faculty: $faculty Year: $academic Lecturer: $lecturer </small>
|
||||
<hr>
|
||||
<div class='row'>";
|
||||
|
||||
echo "<div class='col-md-5'>";
|
||||
}
|
||||
|
||||
|
@ -98,7 +97,6 @@ include 'Header.php';
|
|||
if ($_GET['act'] == "edit") {
|
||||
$getid = mysqli_real_escape_string($con, $_GET["cid"]);
|
||||
$result1 = mysqli_query($con, "SELECT * from lab_reports_table WHERE Lab_Report_ID = '$getid'");
|
||||
|
||||
while($row1 = mysqli_fetch_assoc($result1)) {
|
||||
$Deadline = $row1['Deadline'];
|
||||
$_SESSION['Date'] = trim( strstr($Deadline, ' ', true) );
|
||||
|
@ -122,9 +120,7 @@ include 'Header.php';
|
|||
$sql = "UPDATE `lab_reports_table` SET `Deadline` = ('" . $Deadline . "'), `Instructions` = ('" . $instructions . "'), `Title` = ('" . $title . "'), `Marks` = ('" . $marks . "'), `Type` = ('" . $type . "') WHERE `lab_reports_table`.`Lab_Report_ID` = '$getid'";
|
||||
if ($con->query($sql) === TRUE) {
|
||||
$_SESSION["info_Updated"]="Assignment information updated successfully.";
|
||||
|
||||
} else {
|
||||
// echo "Error: " . $sql . "<br>" . $con->error;
|
||||
echo "Serious error happened while updating assignment information.";
|
||||
}
|
||||
}
|
||||
|
@ -134,7 +130,6 @@ include 'Header.php';
|
|||
if ($con->query($sql) === TRUE) {
|
||||
$_SESSION["info_Updated"]="Assignment deleted successfully.";
|
||||
} else {
|
||||
// echo "Error: " . $sql . "<br>" . $con->error;
|
||||
echo "Serious error happened while deleting the assignment.";
|
||||
}
|
||||
}
|
||||
|
@ -147,8 +142,7 @@ include 'Header.php';
|
|||
$Title = $_SESSION['Title'];
|
||||
$Marks = $_SESSION['Marks'];
|
||||
$Type = $_SESSION['Type'];
|
||||
|
||||
echo " <h3><a href='Courses.php?course=".$url."'>Editing assignment information</a></h3>";
|
||||
echo "<h3><a href='Courses.php?course=".$url."'>Edit assignment information</a></h3>";
|
||||
?>
|
||||
<form method='post' enctype='multipart/form-data' action=''>
|
||||
<input type='hidden' name='form_uploadlab' value='true' required=''/>
|
||||
|
@ -169,18 +163,13 @@ include 'Header.php';
|
|||
<input type='text' name='marks' placeholder='Marks' class='form-control' required='' value="<?php echo isset($_GET['act']) && $_GET['act']=="edit" ? $Marks : ""; ?>">
|
||||
Attachment 1
|
||||
<input type='file' name='attachment1' placeholder='Attachment 1' class='form-control'>
|
||||
|
||||
Attachment 2
|
||||
<input type='file' name='attachment2' placeholder='Attachment 1' class='form-control'>
|
||||
|
||||
Attachment 3
|
||||
<input type='file' name='attachment3' placeholder='Attachment 1' class='form-control' >
|
||||
|
||||
|
||||
Attachment 4
|
||||
<input type='file' name='attachment4' placeholder='Attachment 4' class='form-control' >
|
||||
<br>
|
||||
|
||||
<?php
|
||||
if ($Type == "Individual") {
|
||||
echo "Submission Type <input type='radio' name='type' value='Individual' checked /> Individual <input type='radio' name='type' value='Group' /> Group";
|
||||
|
@ -188,7 +177,6 @@ include 'Header.php';
|
|||
echo "Submission Type <input type='radio' name='type' value='Individual' /> Individual <input type='radio' name='type' value='Group' checked> Group";
|
||||
}
|
||||
?>
|
||||
|
||||
<br>
|
||||
<input type='submit' class='btn btn-primary' value='Update assignment'><br>
|
||||
</form><br><br><br><br>
|
||||
|
@ -197,9 +185,9 @@ include 'Header.php';
|
|||
<input type='hidden' name='form_deletelab' value='true' required=''/>
|
||||
<input type='submit' class='btn btn-danger' value='Delete assignment'><br>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
}}else{
|
||||
}
|
||||
} else {
|
||||
|
||||
// ------------------------------Posting New Lab Assignment------------------------------------
|
||||
|
||||
|
@ -207,7 +195,6 @@ include 'Header.php';
|
|||
// SELECT SUBSTRING_INDEX(Deadline, ' ', 1) as Date, SUBSTRING_INDEX(Deadline, ' ', -1) as Time from lab_reports_table
|
||||
|
||||
if ($_SESSION['user_type'] == "Lecturer") {
|
||||
|
||||
?>
|
||||
|
||||
<h3>New assignment</h3>
|
||||
|
@ -234,14 +221,10 @@ include 'Header.php';
|
|||
<input type='text' name='marks' placeholder='Marks' class='form-control' required='' value="">
|
||||
Attachment 1
|
||||
<input type='file' name='attachment1' placeholder='Attachment 1' class='form-control'>
|
||||
|
||||
Attachment 2
|
||||
<input type='file' name='attachment2' placeholder='Attachment 1' class='form-control'>
|
||||
|
||||
Attachment 3
|
||||
<input type='file' name='attachment3' placeholder='Attachment 1' class='form-control' >
|
||||
|
||||
|
||||
Attachment 4
|
||||
<input type='file' name='attachment4' placeholder='Attachment 4' class='form-control' >
|
||||
<br>
|
||||
|
@ -251,16 +234,13 @@ include 'Header.php';
|
|||
<hr>
|
||||
<input type='submit' class='btn btn-primary' value='Post'><br>
|
||||
</form><br><br><br><br>
|
||||
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
echo "</div>";
|
||||
|
||||
echo "<div class='col-md-7'><h3>Assignment list</h3>";
|
||||
|
||||
error_reporting(0);
|
||||
if (isset($_SESSION["info_Updated"])) {
|
||||
echo '<hr><div class="alert alert-warning" role="alert">' . $_SESSION['info_Updated'] . '</div>';
|
||||
|
@ -275,22 +255,18 @@ include 'Header.php';
|
|||
$_SESSION['info_courses']=null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$result = mysqli_query($con," SELECT `Lab_Report_ID`,Type,Marks, `Course_ID`, `Posted_Date`, `Deadline`, `Instructions`, `Title`, `Attachment_link_1`, `Attachment_link_2`, `Attachment_link_3`, "
|
||||
. "`Attachment_link_4` FROM `lab_reports_table` WHERE Course_ID=$id ORDER by Lab_Report_ID DESC");
|
||||
|
||||
|
||||
if( $_SESSION['user_type']=="TA")
|
||||
{
|
||||
if( $_SESSION['user_type'] == "TA") {
|
||||
echo "<b style='color:gray'>Only Lecturer can post assignments.</b><br>";
|
||||
}
|
||||
if(mysqli_num_rows($result)==0)
|
||||
{
|
||||
echo "No assignments posted so far.";
|
||||
|
||||
} else { while($row = mysqli_fetch_assoc($result)) {
|
||||
$result = mysqli_query($con, "SELECT Lab_Report_ID, Type, Marks, Course_ID, Posted_Date, Deadline, Instructions, Title, Attachment_link_1, Attachment_link_2, Attachment_link_3, Attachment_link_4
|
||||
FROM lab_reports_table
|
||||
WHERE Course_ID=$id ORDER BY Lab_Report_ID DESC");
|
||||
|
||||
if(mysqli_num_rows($result)==0) {
|
||||
echo "No assignments posted so far.";
|
||||
} else {
|
||||
while ($row = mysqli_fetch_assoc($result)) {
|
||||
$marks = $row['Marks'];
|
||||
$title = $row['Title'];
|
||||
$ins = $row['Instructions'];
|
||||
|
@ -311,20 +287,23 @@ include 'Header.php';
|
|||
if ($att3 != "") {
|
||||
$full_link = $full_link."  |  <a href='~\..\Download.php?file=$att3'>$att3</a>";
|
||||
}
|
||||
|
||||
if ($att4 != "") {
|
||||
$full_link = $full_link." |   <a href='~\..\Download.php?file=$att4'>$att4</a>";
|
||||
}
|
||||
|
||||
$resultx1 = mysqli_query($con, "SELECT COUNT(*) AS cnt FROM lab_report_submissions WHERE lab_report_submissions.Lab_Report_ID=$id");
|
||||
while ($row = mysqli_fetch_assoc($resultx1)) {
|
||||
$count_subs = $row['cnt'];
|
||||
}
|
||||
|
||||
|
||||
|
||||
$resultx1 = mysqli_query($con,"Select Count(*) as cnt from lab_report_submissions where lab_report_submissions.Lab_Report_ID=$id");
|
||||
while($row = mysqli_fetch_assoc($resultx1)) {$count_subs=$row['cnt'];}
|
||||
|
||||
$resultx2 = mysqli_query($con,"Select COUNT(*) as cnt from lab_report_submissions where lab_report_submissions.Lab_Report_ID=$id and Marks is not null");
|
||||
if(mysqli_num_rows($resultx2)==0){$count_marked=0;} else { while($row = mysqli_fetch_assoc($resultx2)) {$count_marked =$row['cnt'];}}
|
||||
|
||||
$resultx2 = mysqli_query($con, "SELECT COUNT(*) AS cnt FROM lab_report_submissions WHERE lab_report_submissions.Lab_Report_ID=$id AND Marks IS NOT null");
|
||||
if (mysqli_num_rows($resultx2) == 0) {
|
||||
$count_marked = 0;
|
||||
} else {
|
||||
while ($row = mysqli_fetch_assoc($resultx2)) {
|
||||
$count_marked = $row['cnt'];
|
||||
}
|
||||
}
|
||||
|
||||
$header="Courses > ".$name."($code) > Assignments > ".$title;
|
||||
|
||||
|
@ -341,7 +320,8 @@ include 'Header.php';
|
|||
</div>
|
||||
</div>";
|
||||
|
||||
}}
|
||||
}
|
||||
}
|
||||
echo "</div>";
|
||||
|
||||
$resultx1 = mysqli_query($con,"SELECT course_students_table.Student_ID,users_table.Full_Name FROM
|
||||
|
|
Loading…
Reference in New Issue