Indent Courses.php using Emacs web-mode.
							parent
							
								
									2fa24bba94
								
							
						
					
					
						commit
						380c79fd8a
					
				
							
								
								
									
										250
									
								
								Courses.php
								
								
								
								
							
							
						
						
									
										250
									
								
								Courses.php
								
								
								
								
							|  | @ -10,11 +10,11 @@ include 'Header.php'; | |||
| 
 | ||||
| <div class="container"> | ||||
| 
 | ||||
| <?php | ||||
| $user_d = $_SESSION['user_id']; | ||||
| if( $_SESSION['user_type']=="Lecturer" || $_SESSION['user_type']=="TA") | ||||
| { | ||||
| ?>
 | ||||
|     <?php | ||||
|     $user_d = $_SESSION['user_id']; | ||||
|     if( $_SESSION['user_type']=="Lecturer" || $_SESSION['user_type']=="TA") | ||||
|     { | ||||
|     ?>
 | ||||
| 
 | ||||
| 	<!--    FOR LECTURER--> | ||||
| 
 | ||||
|  | @ -24,10 +24,10 @@ if( $_SESSION['user_type']=="Lecturer" || $_SESSION['user_type']=="TA") | |||
| 	    <script src="./css/jquery-ui.min.js"></script> | ||||
| 	    <link rel="stylesheet" href="./css/jquery-ui.css" /> | ||||
| 	    <script> | ||||
| 		     function extendDeadline(id) { | ||||
| 			 const dropstudents = $("#dropstudents").html(); | ||||
| 			 try { | ||||
| 			     $(`<form id="frm" method="get" action="Script.php"> | ||||
| 			 function extendDeadline(id) { | ||||
| 			     const dropstudents = $("#dropstudents").html(); | ||||
| 			     try { | ||||
| 				 $(`<form id="frm" method="get" action="Script.php"> | ||||
|                                 <input type="hidden" name="extenddeadline" value="true" > | ||||
|                                 <input type="hidden" name="id" value="${id}" > | ||||
|                                 New date and time<br> | ||||
|  | @ -52,10 +52,10 @@ if( $_SESSION['user_type']=="Lecturer" || $_SESSION['user_type']=="TA") | |||
| 				   } | ||||
| 			       } | ||||
| 			   }); | ||||
| 			 } catch(e) { | ||||
| 			     alert(e); | ||||
| 			     } catch(e) { | ||||
| 				 alert(e); | ||||
| 			     } | ||||
| 			 } | ||||
| 		     } | ||||
|             </script> | ||||
| 
 | ||||
| 
 | ||||
|  | @ -482,73 +482,109 @@ WHERE  Lecturer_User_ID=$lecturer_id and course_students_table.Status='Pending'" | |||
| 
 | ||||
| 	    <!--   END LECTURER   --> | ||||
| 
 | ||||
| <?php  | ||||
| }  | ||||
|     <?php | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
| if( $_SESSION['user_type']=="Student") | ||||
| { | ||||
| ?>
 | ||||
|     if( $_SESSION['user_type']=="Student") | ||||
|     { | ||||
|     ?>
 | ||||
| 
 | ||||
|     <!--STUDENT CODE--> | ||||
|     <div class="row"> | ||||
| 	<div class="col-md-6"> | ||||
| 	<!--STUDENT CODE--> | ||||
| 	<div class="row"> | ||||
| 	    <div class="col-md-6"> | ||||
| 
 | ||||
| 	    <?php | ||||
| 		<?php | ||||
| 
 | ||||
| 	    error_reporting(0); | ||||
| 	    if (isset($_SESSION['info_Courses_student'])) { | ||||
| 		echo '<hr><span class="alert alert-success" role="alert">' . $_SESSION['info_Courses_student'] . '</span>'; | ||||
| 		$_SESSION['info_Courses_student'] = null; | ||||
| 	    } | ||||
| 	    ?>
 | ||||
| 	    <br><br> | ||||
| 	</div> | ||||
| 	<div class="col-md-6"></div> | ||||
|     </div> | ||||
| 
 | ||||
| 
 | ||||
|     <div class="row"> | ||||
| 	<div class="col-md-6"> | ||||
| 	     | ||||
| 	    <?php  | ||||
| 	    error_reporting(0); | ||||
| 	    $student_id= $_SESSION['user_student_id']; | ||||
| 	    // current academic year - i.e 2021 - 2022 , so we will show in search result:
 | ||||
| 	    // course containing either 2021 or 2022 as academic year.
 | ||||
| 	    $oldest_academic_year = date('Y') - 1; | ||||
| 	    if(!empty($_GET["search"]) || !empty($_GET["faculty"])) | ||||
| 	    { | ||||
| 		$search = trim(mysqli_real_escape_string($con, $_GET["search"])); | ||||
| 		$search = strtoupper($_GET['search']); | ||||
| 		$faculty = mysqli_real_escape_string($con, $_GET["faculty"]); | ||||
| 		 | ||||
| 		// the user has not entered something under "Find course by Code"
 | ||||
| 		if($faculty=="") | ||||
| 		{ | ||||
| 		    echo "<h4> Search results for course code: $search </h4><hr>"; | ||||
| 		    $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 Academic_Year >= $oldest_academic_year and Course_Code like '%{$search}%'  and courses_table.Course_ID not in (select course_id from course_students_table where Student_ID=$student_id) order by Academic_Year desc"); | ||||
| 		error_reporting(0); | ||||
| 		if (isset($_SESSION['info_Courses_student'])) { | ||||
| 		    echo '<hr><span class="alert alert-success" role="alert">' . $_SESSION['info_Courses_student'] . '</span>'; | ||||
| 		    $_SESSION['info_Courses_student'] = null; | ||||
| 		} | ||||
| 		// the user has entered something under "Find course by Code"
 | ||||
| 		else | ||||
| 		?>
 | ||||
| 		<br><br> | ||||
| 	    </div> | ||||
| 	    <div class="col-md-6"></div> | ||||
| 	</div> | ||||
| 
 | ||||
| 
 | ||||
| 	<div class="row"> | ||||
| 	    <div class="col-md-6"> | ||||
| 
 | ||||
| 		<?php | ||||
| 		error_reporting(0); | ||||
| 		$student_id= $_SESSION['user_student_id']; | ||||
| 		// current academic year - i.e 2021 - 2022 , so we will show in search result:
 | ||||
| 		// course containing either 2021 or 2022 as academic year.
 | ||||
| 		$oldest_academic_year = date('Y') - 1; | ||||
| 		if(!empty($_GET["search"]) || !empty($_GET["faculty"])) | ||||
| 		{ | ||||
| 		    echo "<h3> Find courses under faculty: $faculty</h3>"; | ||||
| 		    $result = mysqli_query($con,"SELECT `Course_ID`, `Course_Name`, `Academic_Year`, `Faculty`,
 | ||||
| 		    $search = trim(mysqli_real_escape_string($con, $_GET["search"])); | ||||
| 		    $search = strtoupper($_GET['search']); | ||||
| 		    $faculty = mysqli_real_escape_string($con, $_GET["faculty"]); | ||||
| 
 | ||||
| 		    // the user has not entered something under "Find course by Code"
 | ||||
| 		    if($faculty=="") | ||||
| 		    { | ||||
| 			echo "<h4> Search results for course code: $search </h4><hr>"; | ||||
| 			$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 Academic_Year >= $oldest_academic_year and Course_Code like '%{$search}%'  and courses_table.Course_ID not in (select course_id from course_students_table where Student_ID=$student_id) order by Academic_Year desc"); | ||||
| 		    } | ||||
| 		    // the user has entered something under "Find course by Code"
 | ||||
| 		    else | ||||
| 		    { | ||||
| 			echo "<h3> Find courses under faculty: $faculty</h3>"; | ||||
| 			$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 Academic_Year >= $oldest_academic_year  and Faculty='$faculty'  and courses_table.Course_ID not in (select course_id from course_students_table where Student_ID=$student_id) order by Academic_Year desc");
 | ||||
| 		} | ||||
| 		    } | ||||
| 
 | ||||
| 
 | ||||
| 		    if(mysqli_num_rows($result)==0) | ||||
| 		    { | ||||
| 			echo "No results. <hr>"; | ||||
| 
 | ||||
| 		    } else { | ||||
| 
 | ||||
| 			while($row = mysqli_fetch_assoc($result)) { | ||||
| 			    $name=$row['Course_Name']; | ||||
| 			    $code=$row['Course_Code']; | ||||
| 			    $faculty=$row['Faculty']; | ||||
| 			    $lecturer=$row['Full_Name']; | ||||
| 			    $academic=$row['Academic_Year']; | ||||
| 			    $url=$row['URL']; | ||||
| 			    $id=$row['Course_ID']; | ||||
| 			    $v=$row['Verify_New_Members']; | ||||
| 			    if($v>0) | ||||
| 			    { | ||||
| 				$msg="<i class='fa fa-exclamation-circle'></i> Lecturer verification required"; | ||||
| 				$msg2="Send Joining Request"; | ||||
| 			    } | ||||
| 
 | ||||
| 			    echo "<div class='btn btn-default' style='word-wrap:break-word'>
 | ||||
|   ($code) $name <br>($url) <br>  <a href='~\..\Script.php?JoinCourse=y&id=$id&std=$student_id&joining=$v' class='btn btn-sm btn-success' onclick=return confirm(\"Are you sure to join this course?\")' >Join</a>
 | ||||
|    <br> <span style='font-size:10pt'>Faculty: $faculty   Year: $academic   Lecturer: $lecturer </span><br>$msg</div> | ||||
|                             ";
 | ||||
| 			} | ||||
| 		    } | ||||
| 		} | ||||
| 		// Otherwise, list the student's joined courses (already done), in reverse chronological order
 | ||||
| 		echo "<h1 class='display-6'> My courses </h1>"; | ||||
| 		$result = mysqli_query($con,"SELECT users_table.Full_Name, course_students_table.Status, courses_table.Course_ID, `Course_Name`, `Academic_Year`, `Faculty`, `Lecturer_User_ID`, `TA_User_ID`, `Course_Code`, `URL`, `Verify_New_Members` FROM `courses_table`
 | ||||
| INNER JOIN users_table | ||||
|           ON users_table.User_ID=courses_table.Lecturer_User_ID | ||||
| 
 | ||||
| INNER JOIN course_students_table on course_students_table.Course_ID=courses_table.Course_ID | ||||
| 
 | ||||
|                   where course_students_table.Student_ID=$student_id ORDER BY Academic_Year DESC, URL ASC");
 | ||||
| 
 | ||||
| 		if(mysqli_num_rows($result)==0) | ||||
| 		{ | ||||
| 		    echo "No results. <hr>"; | ||||
| 
 | ||||
| 		    echo "<i class='fa fa-exclamation-circle'></i> You are not enrolled in any Course"; | ||||
| 		} else { | ||||
| 		     | ||||
| 		    while($row = mysqli_fetch_assoc($result)) { | ||||
| 			$name=$row['Course_Name']; | ||||
| 			$code=$row['Course_Code']; | ||||
|  | @ -557,62 +593,26 @@ if( $_SESSION['user_type']=="Student") | |||
| 			$academic=$row['Academic_Year']; | ||||
| 			$url=$row['URL']; | ||||
| 			$id=$row['Course_ID']; | ||||
| 			$v=$row['Verify_New_Members']; | ||||
| 			if($v>0) | ||||
| 			$Status=$row['Status']; | ||||
| 
 | ||||
| 			if($Status=="Joined") | ||||
| 			{ | ||||
| 			    $msg="<i class='fa fa-exclamation-circle'></i> Lecturer verification required"; | ||||
| 			    $msg2="Send Joining Request"; | ||||
| 			} | ||||
| 			 | ||||
| 			echo "<div class='btn btn-default' style='word-wrap:break-word'>
 | ||||
|   ($code) $name <br>($url) <br>  <a href='~\..\Script.php?JoinCourse=y&id=$id&std=$student_id&joining=$v' class='btn btn-sm btn-success' onclick=return confirm(\"Are you sure to join this course?\")' >Join</a>
 | ||||
|    <br> <span style='font-size:10pt'>Faculty: $faculty   Year: $academic   Lecturer: $lecturer </span><br>$msg</div> | ||||
|                         ";
 | ||||
| 		    } | ||||
| 		} | ||||
| 	    } | ||||
| 	    // Otherwise, list the student's joined courses (already done), in reverse chronological order
 | ||||
| 	    echo "<h1 class='display-6'> My courses </h1>"; | ||||
| 	    $result = mysqli_query($con,"SELECT users_table.Full_Name, course_students_table.Status, courses_table.Course_ID, `Course_Name`, `Academic_Year`, `Faculty`, `Lecturer_User_ID`, `TA_User_ID`, `Course_Code`, `URL`, `Verify_New_Members` FROM `courses_table`
 | ||||
| INNER JOIN users_table | ||||
|           ON users_table.User_ID=courses_table.Lecturer_User_ID | ||||
| 
 | ||||
| INNER JOIN course_students_table on course_students_table.Course_ID=courses_table.Course_ID | ||||
| 
 | ||||
|                   where course_students_table.Student_ID=$student_id ORDER BY Academic_Year DESC, URL ASC");
 | ||||
| 	     | ||||
| 	    if(mysqli_num_rows($result)==0) | ||||
| 	    { | ||||
| 		echo "<i class='fa fa-exclamation-circle'></i> You are not enrolled in any Course"; | ||||
| 	    } else { | ||||
| 		while($row = mysqli_fetch_assoc($result)) { | ||||
| 		    $name=$row['Course_Name']; | ||||
| 		    $code=$row['Course_Code']; | ||||
| 		    $faculty=$row['Faculty'];	 | ||||
| 		    $lecturer=$row['Full_Name']; | ||||
| 		    $academic=$row['Academic_Year']; | ||||
| 		    $url=$row['URL']; | ||||
| 		    $id=$row['Course_ID']; | ||||
| 		    $Status=$row['Status']; | ||||
|                      | ||||
| 		    if($Status=="Joined") | ||||
| 		    { | ||||
| 			echo "<a href='~\..\Course.php?url=$url'>   <div class='btn btn-default' style='word-wrap:break-word'>
 | ||||
| 			    echo "<a href='~\..\Course.php?url=$url'>   <div class='btn btn-default' style='word-wrap:break-word'>
 | ||||
|   ($code) - $name <br>($url)           <i class='fa fa-check-circle'></i> $Status        | ||||
|    <br> <span style='font-size:8pt'>Faculty: $faculty   Year: $academic    Lecturer: $lecturer </span></div></a> | ||||
|                         ";  
 | ||||
| 		    } | ||||
| 		    else | ||||
| 		    { | ||||
| 			echo "<div class='btn btn-default'>
 | ||||
|                             ";
 | ||||
| 			} | ||||
| 			else | ||||
| 			{ | ||||
| 			    echo "<div class='btn btn-default'>
 | ||||
|   ($code) - $name  <i class='btn btn-sm btn-danger'> $Status</i> | ||||
|    <br> <span style='font-size:8pt'>Faculty: $faculty   Year: $academic   Lecturer: $lecturer </span></div> | ||||
|                         "; 
 | ||||
|                             ";
 | ||||
| 			} | ||||
| 		    } | ||||
| 		} | ||||
| 	    }  | ||||
| 
 | ||||
| 	    echo "</div><div class='col-md-6'>
 | ||||
| 		echo "</div><div class='col-md-6'>
 | ||||
| 
 | ||||
|         <form method='get' action='Courses.php'> | ||||
|             <div class='row'> | ||||
|  | @ -626,16 +626,16 @@ INNER JOIN course_students_table on course_students_table.Course_ID=courses_tabl | |||
|                         <div class='col-md-5'> | ||||
|                             List courses by faculty | ||||
|                             <select name='faculty' class='form-control'>";
 | ||||
|             $result = mysqli_query($con,"SELECT   DISTINCT(Faculty) as Faculty FROM `courses_table`"); | ||||
|             if(mysqli_num_rows($result)==0){ | ||||
|             } else {  | ||||
| 		echo"           <option value=''>Search by faculty</option>"; | ||||
| 		while($row = mysqli_fetch_assoc($result)) { | ||||
|                     $fname=$row['Faculty']; | ||||
|                     echo "      <option value='$fname'> $fname </option>"; | ||||
|             }} | ||||
| 		$result = mysqli_query($con,"SELECT   DISTINCT(Faculty) as Faculty FROM `courses_table`"); | ||||
| 		if(mysqli_num_rows($result)==0){ | ||||
| 		} else { | ||||
| 		    echo"           <option value=''>Search by faculty</option>"; | ||||
| 		    while($row = mysqli_fetch_assoc($result)) { | ||||
| 			$fname=$row['Faculty']; | ||||
| 			echo "      <option value='$fname'> $fname </option>"; | ||||
| 		}} | ||||
| 
 | ||||
|             echo "          </select>
 | ||||
| 		echo "          </select>
 | ||||
|                         </div> | ||||
| 
 | ||||
|                         <div class='col-md-2'> <br> | ||||
|  | @ -648,13 +648,13 @@ INNER JOIN course_students_table on course_students_table.Course_ID=courses_tabl | |||
| 
 | ||||
|     </div></div>";
 | ||||
| 
 | ||||
| 	    } | ||||
| 		} | ||||
| 
 | ||||
| 	    ?>
 | ||||
| 		?>
 | ||||
| 
 | ||||
| 	    <?php include 'Footer.php';?>
 | ||||
| 		<?php include 'Footer.php';?>
 | ||||
| 
 | ||||
| 	</div>	     | ||||
| 	    </div> | ||||
| 
 | ||||
| </body> | ||||
| </html> | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue