diff --git a/Admin/Installer.php b/Admin/Installer.php
index 971cbfb..77beada 100755
--- a/Admin/Installer.php
+++ b/Admin/Installer.php
@@ -14,12 +14,15 @@ declare(strict_types=1);
namespace Modules\Workflow\Admin;
+use Modules\Workflow\Admin\Install\Workflow;
use phpOMS\Application\ApplicationAbstract;
use phpOMS\Message\Http\HttpRequest;
use phpOMS\Message\Http\HttpResponse;
use phpOMS\Module\InstallerAbstract;
use phpOMS\System\File\PathException;
use phpOMS\Uri\HttpUri;
+use phpOMS\Config\SettingsInterface;
+use phpOMS\Module\ModuleInfo;
/**
* Installer class.
@@ -39,6 +42,15 @@ final class Installer extends InstallerAbstract
*/
public const PATH = __DIR__;
+ /**
+ * {@inheritdoc}
+ */
+ public static function install(ApplicationAbstract $app, ModuleInfo $info, SettingsInterface $cfgHandler) : void
+ {
+ parent::install($app, $info, $cfgHandler);
+ Workflow::install($app, '');
+ }
+
/**
* Install data from providing modules.
*
diff --git a/Admin/Routes/Web/Backend.php b/Admin/Routes/Web/Backend.php
index f81f7fe..61937c7 100755
--- a/Admin/Routes/Web/Backend.php
+++ b/Admin/Routes/Web/Backend.php
@@ -51,17 +51,6 @@ return [
],
],
],
- '^.*/workflow/dashboard.*$' => [
- [
- 'dest' => '\Modules\Workflow\Controller\BackendController:viewDashboard',
- 'verb' => RouteVerb::GET,
- 'permission' => [
- 'module' => BackendController::NAME,
- 'type' => PermissionType::CREATE,
- 'state' => PermissionCategory::WORKFLOW,
- ],
- ],
- ],
'^.*/workflow/instance/list.*$' => [
[
'dest' => '\Modules\Workflow\Controller\BackendController:viewInstanceList',
diff --git a/Controller/ApiController.php b/Controller/ApiController.php
index 2e1c516..5587902 100755
--- a/Controller/ApiController.php
+++ b/Controller/ApiController.php
@@ -445,7 +445,7 @@ final class ApiController extends Controller
return;
}
- $actions = \json_decode(\file_get_contents(__DIR__ . '/../Definitions/actions.json'), true);
+ $actions = \json_decode($actionContent, true);
if (!\is_array($actions)) {
$this->fillJsonResponse($request, $response, NotificationLevel::ERROR, 'Template', 'Template creation failed', $template);
diff --git a/Controller/BackendController.php b/Controller/BackendController.php
index a255a97..4018f27 100755
--- a/Controller/BackendController.php
+++ b/Controller/BackendController.php
@@ -146,21 +146,14 @@ final class BackendController extends Controller
*
* @return RenderableInterface
*
+ * @todo: remove, the router is already adjusted.
+ *
* @since 1.0.0
* @codeCoverageIgnore
*/
public function viewDashboard(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface
{
- $view = new View($this->app->l11nManager, $request, $response);
- $view->setTemplate('/Modules/Workflow/Theme/Backend/workflow-dashboard');
- $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005501001, $request, $response);
-
- $instances = WorkflowInstanceAbstractMapper::getAll()
- ->execute();
-
- $view->data['instances'] = $instances;
-
- return $view;
+ return $this->viewInstanceList($request, $response, $data);
}
/**
@@ -183,6 +176,7 @@ final class BackendController extends Controller
/** @var \Modules\Workflow\Models\WorkflowInstanceAbstract $instances */
$instances = WorkflowInstanceAbstractMapper::getAll()
+ ->with('template')
->execute();
$view->data['instances'] = $instances;
diff --git a/Theme/Backend/Lang/en.lang.php b/Theme/Backend/Lang/en.lang.php
index efe99b4..4a19ebe 100755
--- a/Theme/Backend/Lang/en.lang.php
+++ b/Theme/Backend/Lang/en.lang.php
@@ -19,6 +19,7 @@ return ['Workflow' => [
'Created' => 'Created',
'Name' => 'Name',
'Creator' => 'Creator',
+ 'Date' => 'Date',
'Due' => 'Due',
'Media' => 'Media',
'Message' => 'Message',
@@ -32,4 +33,8 @@ return ['Workflow' => [
'Workflow' => 'Workflow',
'Workflows' => 'Workflows',
'Instances' => 'Instances',
+ ':istatus-1' => 'Started',
+ ':istatus-2' => 'Suspended',
+ ':istatus-3' => 'Canceled',
+ ':istatus-4' => 'Done',
]];
diff --git a/Theme/Backend/workflow-dashboard.tpl.php b/Theme/Backend/workflow-dashboard.tpl.php
index 3df0a76..dd05ec9 100755
--- a/Theme/Backend/workflow-dashboard.tpl.php
+++ b/Theme/Backend/workflow-dashboard.tpl.php
@@ -27,6 +27,7 @@ echo $this->data['nav']->render(); ?>
= $this->getHtml('Status'); ?>
= $this->getHtml('Title'); ?>
+ = $this->getHtml('Date'); ?>
| = $this->getHtml('Date'); ?> | = $this->getHtml('Status'); ?> | = $this->getHtml('Title'); ?> | $instance) : ++$c; - $url = \phpOMS\Uri\UriFactory::build('workflow/instance/profile?{?}&id=' . $instance->id); + $url = \phpOMS\Uri\UriFactory::build('{/base}/workflow/instance/profile?{?}&id=' . $instance->id); ?>|||
| = $this->printHtml((string) $instance->getStatus()); ?> - | = $this->printHtml($instance->title); ?> + | = $instance->createdAt->format('Y-m-d H:i:s'); ?> + | = $this->getHtml(':istatus-' . $instance->getStatus()); ?> + | = $this->printHtml($instance->template->name); ?> | |
| = $this->getHtml('Empty', '0', '0'); ?> | |||||