CAdvBanner :: Copy: Bitrix method

      
<?php 
//  CAdvBanner :: Copy()
//  /dist/bitrix/modules/advertising/classes/general/advertising.php:1321

    
public static function Copy($BANNER_ID$CHECK_RIGHTS="Y")
    {
        
$ID 0;
        
$rsBanner CAdvBanner::GetByID($BANNER_ID$CHECK_RIGHTS);
        if (
$arBanner $rsBanner->Fetch())
        {
            
$arFields = array(
                
"CONTRACT_ID"            => $arBanner["CONTRACT_ID"],
                
"TYPE_SID"            => $arBanner["TYPE_SID"],
                
"STATUS_SID"            => $arBanner["STATUS_SID"],
                
"STATUS_COMMENTS"        => $arBanner["STATUS_COMMENTS"],
                
"NAME"                => $arBanner["NAME"],
                
"GROUP_SID"            => $arBanner["GROUP_SID"],
                
"ACTIVE"                => $arBanner["ACTIVE"],
                
"WEIGHT"                => $arBanner["WEIGHT"],
                
"MAX_VISITOR_COUNT"        => $arBanner["MAX_VISITOR_COUNT"],
                
"RESET_VISITOR_COUNT"    => "Y",
                
"SHOWS_FOR_VISITOR"        => $arBanner["SHOWS_FOR_VISITOR"],
                
"MAX_SHOW_COUNT"        => $arBanner["MAX_SHOW_COUNT"],
                
"RESET_SHOW_COUNT"        => "Y",
                
"FIX_CLICK"            => $arBanner["FIX_CLICK"],
                
"MAX_CLICK_COUNT"        => $arBanner["MAX_CLICK_COUNT"],
                
"RESET_CLICK_COUNT"        => $arBanner["RESET_CLICK_COUNT"],
                
"DATE_SHOW_FROM"        => $arBanner["DATE_SHOW_FROM"],
                
"DATE_SHOW_TO"            => $arBanner["DATE_SHOW_TO"],
                
"IMAGE_ALT"            => $arBanner["IMAGE_ALT"],
                
"URL"                => $arBanner["URL"],
                
"URL_TARGET"            => $arBanner["URL_TARGET"],
                
"NO_URL_IN_FLASH"        => $arBanner["NO_URL_IN_FLASH"],
                
"CODE"                => $arBanner["CODE"],
                
"CODE_TYPE"            => $arBanner["CODE_TYPE"],
                
"STAT_EVENT_1"            => $arBanner["STAT_EVENT_1"],
                
"STAT_EVENT_2"            => $arBanner["STAT_EVENT_2"],
                
"STAT_EVENT_3"            => $arBanner["STAT_EVENT_3"],
                
"FOR_NEW_GUEST"        => $arBanner["FOR_NEW_GUEST"],
                
"COMMENTS"            => $arBanner["COMMENTS"],
                
"SHOW_USER_GROUP"        => $arBanner["SHOW_USER_GROUP"],
                
"arrSHOW_PAGE"            => CAdvBanner::GetPageArray($BANNER_ID"SHOW"),
                
"arrNOT_SHOW_PAGE"        => CAdvBanner::GetPageArray($BANNER_ID"NOT_SHOW"),
                
"STAT_TYPE"            => $arBanner["STAT_TYPE"],
                
"arrCOUNTRY"            => CAdvBanner::GetCountryArray($BANNER_ID, array("COUNTRY_ID""REGION""CITY_ID")),
                
"arrSTAT_ADV"            => CAdvBanner::GetStatAdvArray($BANNER_ID),
                
"arrWEEKDAY"            => CAdvBanner::GetWeekdayArray($BANNER_ID),
                
"arrSITE"                => CAdvBanner::GetSiteArray($BANNER_ID),
                
"arrUSERGROUP"            => CAdvBanner::GetGroupArray($BANNER_ID),
                
"KEYWORDS"            => $arBanner["KEYWORDS"],
                
"SEND_EMAIL"            => "Y",
                
"AD_TYPE"                => $arBanner["AD_TYPE"],
                
"FLASH_TRANSPARENT" => $arBanner["FLASH_TRANSPARENT"],
                
"arrFlashIMAGE_ID" => $arBanner["arrFlashIMAGE_ID"],
                
"FLASH_JS" => $arBanner["FLASH_JS"],
                
"FLASH_VER" => $arBanner["FLASH_VER"],
                
"TEMPLATE" => $arBanner["TEMPLATE"]
                );
            if (
intval($arBanner["IMAGE_ID"])>0)
            {
                
$arrIMAGE CFile::MakeFileArray($arBanner["IMAGE_ID"]);
                
$arrIMAGE["MODULE_ID"] = "advertising";
                
$arFields["arrIMAGE_ID"] = $arrIMAGE;
            }
            if (
$arBanner["TEMPLATE_FILES"] && CheckSerializedData($arBanner["TEMPLATE_FILES"]))
                
$arBanner["TEMPLATE_FILES"] = unserialize(htmlspecialchars_decode($arBanner["TEMPLATE_FILES"]));
            else
                
$arBanner["TEMPLATE_FILES"] = array();
            
$arrTEMPLATE_FILES = array();
            foreach (
$arBanner["TEMPLATE_FILES"] as $k1 => $v1)
            {
                foreach (
$v1 as $k2 => $v2)
                {
                    
$arrTEMPLATE_FILES[$k1][$k2] = CFile::MakeFileArray($v2);
                }
            }

            
$arFields["TEMPLATE_FILES"] = $arrTEMPLATE_FILES;

            
$ID CAdvBanner::Set($arFields0);
        }
        return 
$ID;
    }