tpl fixes, dont use printHtml for none-string types

This commit is contained in:
Dennis Eichhorn 2020-12-06 11:13:19 +01:00
parent 2805c82e8b
commit 55ba064db8
11 changed files with 42 additions and 40 deletions

View File

@ -17,6 +17,7 @@ namespace Modules\Organization\Controller;
use Modules\Organization\Models\Department;
use Modules\Organization\Models\DepartmentMapper;
use Modules\Organization\Models\Position;
use Modules\Organization\Models\NullPosition;
use Modules\Organization\Models\PositionMapper;
use Modules\Organization\Models\Unit;
use Modules\Organization\Models\UnitMapper;
@ -168,7 +169,7 @@ final class BackendController extends Controller
$parent = $component->parent->getId();
if (!($component instanceof Position) // parent could be in different department then ignore
|| $component->parent->department->getId() === $component->department->getId()
|| (!($component->parent instanceof NullPosition) && $component->parent->department->getId() === $component->department->getId())
) {
if (!isset($tree[$ref][$parent])) {
$tree[$ref][$parent] = ['obj' => null, 'children' => [], 'index' => 0];

View File

@ -1,10 +1,10 @@
<div class="ipt-wrap">
<div class="ipt-first">
<span class="input">
<button type="button" id="<?= $this->printHtml($this->getId()); ?>-book-button" data-action='[
<button type="button" id="<?= $this->getId(); ?>-book-button" data-action='[
{
"key": 1, "listener": "click", "action": [
{"key": 1, "type": "dom.popup", "selector": "#acc-grp-tpl", "aniIn": "fadeIn", "id": "<?= $this->printHtml($this->getId()); ?>"},
{"key": 1, "type": "dom.popup", "selector": "#acc-grp-tpl", "aniIn": "fadeIn", "id": "<?= $this->getId(); ?>"},
{"key": 2, "type": "message.request", "uri": "<?= \phpOMS\Uri\UriFactory::build('{/prefix}admin/account?filter=some&limit=10'); ?>", "method": "GET", "request_type": "json"},
{"key": 3, "type": "dom.table.append", "id": "acc-table", "aniIn": "fadeIn", "data": [], "bindings": {"id": "id", "name": "name"}, "position": -1},
{"key": 4, "type": "message.request", "uri": "<?= \phpOMS\Uri\UriFactory::build('{/prefix}admin/account?filter=some&limit=10'); ?>", "method": "GET", "request_type": "json"},
@ -12,19 +12,19 @@
]
}
]' formaction=""><i class="fa fa-book"></i></button>
<div class="advancedInput wf-100" id="<?= $this->printHtml($this->getId()); ?>">
<input autocomplete="off" class="input" type="text" id="i<?= $this->printHtml($this->getId()); ?>" placeholder="&#xf007; Guest"
<div class="advancedInput wf-100" id="<?= $this->getId(); ?>">
<input autocomplete="off" class="input" type="text" id="i<?= $this->getId(); ?>" placeholder="&#xf007; Guest"
data-emptyAfter="true"
data-autocomplete="off"
data-src="api/organization/find/department?search={!#i<?= $this->printHtml($this->getId()); ?>}">
<div id="<?= $this->printHtml($this->getId()); ?>-dropdown" class="dropdown" data-active="true">
data-src="api/organization/find/department?search={!#i<?= $this->getId(); ?>}">
<div id="<?= $this->getId(); ?>-dropdown" class="dropdown" data-active="true">
<table class="default">
<thead>
<tr>
<td>ID<i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
<td>Name<i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
<tbody>
<template id="<?= $this->printHtml($this->getId()); ?>-rowElement" class="rowTemplate">
<template id="<?= $this->getId(); ?>-rowElement" class="rowTemplate">
<tr tabindex="-1">
<td data-tpl-text="/id" data-tpl-value="/id" data-value=""></td>
<td data-tpl-text="/name" data-tpl-value="/name" data-value=""></td>
@ -38,8 +38,8 @@
</div>
<div class="ipt-second"><button><?= $this->getHtml('Select', '0', '0'); ?></button></div>
</div>
<div class="box" id="<?= $this->printHtml($this->getId()); ?>-tags" data-limit="0" data-active="true">
<template id="<?= $this->printHtml($this->getId()); ?>-tagTemplate">
<div class="box" id="<?= $this->getId(); ?>-tags" data-limit="0" data-active="true">
<template id="<?= $this->getId(); ?>-tagTemplate">
<span class="tag red" data-tpl-value="/id" data-value="" data-uuid="" data-name="<?= $this->printHtml($this->name); ?>">
<i class="fa fa-times"></i>
<span data-tpl-text="/id" data-name="id" data-tpl-value="/id" data-value=""></span>

View File

@ -1,10 +1,10 @@
<div class="ipt-wrap">
<div class="ipt-first">
<span class="input">
<button type="button" id="<?= $this->printHtml($this->getId()); ?>-book-button" data-action='[
<button type="button" id="<?= $this->getId(); ?>-book-button" data-action='[
{
"key": 1, "listener": "click", "action": [
{"key": 1, "type": "dom.popup", "selector": "#acc-grp-tpl", "aniIn": "fadeIn", "id": "<?= $this->printHtml($this->getId()); ?>"},
{"key": 1, "type": "dom.popup", "selector": "#acc-grp-tpl", "aniIn": "fadeIn", "id": "<?= $this->getId(); ?>"},
{"key": 2, "type": "message.request", "uri": "<?= \phpOMS\Uri\UriFactory::build('{/prefix}admin/account?filter=some&limit=10'); ?>", "method": "GET", "request_type": "json"},
{"key": 3, "type": "dom.table.append", "id": "acc-table", "aniIn": "fadeIn", "data": [], "bindings": {"id": "id", "name": "name"}, "position": -1},
{"key": 4, "type": "message.request", "uri": "<?= \phpOMS\Uri\UriFactory::build('{/prefix}admin/account?filter=some&limit=10'); ?>", "method": "GET", "request_type": "json"},
@ -12,19 +12,19 @@
]
}
]' formaction=""><i class="fa fa-book"></i></button>
<div class="advancedInput wf-100" id="<?= $this->printHtml($this->getId()); ?>">
<input autocomplete="off" class="input" type="text" id="i<?= $this->printHtml($this->getId()); ?>" placeholder="&#xf007; Guest"
<div class="advancedInput wf-100" id="<?= $this->getId(); ?>">
<input autocomplete="off" class="input" type="text" id="i<?= $this->getId(); ?>" placeholder="&#xf007; Guest"
data-emptyAfter="true"
data-autocomplete="off"
data-src="api/organization/find/position?search={!#i<?= $this->printHtml($this->getId()); ?>}">
<div id="<?= $this->printHtml($this->getId()); ?>-dropdown" class="dropdown" data-active="true">
data-src="api/organization/find/position?search={!#i<?= $this->getId(); ?>}">
<div id="<?= $this->getId(); ?>-dropdown" class="dropdown" data-active="true">
<table class="default">
<thead>
<tr>
<td>ID<i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
<td>Name<i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
<tbody>
<template id="<?= $this->printHtml($this->getId()); ?>-rowElement" class="rowTemplate">
<template id="<?= $this->getId(); ?>-rowElement" class="rowTemplate">
<tr tabindex="-1">
<td data-tpl-text="/id" data-tpl-value="/id" data-value=""></td>
<td data-tpl-text="/name" data-tpl-value="/name" data-value=""></td>
@ -38,8 +38,8 @@
</div>
<div class="ipt-second"><button><?= $this->getHtml('Select', '0', '0'); ?></button></div>
</div>
<div class="box" id="<?= $this->printHtml($this->getId()); ?>-tags" data-limit="0" data-active="true">
<template id="<?= $this->printHtml($this->getId()); ?>-tagTemplate">
<div class="box" id="<?= $this->getId(); ?>-tags" data-limit="0" data-active="true">
<template id="<?= $this->getId(); ?>-tagTemplate">
<span class="tag red" data-tpl-value="/id" data-value="" data-uuid="" data-name="<?= $this->printHtml($this->name); ?>">
<i class="fa fa-times"></i>
<span data-tpl-text="/id" data-name="id" data-tpl-value="/id" data-value=""></span>

View File

@ -1,10 +1,10 @@
<div class="ipt-wrap">
<div class="ipt-first">
<span class="input">
<button type="button" id="<?= $this->printHtml($this->getId()); ?>-book-button" data-action='[
<button type="button" id="<?= $this->getId(); ?>-book-button" data-action='[
{
"key": 1, "listener": "click", "action": [
{"key": 1, "type": "dom.popup", "selector": "#acc-grp-tpl", "aniIn": "fadeIn", "id": "<?= $this->printHtml($this->getId()); ?>"},
{"key": 1, "type": "dom.popup", "selector": "#acc-grp-tpl", "aniIn": "fadeIn", "id": "<?= $this->getId(); ?>"},
{"key": 2, "type": "message.request", "uri": "<?= \phpOMS\Uri\UriFactory::build('{/prefix}admin/account?filter=some&limit=10'); ?>", "method": "GET", "request_type": "json"},
{"key": 3, "type": "dom.table.append", "id": "acc-table", "aniIn": "fadeIn", "data": [], "bindings": {"id": "id", "name": "name"}, "position": -1},
{"key": 4, "type": "message.request", "uri": "<?= \phpOMS\Uri\UriFactory::build('{/prefix}admin/account?filter=some&limit=10'); ?>", "method": "GET", "request_type": "json"},
@ -12,19 +12,19 @@
]
}
]' formaction=""><i class="fa fa-book"></i></button>
<div class="advancedInput wf-100" id="<?= $this->printHtml($this->getId()); ?>">
<input autocomplete="off" class="input" type="text" id="i<?= $this->printHtml($this->getId()); ?>" placeholder="&#xf007; Guest"
<div class="advancedInput wf-100" id="<?= $this->getId(); ?>">
<input autocomplete="off" class="input" type="text" id="i<?= $this->getId(); ?>" placeholder="&#xf007; Guest"
data-emptyAfter="true"
data-autocomplete="off"
data-src="api/organization/find/unit?search={!#i<?= $this->printHtml($this->getId()); ?>}">
<div id="<?= $this->printHtml($this->getId()); ?>-dropdown" class="dropdown" data-active="true">
data-src="api/organization/find/unit?search={!#i<?= $this->getId(); ?>}">
<div id="<?= $this->getId(); ?>-dropdown" class="dropdown" data-active="true">
<table class="default">
<thead>
<tr>
<td>ID<i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
<td>Name<i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
<tbody>
<template id="<?= $this->printHtml($this->getId()); ?>-rowElement" class="rowTemplate">
<template id="<?= $this->getId(); ?>-rowElement" class="rowTemplate">
<tr tabindex="-1">
<td data-tpl-text="/id" data-tpl-value="/id" data-value=""></td>
<td data-tpl-text="/name" data-tpl-value="/name" data-value=""></td>
@ -38,8 +38,8 @@
</div>
<div class="ipt-second"><button><?= $this->getHtml('Select', '0', '0'); ?></button></div>
</div>
<div class="box" id="<?= $this->printHtml($this->getId()); ?>-tags" data-limit="0" data-active="true">
<template id="<?= $this->printHtml($this->getId()); ?>-tagTemplate">
<div class="box" id="<?= $this->getId(); ?>-tags" data-limit="0" data-active="true">
<template id="<?= $this->getId(); ?>-tagTemplate">
<span class="tag red" data-tpl-value="/id" data-value="" data-uuid="" data-name="<?= $this->printHtml($this->name); ?>">
<i class="fa fa-times"></i>
<span data-tpl-text="/id" data-name="id" data-tpl-value="/id" data-value=""></span>

View File

@ -40,7 +40,7 @@ echo $this->getData('nav')->render(); ?>
<?php $c = 0; foreach ($departments as $key => $value) : ++$c;
$url = UriFactory::build('{/prefix}organization/department/profile?{?}&id=' . $value->getId()); ?>
<tr tabindex="0" data-href="<?= $url; ?>">
<td data-label="<?= $this->getHtml('ID', '0', '0'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->getId()); ?></a>
<td data-label="<?= $this->getHtml('ID', '0', '0'); ?>"><a href="<?= $url; ?>"><?= $value->getId(); ?></a>
<td data-label="<?= $this->getHtml('Name'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->name); ?></a>
<td data-label="<?= $this->getHtml('Parent'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->parent->name); ?></a>
<td data-label="<?= $this->getHtml('Name'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->unit->name); ?></a>

View File

@ -33,7 +33,7 @@ $unitRoot = $unitTree[null][0]['children'];
<?php while (!empty($unitEle)) {
$unitId = $unitEle['obj']->getId(); ?>
<div class="col">
<div class="portlet unit"><div class="portlet-body"><?= $unitEle['obj']->getName(); ?></div></div>
<div class="portlet unit"><div class="portlet-body"><?= $unitEle['obj']->name; ?></div></div>
<?php if (isset($depTree[$unitId]) && !empty($depTree[$unitId])) : ?>
<!-- departments -->
@ -47,7 +47,7 @@ $unitRoot = $unitTree[null][0]['children'];
<?php while (!empty($depEle)) { ?>
<div class="departments">
<div class="portlet">
<div class="portlet-head"><?= $depEle['obj']->getName(); ?></div>
<div class="portlet-head"><?= $depEle['obj']->name; ?></div>
<!-- positions -->
<div class="portlet-body">
@ -64,7 +64,7 @@ $unitRoot = $unitTree[null][0]['children'];
}
$c = 0; while (!empty($posEle)) { ?>
<li><?= $posEle['obj']->getName(); ?>
<li><?= $posEle['obj']->name; ?>
<?php
$posEle = [];
} // if no more children go back to parrent

View File

@ -12,6 +12,7 @@
*/
declare(strict_types=1);
use Modules\Organization\Models\Status;
use phpOMS\Uri\UriFactory;
/** @var \phpOMS\Views\View $this */
@ -32,8 +33,8 @@ echo $this->getData('nav')->render(); ?>
<tr><td><?= $this->getData('department-selector')->render('iDepartment', 'department', false); ?>
<tr><td><label for="iStatus"><?= $this->getHtml('Status'); ?></label>
<tr><td><select name="status" id="iStatus">
<option value="<?= $this->printHtml(\Modules\Organization\Models\Status::ACTIVE); ?>"><?= $this->getHtml('Active'); ?>
<option value="<?= $this->printHtml(\Modules\Organization\Models\Status::INACTIVE); ?>"><?= $this->getHtml('Inactive'); ?>
<option value="<?= Status::ACTIVE; ?>"><?= $this->getHtml('Active'); ?>
<option value="<?= Status::INACTIVE; ?>"><?= $this->getHtml('Inactive'); ?>
</select>
<tr><td><?= $this->getData('editor')->render('position-editor'); ?>
<tr><td><?= $this->getData('editor')->getData('text')->render('position-editor', 'description', 'fPositionCreate'); ?>

View File

@ -40,7 +40,7 @@ echo $this->getData('nav')->render(); ?>
<?php $count = 0; foreach ($positions as $key => $value) : ++$count;
$url = \phpOMS\Uri\UriFactory::build('{/prefix}organization/position/profile?{?}&id=' . $value->getId()); ?>
<tr tabindex="0" data-href="<?= $url; ?>">
<td data-label="<?= $this->getHtml('ID', '0', '0'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->getId()); ?></a>
<td data-label="<?= $this->getHtml('ID', '0', '0'); ?>"><a href="<?= $url; ?>"><?= $value->getId(); ?></a>
<td data-label="<?= $this->getHtml('Name'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->name); ?></a>
<td data-label="<?= $this->getHtml('Parent'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->parent->name); ?></a>
<td data-label="<?= $this->getHtml('Department'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->department->name); ?></a>

View File

@ -34,8 +34,8 @@ echo $this->getData('nav')->render(); ?>
<tr><td><?= $this->getData('unit-selector')->render('iParent', 'parent', false); ?>
<tr><td><label for="iStatus"><?= $this->getHtml('Status'); ?></label>
<tr><td><select name="status" id="iStatus">
<option value="<?= $this->printHtml(Status::ACTIVE); ?>"><?= $this->getHtml('Active'); ?>
<option value="<?= $this->printHtml(Status::INACTIVE); ?>"><?= $this->getHtml('Inactive'); ?>
<option value="<?= Status::ACTIVE; ?>"><?= $this->getHtml('Active'); ?>
<option value="<?= Status::INACTIVE; ?>"><?= $this->getHtml('Inactive'); ?>
</select>
<tr><td><?= $this->getData('editor')->render('unit-editor'); ?>
<tr><td><?= $this->getData('editor')->getData('text')->render('unit-editor', 'description', 'fUnitCreate'); ?>

View File

@ -41,7 +41,7 @@ echo $this->getData('nav')->render(); ?>
<?php foreach ($units as $key => $value) :
$url = UriFactory::build('{/prefix}organization/unit/profile?{?}&id=' . $value->getId()); ?>
<tr tabindex="0" data-href="<?= $url; ?>">
<td data-label="<?= $this->getHtml('ID', '0', '0'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->getId()); ?></a>
<td data-label="<?= $this->getHtml('ID', '0', '0'); ?>"><a href="<?= $url; ?>"><?= $value->getId(); ?></a>
<td><a href="<?= $url; ?>"><img class="profile-image" src="<?= $value->image instanceof NullMedia ?
UriFactory::build('Web/Backend/img/user_default_' . \mt_rand(1, 6) .'.png') :
UriFactory::build('{/prefix}' . $value->image->getPath()); ?>"></a>

View File

@ -53,8 +53,8 @@ echo $this->getData('nav')->render(); ?>
<tr><td><?= $this->getData('unit-selector')->render('iParent', 'parent', false); ?>
<tr><td><label for="iStatus"><?= $this->getHtml('Status'); ?></label>
<tr><td><select name="status" id="iStatus">
<option value="<?= $this->printHtml(Status::ACTIVE); ?>"<?= Status::ACTIVE === $unit->getStatus() ? ' selected' : ''; ?>><?= $this->getHtml('Active'); ?>
<option value="<?= $this->printHtml(Status::INACTIVE); ?>"<?= Status::INACTIVE === $unit->getStatus() ? ' selected' : ''; ?>><?= $this->getHtml('Inactive'); ?>
<option value="<?= Status::ACTIVE; ?>"<?= Status::ACTIVE === $unit->getStatus() ? ' selected' : ''; ?>><?= $this->getHtml('Active'); ?>
<option value="<?= Status::INACTIVE; ?>"<?= Status::INACTIVE === $unit->getStatus() ? ' selected' : ''; ?>><?= $this->getHtml('Inactive'); ?>
</select>
<tr><td><?= $this->getData('editor')->render('unit-editor'); ?>
<tr><td><?= $this->getData('editor')->getData('text')->render(