tag that can be rendered synchronously * or as a piece of Javascript/JQuery/Ajax that will get its content from another page (ajax.render.php). */ class DisplayBlock { const TAG_BLOCK = 'itopblock'; /** @var \DBSearch */ protected $m_oFilter; protected $m_aConditions; // Conditions added to the filter -> avoid duplicate conditions protected $m_sStyle; protected $m_bAsynchronous; protected $m_aParams; /** @var \DBObjectSet|null */ protected $m_oSet; protected $m_bShowObsoleteData = null; /** * @param \DBSearch $oFilter list of cmdbObjects to be displayed into the block * @param string $sStyle one of : * * @param bool $bAsynchronous * @param array $aParams * @param \DBObjectSet $oSet * * @throws \ApplicationException */ public function __construct(DBSearch $oFilter, $sStyle = 'list', $bAsynchronous = false, $aParams = array(), $oSet = null) { $this->m_oFilter = $oFilter->DeepClone(); $this->m_aConditions = array(); $this->m_sStyle = $sStyle; $this->m_bAsynchronous = $bAsynchronous; $this->m_aParams = $aParams; $this->m_oSet = $oSet; if (array_key_exists('show_obsolete_data', $aParams)) { $this->m_bShowObsoleteData = $aParams['show_obsolete_data']; } if ($this->m_bShowObsoleteData === null) { // User defined $this->m_bShowObsoleteData = utils::ShowObsoleteData(); } } /** * @param string $sStyle * * @return string[] */ protected function GetAllowedParams(string $sStyle): array { $aAllowedParams = [ 'actions' => [ 'context_filter', /** int if != 0 filter with user context */ 'display_limit', /** for dashlet*/ ], 'chart' => [ 'chart_type', /** string 'pie' or 'bars' */ 'group_by', /** string group by att code */ 'group_by_expr', /** string group by expression */ 'group_by_label', /** string aggregation column name */ 'aggregation_function', /** string aggregation function ('count', 'sum', 'avg', 'min', 'max', ...) */ 'aggregation_attribute', /** string att code used for aggregation */ 'limit', /** int limit the chart results */ 'order_by', /** string either 'attribute' group_by attcode or 'function' aggregation_function value */ 'order_direction', /** string order direction 'asc' or 'desc' */ 'chart_title', /** string title */ 'display_limit', ], 'chart_ajax' => [ 'chart_type', /** string 'pie' or 'bars' */ 'group_by', /** string group by att code */ 'group_by_expr', /** string group by expression */ 'group_by_label', /** string aggregation column name */ 'aggregation_function', /** string aggregation function ('count', 'sum', 'avg', 'min', 'max', ...) */ 'aggregation_attribute', /** string att code used for aggregation */ 'limit', /** int limit the chart results */ 'order_by', /** string either 'attribute' group_by attcode or 'function' aggregation_function value */ 'order_direction', /** string order direction 'asc' or 'desc' */ ], 'count' => [ 'group_by', /** string group by att code */ 'group_by_expr', /** string group by expression */ 'group_by_label', /** string aggregation column name */ 'aggregation_function', /** string aggregation function ('count', 'sum', 'avg', 'min', 'max', ...) */ 'aggregation_attribute', /** string att code used for aggregation */ 'limit', /** int limit the chart results */ 'order_by', /** string either 'attribute' group_by attcode or 'function' aggregation_function value */ 'order_direction', /** string order direction 'asc' or 'desc' */ 'display_limit', ], 'csv' => [], 'join' => array_merge([ 'display_aliases', /** string comma separated list of class aliases to display */ 'group_by', /** string group by att code */ ], DataTableUIBlockFactory::GetAllowedParams()), 'links' => DataTableUIBlockFactory::GetAllowedParams(), 'list' => array_merge([ 'update_history', /** bool add breadcrumb entry */ 'default', /** array of default attribute values */ 'menu_actions_target', /** string html link target */ 'toolkit_menu', /** bool add toolkit menu */ 'selectionMode', /**positive or negative*/ 'max_height', /** string Max. height of the list, if not specified will occupy all the available height no matter the pagination */ 'localize_values', /** param for export.php */ 'refresh_action', /**to add refresh button in datatable*/ ], DataTableUIBlockFactory::GetAllowedParams()), 'list_search' => array_merge([ 'update_history', /** bool add breadcrumb entry */ 'result_list_outer_selector', /** string js selector of the search result display */ 'table_inner_id', /** string html id of the results table */ 'json', /** string */ 'hidden_criteria', /** string search criteria not visible */ 'baseClass', /** string base class */ 'action', /** string */ 'open', /** bool open by default the search */ 'submit_on_load', /** bool submit the search on loading page */ 'class', /** class name */ 'search_header_force_dropdown', /** Html for