public static function GetDisplayExtendedSet(WebPage $oPage, CMDBObjectSet $oSet, $aExtraParams = array()) { if (empty($aExtraParams['currentId'])) { $iListId = $oPage->GetUniqueId(); // Works only if not in an Ajax page !! } else { $iListId = $aExtraParams['currentId']; } $aList = array(); // Initialize and check the parameters $bViewLink = isset($aExtraParams['view_link']) ? $aExtraParams['view_link'] : true; $bDisplayMenu = isset($aExtraParams['menu']) ? $aExtraParams['menu'] == true : true; // Check if there is a list of aliases to limit the display to... $aDisplayAliases = isset($aExtraParams['display_aliases']) ? explode(',', $aExtraParams['display_aliases']) : array(); $sZListName = isset($aExtraParams['zlist']) ? $aExtraParams['zlist'] : 'list'; $aExtraFieldsRaw = isset($aExtraParams['extra_fields']) ? explode(',', trim($aExtraParams['extra_fields'])) : array(); $aExtraFields = array(); foreach ($aExtraFieldsRaw as $sFieldName) { // Ignore attributes not of the main queried class if (preg_match('/^(.*)\\.(.*)$/', $sFieldName, $aMatches)) { $sClassAlias = $aMatches[1]; $sAttCode = $aMatches[2]; if (array_key_exists($sClassAlias, $oSet->GetSelectedClasses())) { $aExtraFields[$sClassAlias][] = $sAttCode; } } else { $aExtraFields['*'] = $sAttCode; } } $sHtml = ''; $oAppContext = new ApplicationContext(); $aClasses = $oSet->GetFilter()->GetSelectedClasses(); $aAuthorizedClasses = array(); foreach ($aClasses as $sAlias => $sClassName) { if (UserRights::IsActionAllowed($sClassName, UR_ACTION_READ, $oSet) && (UR_ALLOWED_YES || UR_ALLOWED_DEPENDS) && (count($aDisplayAliases) == 0 || in_array($sAlias, $aDisplayAliases))) { $aAuthorizedClasses[$sAlias] = $sClassName; } } $aAttribs = array(); foreach ($aAuthorizedClasses as $sAlias => $sClassName) { if (array_key_exists($sAlias, $aExtraFields)) { $aList[$sAlias] = $aExtraFields[$sAlias]; } else { $aList[$sAlias] = array(); } if ($sZListName !== false) { $aDefaultList = self::FlattenZList(MetaModel::GetZListItems($sClassName, $sZListName)); $aList[$sAlias] = array_merge($aDefaultList, $aList[$sAlias]); } // Filter the list to removed linked set since we are not able to display them here foreach ($aList[$sAlias] as $index => $sAttCode) { $oAttDef = MetaModel::GetAttributeDef($sClassName, $sAttCode); if ($oAttDef instanceof AttributeLinkedSet) { // Removed from the display list unset($aList[$sAlias][$index]); } } } $sSelectMode = 'none'; $sClassAlias = $oSet->GetClassAlias(); $oDataTable = new DataTable($iListId, $oSet, $aAuthorizedClasses); $oSettings = DataTableSettings::GetDataModelSettings($aAuthorizedClasses, $bViewLink, $aList); $bDisplayLimit = isset($aExtraParams['display_limit']) ? $aExtraParams['display_limit'] : true; if ($bDisplayLimit) { $iDefaultPageSize = appUserPreferences::GetPref('default_page_size', MetaModel::GetConfig()->GetMinDisplayLimit()); $oSettings->iDefaultPageSize = $iDefaultPageSize; } $oSettings->aSortOrder = MetaModel::GetOrderByDefault($sClassName); return $oDataTable->Display($oPage, $oSettings, $bDisplayMenu, $sSelectMode, $bViewLink, $aExtraParams); }