diff --git a/application/displayblock.class.inc.php b/application/displayblock.class.inc.php index 61ef712b7..5a5f83f1a 100644 --- a/application/displayblock.class.inc.php +++ b/application/displayblock.class.inc.php @@ -36,6 +36,72 @@ require_once(APPROOT.'/application/utils.inc.php'); */ class DisplayBlock { + /** + * @var string + * @since 3.1.0 + */ + public const ENUM_STYLE_COUNT = 'count'; + + /** + * @var string + * @since 3.1.0 + */ + public const ENUM_STYLE_JOIN = 'join'; + + /** + * @var string For regular list (objects or static data) + * @since 3.1.0 + */ + public const ENUM_STYLE_LIST = 'list'; + + /** + * @var string For search results + * @since 3.1.0 + */ + public const ENUM_STYLE_LIST_SEARCH = 'list_search'; + + /** + * @var string For objects list in other objects (direct / indirect linksets) + * @since 3.1.0 + */ + public const ENUM_STYLE_LIST_IN_OBJECT = 'listInObject'; + + /** + * @var string + * @since 3.1.0 + */ + public const ENUM_STYLE_ACTIONS = 'actions'; + + /** + * @var string + * @since 3.1.0 + */ + public const ENUM_STYLE_SUMMARY = 'summary'; + + /** + * @var string + * @since 3.1.0 + */ + public const ENUM_STYLE_CSV = 'csv'; + + /** + * @var string + * @since 3.1.0 + */ + public const ENUM_STYLE_SEARCH = 'search'; + + /** + * @var string + * @since 3.1.0 + */ + public const ENUM_STYLE_CHART = 'chart'; + + /** + * @var string + * @since 3.1.0 + */ + public const ENUM_STYLE_CHART_AJAX = 'chart_ajax'; + const TAG_BLOCK = 'itopblock'; /** @var \DBSearch */ protected $m_oFilter; @@ -69,7 +135,7 @@ class DisplayBlock * * @throws \ApplicationException */ - public function __construct(DBSearch $oFilter, $sStyle = 'list', $bAsynchronous = false, $aParams = array(), $oSet = null) + public function __construct(DBSearch $oFilter, $sStyle = self::ENUM_STYLE_LIST, $bAsynchronous = false, $aParams = array(), $oSet = null) { $this->m_oFilter = $oFilter->DeepClone(); $this->m_aConditions = array(); @@ -96,13 +162,13 @@ class DisplayBlock protected function GetAllowedParams(string $sStyle): array { $aAllowedParams = [ - 'actions' => [ + static::ENUM_STYLE_ACTIONS => [ 'context_filter', /** int if != 0 filter with user context */ 'display_limit', /** for dashlet*/ ], - 'chart' => [ + static::ENUM_STYLE_CHART => [ 'chart_type', /** string 'pie' or 'bars' */ 'group_by', @@ -125,7 +191,7 @@ class DisplayBlock /** string title */ 'display_limit', ], - 'chart_ajax' => [ + static::ENUM_STYLE_CHART_AJAX => [ 'chart_type', /** string 'pie' or 'bars' */ 'group_by', /** string group by att code */ 'group_by_expr', /** string group by expression */ @@ -136,7 +202,7 @@ class DisplayBlock 'order_by', /** string either 'attribute' group_by attcode or 'function' aggregation_function value */ 'order_direction', /** string order direction 'asc' or 'desc' */ ], - 'count' => [ + static::ENUM_STYLE_COUNT => [ 'group_by', /** string group by att code */ 'group_by_expr', /** string group by expression */ 'group_by_label', /** string aggregation column name */ @@ -152,15 +218,15 @@ class DisplayBlock /** string order direction 'asc' or 'desc' */ 'display_limit', ], - 'csv' => [], - 'join' => array_merge([ + static::ENUM_STYLE_CSV => [], + static::ENUM_STYLE_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([ + static::ENUM_STYLE_LIST => array_merge([ 'update_history', /** bool add breadcrumb entry */ 'default', @@ -178,7 +244,7 @@ class DisplayBlock 'refresh_action', /**to add refresh button in datatable*/ ], DataTableUIBlockFactory::GetAllowedParams()), - 'listInObject' => array_merge([ + static::ENUM_STYLE_LIST_IN_OBJECT => array_merge([ 'update_history', /** bool add breadcrumb entry */ 'default', @@ -196,7 +262,7 @@ class DisplayBlock 'refresh_action', /**to add refresh button in datatable*/ ], DataTableUIBlockFactory::GetAllowedParams()), - 'list_search' => array_merge([ + static::ENUM_STYLE_LIST_SEARCH => array_merge([ 'update_history', /** bool add breadcrumb entry */ 'result_list_outer_selector', @@ -219,7 +285,7 @@ class DisplayBlock 'search_header_force_dropdown', /** Html for