Documentation

GetFilterPresetConditionById

string
public function getFilterPresetConditionById(
	$presetId
);

This method returns the condition of the filter with the specified ID.

Method parameters

ParameterDescription
$presetIdFilter ID, by which the condition is requested.

Returned value

Returns the condition of the filter with the specified ID as an array which can be passed as the $arFilter parameter to the CTasks::GetList() method.

Examples of use

<?php
CModule::IncludeModule('tasks');
$userId = (int) $GLOBALS['USER']->getId();
$bGroupMode = false;
$oFilter = CTaskFilterCtrl::getInstance($userId, $bGroupMode);

$selectedFilter = $oFilter->getSelectedFilterPresetId();
$arFilter = $oFilter->getFilterPresetConditionById($selectedFilter);

// Show the filter conditions 
var_dump($arFilter);

// This condition can be used in CTasks::GetList();
$rsTasks = CTasks::GetList(array(), $arFilter);
?>

Выведет:
array(1) {
  ["::SUBFILTER-ROOT"]=>
  array(3) {
    ["::LOGIC"]=>
    string(3) "AND"
    ["MEMBER"]=>
    int(1)
    ["STATUS"]=>
    array(6) {
      [0]=>
      int(-2)
      [1]=>
      int(-1)
      [2]=>
      int(1)
      [3]=>
      int(2)
      [4]=>
      int(3)
      [5]=>
      int(7)
    }
  }
}



© «Bitrix24», 2001-2024