This commit is contained in:
Dennis Eichhorn 2023-05-30 13:59:06 +00:00
commit 90d4bed874
12 changed files with 50 additions and 103 deletions

View File

@ -154,7 +154,7 @@ final class Application
if ($account->id > 0) { if ($account->id > 0) {
$response->header->l11n = $account->l11n; $response->header->l11n = $account->l11n;
} elseif ($this->app->sessionManager->get('language') !== null } elseif ($this->app->sessionManager->get('language') !== null
&& $response->header->l11n->getLanguage() !== $this->app->sessionManager->get('language') && $response->header->l11n->language !== $this->app->sessionManager->get('language')
) { ) {
$response->header->l11n $response->header->l11n
->loadFromLanguage( ->loadFromLanguage(
@ -165,7 +165,7 @@ final class Application
$this->app->setResponseLanguage($request, $response, $this->config); $this->app->setResponseLanguage($request, $response, $this->config);
} }
if (!\in_array($response->getLanguage(), $this->config['language'])) { if (!\in_array($response->header->l11n->language, $this->config['language'])) {
$response->header->l11n->setLanguage($this->app->l11nServer->getLanguage()); $response->header->l11n->setLanguage($this->app->l11nServer->getLanguage());
} }
@ -173,7 +173,7 @@ final class Application
$head = new Head(); $head = new Head();
$pageView->setData('unitId', $this->app->unitId); $pageView->setData('unitId', $this->app->unitId);
$pageView->setData('head', $head); $pageView->data['head'] = $head;
$response->set('Content', $pageView); $response->set('Content', $pageView);
/* App only allows GET */ /* App only allows GET */
@ -190,14 +190,14 @@ final class Application
return; return;
} }
UriFactory::setQuery('/lang', $response->getLanguage()); UriFactory::setQuery('/lang', $response->header->l11n->language);
$this->loadLanguageFromPath( $this->loadLanguageFromPath(
$response->getLanguage(), $response->header->l11n->language,
__DIR__ . '/lang/' . $response->getLanguage() . '.lang.php' __DIR__ . '/lang/' . $response->header->l11n->language . '.lang.php'
); );
$response->header->set('content-language', $response->getLanguage(), true); $response->header->set('content-language', $response->header->l11n->language, true);
/* Create html head */ /* Create html head */
$this->initResponseHead($head, $request, $response); $this->initResponseHead($head, $request, $response);
@ -255,8 +255,8 @@ final class Application
$response->header->status = RequestStatusCode::R_406; $response->header->status = RequestStatusCode::R_406;
$pageView->setTemplate('/Web/{APPNAME}/Error/406'); $pageView->setTemplate('/Web/{APPNAME}/Error/406');
$this->loadLanguageFromPath( $this->loadLanguageFromPath(
$response->getLanguage(), $response->header->l11n->language,
__DIR__ . '/Error/lang/' . $response->getLanguage() . '.lang.php' __DIR__ . '/Error/lang/' . $response->header->l11n->language . '.lang.php'
); );
} }
@ -275,8 +275,8 @@ final class Application
$response->header->status = RequestStatusCode::R_503; $response->header->status = RequestStatusCode::R_503;
$pageView->setTemplate('/Web/{APPNAME}/Error/503'); $pageView->setTemplate('/Web/{APPNAME}/Error/503');
$this->loadLanguageFromPath( $this->loadLanguageFromPath(
$response->getLanguage(), $response->header->l11n->language,
__DIR__ . '/Error/lang/' . $response->getLanguage() . '.lang.php' __DIR__ . '/Error/lang/' . $response->header->l11n->language . '.lang.php'
); );
} }
@ -334,8 +334,8 @@ final class Application
$response->header->status = RequestStatusCode::R_403; $response->header->status = RequestStatusCode::R_403;
$pageView->setTemplate('/Web/{APPNAME}/Error/403'); $pageView->setTemplate('/Web/{APPNAME}/Error/403');
$this->loadLanguageFromPath( $this->loadLanguageFromPath(
$response->getLanguage(), $response->header->l11n->language,
__DIR__ . '/Error/lang/' . $response->getLanguage() . '.lang.php' __DIR__ . '/Error/lang/' . $response->header->l11n->language . '.lang.php'
); );
} }

View File

@ -16,13 +16,13 @@ declare(strict_types=1);
use phpOMS\Uri\UriFactory; use phpOMS\Uri\UriFactory;
/** @var phpOMS\Model\Html\Head $head */ /** @var phpOMS\Model\Html\Head $head */
$head = $this->getData('head'); $head = $this->head;
/** @var array $dispatch */ /** @var array $dispatch */
$dispatch = $this->getData('dispatch') ?? []; $dispatch = $this->getData('dispatch') ?? [];
?> ?>
<!DOCTYPE HTML> <!DOCTYPE HTML>
<html lang="<?= $this->printHtml($this->response->getLanguage()); ?>"> <html lang="<?= $this->printHtml($this->response->header->l11n->language); ?>">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">

View File

@ -14,10 +14,10 @@ declare(strict_types=1);
use phpOMS\Uri\UriFactory; use phpOMS\Uri\UriFactory;
$settings = $this->getData('settings') ?? []; $settings = $this->data['settings'] ?? [];
$applications = $this->getData('applications') ?? []; $applications = $this->data['applications'] ?? [];
echo $this->getData('nav')->render(); ?> echo $this->data['nav']->render(); ?>
<div id="iSettings" class="tabview tab-2 url-rewrite"> <div id="iSettings" class="tabview tab-2 url-rewrite">
<div class="box wf-100 col-xs-12"> <div class="box wf-100 col-xs-12">

View File

@ -90,7 +90,7 @@ final class ApiController extends Controller
public function apiTicketCreate(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void public function apiTicketCreate(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void
{ {
if (!empty($val = $this->validateTicketCreate($request))) { if (!empty($val = $this->validateTicketCreate($request))) {
$response->set($request->uri->__toString(), new FormValidation($val)); $response->data[$request->uri->__toString()] = new FormValidation($val);
$response->header->status = RequestStatusCode::R_400; $response->header->status = RequestStatusCode::R_400;
return; return;
@ -226,7 +226,7 @@ final class ApiController extends Controller
public function apiTicketElementCreate(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void public function apiTicketElementCreate(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void
{ {
if (!empty($val = $this->validateTicketElementCreate($request))) { if (!empty($val = $this->validateTicketElementCreate($request))) {
$response->set('ticket_element_create', new FormValidation($val)); $response->data['ticket_element_create'] = new FormValidation($val);
$response->header->status = RequestStatusCode::R_400; $response->header->status = RequestStatusCode::R_400;
return; return;
@ -349,7 +349,7 @@ final class ApiController extends Controller
public function apiSupportAppCreate(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void public function apiSupportAppCreate(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void
{ {
if (!empty($val = $this->validateSupportAppCreate($request))) { if (!empty($val = $this->validateSupportAppCreate($request))) {
$response->set('qa_app_create', new FormValidation($val)); $response->data['qa_app_create'] = new FormValidation($val);
$response->header->status = RequestStatusCode::R_400; $response->header->status = RequestStatusCode::R_400;
return; return;
@ -414,7 +414,7 @@ final class ApiController extends Controller
public function apiTicketAttributeCreate(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void public function apiTicketAttributeCreate(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void
{ {
if (!empty($val = $this->validateTicketAttributeCreate($request))) { if (!empty($val = $this->validateTicketAttributeCreate($request))) {
$response->set('attribute_create', new FormValidation($val)); $response->data['attribute_create'] = new FormValidation($val);
$response->header->status = RequestStatusCode::R_400; $response->header->status = RequestStatusCode::R_400;
return; return;
@ -491,7 +491,7 @@ final class ApiController extends Controller
public function apiTicketAttributeTypeL11nCreate(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void public function apiTicketAttributeTypeL11nCreate(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void
{ {
if (!empty($val = $this->validateTicketAttributeTypeL11nCreate($request))) { if (!empty($val = $this->validateTicketAttributeTypeL11nCreate($request))) {
$response->set('attr_type_l11n_create', new FormValidation($val)); $response->data['attr_type_l11n_create'] = new FormValidation($val);
$response->header->status = RequestStatusCode::R_400; $response->header->status = RequestStatusCode::R_400;
return; return;
@ -516,7 +516,7 @@ final class ApiController extends Controller
$attrL11n = new BaseStringL11n(); $attrL11n = new BaseStringL11n();
$attrL11n->ref = $request->getDataInt('type') ?? 0; $attrL11n->ref = $request->getDataInt('type') ?? 0;
$attrL11n->setLanguage( $attrL11n->setLanguage(
$request->getDataString('language') ?? $request->getLanguage() $request->getDataString('language') ?? $request->header->l11n->language
); );
$attrL11n->content = $request->getDataString('title') ?? ''; $attrL11n->content = $request->getDataString('title') ?? '';
@ -560,7 +560,7 @@ final class ApiController extends Controller
public function apiTicketAttributeTypeCreate(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void public function apiTicketAttributeTypeCreate(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void
{ {
if (!empty($val = $this->validateTicketAttributeTypeCreate($request))) { if (!empty($val = $this->validateTicketAttributeTypeCreate($request))) {
$response->set('attr_type_create', new FormValidation($val)); $response->data['attr_type_create'] = new FormValidation($val);
$response->header->status = RequestStatusCode::R_400; $response->header->status = RequestStatusCode::R_400;
return; return;
@ -627,7 +627,7 @@ final class ApiController extends Controller
public function apiTicketAttributeValueCreate(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void public function apiTicketAttributeValueCreate(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void
{ {
if (!empty($val = $this->validateTicketAttributeValueCreate($request))) { if (!empty($val = $this->validateTicketAttributeValueCreate($request))) {
$response->set('attr_value_create', new FormValidation($val)); $response->data['attr_value_create'] = new FormValidation($val);
$response->header->status = RequestStatusCode::R_400; $response->header->status = RequestStatusCode::R_400;
return; return;
@ -712,7 +712,7 @@ final class ApiController extends Controller
public function apiTicketAttributeValueL11nCreate(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void public function apiTicketAttributeValueL11nCreate(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void
{ {
if (!empty($val = $this->validateTicketAttributeValueL11nCreate($request))) { if (!empty($val = $this->validateTicketAttributeValueL11nCreate($request))) {
$response->set('attr_value_l11n_create', new FormValidation($val)); $response->data['attr_value_l11n_create'] = new FormValidation($val);
$response->header->status = RequestStatusCode::R_400; $response->header->status = RequestStatusCode::R_400;
return; return;
@ -737,7 +737,7 @@ final class ApiController extends Controller
$attrL11n = new BaseStringL11n(); $attrL11n = new BaseStringL11n();
$attrL11n->ref = $request->getDataInt('value') ?? 0; $attrL11n->ref = $request->getDataInt('value') ?? 0;
$attrL11n->setLanguage( $attrL11n->setLanguage(
$request->getDataString('language') ?? $request->getLanguage() $request->getDataString('language') ?? $request->header->l11n->language
); );
$attrL11n->content = $request->getDataString('title') ?? ''; $attrL11n->content = $request->getDataString('title') ?? '';

View File

@ -68,12 +68,12 @@ final class BackendController extends Controller
*/ */
public function viewSupportList(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface public function viewSupportList(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface
{ {
$head = $response->get('Content')->getData('head'); $head = $response->get('Content')->head;
$head->addAsset(AssetType::CSS, 'Modules/Tasks/Theme/Backend/css/styles.css?v=1.0.0'); $head->addAsset(AssetType::CSS, 'Modules/Tasks/Theme/Backend/css/styles.css?v=1.0.0');
$view = new View($this->app->l11nManager, $request, $response); $view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/Support/Theme/Backend/support-list'); $view->setTemplate('/Modules/Support/Theme/Backend/support-list');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1002901101, $request, $response)); $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1002901101, $request, $response);
$mapperQuery = TicketMapper::getAll() $mapperQuery = TicketMapper::getAll()
->with('task') ->with('task')
@ -83,17 +83,11 @@ final class BackendController extends Controller
->limit(25); ->limit(25);
if ($request->getData('ptype') === 'p') { if ($request->getData('ptype') === 'p') {
$view->setData('tickets', $view->data['tickets'] = $mapperQuery->where('id', $request->getDataInt('id') ?? 0, '<')->execute();
$mapperQuery->where('id', $request->getDataInt('id') ?? 0, '<')->execute()
);
} elseif ($request->getData('ptype') === 'n') { } elseif ($request->getData('ptype') === 'n') {
$view->setData('tickets', $view->data['tickets'] = $mapperQuery->where('id', $request->getDataInt('id') ?? 0, '>')->execute();
$mapperQuery->where('id', $request->getDataInt('id') ?? 0, '>')->execute()
);
} else { } else {
$view->setData('tickets', $view->data['tickets'] = $mapperQuery->where('id', 0, '>')->execute();
$mapperQuery->where('id', 0, '>')->execute()
);
} }
return $view; return $view;
@ -116,7 +110,7 @@ final class BackendController extends Controller
$view = new TicketView($this->app->l11nManager, $request, $response); $view = new TicketView($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/Support/Theme/Backend/support-ticket'); $view->setTemplate('/Modules/Support/Theme/Backend/support-ticket');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1002901101, $request, $response)); $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1002901101, $request, $response);
$mapperQuery = TicketMapper::get() $mapperQuery = TicketMapper::get()
->with('task') ->with('task')
@ -130,20 +124,20 @@ final class BackendController extends Controller
->with('attributes') ->with('attributes')
->with('for') ->with('for')
->with('app') ->with('app')
->where('task/tags/title/language', $request->getLanguage()); ->where('task/tags/title/language', $request->header->l11n->language);
/** @var \Modules\Support\Models\Ticket $ticket */ /** @var \Modules\Support\Models\Ticket $ticket */
$ticket = $request->hasData('for') $ticket = $request->hasData('for')
? $mapperQuery->where('task', (int) $request->getData('for'))->execute() ? $mapperQuery->where('task', (int) $request->getData('for'))->execute()
: $mapperQuery->where('id', (int) $request->getData('id'))->execute(); : $mapperQuery->where('id', (int) $request->getData('id'))->execute();
$view->addData('ticket', $ticket); $view->data['ticket'] = $ticket;
$accGrpSelector = new \Modules\Profile\Theme\Backend\Components\AccountGroupSelector\BaseView($this->app->l11nManager, $request, $response); $accGrpSelector = new \Modules\Profile\Theme\Backend\Components\AccountGroupSelector\BaseView($this->app->l11nManager, $request, $response);
$view->addData('accGrpSelector', $accGrpSelector); $view->data['accGrpSelector'] = $accGrpSelector;
$editor = new \Modules\Editor\Theme\Backend\Components\Editor\BaseView($this->app->l11nManager, $request, $response); $editor = new \Modules\Editor\Theme\Backend\Components\Editor\BaseView($this->app->l11nManager, $request, $response);
$view->addData('editor', $editor); $view->data['editor'] = $editor;
return $view; return $view;
} }
@ -164,7 +158,7 @@ final class BackendController extends Controller
{ {
$view = new View($this->app->l11nManager, $request, $response); $view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/Support/Theme/Backend/ticket-create'); $view->setTemplate('/Modules/Support/Theme/Backend/ticket-create');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1002901101, $request, $response)); $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1002901101, $request, $response);
return $view; return $view;
} }
@ -185,7 +179,7 @@ final class BackendController extends Controller
{ {
$view = new View($this->app->l11nManager, $request, $response); $view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/Support/Theme/Backend/support-analysis'); $view->setTemplate('/Modules/Support/Theme/Backend/support-analysis');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1002901101, $request, $response)); $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1002901101, $request, $response);
return $view; return $view;
} }
@ -206,7 +200,7 @@ final class BackendController extends Controller
{ {
$view = new View($this->app->l11nManager, $request, $response); $view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/Support/Theme/Backend/support-settings'); $view->setTemplate('/Modules/Support/Theme/Backend/support-settings');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1002901101, $request, $response)); $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1002901101, $request, $response);
return $view; return $view;
} }
@ -227,7 +221,7 @@ final class BackendController extends Controller
{ {
$view = new View($this->app->l11nManager, $request, $response); $view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/Support/Theme/Backend/user-support-dashboard'); $view->setTemplate('/Modules/Support/Theme/Backend/user-support-dashboard');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1002901101, $request, $response)); $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1002901101, $request, $response);
return $view; return $view;
} }
@ -246,16 +240,16 @@ final class BackendController extends Controller
public function viewModuleSettings(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface public function viewModuleSettings(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface
{ {
$view = new View($this->app->l11nManager, $request, $response); $view = new View($this->app->l11nManager, $request, $response);
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1000105001, $request, $response)); $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1000105001, $request, $response);
$id = $request->getDataString('id') ?? ''; $id = $request->getDataString('id') ?? '';
$settings = SettingMapper::getAll()->where('module', $id)->execute(); $settings = SettingMapper::getAll()->where('module', $id)->execute();
$view->setData('settings', $settings); $view->data['settings'] = $settings;
/** @var \Modules\Support\Models\SupportApp[] $applications */ /** @var \Modules\Support\Models\SupportApp[] $applications */
$applications = SupportAppMapper::getAll()->execute(); $applications = SupportAppMapper::getAll()->execute();
$view->setData('applications', $applications); $view->data['applications'] = $applications;
$view->setTemplate('/Modules/' . static::NAME . '/Admin/Settings/Theme/Backend/settings'); $view->setTemplate('/Modules/' . static::NAME . '/Admin/Settings/Theme/Backend/settings');

View File

@ -67,18 +67,6 @@ class TicketAttribute implements \JsonSerializable
$this->value = new TicketAttributeValue(); $this->value = new TicketAttributeValue();
} }
/**
* Get id
*
* @return int
*
* @since 1.0.0
*/
public function getId() : int
{
return $this->id;
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */

View File

@ -97,18 +97,6 @@ class TicketAttributeType implements \JsonSerializable
$this->setL11n($name); $this->setL11n($name);
} }
/**
* Get id
*
* @return int
*
* @since 1.0.0
*/
public function getId() : int
{
return $this->id;
}
/** /**
* Set l11n * Set l11n
* *

View File

@ -108,17 +108,6 @@ class TicketAttributeValue implements \JsonSerializable
*/ */
private ?BaseStringL11n $l11n = null; private ?BaseStringL11n $l11n = null;
/**
* Get id
*
* @return int
*
* @since 1.0.0
*/
public function getId() : int
{
return $this->id;
}
/** /**
* Set value * Set value

View File

@ -70,18 +70,6 @@ class TicketElement implements \JsonSerializable
$this->taskElement = $taskElement ?? new TaskElement(); $this->taskElement = $taskElement ?? new TaskElement();
} }
/**
* Get id
*
* @return int
*
* @since 1.0.0
*/
public function getId() : int
{
return $this->id;
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */

View File

@ -18,9 +18,9 @@ use phpOMS\Uri\UriFactory;
* @var \phpOMS\Views\View $this * @var \phpOMS\Views\View $this
* @var \Modules\Support\Models\Ticket[] $tickets * @var \Modules\Support\Models\Ticket[] $tickets
*/ */
$tickets = $this->getData('tickets'); $tickets = $this->data['tickets'];
echo $this->getData('nav')->render(); ?> echo $this->data['nav']->render(); ?>
<div class="row"> <div class="row">
<div class="col-xs-12 col-md-9"> <div class="col-xs-12 col-md-9">

View File

@ -22,14 +22,14 @@ use phpOMS\Uri\UriFactory;
* @var \Modules\Support\Vies\TicketView $this * @var \Modules\Support\Vies\TicketView $this
* @var \Modules\Support\Models\Ticket $ticket * @var \Modules\Support\Models\Ticket $ticket
*/ */
$ticket = $this->getData('ticket'); $ticket = $this->data['ticket'];
$task = $ticket->task; $task = $ticket->task;
$taskMedia = $task->getMedia(); $taskMedia = $task->getMedia();
$elements = $ticket->invertTicketElements(); $elements = $ticket->invertTicketElements();
$cElements = \count($elements); $cElements = \count($elements);
$color = 'red'; //$this->getStatus($task->getStatus()); $color = 'red'; //$this->getStatus($task->getStatus());
echo $this->getData('nav')->render(); ?> echo $this->data['nav']->render(); ?>
<div class="row"> <div class="row">
<div class="col-md-6 col-xs-12"> <div class="col-md-6 col-xs-12">

View File

@ -15,7 +15,7 @@ declare(strict_types=1);
/** /**
* @var \phpOMS\Views\View $this * @var \phpOMS\Views\View $this
*/ */
echo $this->getData('nav')->render(); ?> echo $this->data['nav']->render(); ?>
<div class="row"> <div class="row">
<div class="col-xs-6"> <div class="col-xs-6">