This commit is contained in:
Dennis Eichhorn 2024-01-02 23:34:19 +00:00
parent 0b4f58f0e0
commit 643eafe4c9
6 changed files with 66 additions and 65 deletions

View File

@ -58,4 +58,24 @@ return [
],
],
],
'^.*/tag/l11n$' => [
[
'dest' => '\Modules\Tag\Controller\ApiController:apiTagL11nCreate',
'verb' => RouteVerb::PUT,
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::READ,
'state' => PermissionCategory::TAG,
],
],
[
'dest' => '\Modules\Tag\Controller\ApiController:apiTagL11nUpdate',
'verb' => RouteVerb::SET,
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::READ,
'state' => PermissionCategory::TAG,
],
],
],
];

View File

@ -33,7 +33,7 @@ use phpOMS\Views\View;
final class BackendController extends Controller
{
/**
* Routing end-point for application behaviour.
* Routing end-point for application behavior.
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
@ -55,7 +55,7 @@ final class BackendController extends Controller
}
/**
* Routing end-point for application behaviour.
* Routing end-point for application behavior.
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
@ -73,34 +73,27 @@ final class BackendController extends Controller
$view->setTemplate('/Modules/Tag/Theme/Backend/tag-list');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1007501001, $request, $response);
$mapper = TagMapper::getAll()
->with('title')
->where('title/language', $request->header->l11n->language)
->limit(25);
if ($request->getData('ptype') === 'p') {
$view->data['tags'] = TagMapper::getAll()
->with('title')
->where('id', $request->getDataInt('id') ?? 0, '<')
->where('title/language', $request->header->l11n->language)
->limit(25)
->execute();
$view->data['tags'] = $mapper->where('id', $request->getDataInt('id') ?? 0, '<')
->execute();
} elseif ($request->getData('ptype') === 'n') {
$view->data['tags'] = TagMapper::getAll()
->with('title')
->where('id', $request->getDataInt('id') ?? 0, '>')
->where('title/language', $request->header->l11n->language)
->limit(25)
->execute();
$view->data['tags'] = $mapper->where('id', $request->getDataInt('id') ?? 0, '>')
->execute();
} else {
$view->data['tags'] = TagMapper::getAll()
->with('title')
->where('id', 0, '>')
->where('title/language', $request->header->l11n->language)
->limit(25)
->execute();
$view->data['tags'] = $mapper->where('id', 0, '>')
->execute();
}
return $view;
}
/**
* Routing end-point for application behaviour.
* Routing end-point for application behavior.
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
@ -126,12 +119,14 @@ final class BackendController extends Controller
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1007501001, $request, $response);
$view->data['tag'] = $tag;
/** @var \phpOMS\Localization\BaseStringL11n[] $l11n */
$l11n = TagL11nMapper::getAll()
$view->data['l11nView'] = new \Web\Backend\Views\L11nView($this->app->l11nManager, $request, $response);
/** @var \phpOMS\Localization\BaseStringL11n[] $l11nValues */
$l11nValues = TagL11nMapper::getAll()
->where('ref', $tag->id)
->execute();
$view->data['l11n'] = $l11n;
$view->data['l11nValues'] = $l11nValues;
return $view;
}

View File

@ -17,7 +17,7 @@ namespace Modules\Tag\Models;
use phpOMS\Stdlib\Base\Enum;
/**
* Permision state enum.
* Permission category enum.
*
* @package Modules\Tag\Models
* @license OMS License 2.0

View File

@ -14,12 +14,12 @@
]' formaction=""><i class="g-icon">book</i></button>
<div class="advancedInput wf-100" id="<?= $this->id; ?>">
<input autocomplete="off" class="input" type="text" id="i<?= $this->id; ?>"
placeholder="&#xf007; Guest"
placeholder="Guest"
data-emptyAfter="true"
data-autocomplete="off"
data-src="api/tag/find?search={!#i<?= $this->id; ?>}">
<div id="<?= $this->id; ?>-popup" class="popup" data-active="true">
<table class="default">
<table class="default sticky">
<thead>
<tr>
<td>ID<i class="sort-asc g-icon">expand_less</i><i class="sort-desc g-icon">expand_more</i>

View File

@ -24,11 +24,11 @@ echo $this->data['nav']->render(); ?>
<div class="portlet-body">
<table class="layout wf-100" style="table-layout: fixed">
<tr><td><label for="iTitle"><?= $this->getHtml('Title'); ?></label>
<tr><td><input type="text" name="title" id="iTitle" placeholder="&#xf040; oms" required>
<tr><td><input type="text" name="title" id="iTitle" placeholder="oms" required>
<tr><td><label for="iColor"><?= $this->getHtml('Color'); ?></label>
<tr><td><input type="color" name="color" id="iColor"required>
<tr><td><label for="iIcon"><?= $this->getHtml('Icon'); ?></label>
<tr><td><input type="text" name="icon" id="iIcon" placeholder="&#xf040; oms" value="<?= $this->printHtml($tag->icon); ?>">
<tr><td><input type="text" name="icon" id="iIcon" placeholder="oms" value="<?= $this->printHtml($tag->icon); ?>">
</table>
</div>
<div class="portlet-foot">

View File

@ -4,7 +4,7 @@
*
* PHP Version 8.1
*
* @package Modules\Editor
* @package Modules\Tag
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
@ -12,29 +12,31 @@
*/
declare(strict_types=1);
use phpOMS\Localization\ISO639Enum;
use phpOMS\Uri\UriFactory;
/** @var \Modules\Tag\Models\Tag */
$tag = $this->data['tag'];
$l11n = $this->data['l11n'] ?? [];
/** @var \phpOMS\Views\View $this */
echo $this->data['nav']->render(); ?>
<div class="row">
<div class="col-xs-12 col-md-6">
<div class="portlet">
<form id="fTagUpdate" method="post" action="<?= UriFactory::build('{/api}tag'); ?>">
<form id="tagForm" method="POST" action="<?= UriFactory::build('{/api}tag'); ?>"
data-ui-container="#tagTable tbody"
data-add-form="tagForm"
data-add-tpl="#tagTable tbody .oms-add-tpl-tag">
<div class="portlet-head"><?= $this->getHtml('Tag'); ?></div>
<div class="portlet-body">
<table class="layout wf-100" style="table-layout: fixed">
<tr><td><label for="iTitle"><?= $this->getHtml('Title'); ?></label>
<tr><td><input type="text" name="title" id="iTitle" placeholder="&#xf040; oms" value="<?= $this->printHtml($tag->getL11n()); ?>" required>
<tr><td><label for="iColor"><?= $this->getHtml('Color'); ?></label>
<tr><td><input type="color" name="color" id="iColor" value="<?= $this->printHtml(\substr($tag->color, 0, 7)); ?>" required>
<tr><td><label for="iIcon"><?= $this->getHtml('Icon'); ?></label>
<tr><td><input type="text" name="icon" id="iIcon" placeholder="&#xf040; oms" value="<?= $this->printHtml($tag->icon); ?>">
</table>
<div class="form-group">
<label for="iColor"><?= $this->getHtml('Color'); ?></label>
<input type="color" name="color" id="iColor" value="<?= $this->printHtml(\substr($tag->color, 0, 7)); ?>" required>
</div>
<div class="form-group">
<label for="iIcon"><?= $this->getHtml('Icon'); ?></label>
<input type="text" name="icon" id="iIcon" placeholder="" value="<?= $this->printHtml($tag->icon); ?>">
</div>
</div>
<div class="portlet-foot">
@ -44,29 +46,13 @@ echo $this->data['nav']->render(); ?>
</form>
</div>
</div>
</div>
<div class="col-xs-12 col-md-6">
<div class="portlet">
<div class="portlet-head"><?= $this->getHtml('Language', '0', '0'); ?><i class="g-icon download btn end-xs">download</i></div>
<table class="default">
<thead>
<tr>
<td>
<td>
<td><?= $this->getHtml('Language', '0', '0'); ?>
<td class="wf-100"><?= $this->getHtml('Title'); ?>
<tbody>
<?php $c = 0; foreach ($l11n as $key => $value) : ++$c; ?>
<tr>
<td><a href="#"><i class="g-icon">close</i></a>
<td><a href="#"><i class="g-icon">settings</i></a>
<td><?= ISO639Enum::getByName('_' . \strtoupper($value->getLanguage())); ?>
<td><?= $value->content; ?>
<?php endforeach; ?>
<?php if ($c === 0) : ?>
<tr><td colspan="3" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
</table>
</div>
</div>
<div class="row">
<?= $this->data['l11nView']->render(
$this->data['l11nValues'],
[],
'{/api}tag/l11n'
);
?>
</div>