From b27061be3b1ea40984ccbdce15eca618f174a9e6 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sun, 9 Jul 2023 02:32:02 +0000 Subject: [PATCH] backup --- Admin/Installer.php | 12 ++++++++++++ Admin/Routes/Web/Backend.php | 11 ----------- Controller/ApiController.php | 2 +- Controller/BackendController.php | 14 ++++---------- Theme/Backend/Lang/en.lang.php | 5 +++++ Theme/Backend/workflow-dashboard.tpl.php | 4 +++- Theme/Backend/workflow-instance-list.tpl.php | 10 ++++++---- tests/Bootstrap.php | 6 +++--- 8 files changed, 34 insertions(+), 30 deletions(-) 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(); ?> getHtml('Status'); ?> getHtml('Title'); ?> + getHtml('Date'); ?> data['nav']->render(); ?> ?> printHtml((string) $instance->getStatus()); ?> - printHtml($instance->title); ?> + printHtml($instance->template->name); ?> + createdAt->format('Y-m-d H:i:s'); ?> getHtml('Empty', '0', '0'); ?> diff --git a/Theme/Backend/workflow-instance-list.tpl.php b/Theme/Backend/workflow-instance-list.tpl.php index d1ba407..9af9876 100755 --- a/Theme/Backend/workflow-instance-list.tpl.php +++ b/Theme/Backend/workflow-instance-list.tpl.php @@ -25,21 +25,23 @@ echo $this->data['nav']->render(); ?>
getHtml('Instances'); ?>
+ $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); ?> -
getHtml('Date'); ?> getHtml('Status'); ?> getHtml('Title'); ?>
printHtml((string) $instance->getStatus()); ?> - printHtml($instance->title); ?> + createdAt->format('Y-m-d H:i:s'); ?> + getHtml(':istatus-' . $instance->getStatus()); ?> + printHtml($instance->template->name); ?>
getHtml('Empty', '0', '0'); ?>
- \ No newline at end of file + diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php index b5d36a8..4d624b6 100755 --- a/tests/Bootstrap.php +++ b/tests/Bootstrap.php @@ -302,7 +302,7 @@ if (\defined('RESET') && RESET === '1') { $db->exec('DROP DATABASE IF EXISTS ' . $CONFIG['db']['core']['masters']['admin']['database']); $db->exec('CREATE DATABASE IF NOT EXISTS ' . $CONFIG['db']['core']['masters']['admin']['database']); $db = null; - } catch (\Throwable $t) { + } catch (\Throwable $_) { echo "\nCouldn't connect to MYSQL DB\n"; } } @@ -317,7 +317,7 @@ if (\defined('RESET') && RESET === '1') { $db->exec('DROP DATABASE IF EXISTS ' . $CONFIG['db']['core']['postgresql']['admin']['database']); $db->exec('CREATE DATABASE ' . $CONFIG['db']['core']['postgresql']['admin']['database']); $db = null; - } catch (\Throwable $t) { + } catch (\Throwable $_) { echo "\nCouldn't connect to POSTGRESQL DB\n"; } } @@ -332,7 +332,7 @@ if (\defined('RESET') && RESET === '1') { $db->exec('DROP DATABASE IF EXISTS ' . $CONFIG['db']['core']['mssql']['admin']['database']); $db->exec('CREATE DATABASE ' . $CONFIG['db']['core']['mssql']['admin']['database']); $db = null; - } catch (\Throwable $t) { + } catch (\Throwable $_) { echo "\nCouldn't connect to MSSQL DB\n"; } }