/** * This method renders a template. * * @param string $pageHtml * @param array $tplVars Variables that should be accessible in the template files * * @return string The rendered template */ protected function renderBasicTemplate($pageHtml, $tplVars = array()) { $currentEnv = $this->core->getCurrentDomain()->environment; $defaultTplVars = array('_core' => $this->core, '_auth' => $this->auth, 'page_html' => $pageHtml, 'logged_in' => $this->auth->isLoggedIn(), 'username' => null, 'siteTitle' => null, 'scripts_footer' => null, 'admin_bar' => null, 'meta_description' => null, 'js_revision' => isset($this->core->getSettings()->cms->{$currentEnv}->js_revision) ? $this->core->getSettings()->cms->{$currentEnv}->js_revision : 1, 'css_revision' => isset($this->core->getSettings()->cms->{$currentEnv}->css_revision) ? $this->core->getSettings()->cms->{$currentEnv}->css_revision : 1, 'area_head' => null, 'area_body' => null, 'cms_page' => null); $lang = $this->core->getLocaleHandler()->getLanguage(); $navModules = array(); foreach ($this->moduleModel->getAllModules() as $module) { if ($module->backendcontroller === null) { continue; } $module->display_name = isset($module->manifest_content->name->{$lang}) ? $module->manifest_content->name->{$lang} : $module->name; $navModules[] = $module; } usort($navModules, function ($a, $b) { return $a->display_name > $b->display_name; }); if ($this->auth->isLoggedIn()) { $adminBarHtml = '<div class="mfadminbar"> <a href="/backend"><img class="adminbar-logo" src="/images/adminbar-logo.png" alt=""></a> <ul class="adminbar-nav"> <li class="more"><a href="#" id="nav-general">General</a> <ul class="adminbar-nav-sub"> <li><a href="/backend/general/phpinfo" id="nav-phpinfo">PHP Info</a></li> </ul> </li> <li class="more"><a href="/backend/modules" id="nav-modules">' . $this->translator->_d('backend', 'Modules') . '</a> <ul class="adminbar-nav-sub">'; foreach ($navModules as $module) { $baseModuleLink = '/backend/module/' . $module->name; $adminBarHtml .= '<li><a href="' . $baseModuleLink . '" id="nav-' . $module->name . '">' . $module->display_name . '</a>' . $this->renderModuleNavigation($module->backendcontroller, $baseModuleLink, BackendNavigationInterface::DISPLAY_IN_ADMIN_BAR) . '</li>'; } $adminBarHtml .= '</ul> </li> <li><a href="/backend/elements" id="nav-elements">' . $this->translator->_d('backend', 'Elements') . '</a></li> <li><a href="/">' . $this->translator->_d('backend', 'Inline editing') . '</a></li> </ul> <ul class="adminbar-user"> <li><a href="/backend/myaccount">' . $this->auth->getUserData()->username . '</a></li> <li class="user-logout"><a href="/backend/logout"><span></span></a></li> </ul> </div>'; $tplVars['username'] = $this->auth->getUserData()->username; $tplVars['admin_bar'] = $adminBarHtml; } return $this->cmsView->render('template.html', $tplVars + $defaultTplVars); }
/** * Renders the module with the given template file and TemplateEngine instance * * @param FrontendController $frontendController * @param CmsView $view * @return string Returns the rendered html of the module */ public function render(FrontendController $frontendController, CmsView $view) { return $view->render($this->identifier . '.html', (array) $this->tplVars); }