GetList
CDBResult CTasks::GetList( array arOrder = array(), array arFilter = array(), array arSelect = array(), array arParams = array() );
Returns list of tasks by arFilter filter, sorted in the arOrder direction.
Note: This method accepts an array of configuration parameters and generates scripts, necessary to show file dialog. Static method.
Method parameters
Parameter | Description | Available from version |
---|---|---|
arOrder | Array for sorting of result. Array of array("sorting field"=>"sorting direction" [, ...]) type.
Field for sorting can have the following values:
Note. Sorting by user fields is available.
| |
arFilter | Array of array("filtered field"=>"filter value" [, ...]) type.
Filtered field can have the following values:
"filter values" - single value or an array. Optional. By default, records are not filtered. | |
arSelect | Array of returned task fields. | |
arParams | Array of additional parameters. Optional. |
Returned value
CDBResult object is returned.
Examples of use
<?
// Select all task of the user with ID = 2
if (CModule::IncludeModule("tasks"))
{
$res = CTasks::GetList(
Array("TITLE" => "ASC"),
Array("RESPONSIBLE_ID" => "2")
);
while ($arTask = $res->GetNext())
{
echo "Task name: ".$arTask["TITLE"]."<br>";
}
}
?>
<? // Selected tasks for which the user is responsible or a participant $arFilter = array( '::LOGIC' => 'AND', 'CHECK_PERMISSIONS' => 'Y', 'ONLY_ROOT_TASKS' => 'Y', 'SAME_GROUP_PARENT' => 'Y', '::SUBFILTER-1' => array( '::LOGIC' => 'OR', '::SUBFILTER-1' => array( 'ACCOMPLICE' => $USER->GetID(), 'REAL_STATUS' => array(CTasks::STATE_NEW, CTasks::STATE_PENDING, CTasks::STATE_IN_PROGRESS), ), '::SUBFILTER-2' => array( 'RESPONSIBLE_ID' => $USER->GetID(), 'REAL_STATUS' => array(CTasks::STATE_NEW, CTasks::STATE_PENDING, CTasks::STATE_IN_PROGRESS), ), ), ); ?>
© «Bitrix24», 2001-2024