/** * Helper for the trigger */ function DisplayTriggers($oPage, $sClass) { $sClassList = implode("', '", MetaModel::EnumParentClasses($sClass, ENUM_PARENT_CLASSES_ALL)); $oSet = new CMDBObjectSet(DBObjectSearch::FromOQL("SELECT TriggerOnObject WHERE target_class IN ('{$sClassList}')")); cmdbAbstractObject::DisplaySet($oPage, $oSet, array('block_id' => 'triggers')); }
/** * Displays a list of objects, without any hyperlink (except for the object's details) * @param DBObjectSet $oSet The set of objects to display * @param Array $aZList The ZList (list of field codes) to use for the tabular display * @param String $sEmptyListMessage Message displayed whenever the list is empty * @return string The HTML text representing the list */ public function DisplaySet($oSet, $aZList, $sEmptyListMessage = '') { if ($oSet->Count() > 0) { $sClass = $oSet->GetClass(); if (is_subclass_of($sClass, 'cmdbAbstractObject')) { // Home-made and very limited display of an object set $sUniqueId = $sClass . $this->GetUniqueId(); $this->add("<div id=\"{$sUniqueId}\">\n"); // The id here MUST be the same as currentId, otherwise the pagination will be broken cmdbAbstractObject::DisplaySet($this, $oSet, array('currentId' => $sUniqueId, 'menu' => false, 'toolkit_menu' => false, 'zlist' => false, 'extra_fields' => implode(',', $aZList))); $this->add("</div>\n"); } else { // Home-made and very limited display of an object set $aAttribs = array(); $aValues = array(); $aAttribs['key'] = array('label' => MetaModel::GetName($sClass), 'description' => ''); foreach ($aZList as $sAttCode) { $oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode); $aAttribs[$sAttCode] = array('label' => $oAttDef->GetLabel(), 'description' => $oAttDef->GetDescription()); } while ($oObj = $oSet->Fetch()) { $aRow = array(); $aRow['key'] = '<a href="./index.php?operation=details&class=' . get_class($oObj) . '&id=' . $oObj->GetKey() . '">' . $oObj->GetName() . '</a>'; $sHilightClass = $oObj->GetHilightClass(); if ($sHilightClass != '') { $aRow['@class'] = $sHilightClass; } foreach ($aZList as $sAttCode) { $aRow[$sAttCode] = $oObj->GetAsHTML($sAttCode); } $aValues[$oObj->GetKey()] = $aRow; } $this->table($aAttribs, $aValues); } } elseif (strlen($sEmptyListMessage) > 0) { $this->add($sEmptyListMessage); } }
$oPage->p(''); // Some space } // Then the content of the groups (one table per group) if (count($aGroups) > 0) { $oPage->get_tcpdf()->AddPage(); $oPage->add('<div class="page_header"><h1>' . Dict::S('UI:RelationGroups') . '</h1></div>'); foreach ($aGroups as $idx => $aObjects) { set_time_limit($iLoopTimeLimit * count($aObjects)); $sListClass = get_class(current($aObjects)); $oSet = CMDBObjectSet::FromArray($sListClass, $aObjects); $sHtml = "<div class=\"page_header\">\n"; $sHtml .= "<table class=\"section\"><tr><td>" . MetaModel::GetClassIcon($sListClass, true, 'width: 24px; height: 24px;') . " " . Dict::Format('UI:RelationGroupNumber_N', 1 + $idx) . "</td></tr></table>\n"; $sHtml .= "</div>\n"; $oPage->add($sHtml); cmdbAbstractObject::DisplaySet($oPage, $oSet); $oPage->p(''); // Some space } } } if ($operation == 'relation_attachment') { $sObjClass = utils::ReadParam('obj_class', '', false, 'class'); $iObjKey = (int) utils::ReadParam('obj_key', 0, false, 'integer'); // Save the generated PDF as an attachment $sPDF = $oPage->get_pdf(); $oPage = new ajax_page(''); $oAttachment = new Attachment(); $oAttachment->Set('item_class', $sObjClass); $oAttachment->Set('item_id', $iObjKey); $oDoc = new ormDocument($sPDF, 'application/pdf', $sTitle . '.pdf');