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",
"permission": { "permission": 4, "category": null, "element": null },
"parent": 1005501001,
"children": []
"children": [],
"status": 3
}
]
}

View File

@ -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');

View File

@ -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();

View File

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

View File

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

View File

@ -14,3 +14,32 @@ declare(strict_types=1);
/** @var \phpOMS\Views\View $this */
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'];
$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(); ?>
<div class="row">