CAdvContract :: GetTypeArray: Bitrix method

      
<?php 
//  CAdvContract :: GetTypeArray()
//  /dist/bitrix/modules/advertising/classes/general/advertising.php:534

    
public static function GetTypeArray($CONTRACT_ID)
    {
        
$err_mess = (CAdvContract_all::err_mess())."<br>Function: GetTypeArray<br>Line: ";
        global 
$DB;

        
$CONTRACT_ID intval($CONTRACT_ID);
        if(
$CONTRACT_ID<=0)
            return array();

        
$strSql "
            SELECT T.SID,
                T.NAME,
                T.SORT,
                CT.TYPE_SID,
                CT.CONTRACT_ID
            FROM
                b_adv_contract_2_type CT
            INNER JOIN b_adv_type T ON (T.SID = CT.TYPE_SID or CT.TYPE_SID='ALL')
            WHERE CT.CONTRACT_ID="
.$CONTRACT_ID."
            ORDER BY T.SORT
        "
;

        
$arrRes = array();
        
$rs $DB->Query($strSqlfalse$err_mess.__LINE__);
        while(
$ar $rs->Fetch())
        {
            
$arrRes[$ar["SID"]] = $ar["NAME"];
            if(
$ar["TYPE_SID"] == 'ALL')
                
$arrRes["ALL"] = true;
        }
        return 
$arrRes;
    }