/** * Renders a list of items, target is the common admin-list. * Please be aware, that the combination of paging and sortable-lists may result in unpredictable ordering. * As soon as the list is sortable, the page-size should be at least the same as the number of elements. Optional * it is possible to provide a filter callback which is called for each entry. If the callback returns false the * entry gets skipped. * * @param class_array_section_iterator $objArraySectionIterator * @param bool $bitSortable * @param string $strListIdentifier an internal identifier to check the current parent-list * @param bool $bitAllowTreeDrop * @param string $strPagerAddon * @param Closure $objFilter * * @throws class_exception * @return string */ protected final function renderList(class_array_section_iterator $objArraySectionIterator, $bitSortable = false, $strListIdentifier = "", $bitAllowTreeDrop = false, $strPagerAddon = "", Closure $objFilter = null) { $strReturn = ""; $intI = 0; $strListId = generateSystemid(); if (!$objArraySectionIterator->valid()) { $strReturn .= $this->objToolkit->getTextRow($this->getLang("commons_list_empty")); } if ($bitSortable) { $strReturn .= $this->objToolkit->dragableListHeader($strListId, false, $bitAllowTreeDrop, $objArraySectionIterator->getIntElementsPerPage(), $objArraySectionIterator->getPageNumber()); } else { $strReturn .= $this->objToolkit->listHeader(); } if ($this->renderLevelUpAction($strListIdentifier) != "") { $strReturn .= $this->objToolkit->genericAdminList("", "", "", $this->objToolkit->listButton($this->renderLevelUpAction($strListIdentifier)), $intI++); } $arrMassActions = $this->getBatchActionHandlers($strListIdentifier); $intTotalNrOfElements = $objArraySectionIterator->getNumberOfElements(); /** @var $objOneIterable class_model|interface_model|interface_admin_listable */ foreach ($objArraySectionIterator as $objOneIterable) { // if we have a filter Closure call it else use the standard rightView method if ($objFilter !== null) { if ($objFilter($objOneIterable) === false) { if ($bitSortable) { //inject hidden dummy row for a proper sorting $strReturn .= $this->objToolkit->genericAdminList($objOneIterable->getSystemid(), "", "", "", 0, "", "", false, "hidden"); } $intTotalNrOfElements--; continue; } } else { if (!$objOneIterable->rightView()) { if ($bitSortable) { //inject hidden dummy row for a proper sorting $strReturn .= $this->objToolkit->genericAdminList($objOneIterable->getSystemid(), "", "", "", 0, "", "", false, "hidden"); } $intTotalNrOfElements--; continue; } } $strActions = $this->getActionIcons($objOneIterable, $strListIdentifier); $strReturn .= $this->objToolkit->simpleAdminList($objOneIterable, $strActions, $intI++, count($arrMassActions) > 0); } $strNewActions = $this->mergeNewEntryActions($this->getNewEntryAction($strListIdentifier)); $strBatchActions = ""; if (count($arrMassActions) > 0) { $strBatchActions .= $this->objToolkit->renderBatchActionHandlers($arrMassActions); } if ($strNewActions != "" || $strBatchActions != "") { $strReturn .= $this->objToolkit->genericAdminList("batchActionSwitch", $strBatchActions, "", $strNewActions, $intI, "", "", $strBatchActions != ""); } if ($bitSortable) { $strReturn .= $this->objToolkit->dragableListFooter($strListId); } else { $strReturn .= $this->objToolkit->listFooter(); } $objArraySectionIterator->setIntTotalElements($intTotalNrOfElements); $strReturn .= $this->objToolkit->getPageview($objArraySectionIterator, $this->getArrModule("modul"), $this->getAction(), "&systemid=" . $this->getSystemid() . $this->strPeAddon . $strPagerAddon); return $strReturn; }
/** * Renders a list of logically deleted records * * @permissions right1 * @return string * @autoTestable */ protected function actionDeletedRecords() { $objArraySectionIterator = new class_array_section_iterator(class_module_system_worker::getDeletedRecordsCount()); $objArraySectionIterator->setPageNumber((int) ($this->getParam("pv") != "" ? $this->getParam("pv") : 1)); $objArraySectionIterator->setArraySection(class_module_system_worker::getDeletedRecords($objArraySectionIterator->calculateStartPos(), $objArraySectionIterator->calculateEndPos())); $strReturn = ""; if (!$objArraySectionIterator->valid()) { $strReturn .= $this->getLang("commons_list_empty"); } $strReturn .= $this->objToolkit->listHeader(); /** @var class_model $objOneRecord */ foreach ($objArraySectionIterator as $objOneRecord) { $strImage = ""; if ($objOneRecord instanceof interface_admin_listable) { $strImage = $objOneRecord->getStrIcon(); if (is_array($strImage)) { $strImage = class_adminskin_helper::getAdminImage($strImage[0], $strImage[1]); } else { $strImage = class_adminskin_helper::getAdminImage($strImage); } } $strActions = ""; if ($objOneRecord->rightDelete()) { $strActions .= $this->objToolkit->listButton(class_link::getLinkAdmin($this->getArrModule("modul"), "finalDeleteRecord", "&systemid=" . $objOneRecord->getSystemid(), $this->getLang("action_final_delete_record"), $this->getLang("action_final_delete_record"), "icon_delete")); } if ($objOneRecord->isRestorable()) { $strActions .= $this->objToolkit->listButton(class_link::getLinkAdmin($this->getArrModule("modul"), "restoreRecord", "&systemid=" . $objOneRecord->getSystemid(), $this->getLang("action_restore_record"), $this->getLang("action_restore_record"), "icon_undo")); } else { $strActions .= $this->objToolkit->listButton(class_adminskin_helper::getAdminImage("icon_undoDisabled", $this->getLang("action_restore_record_blocked"))); } $strReturn .= $this->objToolkit->genericAdminList($objOneRecord->getSystemid(), $objOneRecord instanceof interface_model ? $objOneRecord->getStrDisplayName() : get_class($objOneRecord), $strImage, $strActions, 0, "Systemid / Previd: " . $objOneRecord->getStrSystemid() . " / " . $objOneRecord->getStrPrevId()); } $strReturn .= $this->objToolkit->listFooter(); $strReturn .= $this->objToolkit->getPageview($objArraySectionIterator, "system", "deletedRecords"); return $strReturn; }