CBPAllTrackingService :: DumpWorkflow: Bitrix method

      
<?php 
//  CBPAllTrackingService :: DumpWorkflow()
//  /dist/bitrix/modules/bizproc/classes/general/trackingservice.php:25

    
public static function DumpWorkflow($workflowId)
    {
        global 
$DB;

        
$workflowId trim($workflowId);
        if (
strlen($workflowId) <= 0)
            throw new 
Exception("workflowId");

        
$dbResult $DB->Query(
            
"SELECT ID, TYPE, MODIFIED, ACTION_NAME, ACTION_TITLE, EXECUTION_STATUS, EXECUTION_RESULT, ACTION_NOTE, MODIFIED_BY ".
            
"FROM b_bp_tracking ".
            
"WHERE WORKFLOW_ID = '".$DB->ForSql($workflowId)."' ".
            
"ORDER BY ID "
        
);

        
$r = array();
        
$level 0;
        while (
$arResult $dbResult->GetNext())
        {
            if (
$arResult["TYPE"] == CBPTrackingType::CloseActivity)
            {
                
$level--;
                
$arResult["PREFIX"] = str_repeat("&nbsp;&nbsp;&nbsp;"$level $level 0);
                
$arResult["LEVEL"] = $level;
            }
            elseif (
$arResult["TYPE"] == CBPTrackingType::ExecuteActivity)
            {
                
$arResult["PREFIX"] = str_repeat("&nbsp;&nbsp;&nbsp;"$level $level 0);
                
$arResult["LEVEL"] = $level;
                
$level++;
            }
            else
            {
                
$arResult["PREFIX"] = str_repeat("&nbsp;&nbsp;&nbsp;"$level $level 0);
                
$arResult["LEVEL"] = $level;
            }

            
$r[] = $arResult;
        }

        return 
$r;
    }