/** * @param class_model|interface_admin_listable|interface_model|class_module_pages_pageelement $objOneIterable * @param string $strListIdentifier * * @return string */ public function getActionIcons($objOneIterable, $strListIdentifier = "") { $strActions = ""; if ($objOneIterable instanceof class_module_pages_pageelement) { $objLockmanager = $objOneIterable->getLockManager(); //Create a row to handle the element, check all necessary stuff such as locking etc $strActions = ""; //First step - Record locked? Offer button to unlock? But just as admin! For the user, who locked the record, the unlock-button //won't be visible if (!$objLockmanager->isAccessibleForCurrentUser()) { //So, return a button, if we have an admin in front of us if ($objLockmanager->isUnlockableForCurrentUser()) { $strActions .= $this->objToolkit->listButton(class_link::getLinkAdmin("pages_content", "list", "&systemid=" . $this->getSystemid() . "&adminunlockid=" . $objOneIterable->getSystemid(), "", $this->getLang("ds_entsperren"), "icon_lockerOpen")); } //If the Element is locked, then its not allowed to edit or delete the record, so disable the icons if ($objOneIterable->rightEdit()) { $strActions .= $this->objToolkit->listButton(class_adminskin_helper::getAdminImage("icon_editLocked", $this->getLang("ds_gesperrt"))); } if ($objOneIterable->rightDelete()) { $strActions .= $this->objToolkit->listButton(class_adminskin_helper::getAdminImage("icon_deleteLocked", $this->getLang("ds_gesperrt"))); } } else { if ($objOneIterable->rightEdit()) { $strActions .= $this->objToolkit->listButton(class_link::getLinkAdmin("pages_content", "edit", "&systemid=" . $objOneIterable->getSystemid(), "", $this->getLang("element_bearbeiten"), "icon_edit")); } if ($objOneIterable->rightDelete()) { $strActions .= $this->objToolkit->listDeleteButton($objOneIterable->getStrName() . ($objOneIterable->getConcreteAdminInstance()->getContentTitle() != "" ? " - " . $objOneIterable->getConcreteAdminInstance()->getContentTitle() : "") . ($objOneIterable->getStrTitle() != "" ? " - " . $objOneIterable->getStrTitle() : ""), $this->getLang("element_loeschen_frage"), class_link::getLinkAdminHref("pages_content", "deleteElementFinal", "&systemid=" . $objOneIterable->getSystemid() . ($this->getParam("pe") == "" ? "" : "&peClose=" . $this->getParam("pe")))); } } //The Icons to sort the list and to copy the element $strActions .= $this->objToolkit->listButton(class_link::getLinkAdminDialog("pages_content", "copyElement", "&systemid=" . $objOneIterable->getSystemid(), "", $this->getLang("element_copy"), "icon_copy")); //The status-icons $strActions .= $this->objToolkit->listStatusButton($objOneIterable->getSystemid()); } else { if ($objOneIterable instanceof class_module_pages_element) { $objAdminInstance = class_module_system_module::getModuleByName("pages")->getAdminInstanceOfConcreteModule(); if ($objAdminInstance != null && $objAdminInstance instanceof class_admin_simple) { return $objAdminInstance->getActionIcons($objOneIterable); } } } return $strActions; }
/** * Renders the edit action button for the current record. * * @param class_model|interface_admin_listable $objListEntry * @param bool $bitDialog opens the linked page in a js-based dialog * * @return string */ protected function renderEditAction(class_model $objListEntry, $bitDialog = false) { if ($objListEntry->getIntRecordDeleted() == 1) { return ""; } if ($objListEntry->rightEdit()) { $objLockmanager = $objListEntry->getLockManager(); if (!$objLockmanager->isAccessibleForCurrentUser()) { return $this->objToolkit->listButton(class_adminskin_helper::getAdminImage("icon_editLocked", $this->getLang("commons_locked"))); } if ($bitDialog) { return $this->objToolkit->listButton(class_link::getLinkAdminDialog($objListEntry->getArrModule("modul"), $this->getActionNameForClass("edit", $objListEntry), "folderview=1&systemid=" . $objListEntry->getSystemid() . $this->strPeAddon, $this->getLang("commons_list_edit"), $this->getLang("commons_list_edit"), "icon_edit", $objListEntry->getStrDisplayName())); } else { return $this->objToolkit->listButton(class_link::getLinkAdmin($objListEntry->getArrModule("modul"), $this->getActionNameForClass("edit", $objListEntry), "&systemid=" . $objListEntry->getSystemid() . $this->strPeAddon, $this->getLang("commons_list_edit"), $this->getLang("commons_list_edit"), "icon_edit")); } } return ""; }
/** * @param string $strTargetURI If you pass null, no form-tags will be rendered. * @param int $intButtonConfig a list of buttons to attach to the end of the form. if you need more then the obligatory save-button, * pass them combined by a bitwise or, e.g. class_admin_formgenerator::BIT_BUTTON_SAVE | class_admin_formgenerator::$BIT_BUTTON_CANCEL * * @throws class_exception * @return string */ public function renderForm($strTargetURI, $intButtonConfig = 2) { $strReturn = ""; //add a hidden systemid-field if ($this->objSourceobject != null) { $objField = new class_formentry_hidden($this->strFormname, "systemid"); $objField->setStrEntryName("systemid")->setStrValue($this->objSourceobject->getSystemid())->setObjValidator(new class_systemid_validator()); $this->addField($objField); } $objToolkit = class_carrier::getInstance()->getObjToolkit("admin"); if ($strTargetURI !== null) { $strReturn .= $objToolkit->formHeader($strTargetURI, "", $this->strFormEncoding, $this->strOnSubmit); } $strReturn .= $objToolkit->getValidationErrors($this); $strHidden = ""; foreach ($this->arrFields as $objOneField) { if (in_array($objOneField->getStrEntryName(), $this->arrHiddenElements)) { $strHidden .= $objOneField->renderField(); } else { $strReturn .= $objOneField->renderField(); } } if ($strHidden != "") { $strReturn .= $objToolkit->formOptionalElementsWrapper($strHidden, $this->strHiddenGroupTitle, $this->bitHiddenElementsVisible); } if ($intButtonConfig & self::BIT_BUTTON_SUBMIT) { $strReturn .= $objToolkit->formInputSubmit(class_lang::getInstance()->getLang("commons_submit", "system"), "submitbtn"); } if ($intButtonConfig & self::BIT_BUTTON_SAVE) { $strReturn .= $objToolkit->formInputSubmit(class_lang::getInstance()->getLang("commons_save", "system"), "submitbtn"); } if ($intButtonConfig & self::BIT_BUTTON_CANCEL) { $strReturn .= $objToolkit->formInputSubmit(class_lang::getInstance()->getLang("commons_cancel", "system"), "cancelbtn"); } if ($intButtonConfig & self::BIT_BUTTON_CLOSE) { $strReturn .= $objToolkit->formInputSubmit(class_lang::getInstance()->getLang("commons_close", "system"), "closebtn"); } if ($intButtonConfig & self::BIT_BUTTON_DELETE) { $strReturn .= $objToolkit->formInputSubmit(class_lang::getInstance()->getLang("commons_delete", "system"), "deletebtn"); } if ($intButtonConfig & self::BIT_BUTTON_RESET) { $strReturn .= $objToolkit->formInputSubmit(class_lang::getInstance()->getLang("commons_reset", "system"), "reset", "", "cancelbutton"); } if ($intButtonConfig & self::BIT_BUTTON_CONTINUE) { $strReturn .= $objToolkit->formInputSubmit(class_lang::getInstance()->getLang("commons_continue", "system"), "continuebtn"); } if ($intButtonConfig & self::BIT_BUTTON_BACK) { $strReturn .= $objToolkit->formInputSubmit(class_lang::getInstance()->getLang("commons_back", "system"), "backbtn"); } if ($strTargetURI !== null) { $strReturn .= $objToolkit->formClose(); } if (count($this->arrFields) > 0) { reset($this->arrFields); do { $objField = current($this->arrFields); if (!$objField instanceof class_formentry_hidden && !$objField instanceof class_formentry_plaintext && !$objField instanceof class_formentry_headline && !$objField instanceof class_formentry_divider) { $strReturn .= $objToolkit->setBrowserFocus($objField->getStrEntryName()); break; } } while (next($this->arrFields) !== false); } //lock the record to avoid multiple edit-sessions - if in edit mode if ($this->objSourceobject != null && method_exists($this->objSourceobject, "getLockManager")) { $bitSkip = false; if ($this->getField("mode") != null && $this->getField("mode")->getStrValue() == "new") { $bitSkip = true; } if (!$bitSkip && !validateSystemid($this->objSourceobject->getSystemid())) { $bitSkip = true; } if (!$bitSkip) { if ($this->objSourceobject->getLockManager()->isAccessibleForCurrentUser()) { $this->objSourceobject->getLockManager()->lockRecord(); } else { $objUser = new class_module_user_user($this->objSourceobject->getLockManager()->getLockId()); throw new class_exception("Current record is already locked by user '" . $objUser->getStrDisplayName() . "'.\nCannot be locked for the current user", class_exception::$level_ERROR); } } } return $strReturn; }