Creating job, workflow. Removing logger

This commit is contained in:
Dennis Eichhorn 2016-07-16 15:28:26 +02:00
parent 384bb106ae
commit 0e0dcd3f9b
7 changed files with 160 additions and 52 deletions

View File

@ -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": []
}
]

View File

@ -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',

View File

@ -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 <d.eichhorn@oms.com>
*/
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;
}
}

39
Models/WorkflowStatus.php Normal file
View File

@ -0,0 +1,39 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @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 <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @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;
}

View File

@ -14,6 +14,9 @@
* @link http://orange-management.com
*/
return ['Navigation' => [
'Create' => 'Create',
'Dashboard' => 'Dashboard',
'Templates' => 'Templates',
'Workflows' => 'Workflows',
'Workflow' => 'Workflow',
]];

View File

@ -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',
]];

View File

@ -0,0 +1,52 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @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(); ?>
<div class="box w-100 floatLeft">
<table class="table">
<caption><?= $this->l11n->getText('Workflow', 'Backend', 'Workflow'); ?></caption>
<thead>
<td><?= $this->l11n->getText('Workflow', 'Backend', 'Status'); ?>
<td><?= $this->l11n->getText('Workflow', 'Backend', 'Next'); ?>
<td class="full"><?= $this->l11n->getText('Workflow', 'Backend', 'Title'); ?>
<td><?= $this->l11n->getText('Workflow', 'Backend', 'Creator'); ?>
<td><?= $this->l11n->getText('Workflow', 'Backend', 'Created'); ?>
<tfoot>
<tbody>
<?php $c = 0; foreach($workflows as $key => $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'; } ;?>
<tr>
<td><a href="<?= $url; ?>"><span class="tag <?= $color; ?>"><?= $this->l11n->getText('Workflow', 'Backend', 'S' . $workflow->getStatus()); ?></span></a>
<td><a href="<?= $url; ?>"><?= $workflow->getDue()->format('Y-m-d H:i'); ?></a>
<td><a href="<?= $url; ?>"><?= $workflow->getTitle(); ?></a>
<td><a href="<?= $url; ?>"><?= $workflow->getCreatedBy(); ?></a>
<td><a href="<?= $url; ?>"><?= $workflow->getCreatedAt()->format('Y-m-d H:i'); ?></a>
<?php endforeach; if($c == 0) : ?>
<tr><td colspan="6" class="empty"><?= $this->l11n->getText(0, 'Backend', 'Empty'); ?>
<?php endif; ?>
</table>
</div>