diff --git a/Controller/ApiController.php b/Controller/ApiController.php index 04fcb8d..dfce17b 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -96,7 +96,7 @@ final class ApiController extends Controller public function apiTaskCreate(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void { if (!empty($val = $this->validateTaskCreate($request))) { - $response->set($request->uri->__toString(), new FormValidation($val)); + $response->data[$request->uri->__toString()] = new FormValidation($val); $response->header->status = RequestStatusCode::R_400; return; @@ -106,7 +106,7 @@ final class ApiController extends Controller $task = $this->createTaskFromRequest($request); $this->createModel($request->header->account, $task, TaskMapper::class, 'task', $request->getOrigin()); - if (!empty($request->getFiles()) + if (!empty($request->files) || !empty($request->getDataJson('media')) ) { $this->createTaskMedia($task, $request); @@ -117,7 +117,7 @@ final class ApiController extends Controller $response, NotificationLevel::OK, '', - $this->app->l11nManager->getText($response->getLanguage(), '0', '0', 'SucessfulCreate'), + $this->app->l11nManager->getText($response->header->l11n->language, '0', '0', 'SucessfulCreate'), $task ); } @@ -139,7 +139,7 @@ final class ApiController extends Controller /** @var \Modules\Admin\Models\Account $account */ $account = AccountMapper::get()->where('id', $request->header->account)->execute(); - if (!empty($uploadedFiles = $request->getFiles())) { + if (!empty($uploadedFiles = $request->files)) { $uploaded = $this->app->moduleManager->get('Media')->uploadFiles( names: [], fileNames: [], @@ -386,7 +386,7 @@ final class ApiController extends Controller $response, NotificationLevel::OK, '', - $this->app->l11nManager->getText($response->getLanguage(), '0', '0', 'SucessfulUpdate'), + $this->app->l11nManager->getText($response->header->l11n->language, '0', '0', 'SucessfulUpdate'), $new ); } @@ -453,7 +453,7 @@ final class ApiController extends Controller public function apiTaskElementCreate(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void { if (!empty($val = $this->validateTaskElementCreate($request))) { - $response->set('task_element_create', new FormValidation($val)); + $response->data['task_element_create'] = new FormValidation($val); $response->header->status = RequestStatusCode::R_400; return; @@ -474,7 +474,7 @@ final class ApiController extends Controller $this->createModel($request->header->account, $element, TaskElementMapper::class, 'taskelement', $request->getOrigin()); - if (!empty($request->getFiles()) + if (!empty($request->files) || !empty($request->getDataJson('media')) ) { $this->createTaskElementMedia($task, $element, $request); @@ -491,7 +491,7 @@ final class ApiController extends Controller $response, NotificationLevel::OK, '', - $this->app->l11nManager->getText($response->getLanguage(), '0', '0', 'SucessfulCreate'), + $this->app->l11nManager->getText($response->header->l11n->language, '0', '0', 'SucessfulCreate'), $element ); } @@ -514,7 +514,7 @@ final class ApiController extends Controller /** @var \Modules\Admin\Models\Account $account */ $account = AccountMapper::get()->where('id', $request->header->account)->execute(); - if (!empty($uploadedFiles = $request->getFiles())) { + if (!empty($uploadedFiles = $request->files)) { $uploaded = $this->app->moduleManager->get('Media')->uploadFiles( [], [], @@ -726,7 +726,7 @@ final class ApiController extends Controller $response, NotificationLevel::OK, '', - $this->app->l11nManager->getText($response->getLanguage(), '0', '0', 'SucessfulUpdate'), + $this->app->l11nManager->getText($response->header->l11n->language, '0', '0', 'SucessfulUpdate'), $new ); } @@ -784,7 +784,7 @@ final class ApiController extends Controller public function apiTaskAttributeCreate(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void { if (!empty($val = $this->validateTaskAttributeCreate($request))) { - $response->set('attribute_create', new FormValidation($val)); + $response->data['attribute_create'] = new FormValidation($val); $response->header->status = RequestStatusCode::R_400; return; @@ -798,7 +798,7 @@ final class ApiController extends Controller $response, NotificationLevel::OK, '', - $this->app->l11nManager->getText($response->getLanguage(), '0', '0', 'SucessfulCreate'), + $this->app->l11nManager->getText($response->header->l11n->language, '0', '0', 'SucessfulCreate'), $attribute ); } @@ -870,7 +870,7 @@ final class ApiController extends Controller public function apiTaskAttributeTypeL11nCreate(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void { if (!empty($val = $this->validateTaskAttributeTypeL11nCreate($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; return; @@ -884,7 +884,7 @@ final class ApiController extends Controller $response, NotificationLevel::OK, '', - $this->app->l11nManager->getText($response->getLanguage(), '0', '0', 'SucessfulCreate'), + $this->app->l11nManager->getText($response->header->l11n->language, '0', '0', 'SucessfulCreate'), $attrL11n ); } @@ -903,7 +903,7 @@ final class ApiController extends Controller $attrL11n = new BaseStringL11n(); $attrL11n->ref = $request->getDataInt('type') ?? 0; $attrL11n->setLanguage( - $request->getDataString('language') ?? $request->getLanguage() + $request->getDataString('language') ?? $request->header->l11n->language ); $attrL11n->content = $request->getDataString('title') ?? ''; @@ -947,7 +947,7 @@ final class ApiController extends Controller public function apiTaskAttributeTypeCreate(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void { if (!empty($val = $this->validateTaskAttributeTypeCreate($request))) { - $response->set('attr_type_create', new FormValidation($val)); + $response->data['attr_type_create'] = new FormValidation($val); $response->header->status = RequestStatusCode::R_400; return; @@ -961,7 +961,7 @@ final class ApiController extends Controller $response, NotificationLevel::OK, '', - $this->app->l11nManager->getText($response->getLanguage(), '0', '0', 'SucessfulCreate'), + $this->app->l11nManager->getText($response->header->l11n->language, '0', '0', 'SucessfulCreate'), $attrType ); } @@ -1024,7 +1024,7 @@ final class ApiController extends Controller public function apiTaskAttributeValueCreate(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void { if (!empty($val = $this->validateTaskAttributeValueCreate($request))) { - $response->set('attr_value_create', new FormValidation($val)); + $response->data['attr_value_create'] = new FormValidation($val); $response->header->status = RequestStatusCode::R_400; return; @@ -1047,7 +1047,7 @@ final class ApiController extends Controller $response, NotificationLevel::OK, '', - $this->app->l11nManager->getText($response->getLanguage(), '0', '0', 'SucessfulCreate'), + $this->app->l11nManager->getText($response->header->l11n->language, '0', '0', 'SucessfulCreate'), $attrValue ); } @@ -1116,7 +1116,7 @@ final class ApiController extends Controller public function apiTaskAttributeValueL11nCreate(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void { if (!empty($val = $this->validateTaskAttributeValueL11nCreate($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; return; @@ -1130,7 +1130,7 @@ final class ApiController extends Controller $response, NotificationLevel::OK, '', - $this->app->l11nManager->getText($response->getLanguage(), '0', '0', 'SucessfulCreate'), + $this->app->l11nManager->getText($response->header->l11n->language, '0', '0', 'SucessfulCreate'), $attrL11n ); } @@ -1149,7 +1149,7 @@ final class ApiController extends Controller $attrL11n = new BaseStringL11n(); $attrL11n->ref = $request->getDataInt('value') ?? 0; $attrL11n->setLanguage( - $request->getDataString('language') ?? $request->getLanguage() + $request->getDataString('language') ?? $request->header->l11n->language ); $attrL11n->content = $request->getDataString('title') ?? ''; diff --git a/Controller/BackendController.php b/Controller/BackendController.php index 300cf30..bf26e20 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -62,38 +62,32 @@ final class BackendController extends Controller implements DashboardElementInte $view = new View($this->app->l11nManager, $request, $response); /** @var \phpOMS\Model\Html\Head $head */ - $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'); $view->setTemplate('/Modules/Tasks/Theme/Backend/task-dashboard'); - $view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1001101001, $request, $response)); + $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1001101001, $request, $response); $mapperQuery = TaskMapper::getAnyRelatedToUser($request->header->account) ->with('tags') ->with('tags/title') ->where('status', TaskStatus::OPEN, '!=') - ->where('tags/title/language', $response->getLanguage()) + ->where('tags/title/language', $response->header->l11n->language) ->sort('createdAt', OrderType::DESC) ->limit(25); if ($request->getData('ptype') === 'p') { - $view->setData('tasks', - $mapperQuery->with('createdBy') + $view->data['tasks'] = $mapperQuery->with('createdBy') ->where('id', $request->getDataInt('id') ?? 0, '<') - ->execute() - ); + ->execute(); } elseif ($request->getData('ptype') === 'n') { - $view->setData('tasks', - $mapperQuery->with('createdBy') + $view->data['tasks'] = $mapperQuery->with('createdBy') ->where('id', $request->getDataInt('id') ?? 0, '>') - ->execute() - ); + ->execute(); } else { - $view->setData('tasks', - $mapperQuery->with('createdBy') + $view->data['tasks'] = $mapperQuery->with('createdBy') ->where('id', 0, '>') - ->execute() - ); + ->execute(); } $openQuery = new Builder($this->app->dbPool->get(), true); @@ -108,13 +102,13 @@ final class BackendController extends Controller implements DashboardElementInte ->with('createdBy') ->with('tags') ->with('tags/title') - ->where('tags/title/language', $response->getLanguage()) + ->where('tags/title/language', $response->header->l11n->language) ->where('status', TaskStatus::OPEN) ->sort('createdAt', OrderType::DESC) ->query($openQuery) ->execute(); - $view->setData('open', $open); + $view->data['open'] = $open; return $view; } @@ -126,12 +120,12 @@ final class BackendController extends Controller implements DashboardElementInte public function viewDashboard(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface { /** @var \phpOMS\Model\Html\Head $head */ - $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'); $view = new View($this->app->l11nManager, $request, $response); $view->setTemplate('/Modules/Tasks/Theme/Backend/dashboard-task'); - $view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1001101001, $request, $response)); + $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1001101001, $request, $response); /** @var \Modules\Tasks\Models\Task[] $tasks */ $tasks = TaskMapper::getAnyRelatedToUser($request->header->account) @@ -140,10 +134,10 @@ final class BackendController extends Controller implements DashboardElementInte ->sort('taskElements/createdAt', OrderType::DESC) ->limit(5) ->where('id', 0, '>') - ->where('tags/title/language', $response->getLanguage()) + ->where('tags/title/language', $response->header->l11n->language) ->execute(); - $view->addData('tasks', $tasks); + $view->data['tasks'] = $tasks; return $view; } @@ -176,15 +170,15 @@ final class BackendController extends Controller implements DashboardElementInte $view->setTemplate('/Web/Backend/Error/403'); $this->app->loadLanguageFromPath( - $response->getLanguage(), - __DIR__ . '/../../../Web/Backend/Error/lang/' . $response->getLanguage() . '.lang.php' + $response->header->l11n->language, + __DIR__ . '/../../../Web/Backend/Error/lang/' . $response->header->l11n->language . '.lang.php' ); return $view; } /** @var \phpOMS\Model\Html\Head $head */ - $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'); /** @var \Modules\Tasks\Models\Task $task */ @@ -199,7 +193,7 @@ final class BackendController extends Controller implements DashboardElementInte ->with('taskElements/accRelation') ->with('taskElements/accRelation/relation') ->where('id', (int) $request->getData('id')) - ->where('tags/title/language', $request->getLanguage()) + ->where('tags/title/language', $request->header->l11n->language) ->execute(); $accountId = $request->header->account; @@ -216,14 +210,14 @@ final class BackendController extends Controller implements DashboardElementInte } $view->setTemplate('/Modules/Tasks/Theme/Backend/task-single'); - $view->addData('task', $task); - $view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1001101001, $request, $response)); + $view->data['task'] = $task; + $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1001101001, $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); - $view->addData('editor', $editor); + $view->data['editor'] = $editor; return $view; } @@ -245,13 +239,13 @@ final class BackendController extends Controller implements DashboardElementInte $view = new View($this->app->l11nManager, $request, $response); $view->setTemplate('/Modules/Tasks/Theme/Backend/task-create'); - $view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1001101001, $request, $response)); + $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1001101001, $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); - $view->addData('editor', $editor); + $view->data['editor'] = $editor; return $view; } @@ -272,7 +266,7 @@ final class BackendController extends Controller implements DashboardElementInte { $view = new View($this->app->l11nManager, $request, $response); $view->setTemplate('/Modules/Tasks/Theme/Backend/task-analysis'); - $view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1001101001, $request, $response)); + $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1001101001, $request, $response); return $view; } diff --git a/Models/Task.php b/Models/Task.php index 2a21359..45b74bd 100755 --- a/Models/Task.php +++ b/Models/Task.php @@ -231,18 +231,6 @@ class Task implements \JsonSerializable $this->due->modify('+1 day'); } - /** - * Get id - * - * @return int - * - * @since 1.0.0 - */ - public function getId() : int - { - return $this->id; - } - /** * Adding new task element. * diff --git a/Models/TaskAttribute.php b/Models/TaskAttribute.php index cb1f31a..f3452b6 100755 --- a/Models/TaskAttribute.php +++ b/Models/TaskAttribute.php @@ -67,18 +67,6 @@ class TaskAttribute implements \JsonSerializable $this->value = new NullTaskAttributeValue(); } - /** - * Get id - * - * @return int - * - * @since 1.0.0 - */ - public function getId() : int - { - return $this->id; - } - /** * {@inheritdoc} */ diff --git a/Models/TaskAttributeType.php b/Models/TaskAttributeType.php index 6ef3805..708b11b 100755 --- a/Models/TaskAttributeType.php +++ b/Models/TaskAttributeType.php @@ -105,18 +105,6 @@ class TaskAttributeType implements \JsonSerializable $this->name = $name; } - /** - * Get id - * - * @return int - * - * @since 1.0.0 - */ - public function getId() : int - { - return $this->id; - } - /** * Set l11n * diff --git a/Models/TaskAttributeValue.php b/Models/TaskAttributeValue.php index 276e202..09775b9 100755 --- a/Models/TaskAttributeValue.php +++ b/Models/TaskAttributeValue.php @@ -108,17 +108,6 @@ class TaskAttributeValue implements \JsonSerializable */ private ?BaseStringL11n $l11n = null; - /** - * Get id - * - * @return int - * - * @since 1.0.0 - */ - public function getId() : int - { - return $this->id; - } /** * Set l11n diff --git a/Models/TaskElement.php b/Models/TaskElement.php index 87cb935..9082635 100755 --- a/Models/TaskElement.php +++ b/Models/TaskElement.php @@ -139,18 +139,6 @@ class TaskElement implements \JsonSerializable $this->createdBy = new NullAccount(); } - /** - * Get id - * - * @return int - * - * @since 1.0.0 - */ - public function getId() : int - { - return $this->id; - } - /** * Get all media * diff --git a/Models/TaskSeen.php b/Models/TaskSeen.php index bb03589..7f03f95 100755 --- a/Models/TaskSeen.php +++ b/Models/TaskSeen.php @@ -56,15 +56,4 @@ class TaskSeen $this->seenAt = new \DateTime('now'); } - /** - * Get id - * - * @return int - * - * @since 1.0.0 - */ - public function getId() : int - { - return $this->id; - } } diff --git a/Theme/Backend/dashboard-task.tpl.php b/Theme/Backend/dashboard-task.tpl.php index 7eaffb1..e680015 100755 --- a/Theme/Backend/dashboard-task.tpl.php +++ b/Theme/Backend/dashboard-task.tpl.php @@ -15,7 +15,7 @@ declare(strict_types=1); use Modules\Tasks\Models\TaskPriority; use phpOMS\Uri\UriFactory; -$tasksList = $this->getData('tasks') ?? []; +$tasksList = $this->data['tasks'] ?? []; ?>
diff --git a/Theme/Backend/task-analysis.tpl.php b/Theme/Backend/task-analysis.tpl.php index 10e9e71..e9b54b9 100755 --- a/Theme/Backend/task-analysis.tpl.php +++ b/Theme/Backend/task-analysis.tpl.php @@ -13,7 +13,7 @@ declare(strict_types=1); /** @var \phpOMS\Views\View $this */ -echo $this->getData('nav')->render(); ?> +echo $this->data['nav']->render(); ?>
diff --git a/Theme/Backend/task-create.tpl.php b/Theme/Backend/task-create.tpl.php index fe6384a..df85a6d 100755 --- a/Theme/Backend/task-create.tpl.php +++ b/Theme/Backend/task-create.tpl.php @@ -16,7 +16,7 @@ use Modules\Tasks\Models\TaskPriority; use Modules\Tasks\Models\TaskType; /** @var \phpOMS\Views\View $this */ -echo $this->getData('nav')->render(); ?> +echo $this->data['nav']->render(); ?>
diff --git a/Theme/Backend/task-dashboard.tpl.php b/Theme/Backend/task-dashboard.tpl.php index 951b6b6..81e13c6 100755 --- a/Theme/Backend/task-dashboard.tpl.php +++ b/Theme/Backend/task-dashboard.tpl.php @@ -17,14 +17,14 @@ use phpOMS\Uri\UriFactory; /** @var \phpOMS\Views\View $this */ /** @var \Modules\Tasks\Models\Task[] $tasks */ -$tasks = $this->getData('tasks') ?? []; +$tasks = $this->data['tasks'] ?? []; $previous = empty($tasks) ? 'task/dashboard' : 'task/dashboard?{?}&id=' . \reset($tasks)->id . '&ptype=p'; $next = empty($tasks) ? 'task/dashboard' : 'task/dashboard?{?}&id=' . \end($tasks)->id . '&ptype=n'; -$open = $this->getData('open'); +$open = $this->data['open']; -echo $this->getData('nav')->render(); ?> +echo $this->data['nav']->render(); ?>
diff --git a/Theme/Backend/task-single.tpl.php b/Theme/Backend/task-single.tpl.php index 50035f0..ff94636 100755 --- a/Theme/Backend/task-single.tpl.php +++ b/Theme/Backend/task-single.tpl.php @@ -20,13 +20,13 @@ use phpOMS\Uri\UriFactory; /** @var Modules\Tasks\Views\TaskView $this */ /** @var Modules\Tasks\Models\Task $task */ -$task = $this->getData('task'); +$task = $this->data['task']; $taskMedia = $task->getMedia(); $elements = $task->invertTaskElements(); $cElements = \count($elements); $color = $this->getStatus($task->getStatus()); -echo $this->getData('nav')->render(); ?> +echo $this->data['nav']->render(); ?>