[Refactoring] Particularly make the SQL statement that shows new assigmments in Coruse.php less messy.

SIMPLICITY_link
Hui Lan 2020-10-02 17:02:20 +08:00
parent 25a1431ba8
commit ada55d3394
12 changed files with 2357 additions and 2987 deletions

View File

@ -1,3 +1,8 @@
<?php
include 'NoDirectPhpAcess.php';
?>
<?php <?php
$page="admin"; $page="admin";
include 'Header.php'; include 'Header.php';
@ -32,7 +37,7 @@ if ($_SESSION['user_type'] != "Lecturer") {
<hr> <hr>
--> -->
<div class="col-md-6"> <div class="col-md-6">
<h4> User account Management </h4><hr> <h4> User Account Management </h4><hr>
<b>Lecturer / TA Accounts </b><br> <b>Lecturer / TA Accounts </b><br>
@ -359,4 +364,4 @@ echo "</select> <input type='hidden' name='assignTA' value='true'> <input type=
} }
window.location.href="\Script.php\?action=statuschange&uid="+id+"&status="+status; window.location.href="\Script.php\?action=statuschange&uid="+id+"&status="+status;
} }
</script> </script>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

37
Download.php Normal file
View File

@ -0,0 +1,37 @@
<?php
session_start();
// Allow legal person to download files instead of using direct URL access
// Adapted from https://www.runoob.com/w3cnote/php-download-file.html
// 修改这一行设置你的文件下载目录
$file = "./../../lrr_submission".$_GET['file'];
$filename = basename($file);
// 判断文件是否存在
if(!file_exists($file)) die("File does not exist.");
// 文件类型,作为头部发送给浏览器
$type = filetype($file);
// 获取时间和日期
$today = date("F j, Y, g:i a");
$time = time();
if ( (isset($_SESSION["user_student_id"]) && strpos($file, $_SESSION["user_student_id"])) || $_SESSION['user_type'] == "Lecturer" || $_SESSION['user_type'] == "TA") {
// 发送文件头部
header("Content-type: $type");
header("Content-Disposition: attachment;filename=$filename");
header("Content-Transfer-Encoding: binary");
header('Pragma: no-cache');
header('Expires: 0');
// 发送文件内容
set_time_limit(0);
readfile($file);
} else {
echo "Nothing to download. Contact lanhui _at_ zjnu.edu.cn if you think otherwise.";
}
?>

View File

@ -1,55 +1,39 @@
<?php <?php
session_start(); session_start();
error_reporting(0); error_reporting(0);
date_default_timezone_set('Asia/Shanghai'); date_default_timezone_set('Asia/Shanghai');
$con = mysqli_connect("localhost","username","password","lrr");
$con=mysqli_connect("localhost","username","password","lrr"); // Check database connection
// Check connection if (mysqli_connect_errno()) {
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error(); echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
else
{
} }
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<header> <header>
<link href="./css/bootstrap.min.css" rel="stylesheet" type="text/css"/> <link href="./css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
<link href="./font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"/> <link href="./font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
<link href="./css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
<script src="./css/jquery.min.js" type="text/javascript"></script> <script src="./css/jquery.min.js" type="text/javascript"></script>
<script src="./css/bootsrap.min.js" type="text/javascript"></script> <script src="./css/bootsrap.min.js" type="text/javascript"></script>
<link href="./css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
<script src="./css/jquery.datetimepicker.min.js" type="text/javascript"></script> <script src="./css/jquery.datetimepicker.min.js" type="text/javascript"></script>
</header> </header>
<body> <body>
<?php
$curDateTime = date("Y-m-d H:i");
include 'connect.php';
?>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark" style="padding-left:150px;padding-right:150px;margin:auto;"> <nav class="navbar navbar-expand-lg navbar-dark bg-dark" style="padding-left:150px;padding-right:150px;margin:auto;">
<a class="navbar-brand" href="~\..\index.php"> <img src="logo.png" style="width:30px;heigh:30px;"> LRRS</a> <a class="navbar-brand" href="~\..\index.php"> <img src="logo.png" style="width:30px;heigh:30px;"> LRRS</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarColor02" aria-controls="navbarColor02" aria-expanded="false" aria-label="Toggle navigation"> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarColor02" aria-controls="navbarColor02" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span> <span class="navbar-toggler-icon"></span>
</button> </button>
@ -60,26 +44,24 @@ else
<li class="nav-item active"> <li class="nav-item active">
<!-- <a class='nav-link' href='~\..\Visitors.php'> <i class='fa fa-globe'></i> Visitor Portal <span class='sr-only'>(current)</span></a> --> <!-- <a class='nav-link' href='~\..\Visitors.php'> <i class='fa fa-globe'></i> Visitor Portal <span class='sr-only'>(current)</span></a> -->
</li> </li>
<?php <?php
if(isset($_SESSION["user_fullname"])) if(isset($_SESSION["user_fullname"]))
{ {
echo " <a class='nav-link' href='~\..\Courses.php'><i class='fa fa-book'></i> Courses <span class='sr-only'>(current)</span></a>"; echo " <a class='nav-link' href='~\..\Courses.php'><i class='fa fa-book'></i> Courses <span class='sr-only'>(current)</span></a>";
?> ?>
</li> </li>
</ul>
</ul>
<form class="form-inline my-2 my-lg-0" style="color:#fff;"> <form class="form-inline my-2 my-lg-0" style="color:#fff;">
Welcome &nbsp; <b> <?php echo $_SESSION['user_fullname']; Welcome &nbsp; <b> <?php echo $_SESSION['user_fullname']; ?> </b> &nbsp;
?> </b> &nbsp;
<?php <?php
$c_date= date("Y-m-d H:i"); $c_date= date("Y-m-d H:i");
echo "(". $_SESSION['user_type'] .") "; if (isset( $_SESSION['user_student_id']))
echo "(". $_SESSION['user_type'] . " - " . $_SESSION['user_student_id'] .") ";
else
echo "(". $_SESSION['user_type'] .") ";
?> ?>
<?php <?php
@ -87,16 +69,14 @@ if ($_SESSION['user_type'] == "Lecturer") {
echo "&nbsp;&nbsp;&nbsp; <i class=\"fa fa-cog\" style=\"color:#fff;\"> </i> &nbsp;<a style='color:#fff !important' href=\"~\..\Admin.php\">Admin </a>"; echo "&nbsp;&nbsp;&nbsp; <i class=\"fa fa-cog\" style=\"color:#fff;\"> </i> &nbsp;<a style='color:#fff !important' href=\"~\..\Admin.php\">Admin </a>";
} }
?> ?>
&nbsp;&nbsp;&nbsp; <i class="fa fa-user" style="color:#fff;"> </i> &nbsp;&nbsp;&nbsp; <i class="fa fa-user" style="color:#fff;"> </i>
&nbsp;<a href="#" style='color:#fff !important' onclick="updatePass(<?php echo $_SESSION['user_id'];?>)">Update password</a> &nbsp;<a href="#" style='color:#fff !important' onclick="updatePass(<?php echo $_SESSION['user_id'];?>)">Update password</a>
&nbsp;&nbsp;&nbsp; <i class="fa fa-lock" style="color:#fff;"> </i> &nbsp;<a style='color:#fff !important' href="~\..\logout.php">Logout </a> &nbsp;&nbsp;&nbsp; <i class="fa fa-lock" style="color:#fff;"> </i> &nbsp;<a style='color:#fff !important' href="~\..\logout.php">Logout </a>
<?php <?php
} }
?> ?>
</form> </form>
</div> </div>
</nav> </nav>
@ -130,7 +110,7 @@ if ($_SESSION['user_type'] == "Lecturer") {
} }
h1,h2,h3,h4{color:#03407B;} h1,h2,h3,h4{color:#03407B;}
a { a {
color: #03407B; color: #03407B;
} }
.break-word { .break-word {
@ -156,33 +136,30 @@ if ($_SESSION['user_type'] == "Lecturer") {
.ui-button{ background: #03488B; color:white } .ui-button{ background: #03488B; color:white }
</style> </style>
<script> <script>
function updatePass(id) function updatePass(id)
{ {
var pass= prompt("Enter your new password : ", "..."); var pass = prompt("Enter your new password : ", "Enter a strong password");
if(!confirm('Are you sure to reset your password?')) if(!confirm('Are you sure you want to reset your password?'))
{ {
return; return;
} }
window.location.href="\Script.php\?action=passchange&uid="+id+"&pass="+pass; window.location.href="\Script.php\?action=passchange&uid="+id+"&pass="+pass;
} }
function blockUser(id,status) function blockUser(id,status)
{ {
if(!confirm('Are you to change User Status')) if(!confirm('Are you sure you want to change user status?'))
{ {
return; return;
} }
window.location.href="\Script.php\?action=statuschange&uid="+id+"&status="+status; window.location.href="\Script.php\?action=statuschange&uid="+id+"&status="+status;
} }
</script> </script>

7
NoDirectPhpAcess.php Normal file
View File

@ -0,0 +1,7 @@
<?php
// https://stackoverflow.com/questions/33999475/prevent-direct-url-access-to-php-file
if (!isset($_SERVER['HTTP_REFERER']) ) {
/* choose the appropriate page to redirect users */
die( header( 'location: index.php' ) );
}
?>

2182
Script.php

File diff suppressed because it is too large Load Diff

View File

@ -1,40 +1,40 @@
<?php
include 'NoDirectPhpAcess.php';
?>
<?php <?php
$page='Courses+'; $page='Courses+';
include 'Header.php'; include 'Header.php';
$student_id=$_SESSION["user_student_id"]; $student_id = $_SESSION["user_student_id"];
$group_id=$_SESSION["user_group_id"]; $group_id = $_SESSION["user_group_id"];
$c_date= date("Y-m-d H:i"); $c_date = date("Y-m-d H:i");
if(!empty($_GET["id"])) if(!empty($_GET["id"]))
{ {
$id=$_GET["id"]; $id = $_GET["id"];
$course_id=$id; $course_id = $id;
} }
if(!empty($_GET["header"]))
{ if(!empty($_GET["header"]))
$header=$_GET["header"]; {
} $header = $_GET["header"];
}
if(!empty($_GET["total"])) if(!empty($_GET["total"]))
{ {
$total=$_GET["total"]; $total = $_GET["total"];
} else } else
{ {
$total=0; $total = 0;
} }
$resultx1 = mysqli_query($con,"SELECT `Lab_Report_ID`,Title, `Course_ID`, `Posted_Date`, `Deadline`, `Marks`, `Type` FROM `lab_reports_table` WHERE Lab_Report_ID=$id"); $resultx1 = mysqli_query($con,"SELECT `Lab_Report_ID`,Title, `Course_ID`, `Posted_Date`, `Deadline`, `Marks`, `Type` FROM `lab_reports_table` WHERE Lab_Report_ID=$id");
while($row = mysqli_fetch_assoc($resultx1)) { while($row = mysqli_fetch_assoc($resultx1)) {
$Report_Type = $row['Type'];
$Report_Type=$row['Type']; $c_id = $row['Course_ID'];
$c_id=$row['Course_ID']; $Report_Title = $row['Title'];
$Report_Title=$row['Title']; }
}
@ -52,83 +52,83 @@ echo "<div class='alert' style='margin-left:20px;border-bottom:2px solid #1D91EF
<!-- Lecture CODE--> <!-- Lecturer CODE-->
<?php <?php
if( $_SESSION['user_type']=="Lecturer" || $_SESSION['user_type']=="TA") if( $_SESSION['user_type']=="Lecturer" || $_SESSION['user_type']=="TA")
{ {
?> ?>
<div class="col-md-12"> <div class="col-md-12">
<?php <?php
error_reporting(0); error_reporting(0);
if(isset($_SESSION['info_Marking'])) { if(isset($_SESSION['info_Marking'])) {
echo '<hr><div class="alert alert-info" role="alert">'.$_SESSION['info_Marking'].'</div>'; echo '<hr><div class="alert alert-info" role="alert">'.$_SESSION['info_Marking'].'</div>';
$_SESSION['info_Marking']=null; $_SESSION['info_Marking']=null;
} }
$resultx1 = mysqli_query($con,"Select Count(*) as cnt from lab_report_submissions where lab_report_submissions.Lab_Report_ID=$id"); $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'];} 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 Status='Marked'"); $resultx2 = mysqli_query($con,"Select COUNT(*) as cnt from lab_report_submissions where lab_report_submissions.Lab_Report_ID=$id and Status='Marked'");
if(mysqli_num_rows($resultx2)==0){$count_marked=0;} else { while($row = mysqli_fetch_assoc($resultx2)) {$count_marked =$row['cnt'];}} if(mysqli_num_rows($resultx2)==0){$count_marked=0;} else { while($row = mysqli_fetch_assoc($resultx2)) {$count_marked =$row['cnt'];}}
$resultx3 = mysqli_query($con,"Select COUNT(*) as cnt from lab_report_submissions where lab_report_submissions.Lab_Report_ID=$id and Status='Pending'"); $resultx3 = mysqli_query($con,"Select COUNT(*) as cnt from lab_report_submissions where lab_report_submissions.Lab_Report_ID=$id and Status='Pending'");
if(mysqli_num_rows($resultx3)==0){$count_unmarked=0;} else { while($row = mysqli_fetch_assoc($resultx3)) {$count_unmarked =$row['cnt'];}} if(mysqli_num_rows($resultx3)==0){$count_unmarked=0;} else { while($row = mysqli_fetch_assoc($resultx3)) {$count_unmarked =$row['cnt'];}}
$resultx4 = mysqli_query($con,"Select COUNT(*) as cnt from lab_report_submissions where lab_report_submissions.Lab_Report_ID=$id and Status='Remarking'"); $resultx4 = mysqli_query($con,"Select COUNT(*) as cnt from lab_report_submissions where lab_report_submissions.Lab_Report_ID=$id and Status='Remarking'");
if(mysqli_num_rows($resultx4)==0){$count_remark=0;} else { while($row = mysqli_fetch_assoc($resultx4)) {$count_remark =$row['cnt'];}} if(mysqli_num_rows($resultx4)==0){$count_remark=0;} else { while($row = mysqli_fetch_assoc($resultx4)) {$count_remark =$row['cnt'];}}
?> ?>
<b>Lab Report Submissions (<?php echo $count_subs;?>)</b> <b>Lab Report Submissions (<?php echo $count_subs;?>)</b>
<!-- Nav tabs --> <!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist"> <ul class="nav nav-tabs" role="tablist">
<li class="nav-item"> <li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#menu1">Un-Marked Submissions<b> (<?php echo $count_unmarked;?>)</b></a> <a class="nav-link active" data-toggle="tab" href="#menu1">Un-Marked Submissions<b> (<?php echo $count_unmarked;?>)</b></a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#menu2">Marked Submissions <b>(<?php echo $count_marked;?>)</b></a> <a class="nav-link" data-toggle="tab" href="#menu2">Marked Submissions <b>(<?php echo $count_marked;?>)</b></a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#menu3">Re-Marking Requests <b>(<?php echo $count_remark;?>)</b></a> <a class="nav-link" data-toggle="tab" href="#menu3">Re-Marking Requests <b>(<?php echo $count_remark;?>)</b></a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#menu4"> View Course Groups</a> <a class="nav-link" data-toggle="tab" href="#menu4"> View Course Groups</a>
</li> </li>
</ul> </ul>
<div class="tab-content"> <div class="tab-content">
<div id="menu1" class="container tab-pane active"><br> <div id="menu1" class="container tab-pane active"><br>
<?php <?php
if($Report_Type=="Group") if($Report_Type=="Group")
{ {
$result1 = mysqli_query($con,"SELECT `Submission_ID`, `Submission_Date`, lab_report_submissions.Lab_Report_ID, $result1 = mysqli_query($con,"SELECT `Submission_ID`, `Submission_Date`, lab_report_submissions.Lab_Report_ID,
lab_report_submissions.Course_Group_id, `Attachment1`, lab_report_submissions.Course_Group_id, `Attachment1`,
`Notes`, `Attachment2`, `Attachment3`, `Attachment4`, `Marks`, lab_report_submissions.Status, `Notes`, `Attachment2`, `Attachment3`, `Attachment4`, `Marks`, lab_report_submissions.Status,
`Title`,course_groups_table.Group_Name `Title`,course_groups_table.Group_Name
FROM `lab_report_submissions` FROM `lab_report_submissions`
left JOIN course_groups_table on course_groups_table.Course_Group_id=lab_report_submissions.Course_Group_id left JOIN course_groups_table on course_groups_table.Course_Group_id=lab_report_submissions.Course_Group_id
where Lab_Report_ID=$id and lab_report_submissions.Status='Pending' order by Submission_Date desc"); where Lab_Report_ID=$id and lab_report_submissions.Status='Pending' order by Submission_Date desc");
} }
else else
{ {
$result1 = mysqli_query($con,"SELECT `Submission_ID`, `Submission_Date`, lab_report_submissions.Lab_Report_ID, $result1 = mysqli_query($con,"SELECT `Submission_ID`, `Submission_Date`, lab_report_submissions.Lab_Report_ID,
lab_report_submissions.Student_id sub_std, lab_report_submissions.Course_Group_id, `Attachment1`, lab_report_submissions.Student_id sub_std, lab_report_submissions.Course_Group_id, `Attachment1`,
`Notes`, `Attachment2`, `Attachment3`, `Attachment4`, `Marks`, lab_report_submissions.Status, `Notes`, `Attachment2`, `Attachment3`, `Attachment4`, `Marks`, lab_report_submissions.Status,
`Title`,users_table.Full_Name,course_group_members_table.Student_ID `Title`,users_table.Full_Name,course_group_members_table.Student_ID
@ -136,87 +136,95 @@ FROM `lab_report_submissions`
Left JOIN users_table on users_table.Student_ID=lab_report_submissions.Student_id Left JOIN users_table on users_table.Student_ID=lab_report_submissions.Student_id
left JOIN course_group_members_table on course_group_members_table.Course_Group_id=lab_report_submissions.Course_Group_id left JOIN course_group_members_table on course_group_members_table.Course_Group_id=lab_report_submissions.Course_Group_id
where Lab_Report_ID=$id and lab_report_submissions.Status='Pending' order by Submission_Date desc"); where Lab_Report_ID=$id and lab_report_submissions.Status='Pending' order by Submission_Date desc");
} }
if(mysqli_num_rows($result1)==0) if(mysqli_num_rows($result1)==0)
{ {
echo "No Un-Marked Submissions for this Lab Report."; echo "No Un-Marked Submissions for this Lab Report.";
} else { while($row = mysqli_fetch_assoc($result1)) { } else {
$title=$row['Title']; while($row = mysqli_fetch_assoc($result1)) {
$Marks=$row['Marks']; $title=$row['Title'];
//$ins=$row['Notes']; $Marks=$row['Marks'];
$posted=$row['Submission_Date']; $posted=$row['Submission_Date'];
$deadline=$row['Deadline']; $deadline=$row['Deadline'];
$att1=$row['Attachment1']; $att1=$row['Attachment1'];
$att2=$row['Attachment2']; $att2=$row['Attachment2'];
$att3=$row['Attachment3']; $att3=$row['Attachment3'];
$att4=$row['Attachment4']; $att4=$row['Attachment4'];
$labid=$row['Lab_Report_ID']; $labid=$row['Lab_Report_ID'];
$submitted_std=$row['Student_id']; $submitted_std=$row['Student_id'];
$submitted_group=$row['Course_Group_id']; $submitted_group=$row['Course_Group_id'];
$Submission_ID=$row['Submission_ID']; $Submission_ID=$row['Submission_ID'];
$names=$row['Full_Name']; $names=$row['Full_Name'];
$groupname=$row['Group_Name']; $groupname=$row['Group_Name'];
$student_id=$row['sub_std']; $student_id=$row['sub_std'];
if($submitted_group==0) if($submitted_group==0)
{ {
$submitted_by= $names."(".$student_id.")"; $submitted_by= $names."(".$student_id.")";
} else { } else {
$submitted_by="<i>(GROUP)</i> $groupname" ; $submitted_by="<i>(GROUP)</i> $groupname" ;
} }
$base_att1 = basename($att1);
$base_att2 = basename($att2);
$base_att3 = basename($att3);
$base_att4 = basename($att4);
$full_link = "<a href='~\..\Download.php?file=$att1&attachment=1'>$base_att1</a>"; // prevent students from directly accessing their classmates' submissions
if($att2!=""){
$full_link= $full_link." | <a href='~\..\Download.php?file=$att2&attachment=2'>$base_att2</a>";
}
if($att3!=""){
$full_link= $full_link." | <a href='~\..\Download.php?file=$att3&attachment=3'>$base_att3</a>";
}
if($att4!=""){
$full_link= $full_link." | <a href='~\..\Download.php?file=$att4&attachment=4'>$base_att4</a>";
}
$full_link="<a href='~\..\Lab_Report_Submisions\\$att1'>$att1</a>";
if($att2!=""){
$full_link= $full_link."| <a href='~\..\Lab_Report_Submisions\\$att2'>$att2</a>";
}
if($att3!=""){
$full_link= $full_link."| <a href='~\..\Lab_Report_Submisions\\$att3'>$att3</a>";
}
if($att4!=""){
$full_link= $full_link."| <a href='~\..\Lab_Report_Submisions\\$att4'>$att4</a>";
}
echo " <k href='#'> <div class='btn btn-default break-word' style='dislay:block; word-wrap: break-word; border: 1px solid #F0F0F0;border-left: 4px solid #03407B;'> echo " <k href='#'> <div class='btn btn-default break-word' style='dislay:block; word-wrap: break-word; border: 1px solid #F0F0F0;border-left: 4px solid #03407B;'>
$title <br> by : <b> $submitted_by </b> $title <br> by: <b> $submitted_by </b>
<br> <span style='font-size:8pt'>Submitted : $posted <button class='btn-sm btn-info' style='margin-left:50px;' onclick='mark($Submission_ID,\"$title\",$total)'> Mark Submission</button><br> Attachments : $full_link </span> <br> <span style='font-size:8pt'>Submitted at $posted <button class='btn-sm btn-info' style='margin-left:50px;' onclick='mark($Submission_ID,\"$title\",$total)'> Mark Submission</button><br> Attachments : $full_link </span>
</div></k>"; </div></k>";
}} }
echo ""; }
?> echo "";
?>
</div> </div>
<div id="menu2" class="container tab-pane"><br> <div id="menu2" class="container tab-pane"><br>
<?php <?php
if($Report_Type=="Group") if($Report_Type=="Group")
{ {
$result = mysqli_query($con,"SELECT `Submission_ID`,Visibility, `Submission_Date`, lab_report_submissions.Lab_Report_ID, $result = mysqli_query($con,"SELECT `Submission_ID`,Visibility, `Submission_Date`, lab_report_submissions.Lab_Report_ID,
lab_report_submissions.Course_Group_id, `Attachment1`, lab_report_submissions.Course_Group_id, `Attachment1`,
`Notes`, `Attachment2`, `Attachment3`, `Attachment4`, `Marks`, lab_report_submissions.Status, `Notes`, `Attachment2`, `Attachment3`, `Attachment4`, `Marks`, lab_report_submissions.Status,
`Title`,course_groups_table.Group_Name `Title`,course_groups_table.Group_Name
FROM `lab_report_submissions` FROM `lab_report_submissions`
left JOIN course_groups_table on course_groups_table.Course_Group_id=lab_report_submissions.Course_Group_id left JOIN course_groups_table on course_groups_table.Course_Group_id=lab_report_submissions.Course_Group_id
where Lab_Report_ID=$id and lab_report_submissions.Status='Marked'"); where Lab_Report_ID=$id and lab_report_submissions.Status='Marked'");
} }
else else
{ {
$result = mysqli_query($con,"SELECT `Submission_ID`,Visibility, `Submission_Date`, lab_report_submissions.Lab_Report_ID, $result = mysqli_query($con,"SELECT `Submission_ID`,Visibility, `Submission_Date`, lab_report_submissions.Lab_Report_ID,
lab_report_submissions.Student_id sub_std, lab_report_submissions.Course_Group_id, `Attachment1`, lab_report_submissions.Student_id sub_std, lab_report_submissions.Course_Group_id, `Attachment1`,
`Notes`, `Attachment2`, `Attachment3`, `Attachment4`, `Marks`, lab_report_submissions.Status, `Notes`, `Attachment2`, `Attachment3`, `Attachment4`, `Marks`, lab_report_submissions.Status,
`Title`,users_table.Full_Name,course_group_members_table.Student_ID `Title`,users_table.Full_Name,course_group_members_table.Student_ID
@ -224,55 +232,55 @@ FROM `lab_report_submissions`
Left JOIN users_table on users_table.Student_ID=lab_report_submissions.Student_id Left JOIN users_table on users_table.Student_ID=lab_report_submissions.Student_id
left JOIN course_group_members_table on course_group_members_table.Course_Group_id=lab_report_submissions.Course_Group_id left JOIN course_group_members_table on course_group_members_table.Course_Group_id=lab_report_submissions.Course_Group_id
where Lab_Report_ID=$id and lab_report_submissions.Status='Marked' Order by lab_report_submissions.Student_id Desc"); where Lab_Report_ID=$id and lab_report_submissions.Status='Marked' Order by lab_report_submissions.Student_id Desc");
} }
if(mysqli_num_rows($result)==0) if(mysqli_num_rows($result)==0)
{ {
echo "No Marked submissions for this lab"; echo "No Marked submissions for this lab";
} else { } else {
echo "<h3><a href='~\..\Script.php?exportgrade=true&lab=$id&lab_name=$Report_Title'><i class='fa fa-book'></i> Export Grade Sheet </a></h3>"; echo "<h3><a href='~\..\Script.php?exportgrade=true&lab=$id&lab_name=$Report_Title'><i class='fa fa-book'></i> Export Grade Sheet </a></h3>";
while($row = mysqli_fetch_assoc($result)) { while($row = mysqli_fetch_assoc($result)) {
$title=$row['Title']; $title=$row['Title'];
$Marks=$row['Marks']; $Marks=$row['Marks'];
//$ins=$row['Notes']; //$ins=$row['Notes'];
$posted=$row['Submission_Date']; $posted=$row['Submission_Date'];
$deadline=$row['Deadline']; $deadline=$row['Deadline'];
$att1=$row['Attachment1']; $att1=$row['Attachment1'];
$att2=$row['Attachment2']; $att2=$row['Attachment2'];
$att3=$row['Attachment3']; $att3=$row['Attachment3'];
$att4=$row['Attachment4']; $att4=$row['Attachment4'];
$labid=$row['Lab_Report_ID']; $labid=$row['Lab_Report_ID'];
$submitted_std=$row['Student_id']; $submitted_std=$row['Student_id'];
$submitted_group=$row['Course_Group_id']; $submitted_group=$row['Course_Group_id'];
$Submission_ID=$row['Submission_ID']; $Submission_ID=$row['Submission_ID'];
$names=$row['Full_Name']; $names=$row['Full_Name'];
$student_id=$row['sub_std']; $student_id=$row['sub_std'];
$Visibility=$row['Visibility']; $Visibility=$row['Visibility'];
$notes=$row['Notes']; $notes=$row['Notes'];
if($submitted_group==0) if($submitted_group==0)
{ {
$submitted_by= $names."(".$student_id.")"; $submitted_by= $names."(".$student_id.")";
} else { } else {
$submitted_by="<i>(GROUP)</i> Group X " ; $submitted_by="<i>(GROUP)</i> Group X " ;
} }
$full_link="<a href='~\..\Lab_Report_Submisions\\$att1'>$att1</a>"; $full_link="<a href='~\..\Lab_Report_Submisions\\$att1'>$att1</a>";
if($att2!=""){ if($att2!=""){
$full_link= $full_link."| <a href='~\..\Lab_Report_Submisions\\$att2'>$att2</a>"; $full_link= $full_link."| <a href='~\..\Lab_Report_Submisions\\$att2'>$att2</a>";
} }
if($att3!=""){ if($att3!=""){
$full_link= $full_link."| <a href='~\..\Lab_Report_Submisions\\$att3'>$att3</a>"; $full_link= $full_link."| <a href='~\..\Lab_Report_Submisions\\$att3'>$att3</a>";
} }
if($att4!=""){ if($att4!=""){
$full_link= $full_link."| <a href='~\..\Lab_Report_Submisions\\$att4'>$att4</a>"; $full_link= $full_link."| <a href='~\..\Lab_Report_Submisions\\$att4'>$att4</a>";
} }
echo " <k href='#'> <div class='btn btn-default break-word' style='dislay:block; word-wrap: break-word; border: 1px solid #F0F0F0;border-left: 4px solid #03407B;'> echo " <k href='#'> <div class='btn btn-default break-word' style='dislay:block; word-wrap: break-word; border: 1px solid #F0F0F0;border-left: 4px solid #03407B;'>
$title <br> by : <b> $submitted_by &nbsp; &nbsp;&nbsp;&nbsp;&nbsp; [ Marked $Marks ] </b> &nbsp; Visibility : <b>$Visibility </b> <button class='btn-sm btn-success' style='margin-left:50px;' onclick='updatev($Submission_ID)'>Update visibility</button> $title <br> by : <b> $submitted_by &nbsp; &nbsp;&nbsp;&nbsp;&nbsp; [ Marked $Marks ] </b> &nbsp; Visibility : <b>$Visibility </b> <button class='btn-sm btn-success' style='margin-left:50px;' onclick='updatev($Submission_ID)'>Update visibility</button>
<hr> Lecturer/TA notes : $notes<br> <span style='font-size:8pt'>Submitted : $posted <b> </b> <button class='btn-sm btn-info' style='margin-left:50px;' onclick='mark($Submission_ID,\"$title\",$total)'> Re-Mark Submission</button><br> Attachments : $full_link </span> <hr> Lecturer/TA notes : $notes<br> <span style='font-size:8pt'>Submitted : $posted <b> </b> <button class='btn-sm btn-info' style='margin-left:50px;' onclick='mark($Submission_ID,\"$title\",$total)'> Re-Mark Submission</button><br> Attachments : $full_link </span>
@ -280,28 +288,28 @@ where Lab_Report_ID=$id and lab_report_submissions.Status='Marked' Order by lab
}} }}
echo ""; echo "";
?> ?>
</div> </div>
<div id="menu3" class="container tab-pane"><br> <div id="menu3" class="container tab-pane"><br>
<?php <?php
if($Report_Type=="Group") if($Report_Type=="Group")
{ {
$resulty = mysqli_query($con,"SELECT `Submission_ID`, `Submission_Date`, lab_report_submissions.Lab_Report_ID, $resulty = mysqli_query($con,"SELECT `Submission_ID`, `Submission_Date`, lab_report_submissions.Lab_Report_ID,
lab_report_submissions.Course_Group_id, `Attachment1`, lab_report_submissions.Course_Group_id, `Attachment1`,
`Notes`, `Attachment2`, `Attachment3`, `Attachment4`, lab_report_submissions.Marks, lab_report_submissions.Status, `Notes`, `Attachment2`, `Attachment3`, `Attachment4`, lab_report_submissions.Marks, lab_report_submissions.Status,
`Title`,course_groups_table.Group_Name `Title`,course_groups_table.Group_Name
@ -309,10 +317,10 @@ FROM `lab_report_submissions`
left JOIN course_groups_table on course_groups_table.Course_Group_id=lab_report_submissions.Course_Group_id left JOIN course_groups_table on course_groups_table.Course_Group_id=lab_report_submissions.Course_Group_id
where Lab_Report_ID=$id and lab_report_submissions.Status='Remarking'"); where Lab_Report_ID=$id and lab_report_submissions.Status='Remarking'");
} }
else else
{ {
$resulty = mysqli_query($con,"SELECT `Submission_ID`, `Submission_Date`, lab_report_submissions.Lab_Report_ID, $resulty = mysqli_query($con,"SELECT `Submission_ID`, `Submission_Date`, lab_report_submissions.Lab_Report_ID,
lab_report_submissions.Remarking_Reason, lab_report_submissions.Remarking_Reason,
lab_report_submissions.Student_id sub_std, lab_report_submissions.Course_Group_id, `Attachment1`, lab_report_submissions.Student_id sub_std, lab_report_submissions.Course_Group_id, `Attachment1`,
`Notes`, `Attachment2`, `Attachment3`, `Attachment4`, lab_report_submissions.Marks, lab_report_submissions.Status, `Notes`, `Attachment2`, `Attachment3`, `Attachment4`, lab_report_submissions.Marks, lab_report_submissions.Status,
@ -321,69 +329,69 @@ FROM `lab_report_submissions`
Left JOIN users_table on users_table.Student_ID=lab_report_submissions.Student_id Left JOIN users_table on users_table.Student_ID=lab_report_submissions.Student_id
left JOIN course_group_members_table on course_group_members_table.Course_Group_id=lab_report_submissions.Course_Group_id left JOIN course_group_members_table on course_group_members_table.Course_Group_id=lab_report_submissions.Course_Group_id
where Lab_Report_ID=$id and lab_report_submissions.Status='Remarking'"); where Lab_Report_ID=$id and lab_report_submissions.Status='Remarking'");
} }
if(mysqli_num_rows($resulty)==0) if(mysqli_num_rows($resulty)==0)
{ {
echo "No Remarking Request for this lab"; echo "No Remarking Request for this lab";
} else { while($row = mysqli_fetch_assoc($resulty)) { } else { while($row = mysqli_fetch_assoc($resulty)) {
$title=$row['Title']; $title=$row['Title'];
$Marks=$row['Marks']; $Marks=$row['Marks'];
//$ins=$row['Notes']; //$ins=$row['Notes'];
$posted=$row['Submission_Date']; $posted=$row['Submission_Date'];
$deadline=$row['Deadline']; $deadline=$row['Deadline'];
$att1=$row['Attachment1']; $att1=$row['Attachment1'];
$att2=$row['Attachment2']; $att2=$row['Attachment2'];
$att3=$row['Attachment3']; $att3=$row['Attachment3'];
$att4=$row['Attachment4']; $att4=$row['Attachment4'];
$labid=$row['Lab_Report_ID']; $labid=$row['Lab_Report_ID'];
$remarking_reason=$row['Remarking_Reason']; $remarking_reason=$row['Remarking_Reason'];
$submitted_std=$row['Student_id']; $submitted_std=$row['Student_id'];
$submitted_group=$row['Course_Group_id']; $submitted_group=$row['Course_Group_id'];
$Submission_ID=$row['Submission_ID']; $Submission_ID=$row['Submission_ID'];
$names=$row['Full_Name']; $names=$row['Full_Name'];
$student_id=$row['sub_std']; $student_id=$row['sub_std'];
$gname=$row['Group_Name ']; $gname=$row['Group_Name '];
if($submitted_group==0) if($submitted_group==0)
{ {
$submitted_by= $names."(".$student_id.")"; $submitted_by= $names."(".$student_id.")";
} else { } else {
$submitted_by="<i>(GROUP)</i> $gname" ; $submitted_by="<i>(GROUP)</i> $gname" ;
} }
$full_link="<a href='~\..\Lab_Report_Submisions\\$att1'>$att1</a>"; $full_link="<a href='~\..\Lab_Report_Submisions\\$att1'>$att1</a>";
if($att2!=""){ if($att2!=""){
$full_link= $full_link."| <a href='~\..\Lab_Report_Submisions\\$att2'>$att2</a>"; $full_link= $full_link."| <a href='~\..\Lab_Report_Submisions\\$att2'>$att2</a>";
} }
if($att3!=""){ if($att3!=""){
$full_link= $full_link."| <a href='~\..\Lab_Report_Submisions\\$att3'>$att3</a>"; $full_link= $full_link."| <a href='~\..\Lab_Report_Submisions\\$att3'>$att3</a>";
} }
if($att4!=""){ if($att4!=""){
$full_link= $full_link."| <a href='~\..\Lab_Report_Submisions\\$att4'>$att4</a>"; $full_link= $full_link."| <a href='~\..\Lab_Report_Submisions\\$att4'>$att4</a>";
} }
echo " <k href='#'> <div class='btn btn-default break-word' style='dislay:block; word-wrap: break-word; border: 1px solid #F0F0F0;border-left: 4px solid #03407B;'> echo " <k href='#'> <div class='btn btn-default break-word' style='dislay:block; word-wrap: break-word; border: 1px solid #F0F0F0;border-left: 4px solid #03407B;'>
$title <br> by : <b> $submitted_by &nbsp; &nbsp;&nbsp;&nbsp;&nbsp; [ Marked $Marks ] </b> <br> Remarking Reason : <b>$remarking_reason </b> $title <br> by : <b> $submitted_by &nbsp; &nbsp;&nbsp;&nbsp;&nbsp; [ Marked $Marks ] </b> <br> Remarking Reason : <b>$remarking_reason </b>
<hr> <span style='font-size:8pt'>Submitted : $posted <b> </b> " <hr> <span style='font-size:8pt'>Submitted : $posted <b> </b> "
. "<button class='btn-sm btn-info' style='margin-left:50px;' onclick='mark($Submission_ID,\"$title\",$total)'> Re-Mark Submission</button>" . "<button class='btn-sm btn-info' style='margin-left:50px;' onclick='mark($Submission_ID,\"$title\",$total)'> Re-Mark Submission</button>"
. " &nbsp; &nbsp;&nbsp;&nbsp;<a href='~\..\Script.php?ignoreremarking=yes&id=$id&subid=$Submission_ID&header=$header&total=$total&status=Marked' class='btn-sm btn-warning'> Ignore Request </a>" . " &nbsp; &nbsp;&nbsp;&nbsp;<a href='~\..\Script.php?ignoreremarking=yes&id=$id&subid=$Submission_ID&header=$header&total=$total&status=Marked' class='btn-sm btn-warning'> Ignore Request </a>"
. "<br> Attachments : $full_link </span> . "<br> Attachments : $full_link </span>
</div></k>"; </div></k>";
}} }}
echo ""; echo "";
?> ?>
</div> </div>
@ -391,48 +399,48 @@ where Lab_Report_ID=$id and lab_report_submissions.Status='Remarking'");
<div id="menu4" class="container tab-pane"><br> <div id="menu4" class="container tab-pane"><br>
<h3>Course Groups</h3> <h3>Course Groups</h3>
<hr> <hr>
<?php <?php
$result = mysqli_query($con," SELECT `Course_Group_id`, `Group_Name`, `Group_Leader`, `Course_id`,users_table.Full_Name $result = mysqli_query($con," SELECT `Course_Group_id`, `Group_Name`, `Group_Leader`, `Course_id`,users_table.Full_Name
FROM `course_groups_table` FROM `course_groups_table`
INNER JOIN users_table on users_table.Student_ID=course_groups_table.Group_Leader INNER JOIN users_table on users_table.Student_ID=course_groups_table.Group_Leader
WHERE Course_id=$c_id"); WHERE Course_id=$c_id");
if(mysqli_num_rows($result)==0) if(mysqli_num_rows($result)==0)
{ {
echo "You have no Group in this Course"; echo "You have no Group in this Course";
} else { while($row = mysqli_fetch_assoc($result)) { } else { while($row = mysqli_fetch_assoc($result)) {
$name=$row['Group_Name']; $name=$row['Group_Name'];
$leader=$row['Full_Name']."(".$row['Group_Leader'].")"; $leader=$row['Full_Name']."(".$row['Group_Leader'].")";
$id= $row['Course_Group_id']; $id= $row['Course_Group_id'];
echo "<div class='btn-default'><small> $name - Leader : $leader </small></div>"; echo "<div class='btn-default'><small> $name - Leader : $leader </small></div>";
$rs2=mysqli_query($con,"SELECT `ID`, `Course_Group_id`, course_group_members_table.Student_ID, $rs2=mysqli_query($con,"SELECT `ID`, `Course_Group_id`, course_group_members_table.Student_ID,
course_group_members_table.`Status`,users_table.Full_Name FROM `course_group_members_table` course_group_members_table.`Status`,users_table.Full_Name FROM `course_group_members_table`
INNER JOIN users_table on users_table.Student_ID=course_group_members_table.Student_ID INNER JOIN users_table on users_table.Student_ID=course_group_members_table.Student_ID
where course_group_members_table.Course_Group_id=$id"); where course_group_members_table.Course_Group_id=$id");
while($row = mysqli_fetch_assoc($rs2)) { while($row = mysqli_fetch_assoc($rs2)) {
$name=$row['Full_Name']; $name=$row['Full_Name'];
$id=$row['Course_Group_id']; $id=$row['Course_Group_id'];
$status=$row['Status']; $status=$row['Status'];
$Student_ID=$row['Student_ID']; $Student_ID=$row['Student_ID'];
echo "<li><small> $name-$Student_ID ($status)</small></li>"; echo "<li><small> $name-$Student_ID ($status)</small></li>";
} }
@ -440,190 +448,100 @@ where course_group_members_table.Course_Group_id=$id");
} }
} }
?> ?>
</div> </div>
</div> </div>
</div>
</div>
</div>
</div>
<?php <?php
} }
include 'Footer.php'; include 'Footer.php';
?> ?>
<script src="./css/jquery-1.11.1.min.js"></script>
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="https://code.jquery.com/ui/1.11.1/jquery-ui.min.js"></script> <script src="./css/jquery-ui.min.js"></script>
<link rel="stylesheet" href="./css/jquery-ui.css" />
<link rel="stylesheet" href="https://code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css" />
<script> <script>
function mark(id,title,marks) { function mark(id,title,marks) {
try try
{ {
$('<form id="frm" method="get" action="Script.php">'+title+'('+marks+' marks) <input type="hidden" name="savemarks" value="true">\n\ $('<form id="frm" method="get" action="Script.php">'+title+'('+marks+' marks) <input type="hidden" name="savemarks" value="true">\n\
<input type="hidden" name="total" value="'+marks+'" > <input type="hidden" name="id" value="'+id+'" ><br> Marks <input type="text" name="marks">\n\ <input type="hidden" name="total" value="'+marks+'" > <input type="hidden" name="id" value="'+id+'" ><br> Marks <input type="text" name="marks">\n\
Comments <textarea name="feedback"></textarea> \n\ Comments <textarea name="feedback"></textarea> \n\
<input type="hidden" name="labid" value="<?php echo $course_id; ?>"> <input type="hidden" name="header" value="<?php echo $header; ?>"> </form>').dialog({ <input type="hidden" name="labid" value="<?php echo $course_id; ?>"> <input type="hidden" name="header" value="<?php echo $header; ?>"> </form>').dialog({
modal: true, modal: true,
title:'Mark Submission', title:'Mark Submission',
buttons: { buttons: {
'Submit Marking': function () { 'Submit Marking': function () {
$('#frm').submit(); $('#frm').submit();
$(this).dialog('close'); $(this).dialog('close');
}, },
'X': function () { 'X': function () {
$(this).dialog('close'); $(this).dialog('close');
} }
} }
}); });
}catch(e){ alert(e); } }catch(e){ alert(e); }
} }
function updatev(id) { function updatev(id)
{
try try
{ {
$('<form id="frm" method="get" action="Script.php"> <input type="hidden" name="updatevisibility" value="true">\n\ $('<form id="frm" method="get" action="Script.php"> <input type="hidden" name="updatevisibility" value="true">\n\
<input type="hidden" name="id" value="'+id+'" > <br>\n\ <input type="hidden" name="id" value="'+id+'" > <br>\n\
Update Visibility<br><select name="status"> <option> Public </option><option>Private</option> </select> \n\ Update Visibility<br><select name="status"> <option> Public </option><option>Private</option> </select> \n\
<input type="hidden" name="labid" value="<?php echo $id; ?>"> <input type="hidden" name="total" value="<?php echo $total; ?>" > <input type="hidden" name="header" value="<?php echo $header; ?>"> </form>').dialog({ <input type="hidden" name="labid" value="<?php echo $id; ?>"> <input type="hidden" name="total" value="<?php echo $total; ?>" > <input type="hidden" name="header" value="<?php echo $header; ?>"> </form>').dialog({
modal: true, modal: true,
title:'Update Report Visibility', title:'Update Report Visibility',
buttons: { buttons: {
'Update': function () { 'Update': function () {
$('#frm').submit(); $('#frm').submit();
$(this).dialog('close'); $(this).dialog('close');
}, },
'X': function () { 'X': function () {
$(this).dialog('close'); $(this).dialog('close');
} }
} }
}); });
}catch(e){ alert(e); } }catch(e){ alert(e); }
} }
</script> </script>

View File

@ -1,157 +1,135 @@
<?php
include 'NoDirectPhpAcess.php';
?>
<?php <?php
$page='Submit LAB+'; $page='Submit LAB+';
include 'Header.php'; include 'Header.php';
?> ?>
<div class='row' style='width:80%;margin:auto;'> <div class='row' style='width:80%;margin:auto;'>
<?php <?php
$c_date= date("Y-m-d H:i");
$student_id=$_SESSION["user_student_id"]; $c_date = date("Y-m-d H:i");
$student_id = $_SESSION["user_student_id"];
$student_id=$_SESSION["user_student_id"];
if(!empty($_GET["id"])) if(!empty($_GET["id"]))
{ {
$id=$_GET["id"]; $id = $_GET["id"];
$url=$_GET["url"]; $url = $_GET["url"];
$result1 = mysqli_query($con," SELECT Type, `Lab_Report_ID`, `Course_ID`, `Posted_Date`, `Deadline`, `Instructions`, `Title`, `Attachment_link_1`, `Attachment_link_2`, `Attachment_link_3`, " $result1 = mysqli_query($con," SELECT `Type`, `Lab_Report_ID`, `Course_ID`, `Posted_Date`, `Deadline`, `Instructions`, `Title`, `Attachment_link_1`, `Attachment_link_2`, `Attachment_link_3`, `Attachment_link_4` FROM `lab_reports_table` WHERE Lab_Report_ID=$id and Deadline > '$c_date' ORDER by Lab_Report_ID DESC");
. "`Attachment_link_4` FROM `lab_reports_table` WHERE Lab_Report_ID=$id and deadline > '$c_date' ORDER by Lab_Report_ID DESC"); if(mysqli_num_rows($result1) == 0)
if(mysqli_num_rows($result1)==0)
{ {
echo "No Active assignments for this course so far."; echo "No active assignments for this course so far.";
} else { while($row = mysqli_fetch_assoc($result1)) { } else {
$Course_ID=$row['Course_ID']; while($row = mysqli_fetch_assoc($result1)) {
$title=$row['Title'];
$ins=$row['Instructions'];
$posted=$row['Posted_Date'];
$deadline=$row['Deadline'];
$att1=$row['Attachment_link_1'];
$att2=$row['Attachment_link_2'];
$att3=$row['Attachment_link_3'];
$att4=$row['Attachment_link_4'];
$labid=$row['Lab_Report_ID'];
$type=$row['Type'];
//----------------------------------Giving both Group Admin and Group Members same priviledges to submit assignment-------------------------------------- $Course_ID = $row['Course_ID'];
if($type=="Group"){ $title = $row['Title'];
$resultx1 = mysqli_query($con,"SELECT Course_Group_id FROM `course_groups_table` WHERE (Course_id=$Course_ID) and ((Group_Member=$student_id ) or (Group_Member2=$student_id ) or (Group_Member3=$student_id ) or (Group_Member4=$student_id ) or(Group_Leader=$student_id))"); $ins = $row['Instructions'];
$posted = $row['Posted_Date'];
$deadline = $row['Deadline'];
$att1 = $row['Attachment_link_1'];
$att2 = $row['Attachment_link_2'];
$att3 = $row['Attachment_link_3'];
$att4 = $row['Attachment_link_4'];
$labid = $row['Lab_Report_ID'];
$type = $row['Type'];
//----------------------------------Giving both the Group Admin and Group Members same priviledges to submit assignment--------------------------------------
if($type=="Group"){
$resultx1 = mysqli_query($con,"SELECT Course_Group_id FROM `course_groups_table` WHERE (Course_id=$Course_ID) and ((Group_Member=$student_id ) or (Group_Member2=$student_id ) or (Group_Member3=$student_id ) or (Group_Member4=$student_id ) or (Group_Leader=$student_id))");
while($row = mysqli_fetch_assoc($resultx1)) { while($row = mysqli_fetch_assoc($resultx1)) {
$_SESSION["Group_ID"]=$row['Course_Group_id'];} $_SESSION["Group_ID"] = $row['Course_Group_id'];
}
if($_SESSION["Group_ID"]<1) if($_SESSION["Group_ID"] < 1)
{ {
echo" <center><h3> This Lab report can only be submitted by Group Admin </h3> </center> "; echo" <center><h3> This Lab report can only be submitted by Group Admin </h3> </center> ";
return; return;
} }
} }
$full_link="<a href='~\..\Lab_Report_Assignments\\$att1'>$att1</a>";
if($att2!=""){
$full_link="<a href='~\..\Lab_Report_Assignments\\$att1'>$att1</a>"; $full_link = $full_link."| <a href='~\..\Lab_Report_Assignments\\$att2'>$att2</a>";
}
if($att3!=""){
$full_link = $full_link."| <a href='~\..\Lab_Report_Assignments\\$att3'>$att3</a>";
}
if($att2!=""){ if($att4!=""){
$full_link= $full_link."| <a href='~\..\Lab_Report_Assignments\\$att2'>$att2</a>"; $full_link = $full_link."| <a href='~\..\Lab_Report_Assignments\\$att4'>$att4</a>";
} }
if($att3!=""){
$full_link= $full_link."| <a href='~\..\Lab_Report_Assignments\\$att3'>$att3</a>";
}
if($att4!=""){
$full_link= $full_link."| <a href='~\..\Lab_Report_Assignments\\$att4'>$att4</a>";
}
echo " <div class='alert' style='margin-left:20px;border-bottom:2px solid #1D91EF;'> <a href='~\..\Courses.php?course=$url'>
echo " <div class='alert' style='margin-left:20px;border-bottom:2px solid #1D91EF;'> <a href='~\..\Courses.php?course=$url'>
Courses > $url > Submlit Lab Report > $title Courses > $url > Submlit Lab Report > $title
<br> <br>
</a></div> </a></div>
"; ";
// echo " <k href='#'> <div class='btn btn-default break-word' style='dislay:block; word-wrap: break-word; border: 1px solid #F0F0F0;border-left: 4px solid #03407B;width:100%;'> echo "";
// $title <br> <span style='font-size:8pt'> $ins</span> }
// <br> <span style='font-size:8pt'>Posted : $posted Deadline : $deadline &nbsp; &nbsp; &nbsp;<br> Attachments : $full_link </span> }
//</div></k>"; }
$Group_ID = $_SESSION["Group_ID"];
echo "";
}}
}
$Group_ID=$_SESSION["Group_ID"];
?> ?>
</div> </div>
<div style="width:80%;margin:auto;"> <div style="width:80%;margin:auto;">
<h3> Submit Lab Report Assignment </h3> <h3> Submit Lab Report Assignment </h3>
<hr> <hr>
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
<form method='post' enctype='multipart/form-data' action='Script.php'> <form method='post' enctype='multipart/form-data' action='Script.php'>
<input type='hidden' name='frm_submitlab' value='true' required=''/> <input type='hidden' name='frm_submitlab' value='true' required=''/>
<input type='hidden' name='lab_id' value='<?php echo $id; ?>' required=''/> <input type='hidden' name='lab_id' value='<?php echo $id; ?>' required=''/>
<input type='hidden' name='student_id' value='<?php echo $student_id; ?>' required=''/> <input type='hidden' name='student_id' value='<?php echo $student_id; ?>' required=''/>
<input type='hidden' name='group_id' value='<?php echo $Group_ID; ?>' required=''/>
<input type='hidden' name='group_id' value='<?php echo $Group_ID; ?>' required=''/> <input type='hidden' name='url' value='<?php echo $url; ?>' required=''/>
<input type='hidden' name='url' value='<?php echo $url; ?>' required=''/>
Title
<input type='text' name='title' placeholder='Ttle' class='form-control' required=''>
Title
<input type='text' name='title' placeholder='Ttle' class='form-control' required=''>
Attachment 1
<input type='file' name='attachment1' placeholder='Attachment 1' class='form-control' required=''>
Attachment 2 Attachment 1
<input type='file' name='attachment2' placeholder='Attachment 1' class='form-control'> <input type='file' name='attachment1' placeholder='Attachment 1' class='form-control' required=''>
</div> Attachment 2
<div class="col-md-6"> <input type='file' name='attachment2' placeholder='Attachment 2' class='form-control'>
</div>
Attachment 3 <div class="col-md-6">
<input type='file' name='attachment3' placeholder='Attachment 1' class='form-control' >
Attachment 3
<input type='file' name='attachment3' placeholder='Attachment 3' class='form-control' >
Attachment 4 Attachment 4
<input type='file' name='attachment4' placeholder='Attachment 4' class='form-control' > <input type='file' name='attachment4' placeholder='Attachment 4' class='form-control' >
<br> <br>
<input type='submit' class='btn btn-primary' value='Submit Lab Assignment'><br>
</form> <input type='submit' class='btn btn-primary' value='Submit Lab Assignment'><br>
</form>
</div>
</div>
</div>
</div>
</div> </div>

175
index.php
View File

@ -1,137 +1,129 @@
<?php <?php
$page='Home'; $page='Home';
include 'Header.php'; include 'Header.php';
session_start(); session_start();
?> ?>
<?php
// if the user has already logged in, then clicking the LRRS icon should not display the login page (i.e., index.php).
if (isset($_SESSION["user_fullname"])) {
header("Location: Courses.php");
}
?>
<br><br><br> <br><br><br>
<div class="row" style="width:80%;margin:auto;"> <div class="row" style="width:80%;margin:auto;">
<div class="col-md-4"> <div class="col-md-4">
<br><br> <br><br>
<img src="logo_text.png" style="width"> <img src="logo_text.png" style="width">
<h1> Lab Report Repository System </h1> <h1> Lab Report Repository </h1>
<br><br> <br><br>
</div> </div>
<div class="col-md-4 list-group">
<div class="col-md-4 list-group">
<br> <br>
<h4 class="list-group-item active"> Sign in </h4> <h4 class="list-group-item active"> Sign in </h4>
<div class="list-group-item"> <div class="list-group-item">
<div class="panel-body"> <div class="panel-body">
<form method="post" action="Script.php" name="frm_login">
<input type="hidden" name="frm_login" value="true"/>
Student ID / Email <form method="post" action="Script.php" name="frm_login">
<input type="text" name="user" placeholder="Email / Student Number" class="form-control" required="required" /> <input type="hidden" name="frm_login" value="true"/>
Student ID / Email
<input type="text" name="user" placeholder="Email / Student Number" class="form-control" required="required" />
Password Password
<input type="password" class="form-control" name="password" placeholder="password" required="required" /> <input type="password" class="form-control" name="password" placeholder="password" required="required" />
<br> <br>
<input type="submit" class="btn btn-primary" value="Login"><br> <a href="recover_password.php" style="font-weight:normal;color:orange">Reset my password</a> <input type="submit" class="btn btn-primary" value="Login"><br> <a href="recover_password.php" style="font-weight:normal;color:gray">Reset my password</a>
<?php
error_reporting(E_ALL);
if(isset($_SESSION['info_login'])) {
echo '<hr><div class="alert alert-danger" role="alert">'.$_SESSION['info_login'].'</div>';
$_SESSION['info_login']=null;
}
// wrong pass <?php
if(isset($_SESSION['wrong_pass'])) {
echo '<hr><div class="alert alert-danger" role="alert">'.$_SESSION['wrong_pass'].'</div>'; error_reporting(E_ALL);
$_SESSION['wrong_pass']=null;
} if(isset($_SESSION['info_login'])) {
echo '<hr><div class="alert alert-danger" role="alert">'.$_SESSION['info_login'].'</div>';
$_SESSION['info_login']=null;
if(isset($_SESSION['infoChangePassword'])) { }
echo '<hr><div class="alert alert-danger" role="alert">'.$_SESSION['infoChangePassword'].'</div>';
$_SESSION['infoChangePassword']=null;
} // wrong pass
if(isset($_SESSION['wrong_pass'])) {
echo '<hr><div class="alert alert-danger" role="alert">'.$_SESSION['wrong_pass'].'</div>';
?> $_SESSION['wrong_pass']=null;
</form> }
</div>
if(isset($_SESSION['infoChangePassword'])) {
</div> echo '<hr><div class="alert alert-danger" role="alert">'.$_SESSION['infoChangePassword'].'</div>';
</div> $_SESSION['infoChangePassword']=null;
<div class="col-md-4 list-group"> }
<br> ?>
<h4 class="list-group-item active"> Student sign up </h4>
<div class="list-group-item">
<form method="post" action="Script.php" name="frm_signup_1"> </form>
</div>
</div>
</div>
<div class="col-md-4 list-group">
<br>
<h4 class="list-group-item active"> Sign up </h4>
<div class="list-group-item">
<form method="post" action="Script.php" name="frm_signup_1">
<input type="hidden" name="frm_signup_1" value="true"/> <input type="hidden" name="frm_signup_1" value="true"/>
Student ID Student ID
<input type="text" name="student_id" placeholder="Entre your Student ID" class="form-control" required=""> <input type="text" name="student_id" placeholder="Entre your Student ID" class="form-control" required="">
Your Passport / National ID Your Passport / National ID
<input type="text" class="form-control" name="passport" placeholder="(Optional)"> <input type="text" class="form-control" name="passport" placeholder="(Optional)">
<br> <br>
<input type="submit" name="frm_signup_1" class="btn btn-primary" value="Next"> <br> Click Next to set up password <input type="submit" name="frm_signup_1" class="btn btn-primary" value="Next"> <br> Click Next to set up password
<?php
error_reporting(E_ALL);
if(isset($_SESSION['info_signup1'])) {
echo '<div class="alert alert-danger" role="alert">'.$_SESSION['info_signup1'].'</div>';
$_SESSION['info_signup1']=null;
}
?> <?php
</div> error_reporting(E_ALL);
</form> if(isset($_SESSION['info_signup1'])) {
echo '<div class="alert alert-danger" role="alert">'.$_SESSION['info_signup1'].'</div>';
$_SESSION['info_signup1']=null;
}
?>
</div>
</form>
</div> </div>
</div> </div>
</div> </div>
<hr> <hr>
<div style="" id="footer"> <div style="" id="footer">
LRRS was originally developed as a <a href="http://lanlab.org/course/2018f/se/homepage.html" style="color:white;">software engineering course project</a> by Mohamed Nor and Elmahdi Houzi. Please submit your suggestions or bug reports to lanhui _at_ zjnu.edu.cn. Last updated on 18/04/2020 by Ashly. <a href="./homepage" style="color:white;">More information ...</a> LRRS was originally developed as a <a href="http://lanlab.org/course/2018f/se/homepage.html" style="color:white;">software engineering course project</a> by Mohamed Nor and Elmahdi Houzi. Please submit your suggestions or bug reports to lanhui _at_ zjnu.edu.cn. Last updated on 18/04/2020 by Ashly. <a href="./homepage" style="color:white;">More information ...</a>
</div> </div>
</body> </body>
<style> <style>
#footer{ #footer{
position:fixed; position:fixed;
bottom:0; bottom:0;
left:0; left:0;
background-color:#03417C; background-color:#03417C;
color:#FFF; color:#FFF;
text-align:center; text-align:center;
@ -139,4 +131,3 @@ width:100%;
} }
</style> </style>
</html> </html>

View File

@ -1,3 +1,7 @@
<?php
include 'NoDirectPhpAcess.php';
?>
<?php <?php
/* /*

View File

@ -1,59 +1,50 @@
<?php <?php
include 'NoDirectPhpAcess.php';
?>
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
<?php
include 'Header.php'; include 'Header.php';
?> ?>
<div class="row"> <div class="row">
<div class="col-md-4 list-group" style="margin:auto;"> <div class="col-md-4 list-group" style="margin:auto;">
<br> <br>
<h4 class="list-group-item active"> Sign Up </h4> <h4 class="list-group-item active"> Please fill in each field below </h4>
<div class="list-group-item"> <div class="list-group-item">
<div class="panel-body"> <div class="panel-body">
<form method="post" action="Script.php" > <form method="post" action="Script.php" >
<input type="hidden" name="frm_signup_2" value="true"/> <input type="hidden" name="frm_signup_2" value="true"/>
Full Name Full Name
<input type="text" name="fullname" placeholder="Your Full Name" class="form-control" value="<?php echo $_SESSION['user_fullname']; ?>" required="required"/> <input type="text" name="fullname" placeholder="Your Full Name" class="form-control" value="<?php echo $_SESSION['user_fullname']; ?>" required="required"/>
Email Email
<input type="text" name="email" placeholder="Email" class="form-control" value="<?php echo $_SESSION['user_email']; ?>" required="required" /> <input type="text" name="email" placeholder="Email" class="form-control" value="<?php echo $_SESSION['user_email']; ?>" required="required" />
Password Password (<i>must include uppercase and lowercase letters, digits and special characters</i>)
<input type="password" class="form-control" name="password" placeholder="password" required="required" /> <input type="password" class="form-control" name="password" placeholder="password" required="required" />
Confirm Password Confirm Password
<input type="password" class="form-control" name="confirmpassword" placeholder="Confirm password" required="required" /> <input type="password" class="form-control" name="confirmpassword" placeholder="Confirm password" required="required" />
<br> <br>
<input type="submit" class="btn btn-primary" value="Sign up"> <input type="submit" class="btn btn-primary" value="Sign up">
<?php <?php
error_reporting(E_ALL); error_reporting(E_ALL);
if(isset($_SESSION['info_signup2'])) { if(isset($_SESSION['info_signup2'])) {
echo '<hr><div class="alert alert-danger" role="alert">'.$_SESSION['info_signup2'].'</div>'; echo '<hr><div class="alert alert-danger" role="alert">'.$_SESSION['info_signup2'].'</div>';
$_SESSION['info_signup2'] = null; $_SESSION['info_signup2'] = null;
} }
?> ?>
</form> </form>
</div>
</div>
</div>
</div> </div>
</form> </div>
</div> </div>
</div> </div>