function DisplayNavigatorListTab($oP, $aResults, $sRelation, $oObj) { $oP->SetCurrentTab(Dict::S('UI:RelationshipList')); $oP->add("<div id=\"impacted_objects\" style=\"width:100%;background-color:#fff;padding:10px;\">"); $iBlock = 1; // Zero is not a valid blockid foreach ($aResults as $sListClass => $aObjects) { $oSet = CMDBObjectSet::FromArray($sListClass, $aObjects); $oP->add("<h1>" . MetaModel::GetRelationDescription($sRelation) . ' ' . $oObj->GetName() . "</h1>\n"); $oP->add("<div class=\"page_header\">\n"); $oP->add("<h2>" . MetaModel::GetClassIcon($sListClass) . " <span class=\"hilite\">" . Dict::Format('UI:Search:Count_ObjectsOf_Class_Found', count($aObjects), Metamodel::GetName($sListClass)) . "</h2>\n"); $oP->add("</div>\n"); $oBlock = DisplayBlock::FromObjectSet($oSet, 'list'); $oBlock->Display($oP, $iBlock++); $oP->P(' '); // Some space ? } $oP->add("</div>"); }
switch ($sFormat) { case 'html': $oPage->SetContentType('text/html'); $oObj = MetaModel::GetObject($sClass, $id, true); $aResults = array(); $iMaxRecursionDepth = MetaModel::GetConfig()->Get('relations_max_depth', 20); $oObj->GetRelatedObjects($sRelation, $iMaxRecursionDepth, $aResults); $iBlock = 1; // Zero is not a valid blockid foreach ($aResults as $sClass => $aObjects) { $oSet = CMDBObjectSet::FromArray($sClass, $aObjects); $oPage->add("<h1>" . MetaModel::GetRelationDescription($sRelation) . ' ' . $oObj->GetName() . "</h1>\n"); $oPage->add("<div class=\"page_header\">\n"); $oPage->add("<h2>" . MetaModel::GetClassIcon($sClass) . " <span class=\"hilite\">" . Dict::Format('UI:Search:Count_ObjectsOf_Class_Found', count($aObjects), Metamodel::GetName($sClass)) . "</h2>\n"); $oPage->add("</div>\n"); $oBlock = DisplayBlock::FromObjectSet($oSet, 'list'); $oBlock->Display($oPage, $iBlock++); $oPage->P(' '); // Some space ? } break; case 'xml': default: $oPage->SetContentType('text/xml'); $oObj = MetaModel::GetObject($sClass, $id, true); // Build the root XML part $oXmlDoc = new DOMDocument('1.0', 'UTF-8'); $oXmlRoot = $oXmlDoc->CreateElement('root'); $oXmlNode = $oXmlDoc->CreateElement('node'); $oXmlNode->SetAttribute('id', $oObj->GetKey()); $oXmlNode->SetAttribute('obj_class', get_class($oObj));
function DisplayNavigatorGroupTab($oP, $aGroups, $sRelation, $oObj) { if (count($aGroups) > 0) { $oP->SetCurrentTab(Dict::S('UI:RelationGroups')); $oP->add("<div id=\"impacted_groupss\" style=\"width:100%;background-color:#fff;padding:10px;\">"); $iBlock = 1; // Zero is not a valid blockid foreach ($aGroups as $idx => $aObjects) { $sListClass = get_class(current($aObjects)); $oSet = CMDBObjectSet::FromArray($sListClass, $aObjects); $oP->add("<h1>" . Dict::Format('UI:RelationGroupNumber_N', 1 + $idx) . "</h1>\n"); $oP->add("<div id=\"relation_group_{$idx}\" class=\"page_header\">\n"); $oP->add("<h2>" . MetaModel::GetClassIcon($sListClass) . " <span class=\"hilite\">" . Dict::Format('UI:Search:Count_ObjectsOf_Class_Found', count($aObjects), Metamodel::GetName($sListClass)) . "</h2>\n"); $oP->add("</div>\n"); $oBlock = DisplayBlock::FromObjectSet($oSet, 'list'); $oBlock->Display($oP, 'group_' . $iBlock++); $oP->p(' '); // Some space ? } $oP->add("</div>"); } }