ManageScheduledTasks.template.php 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <?php
  2. /**
  3. * Simple Machines Forum (SMF)
  4. *
  5. * @package SMF
  6. * @author Simple Machines
  7. * @copyright 2011 Simple Machines
  8. * @license http://www.simplemachines.org/about/smf/license.php BSD
  9. *
  10. * @version 2.1 Alpha 1
  11. */
  12. // Template for listing all scheduled tasks.
  13. function template_view_scheduled_tasks()
  14. {
  15. global $context, $settings, $options, $txt, $scripturl, $modSettings;
  16. // We completed some tasks?
  17. if (!empty($context['tasks_were_run']))
  18. echo '
  19. <div id="task_completed">
  20. ', $txt['scheduled_tasks_were_run'], '
  21. </div>';
  22. template_show_list('scheduled_tasks');
  23. }
  24. // A template for, you guessed it, editing a task!
  25. function template_edit_scheduled_tasks()
  26. {
  27. global $context, $settings, $options, $txt, $scripturl, $modSettings;
  28. // Starts off with general maintenance procedures.
  29. echo '
  30. <div id="admincenter">
  31. <form action="', $scripturl, '?action=admin;area=scheduledtasks;sa=taskedit;save;tid=', $context['task']['id'], '" method="post" accept-charset="', $context['character_set'], '">
  32. <div class="cat_bar">
  33. <h3 class="catbg">', $txt['scheduled_task_edit'], '</h3>
  34. </div>
  35. <div class="information">
  36. <em>', sprintf($txt['scheduled_task_time_offset'], $context['server_time']), ' </em>
  37. </div>
  38. <div class="windowbg">
  39. <div class="content">
  40. <dl class="settings">
  41. <dt>
  42. <strong>', $txt['scheduled_tasks_name'], ':</strong>
  43. </dt>
  44. <dd>
  45. ', $context['task']['name'], '<br />
  46. <span class="smalltext">', $context['task']['desc'], '</span>
  47. </dd>
  48. <dt>
  49. <strong><label for="regularity">', $txt['scheduled_task_edit_interval'], ':</label></strong>
  50. </dt>
  51. <dd>
  52. ', $txt['scheduled_task_edit_repeat'], '
  53. <input type="text" name="regularity" id="regularity" value="', empty($context['task']['regularity']) ? 1 : $context['task']['regularity'], '" onchange="if (this.value < 1) this.value = 1;" size="2" maxlength="2" class="input_text" />
  54. <select name="unit">
  55. <option value="0">', $txt['scheduled_task_edit_pick_unit'], '</option>
  56. <option value="0">---------------------</option>
  57. <option value="m" ', empty($context['task']['unit']) || $context['task']['unit'] == 'm' ? 'selected="selected"' : '', '>', $txt['scheduled_task_reg_unit_m'], '</option>
  58. <option value="h" ', $context['task']['unit'] == 'h' ? 'selected="selected"' : '', '>', $txt['scheduled_task_reg_unit_h'], '</option>
  59. <option value="d" ', $context['task']['unit'] == 'd' ? 'selected="selected"' : '', '>', $txt['scheduled_task_reg_unit_d'], '</option>
  60. <option value="w" ', $context['task']['unit'] == 'w' ? 'selected="selected"' : '', '>', $txt['scheduled_task_reg_unit_w'], '</option>
  61. </select>
  62. </dd>
  63. <dt>
  64. <strong><label for="start_time">', $txt['scheduled_task_edit_start_time'], ':</label></strong><br />
  65. <span class="smalltext">', $txt['scheduled_task_edit_start_time_desc'], '</span>
  66. </dt>
  67. <dd>
  68. <input type="text" name="offset" id="start_time" value="', $context['task']['offset_formatted'], '" size="6" maxlength="5" class="input_text" />
  69. </dd>
  70. <dt>
  71. <strong><label for="enabled">', $txt['scheduled_tasks_enabled'], ':</label></strong>
  72. </dt>
  73. <dd>
  74. <input type="checkbox" name="enabled" id="enabled" ', !$context['task']['disabled'] ? 'checked="checked"' : '', ' class="input_check" />
  75. </dd>
  76. </dl>
  77. <div class="righttext">
  78. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  79. <input type="hidden" name="', $context['admin-st_token_var'], '" value="', $context['admin-st_token'], '" />
  80. <input type="submit" name="save" value="', $txt['scheduled_tasks_save_changes'], '" class="button_submit" />
  81. </div>
  82. </div>
  83. </div>
  84. </form>
  85. </div>
  86. <br class="clear" />';
  87. }
  88. ?>