From 4e49c2176f8a001aed1a2eaf31940ce3490d63e8 Mon Sep 17 00:00:00 2001 From: Deon George Date: Thu, 2 May 2013 19:52:19 +1000 Subject: [PATCH] Enhancements to Task --- application/classes/Menu.php | 42 +++++++++ .../classes/Controller/Task/Invoice.php | 2 + .../task/classes/Controller/Admin/Task.php | 19 ++-- modules/task/classes/Controller/Task.php | 15 +++ modules/task/classes/Model/Task.php | 91 ++----------------- modules/task/classes/Model/Task/Log.php | 4 + modules/task/classes/Task/Task/Listactive.php | 25 ++--- modules/task/classes/Task/Task/Run.php | 86 +++++++++++++++--- 8 files changed, 162 insertions(+), 122 deletions(-) create mode 100644 modules/task/classes/Controller/Task.php diff --git a/application/classes/Menu.php b/application/classes/Menu.php index c2614a98..1b1e84d3 100644 --- a/application/classes/Menu.php +++ b/application/classes/Menu.php @@ -23,7 +23,49 @@ class Menu { if (empty($result[$mmo->id])) $result[$mmo->id] = $mmo; + return static::collapse($result); + } + + private static function collapse(array $array) { + $result = array(); + + foreach ($array as $item) { + if (isset($result[$item->module->name])) { + if (! is_array($result[$item->module->name])) + $result[$item->module->name] = array($result[$item->module->name]); + + array_push($result[$item->module->name],$item); + + continue; + + } else { + $result[$item->module->name] = $item; + } + } + return $result; } + + public static function ul(array $result,array $append=NULL,$sub=FALSE) { + $output = $sub ? '