CAdvBanner :: GetEditIcons: Bitrix method

      
<?php 
//  CAdvBanner :: GetEditIcons()
//  /dist/bitrix/modules/advertising/classes/general/advertising.php:4583

    
public static function GetEditIcons($arBanner$TYPE_SID=""$arIcons = array())
    {
        global 
$USER$APPLICATION;
        static 
$arContractTypes false;
        static 
$arContracts false;

        if(
$USER->IsAuthorized() && $APPLICATION->GetShowIncludeAreas())
        {
            if(
CAdvContract::IsManager() || CAdvContract::IsAdmin())
            {
                if (
is_array($arIcons) && count($arIcons) > 0)
                {
                    if (!empty(
$arBanner) && isset($arBanner["ID"]))
                    {
                        
$curIcon = array(
                                
"URL" => 'javascript:'.$APPLICATION->GetPopupLink(
                                                array(
                                                        
'URL' => "/bitrix/admin/adv_banner_edit.php?bxpublic=Y&from_module=advertising&lang=".LANGUAGE_ID."&ID=".$arBanner["ID"]. "&CONTRACT_ID=".$arBanner["CONTRACT_ID"],
                                                        
'PARAMS' => array(
                                                                
'width' => 700,
                                                                
'height' => 400,
                                                                
'resize' => false,
                                                        )
                                                )
                                        ),
                                
"TEXT" => $arBanner["NAME"]
                        );

                        if (!
is_array($arIcons[0]['MENU']))
                        {
                            
$arIcons[0]['MENU'] = array(
                                array(
                                    
"URL" => $arIcons[0]['URL'],
                                    
"TEXT" => $arIcons[0]['MESS']
                                )
                            );
                            unset(
$arIcons[0]['URL']);
                            unset(
$arIcons[0]['MESS']);
                        }

                        
array_push($arIcons[0]['MENU'], $curIcon);
                    }
                }
                else
                {
                    
$arIcons = array();
                    if (!empty(
$arBanner) && isset($arBanner["ID"]))
                    {
                        
$arIcons[] = array(
                                
"URL" => 'javascript:'.$APPLICATION->GetPopupLink(
                                                array(
                                                        
'URL' => "/bitrix/admin/adv_banner_edit.php?bxpublic=Y&from_module=advertising&lang=".LANGUAGE_ID."&ID=".$arBanner["ID"]. "&CONTRACT_ID=".$arBanner["CONTRACT_ID"],
                                                        
'PARAMS' => array(
                                                                
'width' => 700,
                                                                
'height' => 400,
                                                                
'resize' => false,
                                                        )
                                                )
                                        ),
                                
"ICON" => "bx-context-toolbar-edit-icon",
                                
"TITLE" => GetMessage("AD_PUBLIC_ICON_EDIT_BANNER"),
                                
"MESS" => $arBanner["NAME"]
                        );

                        
$TYPE_SID $arBanner["TYPE_SID"];
                    }
                    if (
strlen($TYPE_SID) > 0)
                    {
                        
$arSubMenu = array();

                        if(
$arContracts === false)
                        {
                            
$arContracts = array();
                            
$arContractTypes = array();
                            
$contracts CAdvContract::GetList($sort="s_sort"$order="desc", array("SITE" => SITE_ID), $is_filtered=false);
                            while(
$arContract $contracts->Fetch())
                            {
                                
$arContracts[] = $arContract;
                                
$arContractTypes[$arContract["ID"]] = CAdvContract::GetTypeArray($arContract["ID"]);
                            }
                        }

                        foreach(
$arContracts as $arContract)
                        {
                            if (
array_key_exists("ALL"$arContractTypes[$arContract["ID"]]) || array_key_exists($TYPE_SID$arContractTypes[$arContract["ID"]]))
                            {
                                
$arSubMenu[] = array(
                                        
"URL" => 'javascript:'.$APPLICATION->GetPopupLink(
                                                        array(
                                                                
'URL' => "/bitrix/admin/adv_banner_edit.php?bxpublic=Y&from_module=advertising&lang=".LANGUAGE_ID."&TYPE_SID=".$TYPE_SID."&CONTRACT_ID=".$arContract["ID"],
                                                                
'PARAMS' => array(
                                                                        
'width' => 700,
                                                                        
'height' => 400,
                                                                        
'resize' => false,
                                                                )
                                                        )
                                                ),
                                        
"TEXT" => $arContract["NAME"]
                                );
                            }
                        }

                        
$arIcon = array(
                                
"ICON" => "bx-context-toolbar-create-icon",
                                
"TITLE" => GetMessage("AD_PUBLIC_ICON_ADD_BANNER")
                        );

                        
$nSubMenu count($arSubMenu);
                        if(
$nSubMenu == 1)
                        {
                            
$arIcon["URL"] = $arSubMenu[0]["URL"];
                            
$arIcons[] = $arIcon;
                        }
                        elseif(
$nSubMenu 1)
                        {
                            
$arIcon["MENU"] = $arSubMenu;
                            
$arIcons[] = $arIcon;
                        }
                    }

                    
$arIcons[] = array(
                            
"URL" => "/bitrix/admin/adv_banner_list.php?lang=".LANGUAGE_ID."&find_contract_id[]=".$arBanner["CONTRACT_ID"]. "&find_type_sid[]=".$arBanner["TYPE_SID"]."&set_filter=Y",
                            
"SRC" => "/bitrix/themes/.default/icons/advertising/comp_view.gif",
                            
"TITLE" => GetMessage("AD_PUBLIC_ICON_BANNER_LIST"),
                            
"IN_PARAMS_MENU" => true
                    
);
                }

                return 
$arIcons;
            }
        }
        return 
false;
    }