2
0

ManageScheduledTasks.template.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. <span class="topslice"><span></span></span>
  40. <div class="content">
  41. <dl class="settings">
  42. <dt>
  43. <strong>', $txt['scheduled_tasks_name'], ':</strong>
  44. </dt>
  45. <dd>
  46. ', $context['task']['name'], '<br />
  47. <span class="smalltext">', $context['task']['desc'], '</span>
  48. </dd>
  49. <dt>
  50. <strong><label for="regularity">', $txt['scheduled_task_edit_interval'], ':</label></strong>
  51. </dt>
  52. <dd>
  53. ', $txt['scheduled_task_edit_repeat'], '
  54. <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" />
  55. <select name="unit">
  56. <option value="0">', $txt['scheduled_task_edit_pick_unit'], '</option>
  57. <option value="0">---------------------</option>
  58. <option value="m" ', empty($context['task']['unit']) || $context['task']['unit'] == 'm' ? 'selected="selected"' : '', '>', $txt['scheduled_task_reg_unit_m'], '</option>
  59. <option value="h" ', $context['task']['unit'] == 'h' ? 'selected="selected"' : '', '>', $txt['scheduled_task_reg_unit_h'], '</option>
  60. <option value="d" ', $context['task']['unit'] == 'd' ? 'selected="selected"' : '', '>', $txt['scheduled_task_reg_unit_d'], '</option>
  61. <option value="w" ', $context['task']['unit'] == 'w' ? 'selected="selected"' : '', '>', $txt['scheduled_task_reg_unit_w'], '</option>
  62. </select>
  63. </dd>
  64. <dt>
  65. <strong><label for="start_time">', $txt['scheduled_task_edit_start_time'], ':</label></strong><br />
  66. <span class="smalltext">', $txt['scheduled_task_edit_start_time_desc'], '</span>
  67. </dt>
  68. <dd>
  69. <input type="text" name="offset" id="start_time" value="', $context['task']['offset_formatted'], '" size="6" maxlength="5" class="input_text" />
  70. </dd>
  71. <dt>
  72. <strong><label for="enabled">', $txt['scheduled_tasks_enabled'], ':</label></strong>
  73. </dt>
  74. <dd>
  75. <input type="checkbox" name="enabled" id="enabled" ', !$context['task']['disabled'] ? 'checked="checked"' : '', ' class="input_check" />
  76. </dd>
  77. </dl>
  78. <div class="righttext">
  79. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  80. <input type="hidden" name="', $context['admin-st_token_var'], '" value="', $context['admin-st_token'], '" />
  81. <input type="submit" name="save" value="', $txt['scheduled_tasks_save_changes'], '" class="button_submit" />
  82. </div>
  83. </div>
  84. <span class="botslice"><span></span></span>
  85. </div>
  86. </form>
  87. </div>
  88. <br class="clear" />';
  89. }
  90. ?>