project_list.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <table class="table table-sm table-hover">
  2. <thead>
  3. <tr>
  4. <th class="text-right pr-3">ID</th>
  5. <th>Name</th>
  6. <th>Template</th>
  7. <th>Period</th>
  8. <th>Year</th>
  9. <th>Report Month</th>
  10. <th></th>
  11. </tr>
  12. </thead>
  13. <tbody>
  14. <?php
  15. foreach($projects as $project) {
  16. $year = date("Y", strtotime($project->dts_start));
  17. $date_start = date("M jS", strtotime(explode(" ", $project->dts_start)[0]));
  18. $date_deadline = date("M jS", strtotime(explode(" ", $project->dts_deadline)[0]));
  19. $report_month = "N/A";
  20. if($project->dts_report) {
  21. $dt_report = new DateTime($project->dts_report . " UTC");
  22. $report_month = $dt_report->format("M Y");
  23. }
  24. $time_of_day_icon = $project->getTimeOfDayIcon();
  25. $time_of_day_text = $project->getTimeOfDayText();
  26. $template = $project->getTemplate();
  27. ?>
  28. <tr>
  29. <td class="text-right pr-3 align-middle">
  30. <?=$project->id?>
  31. </td>
  32. <td class="align-middle">
  33. <a href="/account/projects/<?=$project->id?>"><?=htmlspecialchars($project->name)?></a>
  34. <i class="fal fa-<?=$time_of_day_icon?>" data-toggle="tooltip" data-title="<?=$time_of_day_text?> Tests"></i>
  35. </td>
  36. <td class="align-middle">
  37. <a href="<?=htmlspecialchars($template->getURL())?>"><?=htmlspecialchars($template->name)?></a>
  38. </td>
  39. <td class="align-middle">
  40. <?=$date_start?> -
  41. <?=$date_deadline?>
  42. </td>
  43. <td class="align-middle">
  44. <?=$year?>
  45. </td>
  46. <td class="align-middle">
  47. <?=$report_month?>
  48. </td>
  49. <td class="text-right align-middle">
  50. <a class="btn btn-outline-primary" href="/account/projects/<?=$project->id?>/edit">Edit</a>
  51. </td>
  52. </tr>
  53. <?php
  54. }
  55. ?>
  56. </tbody>
  57. </table>
  58. <?php
  59. if(empty($projects)) {
  60. ?>
  61. <div class="alert alert-info">
  62. No projects to display.
  63. </div>
  64. <?php
  65. }
  66. ?>