degreeList.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. $query = "SELECT * FROM degrees";
  7. $result = mysqli_query($db, $query);
  8. if (mysqli_num_rows($result) < 1) {
  9. header("Location: /admin/admin.php?msg=No Degrees");
  10. }
  11. ?>
  12. <!DOCTYPE html>
  13. <html lang="en">
  14. <head>
  15. <title>Degree List</title>
  16. <link rel="stylesheet" type="text/css" href="adminStyle.css">
  17. <link rel="stylesheet" type="text/css" href="tableStyle.css">
  18. </head>
  19. <?php
  20. include($root . "/admin/header.php");
  21. ?>
  22. <main>
  23. <body>
  24. <li><a href="/admin/admin.php">Back</a></li>
  25. <table border="1px" id="users">
  26. <thead>
  27. <tr>
  28. <th>Actions</th>
  29. <th>DegreeID</th>
  30. <th>Name</th>
  31. <th>Description</th>
  32. </tr>
  33. </thead>
  34. <tbody>
  35. <?php //ugly php + html hybrid code that does stuff
  36. while ($row = mysqli_fetch_assoc($result)) { ?>
  37. <tr>
  38. <td>
  39. <a href="/admin/degreeMod.php?degreeID=<?php echo $row['degreeID'] ?>">Modify</a>
  40. <a href="/admin/subjectList.php?degreeID=<?php echo $row['degreeID'] ?>">List Subjects</a>
  41. <a href="/admin/subjectAdd.php?degreeID=<?php echo $row['degreeID'] ?>">Add a subject</a>
  42. <a href="/admin/degreeDel.php?degreeID=<?php echo $row['degreeID'] ?>">Delete</a>
  43. </td>
  44. <td><?php echo $row['degreeID']; ?>
  45. </td>
  46. <td><?php echo $row['degreeName']; ?></td>
  47. <td><?php echo $row['description']; ?></td>
  48. </tr>
  49. <?php } ?>
  50. </tbody>
  51. </table>
  52. </body>
  53. </html>
  54. </main>
  55. <?php
  56. include($root . "/admin/footer.php");
  57. ?>