From 85cf36a4c40ebd9e992a5d6745d587f4b0d729d9 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Tue, 2 Apr 2024 21:40:48 +0000 Subject: [PATCH] template fixes + bug fixes + style fixes --- Admin/Install/Navigation.install.json | 3 +- Controller/BackendController.php | 18 ++++++------ Controller/CliController.php | 2 +- Theme/Backend/Lang/de.lang.php | 5 +++- Theme/Backend/Lang/en.lang.php | 3 ++ Theme/Backend/workflow-instance.tpl.php | 29 ++++++++++++++++++++ Theme/Backend/workflow-template-list.tpl.php | 4 +-- 7 files changed, 49 insertions(+), 15 deletions(-) diff --git a/Admin/Install/Navigation.install.json b/Admin/Install/Navigation.install.json index 3b6549e..4b03973 100755 --- a/Admin/Install/Navigation.install.json +++ b/Admin/Install/Navigation.install.json @@ -56,7 +56,8 @@ "from": "Workflow", "permission": { "permission": 4, "category": null, "element": null }, "parent": 1005501001, - "children": [] + "children": [], + "status": 3 } ] } diff --git a/Controller/BackendController.php b/Controller/BackendController.php index 0f82dcb..679d12d 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -65,7 +65,7 @@ final class BackendController extends Controller ->with('tags/title') ->where('virtualPath', $path) ->where('tags/title/language', $response->header->l11n->language) - ->execute(); + ->executeGetArray(); list($collection, $parent) = CollectionMapper::getCollectionsByPath($path); @@ -185,7 +185,7 @@ final class BackendController extends Controller /** @var \Modules\Workflow\Models\WorkflowInstanceAbstract $instances */ $instances = WorkflowInstanceAbstractMapper::getAll() ->with('template') - ->execute(); + ->executeGetArray(); $view->data['instances'] = $instances; @@ -210,25 +210,23 @@ final class BackendController extends Controller $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005501001, $request, $response); /** @var \Modules\Workflow\Models\WorkflowInstanceAbstract $instance */ - $instance = WorkflowInstanceAbstractMapper::get() + $view->data['instance'] = WorkflowInstanceAbstractMapper::get() ->where('id', (int) $request->getData('id')) ->execute(); /** @var \Modules\Workflow\Models\WorkflowTemplate $template */ - $template = WorkflowTemplateMapper::get() + $view->data['template'] = WorkflowTemplateMapper::get() ->with('source') ->with('source/sources') - ->where('id', $instance->template->id) + ->where('id', $view->data['instance']->template->id) ->limit() ->execute(); - $view->data['template'] = $template; - - if ($template->source->findFile('instance-profile.tpl.php')->id > 0) { - require_once $template->source->findFile('WorkflowController.php')->getPath(); + if ($view->data['template']->source->findFile('instance-profile.tpl.php')->id > 0) { + require_once $view->data['template']->source->findFile('WorkflowController.php')->getPath(); /** @var WorkflowControllerInterface $controller */ - $controller = new \Modules\Workflow\Controller\WorkflowController($this->app, $template); + $controller = new \Modules\Workflow\Controller\WorkflowController($this->app, $view->data['template']); $controller->createInstanceViewFromRequest($view, $request, $response); } else { $view->setTemplate('/Modules/Workflow/Theme/Backend/workflow-instance'); diff --git a/Controller/CliController.php b/Controller/CliController.php index 25ca9c1..593c16a 100755 --- a/Controller/CliController.php +++ b/Controller/CliController.php @@ -50,7 +50,7 @@ final class CliController extends Controller public function runWorkflowFromHook(mixed ...$data) : void { /** @var \Modules\Workflow\Models\WorkflowTemplate[] $workflows */ - $workflows = WorkflowTemplateMapper::getAll()->where('status', WorkflowStatus::ACTIVE)->execute(); + $workflows = WorkflowTemplateMapper::getAll()->where('status', WorkflowStatus::ACTIVE)->executeGetArray(); foreach ($workflows as $workflow) { $hooks = $workflow->getHooks(); diff --git a/Theme/Backend/Lang/de.lang.php b/Theme/Backend/Lang/de.lang.php index 9a86545..6665bbc 100755 --- a/Theme/Backend/Lang/de.lang.php +++ b/Theme/Backend/Lang/de.lang.php @@ -37,5 +37,8 @@ return ['Workflow' => [ 'Updated' => 'Upddate', 'Upload' => 'Hochladen', 'Workflow' => 'Arbeitsablauf', - 'Workflows' => 'Workflows.', + 'Workflows' => 'Workflows', + 'Data' => 'Daten', + 'End' => 'Ende', + 'Instance' => 'Instanz', ]]; diff --git a/Theme/Backend/Lang/en.lang.php b/Theme/Backend/Lang/en.lang.php index 0e2652d..08be147 100755 --- a/Theme/Backend/Lang/en.lang.php +++ b/Theme/Backend/Lang/en.lang.php @@ -38,4 +38,7 @@ return ['Workflow' => [ 'Upload' => 'Upload', 'Workflow' => 'Workflow', 'Workflows' => 'Workflows', + 'Data' => 'Data', + 'End' => 'End', + 'Instance' => 'Instance', ]]; diff --git a/Theme/Backend/workflow-instance.tpl.php b/Theme/Backend/workflow-instance.tpl.php index a46c3d7..a3bdc05 100755 --- a/Theme/Backend/workflow-instance.tpl.php +++ b/Theme/Backend/workflow-instance.tpl.php @@ -14,3 +14,32 @@ declare(strict_types=1); /** @var \phpOMS\Views\View $this */ echo $this->data['nav']->render(); +?> +
+
+
+
getHtml('Instance'); ?>
+
+ + + + + + +
getHtml('Workflow'); ?> + printHtml($this->data['template']->name); ?> +
getHtml('Title'); ?> + printHtml($this->data['instance']->title); ?> +
getHtml('Created'); ?> + data['instance']->createdAt->format('Y-m-d H:i:s'); ?> +
getHtml('End'); ?> + data['instance']->end?->format('Y-m-d H:i:s'); ?> +
getHtml('Status'); ?> + getHtml(':istatus-' . $this->data['instance']->status); ?> +
getHtml('Data'); ?> +
printHtml($this->data['instance']->data); ?>
+
+
+
+
+
diff --git a/Theme/Backend/workflow-template-list.tpl.php b/Theme/Backend/workflow-template-list.tpl.php index 6aea6bd..4af6e3c 100755 --- a/Theme/Backend/workflow-template-list.tpl.php +++ b/Theme/Backend/workflow-template-list.tpl.php @@ -29,8 +29,8 @@ $accountDir = $account->id . ' ' . $account->login; $collections = $this->data['collections']; $mediaPath = \urldecode($this->getData('path') ?? '/'); -$previous = empty($templates) ? 'workflow/template/list' : '{/base}/workflow/template/list?{?}&id=' . \reset($templates)->id . '&ptype=p'; -$next = empty($templates) ? 'workflow/template/list' : '{/base}/workflow/template/list?{?}&id=' . \end($templates)->id . '&ptype=n'; +$previous = empty($templates) ? 'workflow/template/list' : '{/base}/workflow/template/list?{?}&offset=' . \reset($templates)->id . '&ptype=p'; +$next = empty($templates) ? 'workflow/template/list' : '{/base}/workflow/template/list?{?}&offset=' . \end($templates)->id . '&ptype=n'; echo $this->data['nav']->render(); ?>