/*
	var_dump($result->isSuccess());
		echo '<pre>'; print_r($bannerFields); echo '</pre>';
		echo '<pre>'; print_r($result); echo '</pre>';
		echo '<pre>'; print_r($request); echo '</pre>';
	die();
	*/

	if($result->isSuccess())
	{
		if($ID <= 0 && $elementId > 0)
		{
			Adv\LinkTable::add(array(
				'LINK_TYPE' => Adv\LinkTable::TYPE_IBLOCK_ELEMENT,
				'LINK_ID' => $elementId,
				'BANNER_ID' => $result->getId()
			));
		}

		if($ID <= 0)
		{
			Main\Config\Option::set('seo', 'yandex_direct_region_last_list', $bannerSettings["Geo"]);
		}

		$ID = $result->getId();

		if($request["apply"]<>'')
		{
			LocalRedirect('/bitrix/admin/seo_search_yandex_direct_banner_edit.php?lang='.LANGUAGE_ID.'&ID='.$ID.'&'.$tabControl->ActiveTabParam());
		}
Beispiel #2
0
     $res = $engine->updateBannersManual($campaignId, $bannerId);
     break;
 case 'link_delete':
 case 'link_create':
     $res = array('result' => false);
     $bannerId = intval($_REQUEST['banner']);
     $linkId = intval($_REQUEST['link']);
     $linkType = $_REQUEST['link_type'];
     if ($linkId > 0 & $bannerId > 0) {
         if ($_REQUEST['action'] == 'link_delete') {
             $result = Adv\LinkTable::delete(array('LINK_TYPE' => $linkType, 'LINK_ID' => $linkId, 'BANNER_ID' => $bannerId));
             $res = array('result' => $result->isSuccess());
         } elseif ($_REQUEST['action'] == 'link_create') {
             $dbRes = Adv\LinkTable::getByPrimary(array('LINK_TYPE' => $linkType, 'LINK_ID' => $linkId, 'BANNER_ID' => $bannerId));
             if (!$dbRes->fetch()) {
                 $result = Adv\LinkTable::add(array('LINK_TYPE' => $linkType, 'LINK_ID' => $linkId, 'BANNER_ID' => $bannerId));
                 $res = array('result' => $result->isSuccess());
             } else {
                 $res = array('result' => true);
             }
         }
     }
     if ($res['result'] && $_REQUEST['get_list_html']) {
         Loader::includeModule('iblock');
         ob_start();
         if ($_REQUEST['get_list_html'] == '1') {
             $iblockElementInfo = array("ID" => $linkId, "IBLOCK" => array("ID" => 0));
             $dbRes = Adv\LinkTable::getList(array("filter" => array('=LINK_TYPE' => Adv\LinkTable::TYPE_IBLOCK_ELEMENT, '=LINK_ID' => $linkId, "=BANNER.ENGINE_ID" => $engine->getId()), "select" => array("BANNER_ID", "BANNER_NAME" => "BANNER.NAME", "BANNER_XML_ID" => "BANNER.XML_ID", "BANNER_CAMPAIGN_ID" => "BANNER.CAMPAIGN_ID", "LINK_IBLOCK_ID" => "IBLOCK_ELEMENT.IBLOCK_ID")));
             $arBanners = array();
             while ($banner = $dbRes->fetch()) {
                 if (!isset($arBanners[$banner['BANNER_CAMPAIGN_ID']])) {