getWorkflowTasks: Bitrix method

      
<?php 
//  getWorkflowTasks()
//  /dist/bitrix/modules/bizproc/classes/general/viewhelper.php:62

    
public static function getWorkflowTasks($workflowId$withUsers false$extendUserInfo false)
    {
        
$withUsers $withUsers 0;
        
$extendUserInfo $extendUserInfo 0;

        if (!isset(
self::$cachedTasks[$workflowId][$withUsers][$extendUserInfo]))
        {
            
$tasks = array('COMPLETED' => array(), 'RUNNING' => array());
            
$ids = array();
            
$taskIterator CBPTaskService::GetList(
                array(
'MODIFIED' => 'DESC'),
                array(
'WORKFLOW_ID' => $workflowId),
                
false,
                array(
'nTopCount' => 50),
                array(
'ID''MODIFIED''NAME''DESCRIPTION''PARAMETERS''STATUS''IS_INLINE''ACTIVITY')
            );
            while (
$task $taskIterator->getNext())
            {
                
$key $task['STATUS'] == CBPTaskStatus::Running 'RUNNING' 'COMPLETED';
                
$tasks[$key][] = $task;
                
$ids[] = $task['ID'];
            }
            if (
$withUsers && sizeof($ids))
            {
                
$taskUsers = \CBPTaskService::getTaskUsers($ids);
                
self::joinUsersToTasks($tasks['COMPLETED'], $taskUsers$extendUserInfo);
                
$tasks['RUNNING_ALL_USERS'] = self::joinUsersToTasks($tasks['RUNNING'], $taskUsers$extendUserInfo);
            }
            
$tasks['COMPLETED_CNT'] = sizeof($tasks['COMPLETED']);
            
$tasks['RUNNING_CNT'] = sizeof($tasks['RUNNING']);

            
self::$cachedTasks[$workflowId][$withUsers][$extendUserInfo] = $tasks;
        }

        return 
self::$cachedTasks[$workflowId][$withUsers][$extendUserInfo];
    }