ListFilterPresets
array public function listFilterPresets( $bTreeMode = false );
This method returns the list of available preset and filters available for the user.
Method parameters
Parameter | Description |
---|---|
$bTreeMode | Specifies format of the returned list of filters. If returns true — result will have the tree format, when returns false — simple list of filters. |
Returned value
Returns an array that describes the list of filters. Each element of the filter is described by the separate array with the following keys:
- Name - name of filter;
- Parent - ID of the parent filter, NULL — for the root parent filter;
- Condition - serialized (via serialize() function) value of filter conditions.
- #Children (with mode
$bTreeMode = true
) - key is present in filters that have descendant filters. Contains an array of filters.
Examples of use
<?php CModule::IncludeModule('tasks'); $userId = (int) $GLOBALS['USER']->getId(); $bGroupMode = false; $oFilter = CTaskFilterCtrl::getInstance($userId, $bGroupMode); $arPresets1 = $oFilter->listFilterPresets(); var_dump($arPresets1); $arPresets2 = $oFilter->listFilterPresets(true); // in a tree-type format var_dump($arPresets2); ?> Showed for $arPresets1: array(10) { [0]=> array(3) { ["Name"]=> string(1) "/" ["Parent"]=> NULL ["Condition"]=> NULL } [-1]=> array(3) { ["Name"]=> string(10) "My tasks" ["Parent"]=> int(0) ["Condition"]=> string(116) "a:3:{s:7:"::LOGIC";s:3:"AND";s:6:"MEMBER";i:1;s:6:"STATUS";a:6:{i:0;i:-2;i:1;i:-1;i:2;i:1;i:3;i:2;i:4;i:3;i:5;i:7;}}" } [-2]=> array(3) { ["Name"]=> string(16) "Set to me" ["Parent"]=> int(-1) ["Condition"]=> string(114) "a:3:{s:7:"::LOGIC";s:3:"AND";s:4:"DOER";i:1;s:6:"STATUS";a:6:{i:0;i:-2;i:1;i:-1;i:2;i:1;i:3;i:2;i:4;i:3;i:5;i:7;}}" }, ... Showed for $arPresets2: array(4) { [-1]=> array(4) { ["Name"]=> string(10) "My tasks" ["Parent"]=> int(0) ["Condition"]=> string(116) "a:3:{s:7:"::LOGIC";s:3:"AND";s:6:"MEMBER";i:1;s:6:"STATUS";a:6:{i:0;i:-2;i:1;i:-1;i:2;i:1;i:3;i:2;i:4;i:3;i:5;i:7;}}" ["#Children"]=> array(3) { [-2]=> array(4) { ["Name"]=> string(16) "Set to me" ["Parent"]=> int(-1) ["Condition"]=> string(114) "a:3:{s:7:"::LOGIC";s:3:"AND";s:4:"DOER";i:1;s:6:"STATUS";a:6:{i:0;i:-2;i:1;i:-1;i:2;i:1;i:3;i:2;i:4;i:3;i:5;i:7;}}" ["#Children"]=> array(2) { [-7]=> array(3) { ["Name"]=> string(15) "I'm responsible" ["Parent"]=> int(-2) ["Condition"]=> string(125) "a:3:{s:7:"::LOGIC";s:3:"AND";s:14:"RESPONSIBLE_ID";i:1;s:6:"STATUS";a:6:{i:0;i:-2;i:1;i:-1;i:2;i:1;i:3;i:2;i:4;i:3;i:5;i:7;}}" } [-8]=> array(3) { ["Name"]=> string(15) "I'm a participant" ["Parent"]=> int(-2) ["Condition"]=> string(121) "a:3:{s:7:"::LOGIC";s:3:"AND";s:10:"ACCOMPLICE";i:1;s:6:"STATUS";a:6:{i:0;i:-2;i:1;i:-1;i:2;i:1;i:3;i:2;i:4;i:3;i:5;i:7;}}" } } }, ...
© «Bitrix24», 2001-2024