list_cron.php 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <!-- Begin toolbar -->
  2. <div class="toolbar">
  3. <div class="toolbar-inner">
  4. <div class="toolbar-buttons">
  5. <?php if ($read_only !== "true") { ?>
  6. <a href="/add/cron/" class="button button-secondary js-button-create">
  7. <i class="fas fa-circle-plus icon-green"></i><?= _("Add Cron Job") ?>
  8. </a>
  9. <?php if ($panel[$user_plain]["CRON_REPORTS"] == "yes") { ?>
  10. <a class="button button-secondary" href="/delete/cron/reports/?token=<?= $_SESSION["token"] ?>">
  11. <i class="fas fa-toggle-off icon-green"></i><?= _("Disable Notifications") ?>
  12. </a>
  13. <?php } else { ?>
  14. <a class="button button-secondary" href="/add/cron/reports/?token=<?= $_SESSION["token"] ?>">
  15. <i class="fas fa-toggle-off"></i><?= _("Enable Notifications") ?>
  16. </a>
  17. <?php } ?>
  18. <?php } ?>
  19. </div>
  20. <div class="toolbar-right">
  21. <div class="toolbar-sorting">
  22. <button class="toolbar-sorting-toggle js-toggle-sorting-menu" type="button" title="<?= _("Sort items") ?>">
  23. <?= _("Sort by") ?>:
  24. <span class="u-text-bold">
  25. <?php if ($_SESSION['userSortOrder'] === 'name') { $label = _('Command'); } else { $label = _('Date'); } ?>
  26. <?= $label ?> <i class="fas fa-arrow-down-a-z"></i>
  27. </span>
  28. </button>
  29. <ul class="toolbar-sorting-menu animate__animated animate__fadeIn js-sorting-menu u-hidden">
  30. <li data-entity="sort-name">
  31. <span class="name <?php if ($_SESSION['userSortOrder'] === 'name') { echo 'active'; } ?>"><?= _("Command") ?> <i class="fas fa-arrow-down-a-z"></i></span><span class="up"><i class="fas fa-arrow-up-a-z"></i></span>
  32. </li>
  33. <li data-entity="sort-date" data-sort-as-int="1">
  34. <span class="name <?php if ($_SESSION['userSortOrder'] === 'date') { echo 'active'; } ?>"><?= _("Date") ?> <i class="fas fa-arrow-down-a-z"></i></span><span class="up"><i class="fas fa-arrow-up-a-z"></i></span>
  35. </li>
  36. </ul>
  37. <?php if ($read_only !== "true") { ?>
  38. <form x-data x-bind="BulkEdit" action="/bulk/cron/" method="post">
  39. <input type="hidden" name="token" value="<?= $_SESSION["token"] ?>">
  40. <select class="form-select" name="action">
  41. <option value=""><?= _("Apply to selected") ?></option>
  42. <?php if ($panel[$user_plain]['CRON_REPORTS'] == 'yes') echo '<option value="delete-cron-reports">' . _('Disable Notifications') . '</option>'; ?>
  43. <?php if ($panel[$user_plain]['CRON_REPORTS'] == 'no') echo '<option value="add-cron-reports">' . _('Enable Notifications') . '</option>'; ?>
  44. <option value="suspend"><?= _("Suspend") ?></option>
  45. <option value="unsuspend"><?= _("Unsuspend") ?></option>
  46. <option value="delete"><?= _("Delete") ?></option>
  47. </select>
  48. <button type="submit" class="toolbar-input-submit" title="<?= _("Apply to selected") ?>">
  49. <i class="fas fa-arrow-right"></i>
  50. </button>
  51. </form>
  52. <?php } ?>
  53. </div>
  54. <div class="toolbar-search">
  55. <form action="/search/" method="get">
  56. <input type="hidden" name="token" value="<?= $_SESSION["token"] ?>">
  57. <input type="search" class="form-control js-search-input" name="q" value="<? echo isset($_POST['q']) ? htmlspecialchars($_POST['q']) : '' ?>" title="<?= _("Search") ?>">
  58. <button type="submit" class="toolbar-input-submit" title="<?= _("Search") ?>">
  59. <i class="fas fa-magnifying-glass"></i>
  60. </button>
  61. </form>
  62. </div>
  63. </div>
  64. </div>
  65. </div>
  66. <!-- End toolbar -->
  67. <div class="container">
  68. <h1 class="u-text-center u-hide-desktop u-mt20 u-pr30 u-mb20 u-pl30"><?= _("Cron Jobs") ?></h1>
  69. <div class="units-table js-units-container">
  70. <div class="units-table-header">
  71. <div class="units-table-cell">
  72. <input type="checkbox" class="js-toggle-all-checkbox" title="<?= _("Select all") ?>" <?= $display_mode ?>>
  73. </div>
  74. <div class="units-table-cell"><?= _("Command") ?></div>
  75. <div class="units-table-cell"></div>
  76. <div class="units-table-cell u-text-center"><?= _("Minute") ?></div>
  77. <div class="units-table-cell u-text-center"><?= _("Hour") ?></div>
  78. <div class="units-table-cell u-text-center"><?= _("Day") ?></div>
  79. <div class="units-table-cell u-text-center"><?= _("Month") ?></div>
  80. <div class="units-table-cell u-text-center"><?= _("Day of Week") ?></div>
  81. </div>
  82. <!-- Begin cron job list item loop -->
  83. <?php
  84. foreach ($data as $key => $value) {
  85. ++$i;
  86. if ($data[$key]['SUSPENDED'] == 'yes') {
  87. $status = 'suspended';
  88. $spnd_action = 'unsuspend';
  89. $spnd_action_title = _('Unsuspend');
  90. $spnd_icon = 'fa-play';
  91. $spnd_icon_class = 'icon-green';
  92. $spnd_confirmation = _('Are you sure you want to unsuspend this cron job?') ;
  93. } else {
  94. $status = 'active';
  95. $spnd_action = 'suspend';
  96. $spnd_action_title = _('Suspend');
  97. $spnd_icon = 'fa-pause';
  98. $spnd_icon_class = 'icon-highlight';
  99. $spnd_confirmation = _('Are you sure you want to suspend this cron job?') ;
  100. }
  101. ?>
  102. <div class="units-table-row <?php if ($status == 'suspended') echo 'disabled'; ?> animate__animated animate__fadeIn js-unit"
  103. data-sort-date="<?= strtotime($data[$key]['DATE'].' '.$data[$key]['TIME']) ?>"
  104. data-sort-name="<?= htmlspecialchars($data[$key]['CMD'], ENT_NOQUOTES) ?>">
  105. <div class="units-table-cell">
  106. <div>
  107. <input id="check<?= $i ?>" class="js-unit-checkbox" type="checkbox" title="<?= _("Select") ?>" name="job[]" value="<?= $key ?>" <?= $display_mode ?>>
  108. <label for="check<?= $i ?>" class="u-hide-desktop"><?= _("Select") ?></label>
  109. </div>
  110. </div>
  111. <div class="units-table-cell units-table-heading-cell u-text-bold">
  112. <span class="u-hide-desktop"><?= _("Command") ?>:</span>
  113. <?php if ($read_only === "true" || $data[$key]["SUSPENDED"] == "yes") { ?>
  114. <?= htmlspecialchars($data[$key]["CMD"], ENT_NOQUOTES) ?>
  115. <?php } else { ?>
  116. <a href="/edit/cron/?job=<?= $data[$key]["JOB"] ?>&token=<?= $_SESSION["token"] ?>" title="<?= _("Edit Cron Job") ?>: <?= htmlspecialchars($data[$key]["CMD"], ENT_NOQUOTES) ?>">
  117. <?= htmlspecialchars($data[$key]["CMD"], ENT_NOQUOTES) ?>
  118. </a>
  119. <?php } ?>
  120. </div>
  121. <div class="units-table-cell">
  122. <?php if (!$read_only) { ?>
  123. <ul class="units-table-row-actions">
  124. <?php if ($data[$key]["SUSPENDED"] == "no") { ?>
  125. <li class="units-table-row-action shortcut-enter" data-key-action="href">
  126. <a
  127. class="units-table-row-action-link"
  128. href="/edit/cron/?job=<?= $data[$key]["JOB"] ?>&token=<?= $_SESSION["token"] ?>"
  129. title="<?= _("Edit") ?>"
  130. >
  131. <i class="fas fa-pencil icon-orange"></i>
  132. <span class="u-hide-desktop"><?= _("Edit") ?></span>
  133. </a>
  134. </li>
  135. <?php } ?>
  136. <li class="units-table-row-action shortcut-s" data-key-action="js">
  137. <a
  138. class="units-table-row-action-link data-controls js-confirm-action"
  139. href="/<?= $spnd_action ?>/cron/?job=<?= $data[$key]["JOB"] ?>&token=<?= $_SESSION["token"] ?>"
  140. title="<?= $spnd_action_title ?>"
  141. data-confirm-title="<?= $spnd_action_title ?>"
  142. data-confirm-message="<?= sprintf($spnd_confirmation, $key) ?>"
  143. >
  144. <i class="fas <?= $spnd_icon ?> <?= $spnd_icon_class ?>"></i>
  145. <span class="u-hide-desktop"><?= $spnd_action_title ?></span>
  146. </a>
  147. </li>
  148. <li class="units-table-row-action shortcut-delete" data-key-action="js">
  149. <a
  150. class="units-table-row-action-link data-controls js-confirm-action"
  151. href="/delete/cron/?job=<?= $data[$key]["JOB"] ?>&token=<?= $_SESSION["token"] ?>"
  152. title="<?= _("Delete") ?>"
  153. data-confirm-title="<?= _("Delete") ?>"
  154. data-confirm-message="<?= sprintf(_("Are you sure you want to delete this cron job?"), $key) ?>"
  155. >
  156. <i class="fas fa-trash icon-red"></i>
  157. <span class="u-hide-desktop"><?= _("Delete") ?></span>
  158. </a>
  159. </li>
  160. </ul>
  161. <?php } ?>
  162. </div>
  163. <div class="units-table-cell u-text-center-desktop">
  164. <span class="u-hide-desktop u-text-bold"><?= _("Minute") ?>:</span>
  165. <?= $data[$key]["MIN"] ?>
  166. </div>
  167. <div class="units-table-cell u-text-center-desktop">
  168. <span class="u-hide-desktop u-text-bold"><?= _("Hour") ?>:</span>
  169. <?= $data[$key]["HOUR"] ?>
  170. </div>
  171. <div class="units-table-cell u-text-center-desktop">
  172. <span class="u-hide-desktop u-text-bold"><?= _("Day") ?>:</span>
  173. <?= $data[$key]["DAY"] ?>
  174. </div>
  175. <div class="units-table-cell u-text-center-desktop">
  176. <span class="u-hide-desktop u-text-bold"><?= _("Month") ?>:</span>
  177. <?= $data[$key]["MONTH"] ?>
  178. </div>
  179. <div class="units-table-cell u-text-center-desktop">
  180. <span class="u-hide-desktop u-text-bold"><?= _("Day of Week") ?>:</span>
  181. <?= $data[$key]["WDAY"] ?>
  182. </div>
  183. </div>
  184. <?php } ?>
  185. </div>
  186. </div>
  187. <footer class="app-footer">
  188. <div class="container app-footer-inner">
  189. <p>
  190. <?php printf(ngettext("%d cron job", "%d cron jobs", $i), $i); ?>
  191. </p>
  192. </div>
  193. </footer>