Admin.php: format code using visual studio code's PHP Intelephense.
							parent
							
								
									679aff4cc2
								
							
						
					
					
						commit
						e64af95eee
					
				|  | @ -0,0 +1,5 @@ | ||||||
|  | { | ||||||
|  |     "recommendations": [ | ||||||
|  |         "thamaraiselvam.remove-blank-lines" | ||||||
|  |     ] | ||||||
|  | } | ||||||
							
								
								
									
										580
									
								
								Admin.php
								
								
								
								
							
							
						
						
									
										580
									
								
								Admin.php
								
								
								
								
							|  | @ -1,367 +1,323 @@ | ||||||
| <?php | <?php | ||||||
|   include 'NoDirectPhpAcess.php'; | include 'NoDirectPhpAcess.php'; | ||||||
| ?>
 | ?>
 | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| <?php | <?php | ||||||
| $page="admin"; | $page = "admin"; | ||||||
| include 'Header.php'; | include 'Header.php'; | ||||||
| ?>
 | ?>
 | ||||||
| 
 | 
 | ||||||
| <?php | <?php | ||||||
| if ($_SESSION['user_type'] != "Lecturer") { | if ($_SESSION['user_type'] != "Lecturer") { | ||||||
|     $_SESSION["info_login"]="You must log in first."; |   $_SESSION["info_login"] = "You must log in first."; | ||||||
|     echo $_SESSION["info_login"]; |   echo $_SESSION["info_login"]; | ||||||
|     header("Location: index.php"); |   header("Location: index.php"); | ||||||
| } | } | ||||||
| ?>
 | ?>
 | ||||||
| 
 | 
 | ||||||
| <style> | <style> | ||||||
|     .col-md-4{ |   .col-md-4 { | ||||||
|         border-right: 1px solid skyblue; |     border-right: 1px solid skyblue; | ||||||
|     } |   } | ||||||
| </style> | </style> | ||||||
| 
 | 
 | ||||||
| <br> | <br> | ||||||
| <div style="width: 80%;margin: auto;"> <h2> Administration Panel </h2> </div> | <div style="width: 80%;margin: auto;"> | ||||||
|  |   <h2> Administration Panel </h2> | ||||||
|  | </div> | ||||||
| 
 | 
 | ||||||
|     <hr> | <hr> | ||||||
| <div class="row" style="width: 80%;margin: auto;"> | <div class="row" style="width: 80%;margin: auto;"> | ||||||
| 
 | 
 | ||||||
|    |   <!--<h4>General system Settings</h4><hr> | ||||||
|      |  | ||||||
|      <!--<h4>General system Settings</h4><hr> |  | ||||||
|         <a href="" class="btn btn-lg btn-primary">View System Log </a> |         <a href="" class="btn btn-lg btn-primary">View System Log </a> | ||||||
|         <hr> |         <hr> | ||||||
|      Lab Privacy Mode: (STUDENT VERIFICATION) |      Lab Privacy Mode: (STUDENT VERIFICATION) | ||||||
|         <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> | ||||||
| 
 | 
 | ||||||
|  |     <div class="container"> | ||||||
| 
 | 
 | ||||||
|  |       <!-- Nav tabs --> | ||||||
|  |       <ul class="nav nav-tabs" role="tablist"> | ||||||
| 
 | 
 | ||||||
|  |         <li class="nav-item"> | ||||||
|  |           <a class="nav-link active" data-toggle="tab" href="#home">Create New Account</a> | ||||||
|  |         </li> | ||||||
| 
 | 
 | ||||||
|  |         <li class="nav-item"> | ||||||
|  |           <a class="nav-link" data-toggle="tab" href="#menu2">Batch Create New Student Accounts</a> | ||||||
|  |         </li> | ||||||
| 
 | 
 | ||||||
|  |         <li class="nav-item"> | ||||||
|  |           <a class="nav-link" data-toggle="tab" href="#menu1">Existing Accounts</a> | ||||||
|  |         </li> | ||||||
| 
 | 
 | ||||||
|         <div class="container"> |       </ul> | ||||||
| 
 | 
 | ||||||
|  |       <!-- Tab panes --> | ||||||
|  |       <div class="tab-content"> | ||||||
| 
 | 
 | ||||||
|  |         <div id="home" class="container tab-pane active"><br> | ||||||
| 
 | 
 | ||||||
|  <!-- Nav tabs --> |           <b>Create Lecturer/TA Accounts </b> | ||||||
|   <ul class="nav nav-tabs" role="tablist"> |           <form method="post" action="Script.php"> | ||||||
|  |             <input type="hidden" name="frm_createlecturrer" value="true" required="" /> | ||||||
|  |             Full_Name | ||||||
|  |             <input type="text" name="fullname" placeholder="Full Name" class="form-control" required=""> | ||||||
|  |             Email | ||||||
|  |             <input type="text" name="email" placeholder="Email / Student Number" class="form-control" required=""> | ||||||
| 
 | 
 | ||||||
|     <li class="nav-item"> |             Passport_Number / ID (Used as Intial Password) | ||||||
|       <a class="nav-link active" data-toggle="tab" href="#home">Create New Account</a> |             <input type="text" class="form-control" name="passport" placeholder="Passport No./ID" required=""> | ||||||
|     </li> |             <br> User Type : | ||||||
|  |             <input type="radio" name="type" value="Lecturer" required=""> Lecturer | ||||||
|  |             <input type="radio" name="type" value="TA" required=""> T/A | ||||||
|  |             <input type="submit" class="btn btn-primary" value="Create"><br> | ||||||
|  |             <?php | ||||||
| 
 | 
 | ||||||
|     <li class="nav-item"> |             error_reporting(E_ALL); | ||||||
|       <a class="nav-link" data-toggle="tab" href="#menu2">Batch Create New Student Accounts</a> |             if (isset($_SESSION['info_Admin_Users'])) { | ||||||
|     </li> |               echo  '<hr><div class="alert alert-info" role="alert">' . $_SESSION['info_Admin_Users'] . '</div>'; | ||||||
|  |               $_SESSION['info_Admin_Users'] = null; | ||||||
|  |             } | ||||||
|  |             if (isset($_SESSION['info_Admin_Users'])) { | ||||||
|  |               echo  '<hr><div class="alert alert-info" role="alert">' . $_SESSION['info_Admin_Users'] . '</div>'; | ||||||
|  |               $_SESSION['info_Admin_Users'] = null; | ||||||
|  |             } | ||||||
| 
 | 
 | ||||||
|     <li class="nav-item"> |             ?>
 | ||||||
|       <a class="nav-link" data-toggle="tab" href="#menu1">Existing Accounts</a> |  | ||||||
|     </li> |  | ||||||
| 
 | 
 | ||||||
|   </ul> |           </form> | ||||||
| 
 | 
 | ||||||
|   <!-- Tab panes --> |           <hr> | ||||||
|   <div class="tab-content"> |  | ||||||
| 
 |  | ||||||
|     <div id="home" class="container tab-pane active"><br> |  | ||||||
|   |  | ||||||
|         <b>Create Lecturer/TA Accounts </b> |  | ||||||
|      <form method="post" action="Script.php"> |  | ||||||
|                    <input type="hidden" name="frm_createlecturrer" value="true" required=""/> |  | ||||||
|  Full_Name |  | ||||||
| <input type="text" name="fullname" placeholder="Full Name" class="form-control" required=""> |  | ||||||
| Email |  | ||||||
| <input type="text" name="email" placeholder="Email / Student Number" class="form-control" required=""> |  | ||||||
|   |  | ||||||
|   Passport_Number / ID (Used as Intial Password) |  | ||||||
| <input type="text" class="form-control"  name="passport" placeholder="Passport No./ID" required=""> |  | ||||||
|   <br> User Type :  |  | ||||||
|   <input type="radio" name="type" value="Lecturer" required=""> Lecturer |  | ||||||
|      <input type="radio" name="type" value="TA" required=""> T/A |  | ||||||
|   <input type="submit" class="btn btn-primary" value="Create"><br> |  | ||||||
| <?php  |  | ||||||
| 
 |  | ||||||
| error_reporting(E_ALL); |  | ||||||
| if(isset($_SESSION['info_Admin_Users'])) { |  | ||||||
|   echo  '<hr><div class="alert alert-info" role="alert">'.$_SESSION['info_Admin_Users'].'</div>'; |  | ||||||
|   $_SESSION['info_Admin_Users']=null; |  | ||||||
| } |  | ||||||
| if(isset($_SESSION['info_Admin_Users'])) { |  | ||||||
|   echo  '<hr><div class="alert alert-info" role="alert">'.$_SESSION['info_Admin_Users'].'</div>'; |  | ||||||
|   $_SESSION['info_Admin_Users']=null; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| ?>
 |  | ||||||
| 
 |  | ||||||
|         </form> |  | ||||||
|          |  | ||||||
| <hr> |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
|   </div> |  | ||||||
|     |  | ||||||
|        |  | ||||||
|       <div id="menu1" class="container tab-pane fade"><br> |  | ||||||
|     |  | ||||||
| <table class="table-bordered" style="font-size: 10pt;"> |  | ||||||
|     <tr style="font-size:10pt;"> |  | ||||||
|         <th>ID</th> |  | ||||||
|         <th>Name</th> |  | ||||||
|         <th>Email</th> |  | ||||||
|         <th>Passport / ID </th> |  | ||||||
|         <th>Reset Password </th> |  | ||||||
|         <th>Block/Activate </th> |  | ||||||
|     </tr> |  | ||||||
| <?php |  | ||||||
| 
 |  | ||||||
|      $result = mysqli_query($con, |  | ||||||
|         "SELECT * FROM Users_Table  WHERE UserType in ('Lecturer','TA')"); |  | ||||||
|   while($row = mysqli_fetch_assoc($result)) { |  | ||||||
|       $pass=$row['Passport_Number']; |  | ||||||
|      $btn="<button class='btn-primary' onclick=\"updatePass(".$row['User_ID'].",'$pass')\">Reset</button>"; |  | ||||||
|      if($row['Status']=="Active") |  | ||||||
|      { $newstatus="Blocked"; |  | ||||||
|       $btnBlock="<button class='btn-danger' onclick=\"blockUser(".$row['User_ID'].",'$newstatus')\">Block</button>"; |  | ||||||
|      }else{ |  | ||||||
|        $newstatus="Active"; |  | ||||||
|       $btnBlock="<button class='btn-success' onclick=\"blockUser(".$row['User_ID'].",'$newstatus')\">Activate</button>";   |  | ||||||
|      } |  | ||||||
|       |  | ||||||
|       echo "<tr><td>".$row['User_ID']."</td><td>".$row['Full_Name']."</td><td>".$row['Email']."</td> <td>".$row['Passport_Number']."</td><td>$btn</td><td>$btnBlock</td></tr>"; |  | ||||||
|   } |  | ||||||
| ?></table>    
 |  | ||||||
|      |  | ||||||
|             |  | ||||||
|      </div> |  | ||||||
|     |  | ||||||
| 
 |  | ||||||
|       <!-- code contributed by Xu Xiaopeng (https://github.com/xxp1999) --> |  | ||||||
|        |  | ||||||
|       <div id="menu2"  class="container tab-pane fade" style="margin-top:10px" > |  | ||||||
| 	<b>Separate two student numbers with a space.</b><br> |  | ||||||
| 	<form action="batch_insert.php" method="post"> |  | ||||||
| 	  <p> |  | ||||||
| 	    <textarea cols="80" rows="16" name="users" required=""></textarea> |  | ||||||
| 	  </p> |  | ||||||
| 	  <input type="submit" class="btn btn-primary" value="Register Students"><br> |  | ||||||
| 	</form>	 |  | ||||||
|       </div> |  | ||||||
| 	 |  | ||||||
|    |  | ||||||
|   </div> |  | ||||||
| </div> |  | ||||||
|          |  | ||||||
|          |  | ||||||
|     </div> |  | ||||||
|      |  | ||||||
|     <div class="col-md-6"> |  | ||||||
|          |  | ||||||
|          |  | ||||||
|          |  | ||||||
|            <div class="container"> |  | ||||||
|  <!-- Nav tabs --> |  | ||||||
|   <ul class="nav nav-tabs" role="tablist"> |  | ||||||
|     <li class="nav-item"> |  | ||||||
|       <a class="nav-link active" data-toggle="tab" href="#menua">   Course Portal </a> |  | ||||||
|     </li> |  | ||||||
|     <li class="nav-item"> |  | ||||||
|       <a class="nav-link" data-toggle="tab" href="#menub">Existing Courses</a> |  | ||||||
|     </li> |  | ||||||
|    |  | ||||||
|   </ul> |  | ||||||
| 
 |  | ||||||
|   <!-- Tab panes --> |  | ||||||
|   <div class="tab-content"> |  | ||||||
|     <div id="menua" class="container tab-pane active"><br> |  | ||||||
|          |  | ||||||
|          |  | ||||||
|          |  | ||||||
|        |  | ||||||
|       |  | ||||||
|         <hr> |  | ||||||
|         <b>Create new Portal </b> |  | ||||||
| 		 |  | ||||||
| 		 |  | ||||||
| 		 |  | ||||||
| 		<form method="post" action="Script.php"> |  | ||||||
|                    <input type="hidden" name="frm_createCourse" value="true" required=""/> |  | ||||||
|  Course Name |  | ||||||
| <input type="text" name="name" placeholder="Course Name" class="form-control" required=""> |  | ||||||
| 
 |  | ||||||
|  Course Code |  | ||||||
| <input type="text" name="code" placeholder="Course Code" class="form-control" required=""> |  | ||||||
| 
 |  | ||||||
| URL (Leave blank to use Course Name) |  | ||||||
| <input type="text" name="url" placeholder="Choose Custom URL " class="form-control" required=""> |  | ||||||
| 
 |  | ||||||
| Academic Year |  | ||||||
| <input type="text" name="academic" placeholder="Academic Year" class="form-control" required=""> |  | ||||||
|   |  | ||||||
|  Faculty <br> |  | ||||||
| <input type="text" name="faculty" placeholder="Faculty" class="form-control" required=""> |  | ||||||
|   |  | ||||||
|   Assign Lecturer |  | ||||||
| <br> |  | ||||||
| 
 |  | ||||||
| <select name="lecturer" class="form-control"> |  | ||||||
|  <?php  |  | ||||||
|  $result = mysqli_query($con,"SELECT * FROM Users_Table WHERE UserType='Lecturer'"); |  | ||||||
|  if(mysqli_num_rows($result)==0) |  | ||||||
|     {} else { while($row = mysqli_fetch_assoc($result)) { |  | ||||||
| 			$id=$row['User_ID']; |  | ||||||
| 			$name=$row['Full_Name']; |  | ||||||
| 		   echo "<option value='$id'> $name </option>"; |  | ||||||
| 		}}?>
 |  | ||||||
| 
 |  | ||||||
| </select> |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| Assigned T/A <br>  |  | ||||||
|   <select name="ta" class="form-control"> |  | ||||||
|  <?php  |  | ||||||
|  $result = mysqli_query($con,"SELECT * FROM Users_Table WHERE UserType='TA'"); |  | ||||||
|  if(mysqli_num_rows($result)==0) |  | ||||||
|     {} else { while($row = mysqli_fetch_assoc($result)) { |  | ||||||
| 			$id=$row['User_ID']; |  | ||||||
| 			$name=$row['Full_Name']; |  | ||||||
| 		   echo "<option value='$id'> $name </option>"; |  | ||||||
| 		}}?>
 |  | ||||||
| 
 |  | ||||||
| </select> |  | ||||||
|   |  | ||||||
| Verify Joining Students |  | ||||||
| <input type="radio" name="verify" value="1"> Yes |  | ||||||
| <input type="radio" name="verify" value="0" checked=""> No |  | ||||||
| 
 |  | ||||||
| 	 <br> |  | ||||||
|   <input type="submit" class="btn btn-primary" value="Create Portal"><br> |  | ||||||
|    |  | ||||||
|   </form> |  | ||||||
| 	 |  | ||||||
|          |  | ||||||
|          |  | ||||||
|         <?php  |  | ||||||
| 
 |  | ||||||
| error_reporting(E_ALL); |  | ||||||
| if(isset($_SESSION['info_Admin_Courses'])) { |  | ||||||
|   echo  '<hr><div class="alert alert-info" role="alert">'.$_SESSION['info_Admin_Courses'].'</div>'; |  | ||||||
|   $_SESSION['info_Admin_Courses']=null; |  | ||||||
| } |  | ||||||
| if(isset($_SESSION['info_Admin_Courses'])) { |  | ||||||
|   echo  '<hr><div class="alert alert-info" role="alert">'.$_SESSION['info_Admin_Courses'].'</div>'; |  | ||||||
|   $_SESSION['info_Admin_Courses']=null; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| ?>
 |  | ||||||
|          |  | ||||||
|          |  | ||||||
|          |  | ||||||
| 		 |  | ||||||
| 		 |  | ||||||
| 	  </div> |  | ||||||
|     |  | ||||||
|        |  | ||||||
|       <div id="menub" class="container tab-pane fade"><br> |  | ||||||
|    	 |  | ||||||
| 		 |  | ||||||
| 		 |  | ||||||
|         <b> Existing Course Portals </b> |  | ||||||
|         <hr> |  | ||||||
|         <table class="table-bordered" style="font-size: 10pt;"> |  | ||||||
|             <tr> <th>Course  Name </th> <th> Faculty </th> <th>Lecturer </th> <th>TAs</th>  <th>Assign new TA </th> </tr> |  | ||||||
|          <?php  |  | ||||||
|  $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"); |  | ||||||
|  if(mysqli_num_rows($result)==0) |  | ||||||
|     {} 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']; |  | ||||||
|                           $c_id=$row['Course_ID']; |  | ||||||
|                            |  | ||||||
|                            |  | ||||||
|                            |  | ||||||
|                           $resultTA = mysqli_query($con,"SELECT `Course_ID`, `TA`,users_table.Full_Name as TA_NAME FROM `course_ta`
 |  | ||||||
| INNER JOIN users_table on users_table.User_ID=course_ta.TA |  | ||||||
| where course_ta.Course_ID=$c_id");  
 |  | ||||||
|                      |  | ||||||
|                     $ta=""; |  | ||||||
|                     while($rowTA = mysqli_fetch_assoc($resultTA)) { |  | ||||||
|                         $ta=$ta."  - ".$rowTA['TA_NAME']; |  | ||||||
|                     } |  | ||||||
|                      |  | ||||||
|                            |  | ||||||
|                            |  | ||||||
|                            |  | ||||||
|                           |  | ||||||
|                 echo"  
 |  | ||||||
|                           <tr> <td>$code - $name</td>  <td>$faculty </td> <td>$lecturer</td><td>$ta</td>  <td><form method='get' action='Script.php'> <select name='ta' class=''>";
 |  | ||||||
|                                |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
|  $resultx = mysqli_query($con,"SELECT * FROM Users_Table WHERE UserType='TA'"); |  | ||||||
|  if(mysqli_num_rows($resultx)==0) |  | ||||||
|     {} else { while($row = mysqli_fetch_assoc($resultx)) { |  | ||||||
| 			$id=$row['User_ID']; |  | ||||||
| 			$name=$row['Full_Name']; |  | ||||||
| 		   echo "<option value='$id'> $name </option>"; |  | ||||||
| 		}} |  | ||||||
|                  |  | ||||||
| 
 |  | ||||||
| echo "</select>  <input type='hidden' name='assignTA' value='true'> <input type='hidden' name='id' value='$c_id'>  <input type='submit' value='assign'></form> </td></tr>
 |  | ||||||
|                          ";
 |  | ||||||
|                           |  | ||||||
|                           |  | ||||||
|                           |  | ||||||
| 		}}?>
 |  | ||||||
|          |  | ||||||
|         </table> |  | ||||||
| 
 | 
 | ||||||
|         </div> |         </div> | ||||||
| 
 | 
 | ||||||
|  |         <div id="menu1" class="container tab-pane fade"><br> | ||||||
|  | 
 | ||||||
|  |           <table class="table-bordered" style="font-size: 10pt;"> | ||||||
|  |             <tr style="font-size:10pt;"> | ||||||
|  |               <th>ID</th> | ||||||
|  |               <th>Name</th> | ||||||
|  |               <th>Email</th> | ||||||
|  |               <th>Passport / ID </th> | ||||||
|  |               <th>Reset Password </th> | ||||||
|  |               <th>Block/Activate </th> | ||||||
|  |             </tr> | ||||||
|  |             <?php | ||||||
|  | 
 | ||||||
|  |             $result = mysqli_query( | ||||||
|  |               $con, | ||||||
|  |               "SELECT * FROM Users_Table  WHERE UserType in ('Lecturer','TA')" | ||||||
|  |             ); | ||||||
|  |             while ($row = mysqli_fetch_assoc($result)) { | ||||||
|  |               $pass = $row['Passport_Number']; | ||||||
|  |               $btn = "<button class='btn-primary' onclick=\"updatePass(" . $row['User_ID'] . ",'$pass')\">Reset</button>"; | ||||||
|  |               if ($row['Status'] == "Active") { | ||||||
|  |                 $newstatus = "Blocked"; | ||||||
|  |                 $btnBlock = "<button class='btn-danger' onclick=\"blockUser(" . $row['User_ID'] . ",'$newstatus')\">Block</button>"; | ||||||
|  |               } else { | ||||||
|  |                 $newstatus = "Active"; | ||||||
|  |                 $btnBlock = "<button class='btn-success' onclick=\"blockUser(" . $row['User_ID'] . ",'$newstatus')\">Activate</button>"; | ||||||
|  |               } | ||||||
|  | 
 | ||||||
|  |               echo "<tr><td>" . $row['User_ID'] . "</td><td>" . $row['Full_Name'] . "</td><td>" . $row['Email'] . "</td> <td>" . $row['Passport_Number'] . "</td><td>$btn</td><td>$btnBlock</td></tr>"; | ||||||
|  |             } | ||||||
|  |             ?>
 | ||||||
|  |           </table> | ||||||
|  | 
 | ||||||
|  |         </div> | ||||||
|  | 
 | ||||||
|  |         <!-- code contributed by Xu Xiaopeng (https://github.com/xxp1999) --> | ||||||
|  | 
 | ||||||
|  |         <div id="menu2" class="container tab-pane fade" style="margin-top:10px"> | ||||||
|  |           <b>Separate two student numbers with a space.</b><br> | ||||||
|  |           <form action="batch_insert.php" method="post"> | ||||||
|  |             <p> | ||||||
|  |               <textarea cols="80" rows="16" name="users" required=""></textarea> | ||||||
|  |             </p> | ||||||
|  |             <input type="submit" class="btn btn-primary" value="Register Students"><br> | ||||||
|  |           </form> | ||||||
|  |         </div> | ||||||
|  | 
 | ||||||
|  |       </div> | ||||||
|     </div> |     </div> | ||||||
| 
 | 
 | ||||||
|  |   </div> | ||||||
| 
 | 
 | ||||||
| </div> |   <div class="col-md-6"> | ||||||
| 
 | 
 | ||||||
|  |     <div class="container"> | ||||||
|  |       <!-- Nav tabs --> | ||||||
|  |       <ul class="nav nav-tabs" role="tablist"> | ||||||
|  |         <li class="nav-item"> | ||||||
|  |           <a class="nav-link active" data-toggle="tab" href="#menua"> Course Portal </a> | ||||||
|  |         </li> | ||||||
|  |         <li class="nav-item"> | ||||||
|  |           <a class="nav-link" data-toggle="tab" href="#menub">Existing Courses</a> | ||||||
|  |         </li> | ||||||
| 
 | 
 | ||||||
|  |       </ul> | ||||||
| 
 | 
 | ||||||
|  |       <!-- Tab panes --> | ||||||
|  |       <div class="tab-content"> | ||||||
|  |         <div id="menua" class="container tab-pane active"><br> | ||||||
| 
 | 
 | ||||||
|  |           <hr> | ||||||
|  |           <b>Create new Portal </b> | ||||||
|  | 
 | ||||||
|  |           <form method="post" action="Script.php"> | ||||||
|  |             <input type="hidden" name="frm_createCourse" value="true" required="" /> | ||||||
|  |             Course Name | ||||||
|  |             <input type="text" name="name" placeholder="Course Name" class="form-control" required=""> | ||||||
|  | 
 | ||||||
|  |             Course Code | ||||||
|  |             <input type="text" name="code" placeholder="Course Code" class="form-control" required=""> | ||||||
|  | 
 | ||||||
|  |             URL (Leave blank to use Course Name) | ||||||
|  |             <input type="text" name="url" placeholder="Choose Custom URL " class="form-control" required=""> | ||||||
|  | 
 | ||||||
|  |             Academic Year | ||||||
|  |             <input type="text" name="academic" placeholder="Academic Year" class="form-control" required=""> | ||||||
|  | 
 | ||||||
|  |             Faculty <br> | ||||||
|  |             <input type="text" name="faculty" placeholder="Faculty" class="form-control" required=""> | ||||||
|  | 
 | ||||||
|  |             Assign Lecturer | ||||||
|  |             <br> | ||||||
|  | 
 | ||||||
|  |             <select name="lecturer" class="form-control"> | ||||||
|  |               <?php | ||||||
|  |               $result = mysqli_query($con, "SELECT * FROM Users_Table WHERE UserType='Lecturer'"); | ||||||
|  |               if (mysqli_num_rows($result) == 0) { | ||||||
|  |               } else { | ||||||
|  |                 while ($row = mysqli_fetch_assoc($result)) { | ||||||
|  |                   $id = $row['User_ID']; | ||||||
|  |                   $name = $row['Full_Name']; | ||||||
|  |                   echo "<option value='$id'> $name </option>"; | ||||||
|  |                 } | ||||||
|  |               } ?>
 | ||||||
|  | 
 | ||||||
|  |             </select> | ||||||
|  | 
 | ||||||
|  |             Assigned T/A <br> | ||||||
|  |             <select name="ta" class="form-control"> | ||||||
|  |               <?php | ||||||
|  |               $result = mysqli_query($con, "SELECT * FROM Users_Table WHERE UserType='TA'"); | ||||||
|  |               if (mysqli_num_rows($result) == 0) { | ||||||
|  |               } else { | ||||||
|  |                 while ($row = mysqli_fetch_assoc($result)) { | ||||||
|  |                   $id = $row['User_ID']; | ||||||
|  |                   $name = $row['Full_Name']; | ||||||
|  |                   echo "<option value='$id'> $name </option>"; | ||||||
|  |                 } | ||||||
|  |               } ?>
 | ||||||
|  | 
 | ||||||
|  |             </select> | ||||||
|  | 
 | ||||||
|  |             Verify Joining Students | ||||||
|  |             <input type="radio" name="verify" value="1"> Yes | ||||||
|  |             <input type="radio" name="verify" value="0" checked=""> No | ||||||
|  | 
 | ||||||
|  |             <br> | ||||||
|  |             <input type="submit" class="btn btn-primary" value="Create Portal"><br> | ||||||
|  | 
 | ||||||
|  |           </form> | ||||||
|  | 
 | ||||||
|  |           <?php | ||||||
|  | 
 | ||||||
|  |           error_reporting(E_ALL); | ||||||
|  |           if (isset($_SESSION['info_Admin_Courses'])) { | ||||||
|  |             echo  '<hr><div class="alert alert-info" role="alert">' . $_SESSION['info_Admin_Courses'] . '</div>'; | ||||||
|  |             $_SESSION['info_Admin_Courses'] = null; | ||||||
|  |           } | ||||||
|  |           if (isset($_SESSION['info_Admin_Courses'])) { | ||||||
|  |             echo  '<hr><div class="alert alert-info" role="alert">' . $_SESSION['info_Admin_Courses'] . '</div>'; | ||||||
|  |             $_SESSION['info_Admin_Courses'] = null; | ||||||
|  |           } | ||||||
|  | 
 | ||||||
|  |           ?>
 | ||||||
|  | 
 | ||||||
|  |         </div> | ||||||
|  | 
 | ||||||
|  |         <div id="menub" class="container tab-pane fade"><br> | ||||||
|  | 
 | ||||||
|  |           <b> Existing Course Portals </b> | ||||||
|  |           <hr> | ||||||
|  |           <table class="table-bordered" style="font-size: 10pt;"> | ||||||
|  |             <tr> | ||||||
|  |               <th>Course Name </th> | ||||||
|  |               <th> Faculty </th> | ||||||
|  |               <th>Lecturer </th> | ||||||
|  |               <th>TAs</th> | ||||||
|  |               <th>Assign new TA </th> | ||||||
|  |             </tr> | ||||||
|  |             <?php | ||||||
|  |             $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"); | ||||||
|  |             if (mysqli_num_rows($result) == 0) { | ||||||
|  |             } 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']; | ||||||
|  |                 $c_id = $row['Course_ID']; | ||||||
|  | 
 | ||||||
|  |                 $resultTA = mysqli_query($con, "SELECT `Course_ID`, `TA`,users_table.Full_Name as TA_NAME FROM `course_ta`
 | ||||||
|  | INNER JOIN users_table on users_table.User_ID=course_ta.TA | ||||||
|  | where course_ta.Course_ID=$c_id");
 | ||||||
|  | 
 | ||||||
|  |                 $ta = ""; | ||||||
|  |                 while ($rowTA = mysqli_fetch_assoc($resultTA)) { | ||||||
|  |                   $ta = $ta . "  - " . $rowTA['TA_NAME']; | ||||||
|  |                 } | ||||||
|  | 
 | ||||||
|  |                 echo "  
 | ||||||
|  |                           <tr> <td>$code - $name</td>  <td>$faculty </td> <td>$lecturer</td><td>$ta</td>  <td><form method='get' action='Script.php'> <select name='ta' class=''>";
 | ||||||
|  | 
 | ||||||
|  |                 $resultx = mysqli_query($con, "SELECT * FROM Users_Table WHERE UserType='TA'"); | ||||||
|  |                 if (mysqli_num_rows($resultx) == 0) { | ||||||
|  |                 } else { | ||||||
|  |                   while ($row = mysqli_fetch_assoc($resultx)) { | ||||||
|  |                     $id = $row['User_ID']; | ||||||
|  |                     $name = $row['Full_Name']; | ||||||
|  |                     echo "<option value='$id'> $name </option>"; | ||||||
|  |                   } | ||||||
|  |                 } | ||||||
|  | 
 | ||||||
|  |                 echo "</select>  <input type='hidden' name='assignTA' value='true'> <input type='hidden' name='id' value='$c_id'>  <input type='submit' value='assign'></form> </td></tr>
 | ||||||
|  |                          ";
 | ||||||
|  |               } | ||||||
|  |             } ?>
 | ||||||
|  | 
 | ||||||
|  |           </table> | ||||||
|  | 
 | ||||||
|  |         </div> | ||||||
|  | 
 | ||||||
|  |       </div> | ||||||
|  | 
 | ||||||
|  |     </div> | ||||||
| 
 | 
 | ||||||
|     <script> |     <script> | ||||||
|     function updatePass(id,pass) |       function updatePass(id, pass) { | ||||||
|     { |         if (!confirm('Are you to Reset User Password')) { | ||||||
|       if(!confirm('Are you to Reset User 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) { | ||||||
|     } |         if (!confirm('Are you to change User Status')) { | ||||||
|      |           return; | ||||||
|       function blockUser(id,status) |         } | ||||||
|     { |         window.location.href = "\Script.php\?action=statuschange&uid=" + id + "&status=" + status; | ||||||
|           if(!confirm('Are you to change User Status')) |  | ||||||
|       { |  | ||||||
|         return;   |  | ||||||
|       } |       } | ||||||
|     window.location.href="\Script.php\?action=statuschange&uid="+id+"&status="+status; |  | ||||||
|     } |  | ||||||
|     </script> |     </script> | ||||||
							
								
								
									
										939
									
								
								Course.php
								
								
								
								
							
							
						
						
									
										939
									
								
								Course.php
								
								
								
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Loading…
	
		Reference in New Issue