function printSingleLevel($strStartId, &$arrGlobalNodes) { foreach ($arrGlobalNodes as $intI => $strId) { if ($strId["system_id"] == $strStartId) { unset($arrGlobalNodes[$intI]); break; } } $objCommon = new class_module_system_common($strStartId); $arrRecord = $objCommon->getSystemRecord(); $arrChilds = $objCommon->getChildNodesAsIdArray(); echo "<div style=\"padding-bottom: 5px; " . (count($arrChilds) > 0 ? " cursor: pointer; " : "") . " \"\n onmouseover=\"this.style.backgroundColor='#cccccc';\" onmouseout=\"this.style.backgroundColor='#ffffff';\"\n " . (count($arrChilds) > 0 ? " onclick=\"javascript:fold('" . $strStartId . "')\" " : " ") . "\n >"; $strStatus = "<span style=\"color: green; \">active</span>"; if ($objCommon->getIntRecordStatus() == 0) { $strStatus = "<span style=\"color: red;\">inactive</span>"; } if (count($arrChilds) > 0) { echo " + "; } else { echo " "; } echo $objCommon->getStrRecordClass() . " / " . $objCommon->getRecordComment() . " / " . $objCommon->getSystemid() . "\n"; echo " state: " . $strStatus . " module nr: " . $arrRecord["system_module_nr"] . " sort: " . $arrRecord["system_sort"] . "\n"; echo "</div>"; if (count($arrChilds) > 0) { echo "<div id=\"" . $strStartId . "\" style=\"border: 1px solid #cccccc; margin: 0 0 0px 20px; display: none;\" >"; for ($intI = 0; $intI < count($arrChilds); $intI++) { $strSingleId = $arrChilds[$intI]; printSingleLevel($strSingleId, $arrGlobalNodes); } echo "</div>"; } }
function validateSingleLevelSort($strParentId) { $objCommon = new class_module_system_common($strParentId); if ($objCommon->getIntModuleNr() == _pages_modul_id_ || $objCommon->getIntModuleNr() == _pages_folder_id_) { $strQuery = "SELECT system_id\n FROM " . _dbprefix_ . "system\n WHERE system_prev_id=? AND system_id != '0'\n AND system_module_nr IN (?, ?)\n ORDER BY system_sort ASC, system_comment ASC"; $arrNodesRaw = class_carrier::getInstance()->getObjDB()->getPArray($strQuery, array($strParentId, _pages_modul_id_, _pages_folder_id_)); $arrNodes = array(); foreach ($arrNodesRaw as $arrOneRow) { $arrNodes[] = $arrOneRow["system_id"]; } } else { $arrNodes = $objCommon->getChildNodesAsIdArray($strParentId); } echo "<div style='padding-left: 25px;'>"; for ($intI = 1; $intI <= count($arrNodes); $intI++) { $objCurNode = class_objectfactory::getInstance()->getObject($arrNodes[$intI - 1]); if ($objCurNode == null) { $objCommon = new class_module_system_common($arrNodes[$intI - 1]); $strCurLevel = "<span style='color: red'>error loading node for: " . $intI . " @ " . $arrNodes[$intI - 1] . " - " . $objCommon->getStrRecordClass() . "</span>"; echo "<div>" . $strCurLevel . "</div>"; } $strCurLevel = $objCurNode->getSystemid() . " - " . $objCurNode->getIntSort() . " - " . $objCurNode->getStrRecordClass() . " - " . $objCurNode->getStrRecordComment(); if ($intI != $objCurNode->getIntSort()) { $strCurLevel = "<span style='color: red'>expected: " . $intI . ", got " . $objCurNode->getIntSort() . " @ " . $strCurLevel . "</span>"; if (getGet("doFix") != "") { $strCurLevel .= "\nSetting new sort-id to " . $intI . "\n"; $strQuery = "UPDATE " . _dbprefix_ . "system SET system_sort = ? WHERE system_id = ? "; class_carrier::getInstance()->getObjDB()->_pQuery($strQuery, array($intI, $objCurNode->getSystemid())); } } else { $strCurLevel = "<span style='color: green'>" . $strCurLevel . "</span>"; } echo "<div>" . $strCurLevel . "</div>"; if ($objCurNode instanceof class_module_pages_page) { validateSinglePage($objCurNode); } validateSingleLevelSort($objCurNode->getSystemid()); } echo "</div>"; }