コード例 #1
0
    /**
     * 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);
    }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 protected function loadNeededModules()
 {
     $moduleModel = new ModuleModel($this->db);
     foreach ($moduleModel->getAllModules() as $module) {
         if ($module->frontendcontroller === null || class_exists($module->frontendcontroller) === false || ($implementedInterfaces = class_implements($module->frontendcontroller)) === false || in_array('Symfony\\Component\\EventDispatcher\\EventSubscriberInterface', $implementedInterfaces) === false) {
             continue;
         }
         $moduleControllerInstance = new $module->frontendcontroller($this, $module->name);
         $this->eventDispatcher->addSubscriber($moduleControllerInstance);
         $this->loadedModules[$module->name] = $moduleControllerInstance;
     }
 }
コード例 #3
0
 private function getAllRights()
 {
     $moduleModel = new ModuleModel($this->db);
     $rights = array();
     foreach ($moduleModel->getAllModules() as $mod) {
         if (isset($mod->manifest_content->rights) === false) {
             continue;
         }
         foreach ($mod->manifest_content->rights as $rKey => $rLang) {
             $rights[] = $rKey;
         }
     }
     return $rights;
 }