MDL-55980 Scheduled tasks: Run individual scheduled tasks from web

This commit is contained in:
sam marshall
2017-02-24 10:42:28 +00:00
parent 0f59b6dd75
commit 38fa1ca558
10 changed files with 348 additions and 48 deletions
+19 -1
View File
@@ -104,11 +104,19 @@ class tool_task_renderer extends plugin_renderer_base {
$nextrun = $asap;
}
$runnow = '';
if (!$disabled && get_config('tool_task', 'enablerunnow')) {
$runnow = html_writer::div(html_writer::link(
new moodle_url('/admin/tool/task/schedule_task.php',
array('task' => get_class($task))),
get_string('runnow', 'tool_task')), 'task-runnow');
}
$row = new html_table_row(array(
$namecell,
$componentcell,
new html_table_cell($editlink),
new html_table_cell($lastrun),
new html_table_cell($lastrun . $runnow),
new html_table_cell($nextrun),
new html_table_cell($task->get_minute()),
new html_table_cell($task->get_hour()),
@@ -133,4 +141,14 @@ class tool_task_renderer extends plugin_renderer_base {
$table->data = $data;
return html_writer::table($table);
}
/**
* Renders a link back to the scheduled tasks page (used from the 'run now' screen).
*
* @return string HTML code
*/
public function link_back() {
return $this->render_from_template('tool_task/link_back',
array('url' => new moodle_url('/admin/tool/task/scheduledtasks.php')));
}
}