From 0e0dcd3f9b17bac81db6ed7f52d343551142ed5b Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sat, 16 Jul 2016 15:28:26 +0200 Subject: [PATCH] Creating job, workflow. Removing logger --- Admin/Install/Navigation.install.json | 88 ++++++++++------------- Admin/Routes/http.php | 6 ++ Controller.php | 19 +++++ Models/WorkflowStatus.php | 39 ++++++++++ Theme/Backend/Lang/Navigation.en.lang.php | 3 + Theme/Backend/Lang/en.lang.php | 5 ++ Theme/Backend/workflow-dashboard.tpl.php | 52 ++++++++++++++ 7 files changed, 160 insertions(+), 52 deletions(-) create mode 100644 Models/WorkflowStatus.php create mode 100644 Theme/Backend/workflow-dashboard.tpl.php diff --git a/Admin/Install/Navigation.install.json b/Admin/Install/Navigation.install.json index 80a8f51..8fa4022 100644 --- a/Admin/Install/Navigation.install.json +++ b/Admin/Install/Navigation.install.json @@ -1,77 +1,61 @@ [ { - "id": 1001101001, + "id": 1005501001, "pid": "754a08ddf8bcb1cf22f310f09206dd783d42f7dd", - "type": 1, + "type": 2, "subtype": 1, - "name": "Tasks", - "uri": "/{/lang}/backend/task/dashboard", + "name": "Workflows", + "uri": "/{/lang}/backend/workflow/dashboard", "target": "self", - "icon": "fa fa-bolt", - "order": 15, - "from": "Tasks", + "icon": null, + "order": 40, + "from": "Wokflow", "permission": null, - "parent": 0, + "parent": 1003301001, "children": [ { - "id": 1001102001, - "pid": "43ec7cda8be033d7b20996708a2fca644e5dde86", + "id": 1005502001, + "pid": "ac3d9bdf783c7963f449488e33c60133b3dbe6f8", "type": 3, "subtype": 1, - "name": "List", - "uri": "/{/lang}/backend/task/dashboard", + "name": "Dashboard", + "uri": "/{/lang}/backend/workflow/dashboard", "target": "self", "icon": null, "order": 1, - "from": "Tasks", + "from": "Wokflow", "permission": null, - "parent": 1001101001, - "children": [ - { - "id": 1001102101, - "pid": "43ec7cda8be033d7b20996708a2fca644e5dde86", - "type": 0, - "subtype": 1, - "name": "Tasks", - "uri": "/{/lang}/backend/task/single", - "target": "self", - "icon": null, - "order": 1, - "from": "Tasks", - "permission": null, - "parent": 1001102001, - "children": [] - } - ] - }, - { - "id": 1001103001, - "pid": "43ec7cda8be033d7b20996708a2fca644e5dde86", - "type": 3, - "subtype": 1, - "name": "Create", - "uri": "/{/lang}/backend/task/create", - "target": "self", - "icon": null, - "order": 10, - "from": "Tasks", - "permission": null, - "parent": 1001101001, + "parent": 1005501001, "children": [] }, { - "id": 1001104001, - "pid": "43ec7cda8be033d7b20996708a2fca644e5dde86", + "id": 1005503001, + "pid": "ac3d9bdf783c7963f449488e33c60133b3dbe6f8", "type": 3, "subtype": 1, - "name": "Analysis", - "uri": "/{/lang}/backend/task/analysis", + "name": "Templates", + "uri": "/{/lang}/backend/workflow/template/list", "target": "self", "icon": null, - "order": 20, - "from": "Tasks", + "order": 5, + "from": "Wokflow", "permission": null, - "parent": 1001101001, + "parent": 1005501001, + "children": [] + }, + { + "id": 1005504001, + "pid": "ac3d9bdf783c7963f449488e33c60133b3dbe6f8", + "type": 3, + "subtype": 1, + "name": "Create", + "uri": "/{/lang}/backend/workflow/template/create", + "target": "self", + "icon": null, + "order": 10, + "from": "Wokflow", + "permission": null, + "parent": 1005501001, "children": [] } ] diff --git a/Admin/Routes/http.php b/Admin/Routes/http.php index 527a0b3..2ac473e 100644 --- a/Admin/Routes/http.php +++ b/Admin/Routes/http.php @@ -21,6 +21,12 @@ return [ 'verb' => RouteVerb::GET, ], ], + '^.*/backend/workflow/dashboard.*$' => [ + [ + 'dest' => '\Modules\Workflow\Controller:viewWorkflowDashboard', + 'verb' => RouteVerb::GET, + ], + ], '^.*/backend/workflow/single.*$' => [ [ 'dest' => '\Modules\Workflow\Controller:viewWorkflowSingle', diff --git a/Controller.php b/Controller.php index 6134893..624871d 100644 --- a/Controller.php +++ b/Controller.php @@ -152,4 +152,23 @@ class Controller extends ModuleAbstract implements WebInterface return $view; } + /** + * @param RequestAbstract $request Request + * @param ResponseAbstract $response Response + * @param mixed $data Generic data + * + * @return \Serializable + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function viewWorkflowDashboard(RequestAbstract $request, ResponseAbstract $response, $data = null) : \Serializable + { + $view = new View($this->app, $request, $response); + $view->setTemplate('/Modules/Workflow/Theme/Backend/workflow-dashboard'); + $view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1005501001, $request, $response)); + + return $view; + } + } diff --git a/Models/WorkflowStatus.php b/Models/WorkflowStatus.php new file mode 100644 index 0000000..bdad6a2 --- /dev/null +++ b/Models/WorkflowStatus.php @@ -0,0 +1,39 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace Modules\Workflow\Models; + +use phpOMS\Datatypes\Enum; + +/** + * Task status enum. + * + * @category Workflow + * @package Modules + * @author OMS Development Team + * @author Dennis Eichhorn + * @license OMS License 1.0 + * @link http://orange-management.com + * @since 1.0.0 + */ +abstract class WorkflowStatus extends Enum +{ + const OPEN = 1; + const WORKING = 2; + const SUSPENDED = 3; + const CANCELED = 4; + const DONE = 5; + const CLOSED = 6; +} diff --git a/Theme/Backend/Lang/Navigation.en.lang.php b/Theme/Backend/Lang/Navigation.en.lang.php index 7723651..cdb4805 100644 --- a/Theme/Backend/Lang/Navigation.en.lang.php +++ b/Theme/Backend/Lang/Navigation.en.lang.php @@ -14,6 +14,9 @@ * @link http://orange-management.com */ return ['Navigation' => [ + 'Create' => 'Create', + 'Dashboard' => 'Dashboard', + 'Templates' => 'Templates', 'Workflows' => 'Workflows', 'Workflow' => 'Workflow', ]]; diff --git a/Theme/Backend/Lang/en.lang.php b/Theme/Backend/Lang/en.lang.php index 3995d95..3a3d870 100644 --- a/Theme/Backend/Lang/en.lang.php +++ b/Theme/Backend/Lang/en.lang.php @@ -14,6 +14,11 @@ * @link http://orange-management.com */ return ['Workflow' => [ + 'Created' => 'Created', + 'Creator' => 'Creator', + 'Next' => 'Next', + 'Status' => 'Status', + 'Title' => 'Title', 'Workflow' => 'Workflow', 'Workflows' => 'Workflows', ]]; diff --git a/Theme/Backend/workflow-dashboard.tpl.php b/Theme/Backend/workflow-dashboard.tpl.php new file mode 100644 index 0000000..2e55ab9 --- /dev/null +++ b/Theme/Backend/workflow-dashboard.tpl.php @@ -0,0 +1,52 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +/** + * @var \phpOMS\Views\View $this + */ +$workflows = []; + +echo $this->getData('nav')->render(); ?> + +
+ + + + + + $workflow) : $c++; + $url = \phpOMS\Uri\UriFactory::build('/{/lang}/backend/task/single?id=' . $workflow->getId()); + $color = 'darkred'; + if($workflow->getStatus() === \Modules\Workflow\Models\WorkflowStatus::DONE) { $color = 'green'; } + elseif($workflow->getStatus() === \Modules\Workflow\Models\WorkflowStatus::OPEN) { $color = 'darkblue'; } + elseif($workflow->getStatus() === \Modules\Workflow\Models\WorkflowStatus::WORKING) { $color = 'purple'; } + elseif($workflow->getStatus() === \Modules\Workflow\Models\WorkflowStatus::CANCELED) { $color = 'red'; } + elseif($workflow->getStatus() === \Modules\Workflow\Models\WorkflowStatus::SUSPENDED) { $color = 'yellow'; } ;?> + +
l11n->getText('Workflow', 'Backend', 'Workflow'); ?>
l11n->getText('Workflow', 'Backend', 'Status'); ?> + l11n->getText('Workflow', 'Backend', 'Next'); ?> + l11n->getText('Workflow', 'Backend', 'Title'); ?> + l11n->getText('Workflow', 'Backend', 'Creator'); ?> + l11n->getText('Workflow', 'Backend', 'Created'); ?> +
l11n->getText('Workflow', 'Backend', 'S' . $workflow->getStatus()); ?> + getDue()->format('Y-m-d H:i'); ?> + getTitle(); ?> + getCreatedBy(); ?> + getCreatedAt()->format('Y-m-d H:i'); ?> + +
l11n->getText(0, 'Backend', 'Empty'); ?> + +
+
\ No newline at end of file