subjectList.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. $root = $_SERVER['DOCUMENT_ROOT'];
  3. include($root . "/util/session.php");//checks that the user is logged in
  4. include($root . "/util/privilege_check.php");
  5. checkPrivilege("admin");
  6. $degreeID=mysqli_real_escape_string($db,$_GET['degreeID']);
  7. $query = "SELECT * FROM subjects where degreeID='$degreeID'";
  8. $result = mysqli_query($db,$query);
  9. if(mysqli_num_rows($result) < 1){
  10. header("Location: /admin/admin.php?msg=No Subjects");
  11. }
  12. ?>
  13. <!DOCTYPE html>
  14. <html lang="en">
  15. <head>
  16. <title>Subject List</title>
  17. <link rel="stylesheet" type="text/css" href="adminStyle.css">
  18. <link rel="stylesheet" type="text/css" href="tableStyle.css">
  19. </head>
  20. <body>
  21. <?php
  22. include($root . "/admin/header.php");
  23. ?>
  24. <li><a href="/admin/degreeList.php">Back</a></li>
  25. <table border="1px" id="users">
  26. <thead>
  27. <tr>
  28. <th>Actions</th>
  29. <th>Subject ID</th>
  30. <th>Name</th>
  31. <th>Description</th>
  32. <th>Coordinator</th>
  33. </tr>
  34. </thead>
  35. <tbody>
  36. <?php //ugly php + html hybrid code that does stuff
  37. while($row=mysqli_fetch_assoc($result)){?>
  38. <tr>
  39. <td>
  40. <a href="/admin/subjectMod.php?subjectID=<?php echo $row['subjectID']?>&&degreeID=<?php echo $row['degreeID']?>">Modify</a>
  41. <a href="/admin/subjectDel.php?subjectID=<?php echo $row['subjectID']?>&&degreeID=<?php echo $row['degreeID']?>">Delete</a>
  42. <a href="/admin/subjectsStudentsList.php?subjectID=<?php echo $row['subjectID']?>&&degreeID=<?php echo $row['degreeID']?>">List students</a>
  43. </td>
  44. <td><?php echo $row['subjectID']; ?>
  45. </td>
  46. <td><?php echo $row['subjectName']; ?></td>
  47. <td><?php echo $row['description']; ?></td>
  48. <td><?php echo $row['coordinatorID']; ?></td>
  49. </tr>
  50. <?php }?>
  51. </tbody>
  52. </table>
  53. <?php
  54. include($root . "/admin/footer.php");
  55. ?>
  56. </body>
  57. </html>