+ /**
+ * Affect variable after controller processing.
+ * Used for alert messages.
+ */
+ protected function finalize(string $basePath): void
+ {
+ // TODO: use the SessionManager
+ $messageKeys = [
+ SessionManager::KEY_SUCCESS_MESSAGES,
+ SessionManager::KEY_WARNING_MESSAGES,
+ SessionManager::KEY_ERROR_MESSAGES
+ ];
+ foreach ($messageKeys as $messageKey) {
+ if (!empty($_SESSION[$messageKey])) {
+ $this->tpl->assign('global_' . $messageKey, $_SESSION[$messageKey]);
+ unset($_SESSION[$messageKey]);
+ }
+ }
+
+ $rootPath = preg_replace('#/index\.php$#', '', $basePath);
+ $this->assign('base_path', $basePath);
+ $this->assign('root_path', $rootPath);
+ $this->assign(
+ 'asset_path',
+ $rootPath . '/' .
+ rtrim($this->conf->get('resource.raintpl_tpl', 'tpl'), '/') . '/' .
+ $this->conf->get('resource.theme', 'default')
+ );
+ }
+