list_cron.php 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  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. <div class="units-table js-units-container">
  69. <div class="units-table-header">
  70. <div class="units-table-cell">
  71. <input type="checkbox" class="js-toggle-all-checkbox" title="<?= _("Select all") ?>" <?= $display_mode ?>>
  72. </div>
  73. <div class="units-table-cell"><?= _("Command") ?></div>
  74. <div class="units-table-cell"></div>
  75. <div class="units-table-cell u-text-center"><?= _("Minute") ?></div>
  76. <div class="units-table-cell u-text-center"><?= _("Hour") ?></div>
  77. <div class="units-table-cell u-text-center"><?= _("Day") ?></div>
  78. <div class="units-table-cell u-text-center"><?= _("Month") ?></div>
  79. <div class="units-table-cell u-text-center"><?= _("Day of Week") ?></div>
  80. </div>
  81. <!-- Begin cron job list item loop -->
  82. <?php
  83. foreach ($data as $key => $value) {
  84. ++$i;
  85. if ($data[$key]['SUSPENDED'] == 'yes') {
  86. $status = 'suspended';
  87. $spnd_action = 'unsuspend';
  88. $spnd_action_title = _('Unsuspend');
  89. $spnd_icon = 'fa-play';
  90. $spnd_icon_class = 'icon-green';
  91. $spnd_confirmation = _('Are you sure you want to unsuspend this cron job?') ;
  92. } else {
  93. $status = 'active';
  94. $spnd_action = 'suspend';
  95. $spnd_action_title = _('Suspend');
  96. $spnd_icon = 'fa-pause';
  97. $spnd_icon_class = 'icon-highlight';
  98. $spnd_confirmation = _('Are you sure you want to suspend this cron job?') ;
  99. }
  100. ?>
  101. <div class="units-table-row <?php if ($status == 'suspended') echo 'disabled'; ?> animate__animated animate__fadeIn js-unit"
  102. data-sort-date="<?=strtotime($data[$key]['DATE'].' '.$data[$key]['TIME'])?>"
  103. data-sort-name="<?=htmlspecialchars($data[$key]['CMD'], ENT_NOQUOTES)?>">
  104. <div class="units-table-cell">
  105. <div>
  106. <input id="check<?= $i ?>" class="js-unit-checkbox" type="checkbox" title="<?= _("Select") ?>" name="job[]" value="<?= $key ?>" <?= $display_mode ?>>
  107. <label for="check<?= $i ?>" class="u-hide-desktop"><?= _("Select") ?></label>
  108. </div>
  109. </div>
  110. <div class="units-table-cell u-text-bold">
  111. <span class="u-hide-desktop"><?= _("Command") ?>:</span>
  112. <?php if ($read_only === "true" || $data[$key]["SUSPENDED"] == "yes") { ?>
  113. <?= htmlspecialchars($data[$key]["CMD"], ENT_NOQUOTES) ?>
  114. <?php } else { ?>
  115. <a href="/edit/cron/?job=<?=$data[$key]['JOB']?>&token=<?=$_SESSION['token']?>" title="<?= _("Edit Cron Job") ?>: <?=htmlspecialchars($data[$key]['CMD'], ENT_NOQUOTES)?>">
  116. <?=htmlspecialchars($data[$key]['CMD'], ENT_NOQUOTES)?>
  117. </a>
  118. <?php } ?>
  119. </div>
  120. <div class="units-table-cell">
  121. <?php if (!$read_only) { ?>
  122. <ul class="units-table-row-actions">
  123. <?php if ($data[$key]['SUSPENDED'] == 'no') {?>
  124. <li class="units-table-row-action shortcut-enter" data-key-action="href">
  125. <a
  126. class="units-table-row-action-link"
  127. href="/edit/cron/?job=<?=$data[$key]['JOB']?>&token=<?=$_SESSION['token']?>"
  128. title="<?= _("Edit") ?>"
  129. >
  130. <i class="fas fa-pencil icon-orange"></i>
  131. <span class="u-hide-desktop"><?= _("Edit") ?></span>
  132. </a>
  133. </li>
  134. <?php } ?>
  135. <li class="units-table-row-action shortcut-s" data-key-action="js">
  136. <a
  137. class="units-table-row-action-link data-controls js-confirm-action"
  138. href="/<?= $spnd_action ?>/cron/?job=<?= $data[$key]["JOB"] ?>&token=<?= $_SESSION["token"] ?>"
  139. title="<?= $spnd_action_title ?>"
  140. data-confirm-title="<?= $spnd_action_title ?>"
  141. data-confirm-message="<?= sprintf($spnd_confirmation, $key) ?>"
  142. >
  143. <i class="fas <?= $spnd_icon ?> <?= $spnd_icon_class ?>"></i>
  144. <span class="u-hide-desktop"><?= $spnd_action_title ?></span>
  145. </a>
  146. </li>
  147. <li class="units-table-row-action shortcut-delete" data-key-action="js">
  148. <a
  149. class="units-table-row-action-link data-controls js-confirm-action"
  150. href="/delete/cron/?job=<?= $data[$key]["JOB"] ?>&token=<?= $_SESSION["token"] ?>"
  151. title="<?= _("Delete") ?>"
  152. data-confirm-title="<?= _("Delete") ?>"
  153. data-confirm-message="<?= sprintf(_("Are you sure you want to delete this cron job?"), $key) ?>"
  154. >
  155. <i class="fas fa-trash icon-red"></i>
  156. <span class="u-hide-desktop"><?= _("Delete") ?></span>
  157. </a>
  158. </li>
  159. </ul>
  160. <?php } ?>
  161. </div>
  162. <div class="units-table-cell u-text-center-desktop">
  163. <span class="u-hide-desktop u-text-bold"><?= _("Minute") ?>:</span>
  164. <?= $data[$key]["MIN"] ?>
  165. </div>
  166. <div class="units-table-cell u-text-center-desktop">
  167. <span class="u-hide-desktop u-text-bold"><?= _("Hour") ?>:</span>
  168. <?= $data[$key]["HOUR"] ?>
  169. </div>
  170. <div class="units-table-cell u-text-center-desktop">
  171. <span class="u-hide-desktop u-text-bold"><?= _("Day") ?>:</span>
  172. <?= $data[$key]["DAY"] ?>
  173. </div>
  174. <div class="units-table-cell u-text-center-desktop">
  175. <span class="u-hide-desktop u-text-bold"><?= _("Month") ?>:</span>
  176. <?= $data[$key]["MONTH"] ?>
  177. </div>
  178. <div class="units-table-cell u-text-center-desktop">
  179. <span class="u-hide-desktop u-text-bold"><?= _("Day of Week") ?>:</span>
  180. <?= $data[$key]["WDAY"] ?>
  181. </div>
  182. </div>
  183. <?php } ?>
  184. </div>
  185. </div>
  186. <footer class="app-footer">
  187. <div class="container app-footer-inner">
  188. <p>
  189. <?php printf(ngettext("%d cron job", "%d cron jobs", $i), $i); ?>
  190. </p>
  191. </div>
  192. </footer>