2020-10-02 17:02:20 +08:00
< ? php
include 'NoDirectPhpAcess.php' ;
?>
2022-05-19 12:35:27 +08:00
2020-03-16 15:23:14 +08:00
< ? php
2022-05-19 12:35:27 +08:00
$page = 'Courses+' ;
2020-03-16 15:23:14 +08:00
include 'Header.php' ;
2023-08-08 15:02:26 +08:00
?>
< div class = " container " >
2023-08-09 16:40:26 +08:00
< ? php
$student_id = $_SESSION [ " user_student_id " ];
$group_id = $_SESSION [ " user_group_id " ];
$c_date = date ( " Y-m-d H:i " );
2023-08-28 21:19:30 +08:00
if ( ! empty ( $_GET [ " url " ])) {
2023-08-09 16:40:26 +08:00
$course_url = mysqli_real_escape_string ( $con , $_GET [ " url " ]);
2023-08-28 21:16:42 +08:00
$result = mysqli_query ( $con , " SELECT Course_ID, Course_Name, Academic_Year, Faculty, Lecturer_User_ID, TA_User_ID, Course_Code, URL, Verify_New_Members, users_table.Full_Name
FROM courses_table
INNER JOIN users_table ON users_table . User_ID = courses_table . Lecturer_User_ID
WHERE URL = '$course_url' " );
2023-08-09 16:40:26 +08:00
2023-08-23 20:31:11 +08:00
if ( mysqli_num_rows ( $result ) == 0 ) {
2023-08-09 16:40:26 +08:00
echo " No course matching the given course URL: " . $course_url ;
} else {
2023-08-28 21:19:30 +08:00
while ( $row = mysqli_fetch_assoc ( $result )) {
2023-08-09 16:40:26 +08:00
$name = $row [ 'Course_Name' ];
$code = $row [ 'Course_Code' ];
$faculty = $row [ 'Faculty' ];
$lecturer = $row [ 'Full_Name' ];
$academic = $row [ 'Academic_Year' ];
$url = $row [ 'URL' ];
$course_id = $row [ 'Course_ID' ];
2023-08-23 20:31:11 +08:00
// also get teaching assistant names (if any)
2023-08-28 21:19:30 +08:00
$ta_result = mysqli_query ( $con , " SELECT Full_Name FROM users_table WHERE User_ID IN (SELECT TA FROM course_ta WHERE Course_ID=' $course_id '); " );
2023-08-09 16:40:26 +08:00
if ( mysqli_num_rows ( $ta_result ) == 0 ) {
2023-08-28 21:19:30 +08:00
echo " <div class='alert' style='border-bottom:2px solid #eee;'>
Courses > ( $code ) $name > Assignments < br >
< span style = 'font-size:8pt' > Faculty : $faculty & nbsp ; Year : $academic & nbsp ; Lecturer : $lecturer </ span >
</ div > " ;
2023-08-09 16:40:26 +08:00
} else {
$ta_name = " " ;
while ( $row = mysqli_fetch_assoc ( $ta_result )) {
$ta_name = $ta_name . $row [ 'Full_Name' ] . " " ;
}
2023-08-28 21:19:30 +08:00
$ta_name = trim ( $ta_name );
echo " <div class='alert' style='border-bottom:2px solid #eee;'>
Courses > ( $code ) $name > Assignments < br >
< span style = 'font-size:8pt' > Faculty : $faculty & nbsp ; Year : $academic & nbsp ; Lecturer : $lecturer & nbsp ; Teaching Assistant : $ta_name </ span >
</ div > " ;
2023-08-09 16:40:26 +08:00
}
2020-10-02 17:02:20 +08:00
}
2023-08-09 16:40:26 +08:00
}
2020-10-02 17:02:20 +08:00
}
2023-08-09 16:40:26 +08:00
?>
2020-10-02 17:02:20 +08:00
2023-08-02 15:09:49 +08:00
2023-08-23 21:55:02 +08:00
< ? php
if ( isset ( $_SESSION [ 'info_general' ])) {
echo '<div class="alert alert-warning">' . $_SESSION [ 'info_general' ] . '</div>' ;
$_SESSION [ 'info_general' ] = null ;
}
if ( isset ( $_SESSION [ 'info_courses' ])) {
echo '<div class="alert alert-warning">' . $_SESSION [ 'info_courses' ] . '</div>' ;
$_SESSION [ 'info_courses' ] = null ;
}
?>
2023-08-01 17:02:33 +08:00
< ? php
2023-08-09 16:40:26 +08:00
if ( $_SESSION [ 'user_type' ] == " Student " )
{
2023-08-01 17:02:33 +08:00
?>
2020-03-16 15:23:14 +08:00
2023-08-09 16:40:26 +08:00
< div class = " row " >
2021-06-12 19:07:54 +08:00
2023-08-09 16:40:26 +08:00
< div class = " col-9 " >
2021-10-18 23:03:36 +08:00
2023-08-09 16:40:26 +08:00
<!-- Nav tabs -->
< ul class = " nav nav-tabs " id = " myTab " >
< li class = " nav-item " >
< a class = " nav-link active " href = " #menu1 " > New </ a >
</ li >
< li class = " nav-item " >
< a class = " nav-link " href = " #menu2 " > Missed </ a >
</ li >
< li class = " nav-item " >
< a class = " nav-link " href = " #menu3 " > Submitted </ a >
</ li >
< li class = " nav-item " >
< a class = " nav-link " href = " #menu4 " > Marked </ a >
</ li >
</ ul >
< div class = " tab-content " >
< div id = " menu1 " class = " tab-pane active " >
< ? php
2023-08-23 20:43:37 +08:00
// Get groups of this student
2023-08-29 19:40:07 +08:00
$sql = " SELECT course_group_members_table.Course_Group_id
FROM course_group_members_table
INNER JOIN course_groups_table ON course_group_members_table . Course_Group_id = course_groups_table . Course_Group_id
WHERE course_group_members_table . Student_ID = $student_id AND course_groups_table . Course_id = $course_id " ;
2023-08-09 16:40:26 +08:00
$resultx1 = mysqli_query ( $con , $sql );
while ( $row = mysqli_fetch_assoc ( $resultx1 ))
{
$_SESSION [ 'group_id' ] = $row [ 'Course_Group_id' ];
}
$group_id = $_SESSION [ 'group_id' ];
2023-08-23 20:43:37 +08:00
if ( $group_id == " " )
2023-08-09 16:40:26 +08:00
{
$group_id = 0 ; // no group. If the student has a group, the group number should be greater than 0.
}
// Show the assignment iff the following conditions are met: (1)
// Before the deadline (2) Before the students' extended deadline (if any)
// (3) none of the student's group members have already submitted
// the assignment.
2023-08-29 19:44:03 +08:00
$sql_stmt = " SELECT Type, Lab_Report_ID, Marks, Course_ID, Posted_Date, Deadline, Instructions, lab_reports_table.Title, Attachment_link_1, Attachment_link_2, Attachment_link_3, Attachment_link_4
FROM lab_reports_table
WHERE Course_ID = $course_id
AND ( Deadline > '$c_date' OR Lab_Report_ID IN ( SELECT Lab_Report_ID FROM extended_deadlines_table WHERE Student_ID = $student_id AND Extended_Deadline_Date > '$c_date' AND Lab_Report_ID IN ( SELECT Lab_Report_ID FROM lab_reports_table WHERE Course_ID = $course_id )))
AND Lab_Report_ID NOT IN ( SELECT Lab_Report_ID FROM lab_report_submissions WHERE Course_Group_id IN ( SELECT Course_Group_id FROM course_group_members_table WHERE Student_ID = $student_id ))
ORDER BY Lab_Report_ID DESC " ;
2023-08-09 16:40:26 +08:00
$result1 = mysqli_query ( $con , $sql_stmt );
2023-08-23 20:43:37 +08:00
if ( mysqli_num_rows ( $result1 ) == 0 ) {
2023-08-28 21:11:59 +08:00
echo " <br><div class='alert alert-warning'>No active assignments now.</div> " ;
2023-08-09 16:40:26 +08:00
} else {
while ( $row = mysqli_fetch_assoc ( $result1 )) {
2023-08-29 19:45:40 +08:00
$title = $row [ 'Title' ];
$type = $row [ 'Type' ];
$Marks = $row [ 'Marks' ];
$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' ];
2023-08-09 16:40:26 +08:00
$days_remaining = date_diff ( date_create ( $deadline ), date_create ()) -> format ( '%a days, %h hours, %i minutes' );
2023-08-29 21:34:58 +08:00
$full_link = " <a href='~ \ .. \ Download.php?file= $att1 '> $att1 </a> " ;
2023-08-09 16:40:26 +08:00
2023-08-29 19:45:40 +08:00
if ( $att2 != " " ) {
2023-08-29 21:34:58 +08:00
$full_link = $full_link . " | <a href='~ \ .. \ Download.php?file= $att2 '> $att2 </a> " ;
2023-08-09 16:40:26 +08:00
}
2023-08-29 19:45:40 +08:00
if ( $att3 != " " ) {
2023-08-29 21:34:58 +08:00
$full_link = $full_link . " | <a href='~ \ .. \ Download.php?file= $att3 '> $att3 </a> " ;
2023-08-09 16:40:26 +08:00
}
2023-08-29 19:45:40 +08:00
if ( $att4 != " " ) {
2023-08-29 21:34:58 +08:00
$full_link = $full_link . " | <a href='~ \ .. \ Download.php?file= $att4 '> $att4 </a> " ;
2023-08-09 16:40:26 +08:00
}
2020-10-02 17:02:20 +08:00
2023-08-29 19:47:29 +08:00
echo " <div class='card mt-md-2' style='word-wrap: break-word;'>
< div class = 'card-body' >
< h5 class = 'card-title' > $title </ h5 >
< h6 class = 'card-subtitle' ' > ( $Marks Marks , $type ) </ h6 >< br >
< p class = 'card-text' > $ins </ p >
< p > < small > Attachments </ small >: $full_link </ p >
< p class = 'card-text' > < small > Posted : $posted & nbsp ; & nbsp ; Deadline : $deadline </ small > </ p >
< div class = 'alert alert-warning' > Time left : $days_remaining </ div >
< p >< a href = '~\..\SubmitLab.php?id=$labid&url=$url' class = 'btn btn-primary' > Submit </ a ></ p >
</ div >
</ div > " ;
2023-08-23 20:43:37 +08:00
}
}
2023-08-09 16:40:26 +08:00
echo " " ;
?>
2020-10-02 17:02:20 +08:00
2023-08-09 16:40:26 +08:00
</ div >
2022-05-19 12:35:27 +08:00
2023-08-09 16:40:26 +08:00
< div id = " menu2 " class = " tab-pane " >
< ? php
2023-08-22 19:51:02 +08:00
$group_id = $_SESSION [ 'group_id' ];
if ( $group_id == " " ) { // Individual assignment does not require the student to have a group id. Therefore, the group is an empty string. To make the following SQL statement work properly, initialize the group id to -1.
$group_id = - 1 ;
}
$result = mysqli_query ( $con , " SELECT Lab_Report_ID, Marks, `Course_ID`, `Posted_Date`, `Deadline`, `Instructions`, lab_reports_table.Title, `Attachment_link_1`, `Attachment_link_2`, `Attachment_link_3`, `Attachment_link_4` FROM `lab_reports_table` WHERE Lab_Report_ID not in (select Lab_Report_ID from lab_report_submissions where (Student_id= $student_id or Course_Group_id= $group_id )) and Course_ID= $course_id and Deadline < ' $c_date ' ORDER by Lab_Report_ID DESC " );
if ( mysqli_num_rows ( $result ) == 0 )
2023-08-09 16:40:26 +08:00
{
2023-08-29 19:41:02 +08:00
echo '<br><div class="alert alert-warning">You missed no lab reports.</div>' ;
2023-08-09 16:40:26 +08:00
} else {
while ( $row = mysqli_fetch_assoc ( $result )) {
2023-08-22 19:51:02 +08:00
$title = $row [ 'Title' ];
$marks = $row [ 'Marks' ];
$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' ];
$id = $row [ 'Lab_Report_ID' ];
$full_link = " None " ;
if ( $att1 != " " ) {
$full_link = " <a href='~ \ .. \ Lab_Report_Assignments \\ $att1 '> $att1 </a> " ;
}
2023-08-09 16:40:26 +08:00
2023-08-22 19:51:02 +08:00
if ( $att2 != " " ) {
$full_link = $full_link . " | <a href='~ \ .. \ Lab_Report_Assignments \\ $att2 '> $att2 </a> " ;
2023-08-09 16:40:26 +08:00
}
2023-08-22 19:51:02 +08:00
if ( $att3 != " " ) {
$full_link = $full_link . " | <a href='~ \ .. \ Lab_Report_Assignments \\ $att3 '> $att3 </a> " ;
2023-08-09 16:40:26 +08:00
}
2023-08-22 19:51:02 +08:00
if ( $att4 != " " ) {
$full_link = $full_link . " | <a href='~ \ .. \ Lab_Report_Assignments \\ $att4 '> $att4 </a> " ;
2023-08-09 16:40:26 +08:00
}
2023-08-22 19:51:02 +08:00
2023-08-28 21:09:15 +08:00
echo " <div class='card mt-md-2' style='word-wrap: break-word;'>
< div class = 'card-body' >
< p >< span class = 'btn btn-sm btn-outline-danger' > MISSED </ span ></ p >
< h5 class = 'card-title' > $title </ h5 >
< h6 class = 'card-subtitle' > ( $marks Marks ) </ h6 > < br >
< p class = 'card-text' > $ins </ p >
< p class = 'card-text' >< small > Posted : $posted & nbsp ; & nbsp ; & nbsp ; Deadline : $deadline & nbsp ; & nbsp ; & nbsp ; </ small ></ p >
< p class = 'card-text' >< small > Attachments : $full_link </ small ></ p >
</ div >
</ div >< br > " ;
2023-08-09 16:40:26 +08:00
2023-08-01 17:02:33 +08:00
}
2023-08-09 16:40:26 +08:00
}
?>
2021-04-04 20:03:05 +08:00
2023-08-09 16:40:26 +08:00
</ div >
2020-09-29 17:38:14 +08:00
2020-10-02 17:02:20 +08:00
2023-08-09 16:40:26 +08:00
< div id = " menu3 " class = " tab-pane " >
< ? php
2020-10-02 17:02:20 +08:00
2023-08-09 16:40:26 +08:00
$group_id = $_SESSION [ 'group_id' ];
2023-08-23 20:43:37 +08:00
if ( $group_id == " " ) {
$group_id = - 1 ;
} // This fixes "Submitted report not shown" http://118.25.96.118/bugzilla/show_bug.cgi?id=176
2021-10-18 23:03:36 +08:00
2023-08-09 16:40:26 +08:00
$sql_stmt = " SELECT Lab_Report_ID, Marks, `Course_ID`, `Posted_Date`, `Deadline`, `Instructions`, lab_reports_table.Title, `Attachment_link_1`, `Attachment_link_2`, `Attachment_link_3`, `Attachment_link_4`
2022-05-19 12:35:27 +08:00
FROM `lab_reports_table`
WHERE Lab_Report_ID in ( select Lab_Report_ID from lab_report_submissions "
2023-08-09 16:40:26 +08:00
. " where Status='Pending' and (Student_id= $student_id or Course_Group_id= $group_id ) and Course_ID= $course_id ) ORDER by Lab_Report_ID DESC " ;
$resultx = mysqli_query ( $con , $sql_stmt );
2023-08-23 20:43:37 +08:00
if ( mysqli_num_rows ( $resultx ) == 0 ) {
2023-08-28 21:11:59 +08:00
echo '<br><div class="alert alert-warning">You have no unmarked submissions. Check the Marked tab for your marked submissions (if any).</div>' ;
2023-08-09 16:40:26 +08:00
} else {
while ( $row = mysqli_fetch_assoc ( $resultx )) {
$lab_repo_id = $row [ 'Lab_Report_ID' ];
$title = $row [ 'Title' ];
$marks = $row [ 'Marks' ];
$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' ];
$id = $row [ 'Lab_Report_ID' ];
2023-08-23 20:43:37 +08:00
if ( $c_date < $deadline ) {
2023-08-09 16:40:26 +08:00
$submittedx = " <a href='~ \ .. \ SubmitLab.php?id= $id &url= $url ' class='btn btn-sm btn-light'>Re-submit</a> " ;
}
$full_link = " <a href='~ \ .. \ Lab_Report_Assignments \\ $att1 '> $att1 </a> " ;
2023-08-23 20:43:37 +08:00
if ( $att2 != " " ) {
2023-08-09 16:40:26 +08:00
$full_link = $full_link . " | <a href='~ \ .. \ Lab_Report_Assignments \\ $att2 '> $att2 </a> " ;
}
2023-08-23 20:43:37 +08:00
if ( $att3 != " " ) {
2023-08-09 16:40:26 +08:00
$full_link = $full_link . " | <a href='~ \ .. \ Lab_Report_Assignments \\ $att3 '> $att3 </a> " ;
}
2023-08-23 20:43:37 +08:00
if ( $att4 != " " ) {
2023-08-09 16:40:26 +08:00
$full_link = $full_link . " | <a href='~ \ .. \ Lab_Report_Assignments \\ $att4 '> $att4 </a> " ;
}
echo " <div class='btn btn-default break-word' style='dislay:block; word-wrap: break-word; border: 1px solid #F0F0F0;border-left: 4px solid #03407B;'>
2023-08-05 16:11:27 +08:00
$title ( $marks Marks ) < i class = 'fa fa-check-circle' ></ i > Submitted < br > < span style = 'font-size:8pt' > $ins </ span >
2023-08-09 16:40:26 +08:00
< br > < span style = 'font-size:9pt' > Posted : $posted & nbsp ; Deadline : $deadline </ span > & nbsp ; & nbsp ; & nbsp ; $submittedx & nbsp ;
2023-08-05 16:11:27 +08:00
< br > < span style = 'font-size:9pt' > Submitted files : " ;
2020-03-16 15:23:14 +08:00
2023-08-09 16:40:26 +08:00
$Sub_result = mysqli_query ( $con , " SELECT `Submission_ID`, `Submission_Date`, lab_report_submissions.Lab_Report_ID,
2020-03-16 15:23:14 +08:00
lab_report_submissions . Student_id sub_std , lab_report_submissions . Course_Group_id , `Attachment1` ,
2023-08-09 16:40:26 +08:00
`Notes` , `Attachment2` , `Attachment3` , `Attachment4` , `Marks` , lab_report_submissions . Status ,
2020-03-16 15:23:14 +08:00
`Title` , users_table . Full_Name , course_group_members_table . Student_ID
FROM `lab_report_submissions`
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
2023-08-09 16:40:26 +08:00
where Lab_Report_ID = $lab_repo_id and ( lab_report_submissions . Student_id = '$student_id' ) " );
2023-08-23 20:43:37 +08:00
if ( mysqli_num_rows ( $Sub_result ) == 0 ) {
2023-08-09 16:40:26 +08:00
echo " No Attachments found. " ;
} else {
while ( $row = mysqli_fetch_assoc ( $Sub_result )) {
$at1 = $row [ 'Attachment1' ];
$at2 = $row [ 'Attachment2' ];
$at3 = $row [ 'Attachment3' ];
$at4 = $row [ 'Attachment4' ];
$base_at1 = basename ( $at1 );
$base_at2 = basename ( $at2 );
$base_at3 = basename ( $at3 );
$base_at4 = basename ( $at4 );
2023-08-01 17:02:33 +08:00
2023-08-09 16:40:26 +08:00
$full_link = " <a href='~ \ .. \ Download.php?file= $at1 &attachment=1'> $base_at1 </a> " ; // prevent students from directly accessing their classmates' submissions
2023-08-01 17:02:33 +08:00
2023-08-09 16:40:26 +08:00
if ( $at2 != " " ){
$full_link = $full_link . " | <a href='~ \ .. \ Download.php?file= $at2 &attachment=2'> $base_at2 </a> " ;
}
if ( $at3 != " " ){
$full_link = $full_link . " | <a href='~ \ .. \ Download.php?file= $at3 &attachment=3'> $base_at3 </a> " ;
}
if ( $at4 != " " ){
$full_link = $full_link . " | <a href='~ \ .. \ Download.php?file= $at4 &attachment=4'> $base_at4 </a> " ;
}
echo $full_link ;
}
2023-08-01 17:02:33 +08:00
}
2023-08-09 16:40:26 +08:00
echo " </span></div> " ;
2023-08-23 20:43:37 +08:00
}
}
2023-08-09 16:40:26 +08:00
echo " " ;
?>
</ div >
2023-08-02 15:09:49 +08:00
2023-08-01 17:02:33 +08:00
< ? php
2023-08-23 20:43:37 +08:00
$sqli = mysqli_query ( $con , " SELECT * from course_groups_table WHERE Course_Group_id= $group_id and Course_id= $course_id " );
while ( $row = mysqli_fetch_assoc ( $sqli )) {
$Group_Leader = $row [ 'Group_Leader' ];
$Group_Member = $row [ 'Group_Member' ];
$Group_Member2 = $row [ 'Group_Member2' ];
$Group_Member3 = $row [ 'Group_Member3' ];
$Group_Member4 = $row [ 'Group_Member4' ];
2023-08-09 16:40:26 +08:00
}
2023-08-23 20:43:37 +08:00
2023-08-09 16:40:26 +08:00
?>
< div id = " menu4 " class = " tab-pane " >
< ? php
$resultx = mysqli_query ( $con , " SELECT `Submission_ID`, `Submission_Date`, lab_reports_table.`Lab_Report_ID`, `Student_id`, "
. " `Course_Group_id`, `Notes`, lab_report_submissions.`Marks`,
2020-03-16 15:23:14 +08:00
lab_report_submissions . Remarking_Reason ,
`Status` , lab_reports_table . Title Lab_Title , lab_reports_table . Marks Original_marks FROM `lab_report_submissions` "
2023-08-09 16:40:26 +08:00
. " INNER JOIN lab_reports_table on lab_reports_table.Lab_Report_ID=lab_report_submissions.Lab_Report_ID "
. " WHERE (lab_report_submissions.Student_id=' $student_id '
2020-04-16 14:46:43 +08:00
or ( lab_report_submissions . Student_id = '$Group_Leader' and lab_report_submissions . Course_Group_id = '$group_id' )
or ( lab_report_submissions . Student_id = '$Group_Member' and lab_report_submissions . Course_Group_id = '$group_id' )
or ( lab_report_submissions . Student_id = '$Group_Member2' and lab_report_submissions . Course_Group_id = '$group_id' )
or ( lab_report_submissions . Student_id = '$Group_Member3' and lab_report_submissions . Course_Group_id = '$group_id' )
or ( lab_report_submissions . Student_id = '$Group_Member4' and lab_report_submissions . Course_Group_id = '$group_id' )
2023-08-09 16:40:26 +08:00
) and "
. " "
. " "
. " "
. " lab_reports_table.Lab_Report_ID in (select Lab_Report_ID from lab_report_submissions "
. " where (Status='Marked' or Status='Remarking') and (Student_id= $student_id or Course_Group_id= $group_id ) and Course_ID= $course_id ) ORDER by Submission_ID DESC " );
2023-08-23 20:43:37 +08:00
if ( mysqli_num_rows ( $resultx ) == 0 ) {
2023-08-28 21:11:59 +08:00
echo '<br><div class="alert alert-warning">You have no marked submissions.</div>' ;
2023-08-09 16:40:26 +08:00
} else {
while ( $row = mysqli_fetch_assoc ( $resultx )) {
2023-08-23 20:43:37 +08:00
$title = $row [ 'Lab_Title' ];
$marks = $row [ 'Marks' ];
2023-08-24 20:59:27 +08:00
$original_marks = $row [ 'Original_marks' ];
2023-08-23 20:43:37 +08:00
$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' ];
$id = $row [ 'Lab_Report_ID' ];
2023-08-24 21:01:34 +08:00
$submission_id = $row [ 'Submission_ID' ];
2023-08-23 20:43:37 +08:00
$notes = $row [ 'Notes' ];
$status = $row [ 'Status' ];
$remarking_reason = $row [ 'Remarking_Reason' ];
if ( $status == 'Marked' ) {
2023-08-24 21:02:18 +08:00
$remarking_url = " \ Script.php?remarking=yes&id= $submission_id &url= $url &status=Remarking " ;
$remarking = " <button onclick='remarking( \" $remarking_url\ " ) ' class=' btn btn - sm btn - light ' > Request remarking </ button > " ;
2023-08-09 16:40:26 +08:00
}
2023-08-24 20:57:48 +08:00
if ( $status == 'Remarking' ) {
2023-08-24 21:06:14 +08:00
$remarking = " <br> <span style='color:orange'><i class='fa fa-info-circle'></i> Remarking request sent </span> Reasons for remarking: <i> $remarking_reason </i> <br> " ;
2023-08-09 16:40:26 +08:00
}
2023-08-30 20:21:35 +08:00
echo " <div class='card mt-md-2' style='word-wrap:break-word;'>
< div class = 'card-body' >
< h5 class = 'card-title' > $title </ h5 >
< h6 class = 'card-subtitle' > ( $marks marks out of $original_marks ) </ h6 >< br >
< p class = 'card-text' > Lecturer feedback $notes & nbsp ; & nbsp ; $remarking </ p >
< small > Submitted files : " ;
$sub_result = 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, Notes, Attachment2, Attachment3, Attachment4, Marks, lab_report_submissions.Status, Title, users_table.Full_Name, course_group_members_table.Student_ID
FROM lab_report_submissions
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
WHERE Lab_Report_ID = $id AND lab_report_submissions . Student_id = '$student_id' " );
if ( mysqli_num_rows ( $sub_result ) == 0 ) {
echo " None. " ;
2023-08-09 16:40:26 +08:00
} else {
2023-08-30 20:21:35 +08:00
while ( $row = mysqli_fetch_assoc ( $sub_result )) {
$att1 = $row [ 'Attachment1' ];
$att2 = $row [ 'Attachment2' ];
$att3 = $row [ 'Attachment3' ];
$att4 = $row [ 'Attachment4' ];
2023-08-09 16:40:26 +08:00
2023-08-30 20:21:35 +08:00
$full_link = " <a href='~ \ .. \ Download.php?file= $att1 '> $att1 </a> " ;
2023-08-09 16:40:26 +08:00
2023-08-30 20:21:35 +08:00
if ( $att2 != " " ) {
$full_link = $full_link . " | <a href='~ \ .. \ Download.php?file= $att2 '> $att2 </a> " ;
2023-08-09 16:40:26 +08:00
}
2023-08-30 20:21:35 +08:00
if ( $att3 != " " ) {
$full_link = $full_link . " | <a href='~ \ .. \ Download.php?file= $att3 '> $att3 </a> " ;
2023-08-09 16:40:26 +08:00
}
2023-08-30 20:21:35 +08:00
if ( $att4 != " " ) {
$full_link = $full_link . " | <a href='~ \ .. \ Download.php?file= $att4 '> $att4 </a> " ;
2023-08-09 16:40:26 +08:00
}
echo $full_link ;
}
}
echo " </small></div></div> " ; // This statement's position must be correct. Otherwise, the "My groups" part won't be placed correctly.
2023-08-01 17:02:33 +08:00
}
}
2023-08-09 16:40:26 +08:00
?>
2023-08-02 15:09:49 +08:00
2023-08-09 16:40:26 +08:00
</ div > <!-- Closing menu4 -->
</ div > <!-- Closing tab - content -->
</ div > <!-- Closing col - 9 -->
< div class = " col-3 " >
< h1 class = " display-6 " > My groups </ h1 >
< ? php
echo " <button onclick='createGroup()' class='btn btn-primary'>Create group</button> " ;
?>
< hr >
2023-08-05 16:11:27 +08:00
2023-08-09 16:40:26 +08:00
< ? php
2023-08-23 20:49:00 +08:00
$result = mysqli_query ( $con , " SELECT ID, course_group_members_table.Course_Group_id, Student_ID, Status,course_groups_table.Group_Name, course_groups_table.Course_id FROM course_group_members_table INNER JOIN course_groups_table ON course_groups_table.Course_Group_id=course_group_members_table.Course_Group_id WHERE Student_id= $student_id and course_groups_table.Course_id= $course_id " );
2023-08-09 16:40:26 +08:00
2023-08-23 20:49:00 +08:00
if ( mysqli_num_rows ( $result ) == 0 ) {
2023-08-09 16:40:26 +08:00
echo " You have no group in this course. " ;
} else {
while ( $row = mysqli_fetch_assoc ( $result )) {
2023-08-23 20:49:00 +08:00
$name = $row [ 'Group_Name' ];
$id = $row [ 'Course_Group_id' ];
$status = $row [ 'Status' ];
2023-08-23 21:55:02 +08:00
$extra = " <a href='#' class='' onclick='invite( $id )'> Invite member </a></small> " ;
2023-08-09 16:40:26 +08:00
2023-08-23 20:49:00 +08:00
if ( $status == " Invited " )
2023-08-09 16:40:26 +08:00
{
2023-08-23 20:49:00 +08:00
$extra2 = " <a href='#' class='' onclick='accept( $id ,1)'>Accept</a></small> " ;
$extra3 = " <a href='#' class='' onclick='accept( $id ,0)'>Decline</a></small> " ;
2023-08-09 16:40:26 +08:00
}
2023-01-19 18:22:39 +08:00
2023-08-09 16:40:26 +08:00
echo " <ul class='list-group'> " ;
2023-08-23 21:55:02 +08:00
echo " <li class='list-group-item'><b> $name </b> ( $id ) <br> $extra <br> $extra2 <br> $extra3 </li> " ;
2023-08-09 16:40:26 +08:00
2023-08-23 21:55:02 +08:00
$rs2 = mysqli_query ( $con , " SELECT Course_Group_id, users_table.Student_ID, 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
WHERE course_group_members_table . Student_ID AND course_group_members_table . Course_Group_id = $id " );
2023-08-09 16:40:26 +08:00
2023-08-23 20:49:00 +08:00
# Check whether the current user in session is the creator of the group
2023-08-23 21:55:02 +08:00
$rs3 = mysqli_query ( $con , " SELECT Status from course_group_members_table where Student_ID = $student_id " );
2023-08-09 16:40:26 +08:00
$flag = mysqli_fetch_assoc ( $rs3 )[ 'Status' ] == " Created " ;
2023-08-23 20:49:00 +08:00
while ( $row = mysqli_fetch_assoc ( $rs2 )) {
$name = $row [ 'Full_Name' ];
$id = $row [ 'Course_Group_id' ];
$status = $row [ 'Status' ];
$Student_ID = $row [ 'Student_ID' ];
2023-08-09 16:40:26 +08:00
2023-08-23 21:55:02 +08:00
# Show group members + Kick out button next to each member except the creator of the group
2023-08-23 20:49:00 +08:00
if ( $flag ) {
2023-08-09 16:40:26 +08:00
echo " <li class='list-group-item'> $name - $Student_ID ( $status ) " . (( $status != " Created " ) ? " <button onclick='removeMember( $Student_ID , $id )'
2023-08-07 16:39:19 +08:00
class = 'btn btn-sm btn-warning' > Kick out </ button > " : " " ). " </ li > " ;
2023-08-09 16:40:26 +08:00
} else {
echo " <li class='list-group-item'><small> $name - $Student_ID ( $status )</small> " ;
}
}
2023-08-23 21:55:02 +08:00
# Add "delete group" button and allow only group creator to delete it
if ( $status == 'Created' ) {
echo " <li class='list-group-item'> <button onclick='deleteGroup( $id )' class='btn btn-sm btn-danger'>Delete group</button> </li> " ;
}
echo " </ul> " ;
2023-08-09 16:40:26 +08:00
}
2023-08-01 17:02:33 +08:00
}
2023-08-09 16:40:26 +08:00
?>
</ div >
2023-08-01 17:02:33 +08:00
</ div >
2021-10-18 23:03:36 +08:00
2023-08-09 16:40:26 +08:00
< ? php
}
?>
2020-03-16 15:23:14 +08:00
2023-08-08 15:02:26 +08:00
</ div >
2023-08-23 20:31:11 +08:00
2023-08-12 20:56:27 +08:00
< link rel = " stylesheet " href = " https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.13.2/themes/base/jquery-ui.min.css " integrity = " sha512-ELV+xyi8IhEApPS/pSj66+Jiw+sOT1Mqkzlh8ExXihe4zfqbWkxPRi8wptXIO9g73FSlhmquFlUOuMSoXz5IRw== " crossorigin = " anonymous " referrerpolicy = " no-referrer " />
2023-08-23 20:15:55 +08:00
< script src = " https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.0/jquery.min.js " integrity = " sha512-3gJwYpMe3QewGELv8k/BX9vcqhryRdzRMxVfq6ngyWXwo03GFEzjsUm8Q7RZcHPHksttq7/GFoxjCVUjkjvPdw== " crossorigin = " anonymous " referrerpolicy = " no-referrer " ></ script >
2023-08-12 20:56:27 +08:00
< script src = " https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.13.2/jquery-ui.min.js " integrity = " sha512-57oZ/vW8ANMjR/KQ6Be9v/+/h6bq9/l3f0Oc7vn6qMqyhvPd1cvKBRWWpzu0QoneImqr2SkmO4MSqU+RpHom3Q== " crossorigin = " anonymous " referrerpolicy = " no-referrer " ></ script >
2020-03-16 15:23:14 +08:00
< script >
2021-10-18 23:03:36 +08:00
2023-08-02 15:03:25 +08:00
function createGroup () {
2023-08-31 20:35:09 +08:00
try {
$ ( ' < form id = " frm " method = " get " action = " Script.php " > \
< input type = " hidden " name = " creategroup " value = " true " > \
< input type = " hidden " name = " student_id " value = " <?php echo $student_id ; ?> " > \
Group name \
< input type = " text " name = " name " > \
< input type = " hidden " name = " url " value = " <?php echo $url ; ?> " > \
< input type = " hidden " name = " id " value = " <?php echo $course_id ; ?> " > \
</ form > ' ) . dialog ({
modal : true ,
title : 'Create a group' ,
close : function () {
var closeBtn = $ ( '.ui-dialog-titlebar-close' );
closeBtn . html ( '' );
},
buttons : {
'Create' : function () {
$ ( '#frm' ) . submit ();
$ ( this ) . dialog ( 'close' );
},
'Cancel' : function () {
$ ( this ) . dialog ( 'close' );
}
}
});
} catch ( e ) {
alert ( e );
2023-08-01 17:02:33 +08:00
}
}
2021-10-18 23:03:36 +08:00
2023-08-01 17:02:33 +08:00
function invite ( id ) {
2023-08-09 16:40:26 +08:00
2023-08-01 17:02:33 +08:00
try
{
$ ( ' < form id = " frm " method = " get " action = " Script.php " >< input type = " hidden " name = " groupinvite " value = " true " > \n\
2023-08-03 16:31:16 +08:00
< input type = " hidden " name = " groupid " value = " '+id+' " > Enter Student ID to invite < input type = " text " name = " student_id " > \n\
2022-05-19 12:35:27 +08:00
< input type = " hidden " name = " url " value = " <?php echo $url ; ?> " > < input type = " hidden " name = " courseid " value = " <?php echo $course_id ; ?> " > </ form > ' ) . dialog ({
2023-08-01 17:02:33 +08:00
modal : true ,
2023-08-12 21:29:49 +08:00
title : 'Invite students to group' ,
close : function () {
var closeBtn = $ ( '.ui-dialog-titlebar-close' );
closeBtn . html ( '' );
2023-08-23 20:15:55 +08:00
},
2023-08-01 17:02:33 +08:00
buttons : {
'Invite' : function () {
2023-08-09 16:40:26 +08:00
$ ( '#frm' ) . submit ();
$ ( this ) . dialog ( 'close' );
2023-08-01 17:02:33 +08:00
},
2023-08-02 15:09:49 +08:00
'Cancel' : function () {
2023-08-09 16:40:26 +08:00
$ ( this ) . dialog ( 'close' );
2023-08-01 17:02:33 +08:00
}
2023-08-09 16:40:26 +08:00
2023-08-01 17:02:33 +08:00
}
});
} catch ( e ){ alert ( e ); }
}
2021-10-18 23:03:36 +08:00
2020-10-02 17:02:20 +08:00
2021-10-18 23:03:36 +08:00
2023-08-01 17:02:33 +08:00
function accept ( id , val ) {
2023-08-09 16:40:26 +08:00
2023-08-01 17:02:33 +08:00
try
{
$ ( ' < form id = " frm " method = " get " action = " Script.php " >< input type = " hidden " name = " acceptinvite " value = " true " > \n\
2022-05-19 12:35:27 +08:00
< input type = " hidden " name = " groupid " value = " '+id+' " > \n\ < input type = " hidden " name = " action " value = " '+val+' " > \n\
2020-03-16 15:23:14 +08:00
\n\
< input type = " hidden " name = " student_id " value = " <?php echo $student_id ; ?> " > \n\
< input type = " hidden " name = " url " value = " <?php echo $url ; ?> " > < input type = " hidden " name = " courseid " value = " <?php echo $course_id ; ?> " > </ form > ' ) . dialog ({
2023-08-01 17:02:33 +08:00
modal : true ,
2023-08-12 21:29:49 +08:00
title : 'Respond to group invitation' ,
close : function () {
var closeBtn = $ ( '.ui-dialog-titlebar-close' );
closeBtn . html ( '' );
2023-08-23 20:15:55 +08:00
},
2023-08-01 17:02:33 +08:00
buttons : {
'Confirm' : function () {
2023-08-09 16:40:26 +08:00
$ ( '#frm' ) . submit ();
$ ( this ) . dialog ( 'close' );
2023-08-01 17:02:33 +08:00
},
2023-08-02 15:09:49 +08:00
'Cancel' : function () {
2023-08-09 16:40:26 +08:00
$ ( this ) . dialog ( 'close' );
2023-08-01 17:02:33 +08:00
}
2023-08-09 16:40:26 +08:00
2023-08-01 17:02:33 +08:00
}
});
} catch ( e ){ alert ( e ); }
}
function remarking ( data )
{
2023-08-02 15:09:49 +08:00
const details = prompt ( " Please enter your remarking reasons " , " " );
2023-08-09 16:40:26 +08:00
2023-08-01 17:02:33 +08:00
window . location . href = data + " &details= " + details ;
}
2023-08-02 15:09:49 +08:00
2023-08-09 16:40:26 +08:00
2023-08-02 15:09:49 +08:00
function removeMember ( student_id , group_id ) {
2023-08-01 17:02:33 +08:00
try
{
$ ( ' < form id = " frm " method = " get " action = " Script.php " >< input type = " hidden " name = " removemember " value = " true " > \n\
2023-01-19 18:22:39 +08:00
< input type = " hidden " name = " student_id " value = " '+student_id+' " > \n\
< input type = " hidden " name = " group_id " value = " '+group_id+' " > \n\
< input type = " hidden " name = " url " value = " <?php echo $url ; ?> " ></ form > ' ) . dialog ({
2023-08-01 17:02:33 +08:00
modal : true ,
2023-08-03 16:31:16 +08:00
title : 'Kick out ' + student_id + '?' ,
2023-08-12 21:29:49 +08:00
close : function () {
var closeBtn = $ ( '.ui-dialog-titlebar-close' );
closeBtn . html ( '' );
2023-08-23 20:15:55 +08:00
},
2023-08-01 17:02:33 +08:00
buttons : {
2023-08-03 16:31:16 +08:00
'Yes' : function () {
2023-08-09 16:40:26 +08:00
$ ( '#frm' ) . submit ();
$ ( this ) . dialog ( 'close' );
2023-08-01 17:02:33 +08:00
},
2023-08-03 16:31:16 +08:00
'No' : function () {
2023-08-09 16:40:26 +08:00
$ ( this ) . dialog ( 'close' );
2023-08-01 17:02:33 +08:00
}
2023-08-09 16:40:26 +08:00
2023-08-01 17:02:33 +08:00
}
});
} catch ( e ){ alert ( e ); }
}
2023-08-02 15:09:49 +08:00
function deleteGroup ( id ) {
2023-08-09 16:40:26 +08:00
2023-08-01 17:02:33 +08:00
try
{
$ ( ' < form id = " frm " method = " get " action = " Script.php " >< input type = " hidden " name = " deletegroup " value = " true " > \n\
2023-01-19 18:22:39 +08:00
< input type = " hidden " name = " group_id " value = " '+id+' " > \n\
< input type = " hidden " name = " url " value = " <?php echo $url ; ?> " ></ form > ' ) . dialog ({
2023-08-01 17:02:33 +08:00
modal : true ,
title : 'Delete this group?' ,
2023-08-12 21:29:49 +08:00
close : function () {
var closeBtn = $ ( '.ui-dialog-titlebar-close' );
closeBtn . html ( '' );
2023-08-23 20:15:55 +08:00
},
2023-08-01 17:02:33 +08:00
buttons : {
2023-08-03 16:31:16 +08:00
'Yes' : function () {
2023-08-09 16:40:26 +08:00
$ ( '#frm' ) . submit ();
$ ( this ) . dialog ( 'close' );
2023-08-01 17:02:33 +08:00
},
2023-08-03 16:31:16 +08:00
'No' : function () {
2023-08-09 16:40:26 +08:00
$ ( this ) . dialog ( 'close' );
2023-08-01 17:02:33 +08:00
}
2023-08-09 16:40:26 +08:00
2023-08-01 17:02:33 +08:00
}
});
} catch ( e ){ alert ( e ); }
}
2023-01-19 18:22:39 +08:00
2023-08-07 16:39:19 +08:00
/* For tabs to work */
const triggerTabList = document . querySelectorAll ( '#myTab a' )
triggerTabList . forEach ( triggerEl => {
const tabTrigger = new bootstrap . Tab ( triggerEl )
triggerEl . addEventListener ( 'click' , event => {
event . preventDefault ()
tabTrigger . show ()
})
})
2023-08-12 21:25:16 +08:00
2022-05-19 12:35:27 +08:00
</ script >
2023-08-08 15:02:26 +08:00
</ body >
</ html >