/** * The v4 way of generating a backend-navigation. * * @param string $strCurrentModule * * @return string */ public function getAdminSitemap($strCurrentModule = "") { $strWrapperID = $this->objTemplate->readTemplate("/elements.tpl", "sitemap_wrapper"); $strModuleID = $this->objTemplate->readTemplate("/elements.tpl", "sitemap_module_wrapper"); $strModuleActiveID = $this->objTemplate->readTemplate("/elements.tpl", "sitemap_module_wrapper_active"); $strActionID = $this->objTemplate->readTemplate("/elements.tpl", "sitemap_action_entry"); $strDividerID = $this->objTemplate->readTemplate("/elements.tpl", "sitemap_divider_entry"); $strModules = ""; if ($strCurrentModule == "elemente") { $strCurrentModule = "pages"; } $arrModules = class_module_system_module::getModulesInNaviAsArray(class_module_system_aspect::getCurrentAspectId()); /** @var $arrNaviInstances class_module_system_module[] */ $arrNaviInstances = array(); foreach ($arrModules as $arrModule) { $objModule = class_module_system_module::getModuleBySystemid($arrModule["module_id"]); if ($objModule->rightView()) { $arrNaviInstances[] = $objModule; } } foreach ($arrNaviInstances as $objOneInstance) { $arrActions = class_admin_helper::getModuleActionNaviHelper($objOneInstance); $strActions = ""; foreach ($arrActions as $strOneAction) { if (trim($strOneAction) != "") { $arrActionEntries = array("action" => $strOneAction); $strActions .= $this->objTemplate->fillTemplate($arrActionEntries, $strActionID); } else { $strActions .= $this->objTemplate->fillTemplate(array(), $strDividerID); } } $arrModuleLevel = array("module" => class_link::getLinkAdmin($objOneInstance->getStrName(), "", "", class_carrier::getInstance()->getObjLang()->getLang("modul_titel", $objOneInstance->getStrName())), "actions" => $strActions, "systemid" => $objOneInstance->getSystemid(), "moduleTitle" => $objOneInstance->getStrName(), "moduleName" => class_carrier::getInstance()->getObjLang()->getLang("modul_titel", $objOneInstance->getStrName()), "moduleHref" => class_link::getLinkAdminHref($objOneInstance->getStrName(), "")); if ($strCurrentModule == $objOneInstance->getStrName()) { $strModules .= $this->objTemplate->fillTemplate($arrModuleLevel, $strModuleActiveID); } else { $strModules .= $this->objTemplate->fillTemplate($arrModuleLevel, $strModuleID); } } return $this->objTemplate->fillTemplate(array("level" => $strModules), $strWrapperID); }
/** * @param interface_usersources_user $objUser * @param bool $bitSelfedit * @param string $strMode * * @return class_admin_formgenerator|class_model */ protected function getUserForm(interface_usersources_user $objUser, $bitSelfedit, $strMode) { //load a few default values //languages $arrLang = array(); foreach ($this->arrLanguages as $strLanguage) { $arrLang[$strLanguage] = $this->getLang("lang_" . $strLanguage); } //skins $arrSkinsTemp = class_adminskin_helper::getListOfAdminskinsAvailable(); $arrSkins = array(); foreach ($arrSkinsTemp as $strSkin) { $arrSkins[$strSkin] = $strSkin; } //possible start-modules $arrModules = array(); foreach (class_module_system_module::getModulesInNaviAsArray() as $arrOneModule) { $objOneModule = class_module_system_module::getModuleByName($arrOneModule["module_name"]); if (!$objOneModule->rightView()) { continue; } $arrModules[$objOneModule->getStrName()] = $objOneModule->getAdminInstanceOfConcreteModule()->getLang("modul_titel"); } $objForm = new class_admin_formgenerator("user", $objUser); $objForm->addField(new class_formentry_headline())->setStrValue($this->getLang("user_personaldata")); //globals $objName = $objForm->addField(new class_formentry_text("user", "username"))->setBitMandatory(true)->setStrLabel($this->getLang("user_username"))->setStrValue($this->getParam("user_username")); if ($bitSelfedit) { $objName->setBitReadonly(true); } //generic //adding elements is more generic right here - load all methods if ($objUser->isEditable()) { $objAnnotations = new class_reflection($objUser); $arrProperties = $objAnnotations->getPropertiesWithAnnotation("@fieldType"); foreach ($arrProperties as $strProperty => $strValue) { $objField = $objForm->addDynamicField($strProperty); if ($objField->getStrEntryName() == "user_pass" && $strMode == "new") { $objField->setBitMandatory(true); } } } //system-settings $objForm->addField(new class_formentry_headline())->setStrValue($this->getLang("user_system")); $strInheritPermissionsId = $this->getParam("user_inherit_permissions_id"); if (!empty($strInheritPermissionsId)) { $objForm->addField(new class_formentry_hidden("user", "inherit_permissions_id"))->setStrValue($strInheritPermissionsId); $objInheritUser = new class_module_user_user($strInheritPermissionsId); $objForm->addField(new class_formentry_plaintext("inherit_hint"))->setStrValue($this->objToolkit->warningBox($this->getLang("user_copy_info", "", array($objInheritUser->getStrDisplayName())), "alert-info")); $objForm->setFieldToPosition("inherit_hint", 1); } $objForm->addField(new class_formentry_dropdown("user", "skin"))->setArrKeyValues($arrSkins)->setStrValue($this->getParam("user_skin") != "" ? $this->getParam("user_skin") : class_module_system_setting::getConfigValue("_admin_skin_default_"))->setStrLabel($this->getLang("user_skin")); $objForm->addField(new class_formentry_dropdown("user", "language"))->setArrKeyValues($arrLang)->setStrValue($this->getParam("user_language") != "" ? $this->getParam("user_language") : "")->setStrLabel($this->getLang("user_language"))->setBitMandatory(true); $objForm->addField(new class_formentry_dropdown("user", "startmodule"))->setArrKeyValues($arrModules)->setStrValue($this->getParam("user_startmodule") != "" ? $this->getParam("user_startmodule") : "dashboard")->setStrLabel($this->getLang("user_startmodule")); $objForm->addField(new class_formentry_dropdown("user", "items_per_page"))->setArrKeyValues(array(10 => 10, 15 => 15, 25 => 25, 50 => 50))->setStrValue($this->getParam("user_items_per_page") != "" ? $this->getParam("user_items_per_page") : null)->setStrLabel($this->getLang("user_items_per_page")); if (!$bitSelfedit) { $objForm->addField(new class_formentry_checkbox("user", "adminlogin"))->setStrLabel($this->getLang("user_admin")); $objForm->addField(new class_formentry_checkbox("user", "portal"))->setStrLabel($this->getLang("user_portal")); $objForm->addField(new class_formentry_checkbox("user", "active"))->setStrLabel($this->getLang("user_aktiv")); } if (count($objUser->getGroupIdsForUser()) == 0 && empty($strInheritPermissionsId)) { $objForm->addField(new class_formentry_plaintext("group_hint"))->setStrValue($this->objToolkit->warningBox($this->getLang("form_user_hint_groups"))); $objForm->setFieldToPosition("group_hint", 1); } $objForm->addField(new class_formentry_hidden("", "mode"))->setStrValue($strMode); $objUser->updateAdminForm($objForm); return $objForm; }
/** * Static helper to flush the complete backend navigation cache for the current session * May be used during language-changes or user-switches * * @return void */ public static function flushActionNavigationCache() { $arrAspects = class_module_system_aspect::getObjectList(); foreach (class_module_system_module::getModulesInNaviAsArray() as $arrOneModule) { $objOneModule = class_module_system_module::getModuleByName($arrOneModule["module_name"]); foreach ($arrAspects as $objOneAspect) { class_carrier::getInstance()->getObjSession()->sessionUnset(__CLASS__ . "adminNaviEntries" . $objOneModule->getSystemid() . $objOneAspect->getSystemid()); } } }