diff --git a/Admin/Install/Application/QA/Application.php b/Admin/Install/Application/QA/Application.php index 6982bf6..b80c531 100755 --- a/Admin/Install/Application/QA/Application.php +++ b/Admin/Install/Application/QA/Application.php @@ -154,7 +154,7 @@ final class Application if ($account->id > 0) { $response->header->l11n = $account->l11n; } 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 ->loadFromLanguage( @@ -165,7 +165,7 @@ final class Application $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()); } @@ -173,7 +173,7 @@ final class Application $head = new Head(); $pageView->setData('unitId', $this->app->unitId); - $pageView->setData('head', $head); + $pageView->data['head'] = $head; $response->set('Content', $pageView); /* App only allows GET */ @@ -190,14 +190,14 @@ final class Application return; } - UriFactory::setQuery('/lang', $response->getLanguage()); + UriFactory::setQuery('/lang', $response->header->l11n->language); $this->loadLanguageFromPath( - $response->getLanguage(), - __DIR__ . '/lang/' . $response->getLanguage() . '.lang.php' + $response->header->l11n->language, + __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 */ $this->initResponseHead($head, $request, $response); @@ -255,8 +255,8 @@ final class Application $response->header->status = RequestStatusCode::R_406; $pageView->setTemplate('/Web/{APPNAME}/Error/406'); $this->loadLanguageFromPath( - $response->getLanguage(), - __DIR__ . '/Error/lang/' . $response->getLanguage() . '.lang.php' + $response->header->l11n->language, + __DIR__ . '/Error/lang/' . $response->header->l11n->language . '.lang.php' ); } @@ -275,8 +275,8 @@ final class Application $response->header->status = RequestStatusCode::R_503; $pageView->setTemplate('/Web/{APPNAME}/Error/503'); $this->loadLanguageFromPath( - $response->getLanguage(), - __DIR__ . '/Error/lang/' . $response->getLanguage() . '.lang.php' + $response->header->l11n->language, + __DIR__ . '/Error/lang/' . $response->header->l11n->language . '.lang.php' ); } @@ -334,8 +334,8 @@ final class Application $response->header->status = RequestStatusCode::R_403; $pageView->setTemplate('/Web/{APPNAME}/Error/403'); $this->loadLanguageFromPath( - $response->getLanguage(), - __DIR__ . '/Error/lang/' . $response->getLanguage() . '.lang.php' + $response->header->l11n->language, + __DIR__ . '/Error/lang/' . $response->header->l11n->language . '.lang.php' ); } diff --git a/Admin/Install/Application/QA/index.tpl.php b/Admin/Install/Application/QA/index.tpl.php index 6e064d3..ffc3891 100755 --- a/Admin/Install/Application/QA/index.tpl.php +++ b/Admin/Install/Application/QA/index.tpl.php @@ -16,13 +16,13 @@ declare(strict_types=1); use phpOMS\Uri\UriFactory; /** @var phpOMS\Model\Html\Head $head */ -$head = $this->getData('head'); +$head = $this->head; /** @var array $dispatch */ $dispatch = $this->getData('dispatch') ?? []; ?> - + diff --git a/Admin/Settings/Theme/Backend/settings.tpl.php b/Admin/Settings/Theme/Backend/settings.tpl.php index f742933..262b561 100755 --- a/Admin/Settings/Theme/Backend/settings.tpl.php +++ b/Admin/Settings/Theme/Backend/settings.tpl.php @@ -18,9 +18,9 @@ use phpOMS\Uri\UriFactory; * @var \phpOMS\Views\View $this * @var \Modules\QA\Models\QAApp[] $apps */ -$apps = $this->getData('apps') ?? []; +$apps = $this->data['apps'] ?? []; -echo $this->getData('nav')->render(); ?> +echo $this->data['nav']->render(); ?>
diff --git a/Controller/ApiController.php b/Controller/ApiController.php index 13cb439..238df37 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -117,7 +117,7 @@ final class ApiController extends Controller public function apiQAQuestionCreate(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void { if (!empty($val = $this->validateQAQuestionCreate($request))) { - $response->set('qa_question_create', new FormValidation($val)); + $response->data['qa_question_create'] = new FormValidation($val); $response->header->status = RequestStatusCode::R_400; return; @@ -172,7 +172,7 @@ final class ApiController extends Controller } } - if (!empty($uploadedFiles = $request->getFiles())) { + if (!empty($uploadedFiles = $request->files)) { $uploaded = $this->app->moduleManager->get('Media')->uploadFiles( [], [], @@ -238,7 +238,7 @@ final class ApiController extends Controller public function apiQAAnswerCreate(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void { if (!empty($val = $this->validateQAAnswerCreate($request))) { - $response->set('qa_answer_create', new FormValidation($val)); + $response->data['qa_answer_create'] = new FormValidation($val); $response->header->status = RequestStatusCode::R_400; return; @@ -270,7 +270,7 @@ final class ApiController extends Controller $answer->setStatus((int) $request->getData('status')); $answer->createdBy = new Profile(new NullAccount($request->header->account)); - if (!empty($uploadedFiles = $request->getFiles())) { + if (!empty($uploadedFiles = $request->files)) { $uploaded = $this->app->moduleManager->get('Media')->uploadFiles( [], [], @@ -393,7 +393,7 @@ final class ApiController extends Controller public function apiQAAppCreate(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void { if (!empty($val = $this->validateQAAppCreate($request))) { - $response->set('qa_app_create', new FormValidation($val)); + $response->data['qa_app_create'] = new FormValidation($val); $response->header->status = RequestStatusCode::R_400; return; @@ -458,7 +458,7 @@ final class ApiController extends Controller public function apiChangeQAQuestionVote(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void { if (!empty($val = $this->validateQuestionVote($request))) { - $response->set('qa_question_vote', new FormValidation($val)); + $response->data['qa_question_vote'] = new FormValidation($val); $response->header->status = RequestStatusCode::R_400; return; @@ -533,7 +533,7 @@ final class ApiController extends Controller public function apiChangeQAAnswerVote(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void { if (!empty($val = $this->validateAnswerVote($request))) { - $response->set('qa_answer_vote', new FormValidation($val)); + $response->data['qa_answer_vote'] = new FormValidation($val); $response->header->status = RequestStatusCode::R_400; return; diff --git a/Controller/BackendController.php b/Controller/BackendController.php index e5e9a64..7db82b0 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -49,7 +49,7 @@ final class BackendController extends Controller */ public function setUpBackend(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void { - $head = $response->get('Content')->getData('head'); + $head = $response->get('Content')->head; $head->addAsset(AssetType::CSS, '/Modules/QA/Theme/Backend/styles.css?v=1.0.0'); } @@ -69,7 +69,7 @@ final class BackendController extends Controller { $view = new View($this->app->l11nManager, $request, $response); $view->setTemplate('/Modules/QA/Theme/Backend/qa-dashboard'); - $view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1006001001, $request, $response)); + $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1006001001, $request, $response); /** @var \Modules\QA\Models\QAQuestion[] $list */ $list = QAQuestionMapper::getAll() @@ -80,15 +80,15 @@ final class BackendController extends Controller ->with('answers/votes') ->with('tags') ->with('tags/title') - ->where('tags/title/language', $response->getLanguage()) - ->where('language', $response->getLanguage()) + ->where('tags/title/language', $response->header->l11n->language) + ->where('language', $response->header->l11n->language) ->limit(50)->execute(); - $view->setData('questions', $list); + $view->data['questions'] = $list; /** @var \Modules\QA\Models\QAApp[] $apps */ $apps = QAAppMapper::getAll()->execute(); - $view->setData('apps', $apps); + $view->data['apps'] = $apps; return $view; } @@ -109,7 +109,7 @@ final class BackendController extends Controller { $view = new View($this->app->l11nManager, $request, $response); $view->setTemplate('/Modules/QA/Theme/Backend/qa-question'); - $view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1006001001, $request, $response)); + $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1006001001, $request, $response); /** @var \Modules\QA\Models\QAQuestion $question */ $question = QAQuestionMapper::get() @@ -124,13 +124,13 @@ final class BackendController extends Controller ->with('tags/title') ->with('media') ->where('id', (int) $request->getData('id')) - ->where('tags/title/language', $response->getLanguage()) + ->where('tags/title/language', $response->header->l11n->language) ->execute(); - $view->addData('question', $question); + $view->data['question'] = $question; $scores = QAHelperMapper::getAccountScore($question->getAccounts()); - $view->addData('scores', $scores); + $view->data['scores'] = $scores; return $view; } @@ -151,11 +151,11 @@ final class BackendController extends Controller { $view = new View($this->app->l11nManager, $request, $response); $view->setTemplate('/Modules/QA/Theme/Backend/qa-question-create'); - $view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1006001001, $request, $response)); + $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1006001001, $request, $response); /** @var \Modules\QA\Models\QAQuestion $question */ $question = QAQuestionMapper::get()->where('id', (int) $request->getData('id'))->execute(); - $view->addData('question', $question); + $view->data['question'] = $question; return $view; } @@ -174,17 +174,17 @@ final class BackendController extends Controller public function viewModuleSettings(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface { $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') ?? ''; /** @var \Model\Setting[] $settings */ $settings = SettingMapper::getAll()->where('module', $id)->execute(); - $view->setData('settings', $settings); + $view->data['settings'] = $settings; /** @var \Modules\QA\Models\QAApp[] $apps */ $apps = QAAppMapper::getAll()->execute(); - $view->setData('apps', $apps); + $view->data['apps'] = $apps; $view->setTemplate('/Modules/' . static::NAME . '/Admin/Settings/Theme/Backend/settings'); @@ -206,9 +206,9 @@ final class BackendController extends Controller { $view = new View($this->app->l11nManager, $request, $response); $view->setTemplate('/Modules/' . static::NAME . '/Admin/Settings/Theme/Backend/settings-app'); - $view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1000105001, $request, $response)); + $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1000105001, $request, $response); - $view->addData('app', QAAppMapper::get()->where('id', (int) $request->getData('app'))->execute()); + $view->data['app'] = QAAppMapper::get()->where('id', (int) $request->getData('app'))->execute(); return $view; } diff --git a/Theme/Backend/qa-dashboard.tpl.php b/Theme/Backend/qa-dashboard.tpl.php index 774213f..612a135 100755 --- a/Theme/Backend/qa-dashboard.tpl.php +++ b/Theme/Backend/qa-dashboard.tpl.php @@ -15,12 +15,12 @@ declare(strict_types=1); use phpOMS\Uri\UriFactory; /** @var \Modules\QA\Modles\QAQuestion[] $questions */ -$questions = $this->getData('questions'); +$questions = $this->data['questions']; /** @var \Modules\QA\Modles\QAApp[] $apps */ -$apps = $this->getData('apps'); +$apps = $this->data['apps']; -echo $this->getData('nav')->render(); ?> +echo $this->data['nav']->render(); ?>
diff --git a/Theme/Backend/qa-question.tpl.php b/Theme/Backend/qa-question.tpl.php index 784a2d2..5d4612d 100755 --- a/Theme/Backend/qa-question.tpl.php +++ b/Theme/Backend/qa-question.tpl.php @@ -15,15 +15,15 @@ declare(strict_types=1); use phpOMS\Uri\UriFactory; /** @var \Modules\QA\Models\QAQuestion $question */ -$question = $this->getData('question'); +$question = $this->data['question']; /** @var \Modules\QA\Models\QAAnswer[] $answers */ $answers = $question->getAnswersByScore(); /** @var array $scores */ -$scores = $this->getData('scores'); +$scores = $this->data['scores']; -echo $this->getData('nav')->render(); +echo $this->data['nav']->render(); ?>
diff --git a/Theme/Backend/qa-tag-edit.tpl.php b/Theme/Backend/qa-tag-edit.tpl.php index 739d6f4..6213df6 100755 --- a/Theme/Backend/qa-tag-edit.tpl.php +++ b/Theme/Backend/qa-tag-edit.tpl.php @@ -12,10 +12,10 @@ */ declare(strict_types=1); -$tag = $this->getData('tag'); +$tag = $this->data['tag']; /** @var \phpOMS\Views\View $this */ -echo $this->getData('nav')->render(); +echo $this->data['nav']->render(); ?>
diff --git a/Theme/Backend/qa-tag-list.tpl.php b/Theme/Backend/qa-tag-list.tpl.php index 8ec157b..8209641 100755 --- a/Theme/Backend/qa-tag-list.tpl.php +++ b/Theme/Backend/qa-tag-list.tpl.php @@ -12,10 +12,10 @@ */ declare(strict_types=1); -$tags = $this->getData('tags'); +$tags = $this->data['tags']; /** @var \phpOMS\Views\View $this */ -echo $this->getData('nav')->render(); +echo $this->data['nav']->render(); ?>