CBPVirtualDocument::GetList: Bitrix method

      
<?php 
//  CBPVirtualDocument :: GetList()
//  /dist/bitrix/modules/bizproc/classes/general/virtualdocument.php:1051

    
function GetList($arOrder = array("SORT" => "ASC"), $arFilter = array(), $arGroupBy false$arNavStartParams false$arSelectFields=array())
    {
        
$arFilter["SHOW_NEW"] = "Y";
        
$arFilter["ACTIVE"] = "Y";

        if (
count($arSelectFields) > 0)
        {
            if (!
in_array("ID"$arSelectFields))
                
$arSelectFields[] = "ID";
            if (!
in_array("IBLOCK_ID"$arSelectFields))
                
$arSelectFields[] = "IBLOCK_ID";
            if (!
in_array("CREATED_BY"$arSelectFields))
                
$arSelectFields[] = "CREATED_BY";
        }

        
$arResultList = array();

        
$arIDMap = array();

        
$dbTasksList CIBlockElement::GetList(
            
$arOrder,
            
$arFilter,
            
$arGroupBy,
            
$arNavStartParams,
            
$arSelectFields
        
);
        while (
$obTask $dbTasksList->GetNextElement())
        {
            
$arResult = array();

            
$arFields $obTask->GetFields();
            foreach (
$arFields as $fieldKey => $fieldValue)
            {
                if (
substr($fieldKey01) != "~")
                    continue;
                
$fieldKey substr($fieldKey1);

                
$arResult[$fieldKey] = $fieldValue;
                
$arResult[$fieldKey."_PRINTABLE"] = $fieldValue;

                if (
in_array($fieldKey, array("MODIFIED_BY""CREATED_BY")))
                {
                    
$arResult[$fieldKey] = "user_".$fieldValue;
                    
$arResult[$fieldKey."_PRINTABLE"] = self::PrepareUserForPrint($fieldValue);
                }
            }

            
$arProperties $obTask->GetProperties();
            foreach (
$arProperties as $propertyKey => $propertyValue)
            {
                
$arResult["PROPERTY_".$propertyKey] = $propertyValue["~VALUE"];
                
$arResult["PROPERTY_".$propertyKey."_PRINTABLE"] = $propertyValue["~VALUE"];

                if (
strlen($propertyValue["USER_TYPE"]) > 0)
                {
                    if (
$propertyValue["USER_TYPE"] == "UserID")
                    {
                        if (
is_array($propertyValue["VALUE"]))
                        {
                            
$arResult["PROPERTY_".$propertyKey] = array();
                            foreach (
$propertyValue["VALUE"] as $v)
                            {
                                
$v intval($v);
                                if (
$v 0)
                                    
$arResult["PROPERTY_".$propertyKey][] = "user_".$v;
                            }
                        }
                        else
                        {
                            
$arResult["PROPERTY_".$propertyKey] = "";
                            if (
intval($propertyValue["VALUE"]) > 0)
                                
$arResult["PROPERTY_".$propertyKey] = "user_".intval($propertyValue["VALUE"]);
                        }
                        
$arResult["PROPERTY_".$propertyKey."_PRINTABLE"] = self::PrepareUserForPrint($propertyValue["VALUE"]);
                    }
                }
                elseif (
$propertyValue["PROPERTY_TYPE"] == "G")
                {
                    
$arResult["PROPERTY_".$propertyKey."_PRINTABLE"] = array();
                    
$vx self::PrepareSectionForPrint($propertyValue["VALUE"], $propertyValue["LINK_IBLOCK_ID"]);
                    foreach (
$vx as $vx1 => $vx2)
                        
$arResult["PROPERTY_".$propertyKey."_PRINTABLE"][$vx1] = $vx2["NAME"];
                }
                elseif (
$propertyValue["PROPERTY_TYPE"] == "L")
                {
                    
$arResult["PROPERTY_".$propertyKey] = array();

                    
$arPropertyValue $propertyValue["VALUE"];
                    
$arPropertyKey $propertyValue["VALUE_ENUM_ID"];
                    if (!
is_array($arPropertyValue))
                    {
                        
$arPropertyValue = array($arPropertyValue);
                        
$arPropertyKey = array($arPropertyKey);
                    }

                    for (
$i 0$cnt count($arPropertyValue); $i $cnt$i++)
                        
$arResult["PROPERTY_".$propertyKey][$arPropertyKey[$i]] = $arPropertyValue[$i];

                    
$arResult["PROPERTY_".$propertyKey."_PRINTABLE"] = $arResult["PROPERTY_".$propertyKey];
                }
            }

            if (
array_key_exists($arFields["ID"], $arIDMap))
            {
                foreach (
$arResultList[$arIDMap[$arFields["ID"]]] as $key => &$value)
                {
                    if (
$value != $arResult[$key])
                    {
                        if (!
is_array($value))
                            
$value = array($value);
                        
$value[] = $arResult[$key];
                    }
                }
            }
            else
            {
                
$index count($arResultList);
                
$arResultList[$index] = $arResult;
                
$arIDMap[$arFields["ID"]] = $index;
            }
        }

        
$dbTasksList1 = new CDBResult();
        
$dbTasksList1->InitFromArray($arResultList);

        return array(
$dbTasksList1$dbTasksList);
    }