diff --git a/Application/Timerecording/Application.php b/Application/Timerecording/Application.php index b5d8aa3..0fb7ac9 100755 --- a/Application/Timerecording/Application.php +++ b/Application/Timerecording/Application.php @@ -108,7 +108,7 @@ final class Application $pageView = new TimerecordingView($this->app->l11nManager, $request, $response); $head = new Head(); - $pageView->setData('head', $head); + $pageView->data['head'] = $head; $response->set('Content', $pageView); /* Timerecording only allows GET */ @@ -178,7 +178,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( @@ -189,14 +189,14 @@ final class Application $this->app->setResponseLanguage($request, $response, $this->config); } - 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); @@ -270,8 +270,8 @@ final class Application $response->header->status = RequestStatusCode::R_406; $pageView->setTemplate('/Web/Timerecording/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' ); } @@ -290,8 +290,8 @@ final class Application $response->header->status = RequestStatusCode::R_503; $pageView->setTemplate('/Web/Timerecording/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' ); } @@ -349,8 +349,8 @@ final class Application $response->header->status = RequestStatusCode::R_403; $pageView->setTemplate('/Web/Timerecording/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' ); } @@ -433,7 +433,7 @@ final class Application private function createDefaultPageView(HttpRequest $request, HttpResponse $response, TimerecordingView $pageView) : void { $pageView->setOrganizations(UnitMapper::getAll()->execute()); - $pageView->setProfile(ProfileMapper::get()->where('account', $request->header->account)->execute()); + $pageView->profile = ProfileMapper::get()->where('account', $request->header->account)->execute(); $pageView->setData('nav', $this->getNavigation($request, $response)); $pageView->setTemplate('/Web/Timerecording/index'); diff --git a/Application/Timerecording/TimerecordingView.php b/Application/Timerecording/TimerecordingView.php index b884b7e..085dd3a 100755 --- a/Application/Timerecording/TimerecordingView.php +++ b/Application/Timerecording/TimerecordingView.php @@ -44,7 +44,7 @@ class TimerecordingView extends View * @var Profile * @since 1.0.0 */ - protected $profile = null; + public $profile = null; /** * Organizations. @@ -69,21 +69,6 @@ class TimerecordingView extends View $this->nav = $nav; } - /** - * Set user profile. - * - * @param Profile $profile user account - * - * @return void - * - * @since 1.0.0 - * @codeCoverageIgnore - */ - public function setProfile(Profile $profile) : void - { - $this->profile = $profile; - } - /** * Get profile image * diff --git a/Application/Timerecording/index.tpl.php b/Application/Timerecording/index.tpl.php index c1a0724..6a97855 100755 --- a/Application/Timerecording/index.tpl.php +++ b/Application/Timerecording/index.tpl.php @@ -18,13 +18,13 @@ $nav->setTemplate('/Modules/Navigation/Theme/Backend/top'); $top = $nav->render(); /** @var phpOMS\Model\Html\Head $head */ -$head = $this->getData('head'); +$head = $this->head; /** @var array $dispatch */ $dispatch = $this->getData('dispatch') ?? []; ?> - + diff --git a/Application/Timerecording/login.tpl.php b/Application/Timerecording/login.tpl.php index 56770e7..7621684 100755 --- a/Application/Timerecording/login.tpl.php +++ b/Application/Timerecording/login.tpl.php @@ -23,10 +23,10 @@ declare(strict_types=1); * @version 1.0.0 * @link https://jingga.app */ -$head = $this->getData('head'); +$head = $this->head; ?> - + diff --git a/Controller/ApiController.php b/Controller/ApiController.php index 678a119..140e554 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -142,7 +142,7 @@ final class ApiController extends Controller } if (!empty($val = $this->validateSessionElementCreate($request))) { - $response->set($request->uri->__toString(), new FormValidation($val)); + $response->data[$request->uri->__toString()] = new FormValidation($val); $response->header->status = RequestStatusCode::R_400; return; diff --git a/Controller/BackendController.php b/Controller/BackendController.php index a307876..5e30ef9 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -43,11 +43,11 @@ final class BackendController extends Controller implements DashboardElementInte { $view = new View($this->app->l11nManager, $request, $response); $view->setTemplate('/Modules/HumanResourceTimeRecording/Theme/Backend/dashboard'); - $view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1006301001, $request, $response)); + $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1006301001, $request, $response); /** @var \Modules\HumanResourceTimeRecording\Models\Session[] $list */ $list = SessionMapper::getLastSessionsFromAllEmployees(); - $view->addData('sessions', $list); + $view->data['sessions'] = $list; return $view; } @@ -68,7 +68,7 @@ final class BackendController extends Controller implements DashboardElementInte { $view = new View($this->app->l11nManager, $request, $response); $view->setTemplate('/Modules/HumanResourceTimeRecording/Theme/Backend/private-dashboard'); - $view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1006303001, $request, $response)); + $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1006303001, $request, $response); /** @var \Modules\HumanResourceManagement\Models\Employee $employee */ $employee = EmployeeMapper::get() @@ -91,9 +91,9 @@ final class BackendController extends Controller implements DashboardElementInte ->sort('id', OrderType::DESC) ->execute(); - $view->addData('sessions', $list); - $view->addData('lastSession', $lastOpenSession); - $view->addData('date', $limit); + $view->data['sessions'] = $list; + $view->data['lastSession'] = $lastOpenSession; + $view->data['date'] = $limit; return $view; } @@ -114,7 +114,7 @@ final class BackendController extends Controller implements DashboardElementInte { $view = new View($this->app->l11nManager, $request, $response); $view->setTemplate('/Modules/HumanResourceTimeRecording/Theme/Backend/private-session'); - $view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1006303001, $request, $response)); + $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1006303001, $request, $response); /** @var \Modules\HumanResourceTimeRecording\Models\Session $session */ $session = SessionMapper::get()->where('id', (int) $request->getData('id'))->execute(); @@ -127,9 +127,9 @@ final class BackendController extends Controller implements DashboardElementInte ->execute(); if ($session->employee->id !== $employee->id) { - $view->addData('session', new NullSession()); + $view->data['session'] = new NullSession(); } else { - $view->addData('session', $session); + $view->data['session'] = $session; } return $view; @@ -151,11 +151,11 @@ final class BackendController extends Controller implements DashboardElementInte { $view = new View($this->app->l11nManager, $request, $response); $view->setTemplate('/Modules/HumanResourceTimeRecording/Theme/Backend/hr-stats'); - $view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1006301001, $request, $response)); + $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1006301001, $request, $response); /** @var \Modules\HumanResourceTimeRecording\Models\Session[] $list */ $list = SessionMapper::getLastSessionsFromAllEmployees(); - $view->addData('sessions', $list); + $view->data['sessions'] = $list; return $view; } diff --git a/Controller/TimerecordingController.php b/Controller/TimerecordingController.php index 62aa46a..3cb7734 100755 --- a/Controller/TimerecordingController.php +++ b/Controller/TimerecordingController.php @@ -47,10 +47,10 @@ final class TimerecordingController extends Controller { $view = new View($this->app->l11nManager, $request, $response); $view->setTemplate('/Modules/HumanResourceTimeRecording/Theme/Timeterminal/overview'); - $view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1006301001, $request, $response)); + $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1006301001, $request, $response); $list = SessionMapper::getAll()->sort('id', OrderType::DESC)->limit(50)->execute(); - $view->addData('sessions', $list); + $view->data['sessions'] = $list; return $view; } diff --git a/Theme/Backend/dashboard.tpl.php b/Theme/Backend/dashboard.tpl.php index 39372fd..c176729 100755 --- a/Theme/Backend/dashboard.tpl.php +++ b/Theme/Backend/dashboard.tpl.php @@ -12,9 +12,9 @@ */ declare(strict_types=1); -$sessions = $this->getData('sessions'); +$sessions = $this->data['sessions']; -echo $this->getData('nav')->render(); ?> +echo $this->data['nav']->render(); ?>
diff --git a/Theme/Backend/private-dashboard.tpl.php b/Theme/Backend/private-dashboard.tpl.php index 649568c..ff8210d 100755 --- a/Theme/Backend/private-dashboard.tpl.php +++ b/Theme/Backend/private-dashboard.tpl.php @@ -18,11 +18,11 @@ use \phpOMS\Stdlib\Base\SmartDateTime; use phpOMS\Uri\UriFactory; /** @var Session[] $sessions */ -$sessions = $this->getData('sessions'); +$sessions = $this->data['sessions']; $sessionCount = \count($sessions); /** @var Session $lastOpenSession */ -$lastOpenSession = $this->getData('lastSession'); +$lastOpenSession = $this->data['lastSession']; $type = $lastOpenSession !== null ? $lastOpenSession->getType() : ClockingType::OFFICE; $status = $lastOpenSession !== null ? $lastOpenSession->getStatus() : ClockingStatus::END; @@ -42,7 +42,7 @@ $busy = [ 'week' => 0, ]; -echo $this->getData('nav')->render(); ?> +echo $this->data['nav']->render(); ?>
diff --git a/Theme/Backend/private-session.tpl.php b/Theme/Backend/private-session.tpl.php index ca495ff..6174b50 100755 --- a/Theme/Backend/private-session.tpl.php +++ b/Theme/Backend/private-session.tpl.php @@ -13,10 +13,10 @@ declare(strict_types=1); /** @var \Modules\HumanResourceTimeRecording\Models\Session $session */ -$session = $this->getData('session'); +$session = $this->data['session']; $elements = $session->getSessionElements(); -echo $this->getData('nav')->render(); ?> +echo $this->data['nav']->render(); ?>
diff --git a/Theme/Timeterminal/overview.tpl.php b/Theme/Timeterminal/overview.tpl.php index 73fb1b2..bb655e7 100755 --- a/Theme/Timeterminal/overview.tpl.php +++ b/Theme/Timeterminal/overview.tpl.php @@ -15,9 +15,9 @@ declare(strict_types=1); use \Modules\HumanResourceTimeRecording\Models\ClockingStatus; use \Modules\HumanResourceTimeRecording\Models\ClockingType; -$sessions = $this->getData('sessions'); +$sessions = $this->data['sessions']; -echo $this->getData('nav')->render(); ?> +echo $this->data['nav']->render(); ?>