mirror of
https://github.com/Karaka-Management/oms-Workflow.git
synced 2026-01-11 14:58:39 +00:00
162 lines
6.6 KiB
PHP
Executable File
162 lines
6.6 KiB
PHP
Executable File
<?php
|
|
/**
|
|
* Orange Management
|
|
*
|
|
* PHP Version 7.4
|
|
*
|
|
* @package Modules\Workflow
|
|
* @copyright Dennis Eichhorn
|
|
* @license OMS License 1.0
|
|
* @version 1.0.0
|
|
* @link https://orange-management.org
|
|
*/
|
|
declare(strict_types=1);
|
|
|
|
namespace Modules\Workflow\Controller;
|
|
|
|
use phpOMS\Contract\RenderableInterface;
|
|
use phpOMS\Message\RequestAbstract;
|
|
use phpOMS\Message\ResponseAbstract;
|
|
use phpOMS\Views\View;
|
|
|
|
/**
|
|
* Workflow class.
|
|
*
|
|
* @package Modules\Workflow
|
|
* @license OMS License 1.0
|
|
* @link https://orange-management.org
|
|
* @since 1.0.0
|
|
*
|
|
* @todo Orange-Management/Modules#20
|
|
* The workflow module can be used by other modules to register a workflow.
|
|
* The article management module for example could register a workflow for generating articles.
|
|
* This way multiple employees have to insert data and only after everything is done the article will be generated by the system itself.
|
|
* User permissions for creating an article would now get disabled and only allowed through this module.
|
|
* Other things that could be changing prices, customers etc. (essential tool for SOX and ISO and maybe even IFRS)
|
|
* This module would also make use of the task module to notify users that they have a task.
|
|
* At the same time actions such as changing a price could also create a workflow.
|
|
* If a user changes a price a workflow element for price changes gets triggered which now needs to be approved by authorized employees.
|
|
* Such modules now should add an additional tab for workflow steps.
|
|
* In this list a log of all workflows is displayed (pending, done, canceled).
|
|
* This way changes/events get forwarded to the workflow module and later the workflow decides what to do with these information
|
|
* (e.g. inserting these information into other modules etc).
|
|
* Instead of actually doing changes this can be extended further to only request something.
|
|
* E.g. a user could request a unlocking of a customer for invoicing by a simple button click and a credit manager only has to approve it.
|
|
* The workflow module now knows that the approval means to unlock the customer (maybe for only one invoice, limited time, value etc).
|
|
*
|
|
* @todo Orange-Management/Modules#23
|
|
* Request/approval workflow
|
|
* For many things a request/approval workflow should be implemented.
|
|
* Users should be able to request permission changes which then have to be approved by group/department managers or the IT.
|
|
* Upon approval the workflow automatically grants these permissions and informs the user.
|
|
* This should be a selectable workflow from the template list but also get integrated into the modules.
|
|
* Modules should inform the user that he doesn't have sufficient permissions to perform certain tasks upon which he gets provided with a direct link for requesting these permissions.
|
|
*/
|
|
final class BackendController extends Controller
|
|
{
|
|
/**
|
|
* Routing end-point for application behaviour.
|
|
*
|
|
* @param RequestAbstract $request Request
|
|
* @param ResponseAbstract $response Response
|
|
* @param mixed $data Generic data
|
|
*
|
|
* @return RenderableInterface
|
|
*
|
|
* @since 1.0.0
|
|
* @codeCoverageIgnore
|
|
*/
|
|
public function viewWorkflowTemplates(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface
|
|
{
|
|
$view = new View($this->app->l11nManager, $request, $response);
|
|
$view->setTemplate('/Modules/Workflow/Theme/Backend/workflow-template-list');
|
|
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1005501001, $request, $response));
|
|
|
|
return $view;
|
|
}
|
|
|
|
/**
|
|
* Routing end-point for application behaviour.
|
|
*
|
|
* @param RequestAbstract $request Request
|
|
* @param ResponseAbstract $response Response
|
|
* @param mixed $data Generic data
|
|
*
|
|
* @return RenderableInterface
|
|
*
|
|
* @since 1.0.0
|
|
* @codeCoverageIgnore
|
|
*/
|
|
public function viewWorkflowTemplate(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface
|
|
{
|
|
$view = new View($this->app->l11nManager, $request, $response);
|
|
$view->setTemplate('/Modules/Workflow/Theme/Backend/task-single');
|
|
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1005501001, $request, $response));
|
|
|
|
return $view;
|
|
}
|
|
|
|
/**
|
|
* Routing end-point for application behaviour.
|
|
*
|
|
* @param RequestAbstract $request Request
|
|
* @param ResponseAbstract $response Response
|
|
* @param mixed $data Generic data
|
|
*
|
|
* @return RenderableInterface
|
|
*
|
|
* @since 1.0.0
|
|
* @codeCoverageIgnore
|
|
*/
|
|
public function viewWorkflowSingle(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface
|
|
{
|
|
$view = new View($this->app->l11nManager, $request, $response);
|
|
$view->setTemplate('/Modules/Workflow/Theme/Backend/task-create');
|
|
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1005501001, $request, $response));
|
|
|
|
return $view;
|
|
}
|
|
|
|
/**
|
|
* Routing end-point for application behaviour.
|
|
*
|
|
* @param RequestAbstract $request Request
|
|
* @param ResponseAbstract $response Response
|
|
* @param mixed $data Generic data
|
|
*
|
|
* @return RenderableInterface
|
|
*
|
|
* @since 1.0.0
|
|
* @codeCoverageIgnore
|
|
*/
|
|
public function viewWorkflowTemplateCreate(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface
|
|
{
|
|
$view = new View($this->app->l11nManager, $request, $response);
|
|
$view->setTemplate('/Modules/Workflow/Theme/Backend/workflow-template-create');
|
|
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1005501001, $request, $response));
|
|
|
|
return $view;
|
|
}
|
|
|
|
/**
|
|
* Routing end-point for application behaviour.
|
|
*
|
|
* @param RequestAbstract $request Request
|
|
* @param ResponseAbstract $response Response
|
|
* @param mixed $data Generic data
|
|
*
|
|
* @return RenderableInterface
|
|
*
|
|
* @since 1.0.0
|
|
* @codeCoverageIgnore
|
|
*/
|
|
public function viewWorkflowDashboard(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface
|
|
{
|
|
$view = new View($this->app->l11nManager, $request, $response);
|
|
$view->setTemplate('/Modules/Workflow/Theme/Backend/workflow-dashboard');
|
|
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1005501001, $request, $response));
|
|
|
|
return $view;
|
|
}
|
|
}
|