public function Display(WebPage $oPage, DataTableSettings $oSettings, $bActionsMenu, $sSelectMode, $bViewLink, $aExtraParams) { $this->oDefaultSettings = $oSettings; // Identified tables can have their own specific settings $oCustomSettings = DataTableSettings::GetTableSettings($this->aClassAliases, $this->sTableId); if ($oCustomSettings != null) { // Custom settings overload the default ones $this->bUseCustomSettings = true; if ($this->oDefaultSettings->iDefaultPageSize == 0) { $oCustomSettings->iDefaultPageSize = 0; } } else { $oCustomSettings = $oSettings; } if ($oCustomSettings->iDefaultPageSize > 0) { $this->oSet->SetLimit($oCustomSettings->iDefaultPageSize); } $this->oSet->SetOrderBy($oCustomSettings->GetSortOrder()); // Load only the requested columns $aColumnsToLoad = array(); foreach ($oCustomSettings->aColumns as $sAlias => $aColumnsInfo) { foreach ($aColumnsInfo as $sAttCode => $aData) { if ($sAttCode != '_key_') { if ($aData['checked']) { $aColumnsToLoad[$sAlias][] = $sAttCode; } else { // See if this column is a must to load $sClass = $this->aClassAliases[$sAlias]; $oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode); if ($oAttDef->alwaysLoadInTables()) { $aColumnsToLoad[$sAlias][] = $sAttCode; } } } } } $this->oSet->OptimizeColumnLoad($aColumnsToLoad); $bToolkitMenu = true; if (isset($aExtraParams['toolkit_menu'])) { $bToolkitMenu = (bool) $aExtraParams['toolkit_menu']; } if (UserRights::IsPortalUser()) { // Portal users have a limited access to data, for now they can only see what's configured for them $bToolkitMenu = false; } return $this->GetAsHTML($oPage, $oCustomSettings->iDefaultPageSize, $oCustomSettings->iDefaultPageSize, 0, $oCustomSettings->aColumns, $bActionsMenu, $bToolkitMenu, $sSelectMode, $bViewLink, $aExtraParams); }
/** * Overridable: depending on the user, head toward a dedicated portal * @param bool $bIsAllowedToPortalUsers Whether or not the current page is considered as part of the portal * @param int $iOnExit How to complete the call: redirect or return a code */ protected static function ChangeLocation($bIsAllowedToPortalUsers, $iOnExit = self::EXIT_PROMPT) { if (!$bIsAllowedToPortalUsers && UserRights::IsPortalUser()) { if ($iOnExit == self::EXIT_RETURN) { return self::EXIT_CODE_PORTALUSERNOTAUTHORIZED; } else { // No rights to be here, redirect to the portal header('Location: ' . utils::GetAbsoluteUrlAppRoot() . 'portal/index.php'); } } else { return self::EXIT_CODE_OK; } }