Refactor the admin maintenance screen so that events are used to pupluate the action buttons and other content such as the list of scheduled tasks.

This commit is contained in:
Tim Almdal
2010-02-02 14:34:50 -08:00
parent 8a9301f756
commit 19fee6b5e4
2 changed files with 16 additions and 11 deletions

View File

@@ -44,10 +44,17 @@ class Admin_Maintenance_Controller extends Admin_Controller {
$view->content->task_definitions = task::get_definitions();
$view->content->running_tasks = ORM::factory("task")
->where("done", "=", 0)->order_by("updated", "DESC")->find_all();
$view->content->schedule_definitions =
module::is_active("scheduler") ? scheduler::get_definitions() : "";
$view->content->finished_tasks = ORM::factory("task")
->where("done", "=", 1)->order_by("updated", "DESC")->find_all();
$task_buttons =
new ArrayObject(array((object)array("text" => t("run"),
"url" =>url::site("admin/maintenance/start"))));
module::event("admin_maintenance_task_buttons", $task_buttons);
$view->content->task_buttons = $task_buttons;
$maintenance_content = new ArrayObject();
module::event("admin_maintenance_content", $maintenance_content);
$view->content->task_maintenance_content = $maintenance_content;
print $view;
}