/** * Edits or creates a group (displays form) * * @param string $strMode * @param \class_admin_formgenerator|null $objForm * * @return string * @permissions edit * @autoTestable */ protected function actionGroupNew($strMode = "new", class_admin_formgenerator $objForm = null) { $this->setArrModuleEntry("template", "/folderview.tpl"); $objUsersources = new class_module_user_sourcefactory(); if ($strMode == "new") { if ($this->getParam("usersource") == "" || $objUsersources->getUsersource($this->getParam("usersource")) == null) { $arrSubsystems = $objUsersources->getArrUsersources(); $arrDD = array(); foreach ($arrSubsystems as $strOneName) { $objConcreteSubsystem = $objUsersources->getUsersource($strOneName); if ($objConcreteSubsystem->getCreationOfGroupsAllowed()) { $arrDD[$strOneName] = $objConcreteSubsystem->getStrReadableName(); } } if (count($arrDD) > 1) { $strReturn = $this->objToolkit->formHeader(class_link::getLinkAdminHref($this->getArrModule("modul"), "groupNew")); $strReturn .= $this->objToolkit->formInputDropdown("usersource", $arrDD, $this->getLang("group_usersource")); $strReturn .= $this->objToolkit->formInputSubmit($this->getLang("commons_save")); $strReturn .= $this->objToolkit->formClose(); return $strReturn; } else { $arrKeys = array_keys($arrDD); $this->setParam("usersource", array_pop($arrKeys)); } } $objSource = $objUsersources->getUsersource($this->getParam("usersource")); $objNewGroup = $objSource->getNewGroup(); if ($objForm == null) { $objForm = $this->getGroupForm($objNewGroup); } $objForm->addField(new class_formentry_hidden("", "usersource"))->setStrValue($this->getParam("usersource")); $objForm->addField(new class_formentry_hidden("", "mode"))->setStrValue("new"); return $objForm->renderForm(class_link::getLinkAdminHref($this->getArrModule("modul"), "groupSave")); } else { $objNewGroup = new class_module_user_group($this->getSystemid()); $this->setParam("usersource", $objNewGroup->getStrSubsystem()); if ($objForm == null) { $objForm = $this->getGroupForm($objNewGroup->getObjSourceGroup()); } $objForm->getField("group_name")->setStrValue($objNewGroup->getStrName()); $objForm->addField(new class_formentry_hidden("", "usersource"))->setStrValue($this->getParam("usersource")); $objForm->addField(new class_formentry_hidden("", "mode"))->setStrValue("edit"); return $objForm->renderForm(class_link::getLinkAdminHref($this->getArrModule("modul"), "groupSave")); } }
/** * Returns the fully featured group-instance created by the matching subsystem. * * @param class_module_user_group $objLeightweightGroup * * @return interface_usersources_group */ public function getSourceGroup(class_module_user_group $objLeightweightGroup) { $objSubsystem = $this->getUsersource($objLeightweightGroup->getStrSubsystem()); $objPlainGroup = $objSubsystem->getGroupById($objLeightweightGroup->getSystemid()); return $objPlainGroup; }