template fixes + bug fixes + style fixes

This commit is contained in:
Dennis Eichhorn 2024-04-02 21:40:48 +00:00
parent 9898d96b9b
commit 85cf36a4c4
7 changed files with 49 additions and 15 deletions

View File

@ -56,7 +56,8 @@
"from": "Workflow", "from": "Workflow",
"permission": { "permission": 4, "category": null, "element": null }, "permission": { "permission": 4, "category": null, "element": null },
"parent": 1005501001, "parent": 1005501001,
"children": [] "children": [],
"status": 3
} }
] ]
} }

View File

@ -65,7 +65,7 @@ final class BackendController extends Controller
->with('tags/title') ->with('tags/title')
->where('virtualPath', $path) ->where('virtualPath', $path)
->where('tags/title/language', $response->header->l11n->language) ->where('tags/title/language', $response->header->l11n->language)
->execute(); ->executeGetArray();
list($collection, $parent) = CollectionMapper::getCollectionsByPath($path); list($collection, $parent) = CollectionMapper::getCollectionsByPath($path);
@ -185,7 +185,7 @@ final class BackendController extends Controller
/** @var \Modules\Workflow\Models\WorkflowInstanceAbstract $instances */ /** @var \Modules\Workflow\Models\WorkflowInstanceAbstract $instances */
$instances = WorkflowInstanceAbstractMapper::getAll() $instances = WorkflowInstanceAbstractMapper::getAll()
->with('template') ->with('template')
->execute(); ->executeGetArray();
$view->data['instances'] = $instances; $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); $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005501001, $request, $response);
/** @var \Modules\Workflow\Models\WorkflowInstanceAbstract $instance */ /** @var \Modules\Workflow\Models\WorkflowInstanceAbstract $instance */
$instance = WorkflowInstanceAbstractMapper::get() $view->data['instance'] = WorkflowInstanceAbstractMapper::get()
->where('id', (int) $request->getData('id')) ->where('id', (int) $request->getData('id'))
->execute(); ->execute();
/** @var \Modules\Workflow\Models\WorkflowTemplate $template */ /** @var \Modules\Workflow\Models\WorkflowTemplate $template */
$template = WorkflowTemplateMapper::get() $view->data['template'] = WorkflowTemplateMapper::get()
->with('source') ->with('source')
->with('source/sources') ->with('source/sources')
->where('id', $instance->template->id) ->where('id', $view->data['instance']->template->id)
->limit() ->limit()
->execute(); ->execute();
$view->data['template'] = $template; if ($view->data['template']->source->findFile('instance-profile.tpl.php')->id > 0) {
require_once $view->data['template']->source->findFile('WorkflowController.php')->getPath();
if ($template->source->findFile('instance-profile.tpl.php')->id > 0) {
require_once $template->source->findFile('WorkflowController.php')->getPath();
/** @var WorkflowControllerInterface $controller */ /** @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); $controller->createInstanceViewFromRequest($view, $request, $response);
} else { } else {
$view->setTemplate('/Modules/Workflow/Theme/Backend/workflow-instance'); $view->setTemplate('/Modules/Workflow/Theme/Backend/workflow-instance');

View File

@ -50,7 +50,7 @@ final class CliController extends Controller
public function runWorkflowFromHook(mixed ...$data) : void public function runWorkflowFromHook(mixed ...$data) : void
{ {
/** @var \Modules\Workflow\Models\WorkflowTemplate[] $workflows */ /** @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) { foreach ($workflows as $workflow) {
$hooks = $workflow->getHooks(); $hooks = $workflow->getHooks();

View File

@ -37,5 +37,8 @@ return ['Workflow' => [
'Updated' => 'Upddate', 'Updated' => 'Upddate',
'Upload' => 'Hochladen', 'Upload' => 'Hochladen',
'Workflow' => 'Arbeitsablauf', 'Workflow' => 'Arbeitsablauf',
'Workflows' => 'Workflows.', 'Workflows' => 'Workflows',
'Data' => 'Daten',
'End' => 'Ende',
'Instance' => 'Instanz',
]]; ]];

View File

@ -38,4 +38,7 @@ return ['Workflow' => [
'Upload' => 'Upload', 'Upload' => 'Upload',
'Workflow' => 'Workflow', 'Workflow' => 'Workflow',
'Workflows' => 'Workflows', 'Workflows' => 'Workflows',
'Data' => 'Data',
'End' => 'End',
'Instance' => 'Instance',
]]; ]];

View File

@ -14,3 +14,32 @@ declare(strict_types=1);
/** @var \phpOMS\Views\View $this */ /** @var \phpOMS\Views\View $this */
echo $this->data['nav']->render(); echo $this->data['nav']->render();
?>
<div class="row">
<div class="col-xs-12 col-md-6">
<div class="portlet">
<div class="portlet-head"><?= $this->getHtml('Instance'); ?></div>
<div class="portlet-body">
<table class="list wf-100">
<tr>
<th><?= $this->getHtml('Workflow'); ?>
<td class="wf-100"><?= $this->printHtml($this->data['template']->name); ?>
<tr>
<th><?= $this->getHtml('Title'); ?>
<td><?= $this->printHtml($this->data['instance']->title); ?>
<tr>
<th><?= $this->getHtml('Created'); ?>
<td><?= $this->data['instance']->createdAt->format('Y-m-d H:i:s'); ?>
<tr>
<th><?= $this->getHtml('End'); ?>
<td><?= $this->data['instance']->end?->format('Y-m-d H:i:s'); ?>
<tr>
<th><?= $this->getHtml('Status'); ?>
<td><?= $this->getHtml(':istatus-' . $this->data['instance']->status); ?>
<tr><th colspan="2"><?= $this->getHtml('Data'); ?>
<tr><td colspan="2"><pre><?= $this->printHtml($this->data['instance']->data); ?></pre>
</table>
</div>
</div>
</div>
</div>

View File

@ -29,8 +29,8 @@ $accountDir = $account->id . ' ' . $account->login;
$collections = $this->data['collections']; $collections = $this->data['collections'];
$mediaPath = \urldecode($this->getData('path') ?? '/'); $mediaPath = \urldecode($this->getData('path') ?? '/');
$previous = empty($templates) ? 'workflow/template/list' : '{/base}/workflow/template/list?{?}&id=' . \reset($templates)->id . '&ptype=p'; $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?{?}&id=' . \end($templates)->id . '&ptype=n'; $next = empty($templates) ? 'workflow/template/list' : '{/base}/workflow/template/list?{?}&offset=' . \end($templates)->id . '&ptype=n';
echo $this->data['nav']->render(); ?> echo $this->data['nav']->render(); ?>
<div class="row"> <div class="row">