/** * @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; }