function InstallDB() { global $APPLICATION, $DB, $errors; if (!$DB->Query("SELECT 'x' FROM b_adv_banner", true)) { $EMPTY = "Y"; } else { $EMPTY = "N"; } if ($EMPTY == "Y") { $errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/advertising/install/db/" . strtolower($DB->type) . "/install.sql"); if (!empty($errors)) { $APPLICATION->ThrowException(implode("", $errors)); return false; } } RegisterModule("advertising"); RegisterModuleDependences("main", "OnBeforeProlog", "advertising"); RegisterModuleDependences("main", "OnEndBufferContent", "advertising", "CAdvBanner", "FixShowAll"); RegisterModuleDependences("main", "OnBeforeRestartBuffer", "advertising", "CAdvBanner", "BeforeRestartBuffer"); CAgent::AddAgent("CAdvContract::SendInfo();", "advertising", "N", 7200); CAgent::AddAgent("CAdvBanner::CleanUpDynamics();", "advertising", "N", 86400); if ($EMPTY == "Y") { CModule::IncludeModule('advertising'); $arSites = array(); $rs = CSite::GetList($b = "sort", $o = "asc"); while ($ar = $rs->Fetch()) { $arSites[] = $ar['ID']; } $ac = new CAdvContract(); $arFields = array('ACTIVE' => 'Y', 'NAME' => 'Default', 'SORT' => 10000, 'DESCRIPTION' => 'all site without any restrictions', 'EMAIL_COUNT' => 1, 'arrTYPE' => array('ALL'), 'arrWEEKDAY' => array('MONDAY' => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23), 'SATURDAY' => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23), 'SUNDAY' => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23), 'THURSDAY' => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23), 'TUESDAY' => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23), 'WEDNESDAY' => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23), 'FRIDAY' => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23)), 'arrSITE' => $arSites); $ac->Set($arFields, 0, 'N'); } return true; }
echo GetMessage("AD_F_CONTRACT"); ?> :<br><img src="/bitrix/images/advertising/mouse.gif" width="44" height="21" border=0 alt=""></td> <td><input type="text" name="find_contract" size="47" value="<?php echo htmlspecialcharsbx($find_contract); ?> "><?php echo InputType("checkbox", "find_contract_exact_match", "Y", $find_contract_exact_match, false, "", "title='" . GetMessage("AD_EXACT_MATCH") . "'"); ?> <?php echo ShowFilterLogicHelp(); ?> <br><?php $contract_ref_id = array(); $contract_ref = array(); $rsContract = CAdvContract::GetList($v1 = "s_sort", $v2 = "desc", array(), $v3); while ($arContract = $rsContract->Fetch()) { $contract_ref_id[] = $arContract["ID"]; $contract_ref[] = "[" . $arContract["ID"] . "] " . $arContract["NAME"]; } $contract_arr = array("REFERENCE" => $contract_ref, "REFERENCE_ID" => $contract_ref_id); echo SelectBoxMFromArray("find_contract_id[]", $contract_arr, $find_contract_id, "", false, "5"); ?> </td> </tr> <tr> <td valign="top"><?php echo GetMessage("AD_F_TYPE"); ?> :<br><img src="/bitrix/images/advertising/mouse.gif" width="44" height="21" border=0 alt=""></td> <td><input type="text" name="find_type" size="47" value="<?php
/* ############################################## # Bitrix: SiteManager # # Copyright (c) 2004 Bitrix # # http://www.bitrix.ru # # mailto:admin@bitrix.ru # ############################################## */ require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_before.php"; require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/advertising/prolog.php"; require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/advertising/include.php"; ClearVars(); $isDemo = CAdvContract::IsDemo(); $isManager = CAdvContract::IsManager(); $isAdvertiser = CAdvContract::IsAdvertiser(); $isAdmin = CAdvContract::IsAdmin(); if (!$isAdmin && !$isDemo && !$isManager && !$isAdvertiser) { $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED")); } IncludeModuleLangFile(__FILE__); define("HELP_FILE", "adv_type_list.php"); /*************************************************************************** ќбработка GET | POST ****************************************************************************/ $aTabs = array(array("DIV" => "edit1", "TAB" => GetMessage("AD_TYPE"), "ICON" => "banner_type_edit", "TITLE" => GetMessage("AD_TYPE"))); $tabControl = new CAdminTabControl("tabControl", $aTabs); $isEditMode = true; if (!$isAdmin && !$isDemo || $action == "view") { $isEditMode = false; } $SID = preg_replace("~[^A-Za-z_0-9]~", "", $SID);
function GetList(&$by, &$order, $arFilter = array(), &$is_filtered, $CHECK_RIGHTS = "Y") { $err_mess = CAdvType_all::err_mess() . "<br>Function: GetList<br>Line: "; global $DB; $arSqlSearch = array(); if ($CHECK_RIGHTS == "Y") { $isAdmin = CAdvContract::IsAdmin(); $isDemo = CAdvContract::IsDemo(); $isManager = CAdvContract::IsManager(); $isAdvertiser = CAdvContract::IsAdvertiser(); } else { $isAdmin = true; $isDemo = true; $isManager = true; $isAdvertiser = true; } if ($isAdmin || $isDemo || $isManager || $isAdvertiser) { if (CAdvType::CheckFilter($arFilter)) { if (is_array($arFilter)) { $filter_keys = array_keys($arFilter); for ($i = 0, $n = count($filter_keys); $i < $n; $i++) { $key = $filter_keys[$i]; $val = $arFilter[$filter_keys[$i]]; if (is_array($val)) { if (count($val) <= 0) { continue; } } else { if (strlen($val) <= 0 || $val === "NOT_REF") { continue; } } $match_value_set = in_array($key . "_EXACT_MATCH", $filter_keys) ? true : false; $key = strtoupper($key); switch ($key) { case "SID": $match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $match_value_set ? "Y" : "N"; $arSqlSearch[] = GetFilterQuery("T.SID", $val, $match); break; case "DATE_MODIFY_1": $arSqlSearch[] = "T.DATE_MODIFY>=" . $DB->CharToDateFunction($val, "SHORT"); break; case "DATE_MODIFY_2": $arSqlSearch[] = "T.DATE_MODIFY<=" . $DB->CharToDateFunction($val . " 23:59:59", "FULL"); break; case "ACTIVE": $arSqlSearch[] = $val == "Y" ? "T.ACTIVE='Y'" : "T.ACTIVE='N'"; break; case "NAME": case "DESCRIPTION": $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y"; $arSqlSearch[] = GetFilterQuery("T." . $key, $val, $match); break; } } } } if ($by == "s_sid") { $strSqlOrder = " ORDER BY T.SID "; } elseif ($by == "s_date_modify") { $strSqlOrder = " ORDER BY T.DATE_MODIFY "; } elseif ($by == "s_modified_by") { $strSqlOrder = " ORDER BY T.MODIFIED_BY "; } elseif ($by == "s_date_create") { $strSqlOrder = " ORDER BY T.DATE_CREATE "; } elseif ($by == "s_created_by") { $strSqlOrder = " ORDER BY T.CREATED_BY "; } elseif ($by == "s_active") { $strSqlOrder = " ORDER BY T.ACTIVE "; } elseif ($by == "s_name") { $strSqlOrder = " ORDER BY T.NAME "; } elseif ($by == "s_banners") { $strSqlOrder = " ORDER BY BANNER_COUNT "; } elseif ($by == "s_description") { $strSqlOrder = " ORDER BY T.DESCRIPTION "; } else { $strSqlOrder = " ORDER BY T.SORT "; $by = "s_sort"; } if ($order != "desc") { $strSqlOrder .= " asc "; $order = "asc"; } else { $strSqlOrder .= " desc "; $order = "desc"; } $strSqlSearch = GetFilterSqlSearch($arSqlSearch); $strContracts = ""; if (!$isAdmin && !$isDemo && !$isManager) { $strContracts = "0"; $arPermissions = CAdvContract::GetUserPermissions(); foreach ($arPermissions as $contract_id => $arContractPerms) { if (is_array($arContractPerms) && !empty($arContractPerms)) { $strContracts .= "," . $contract_id; } } } $strSql = "\n\t\t\t\tSELECT\n\t\t\t\t\tT.SID,\n\t\t\t\t\tT.ACTIVE,\n\t\t\t\t\tT.SORT,\n\t\t\t\t\tT.NAME,\n\t\t\t\t\tT.DESCRIPTION,\n\t\t\t\t\t" . $DB->DateToCharFunction("T.DATE_CREATE") . "\tDATE_CREATE,\n\t\t\t\t\t" . $DB->DateToCharFunction("T.DATE_MODIFY") . "\tDATE_MODIFY,\n\t\t\t\t\tT.CREATED_BY,\n\t\t\t\t\tT.MODIFIED_BY,\n\t\t\t\t\tcount(distinct B.ID)\t\t\t\t\t\t\tBANNER_COUNT\n\t\t\t\tFROM\n\t\t\t\t\tb_adv_type T\n\t\t\t\t\tLEFT JOIN b_adv_banner B ON (B.TYPE_SID=T.SID" . ($strContracts == "" ? "" : " AND B.CONTRACT_ID IN (" . $strContracts . ")") . ")\n\t\t\t\tWHERE\n\t\t\t\t{$strSqlSearch} " . ($strContracts == "" ? "" : "and exists(select 'x' from b_adv_contract_2_type CT where (CT.TYPE_SID=T.SID OR CT.TYPE_SID='ALL') AND CT.CONTRACT_ID IN (" . $strContracts . ")) ") . " and T.SID<>'ALL'\n\t\t\t\tGROUP BY\n\t\t\t\t\tT.SID, T.ACTIVE, T.SORT, T.NAME, T.DESCRIPTION,\tT.DATE_CREATE, T.DATE_MODIFY, T.CREATED_BY, T.MODIFIED_BY\n\t\t\t\t{$strSqlOrder}\n\t\t\t\t"; $res = $DB->Query($strSql, false, $err_mess . __LINE__); $is_filtered = IsFiltered($strSqlSearch); return $res; } return null; }
/** * <p>Функция предназначена для получения списка баннеров.</p> * * * * * @param varchar &$by Идентификатор позволяющий задать имя поля для сортировки. * Допустимы следующие значения: <ul> <li>s_id - по ID </li> <li>s_lamp - по * индикатору </li> <li>s_name - по имени баннера </li> <li>s_type_sid - по типу * баннера </li> <li>s_contract_id - по ID контракта </li> <li>s_group_sid - по имени группы * </li> <li>s_show_count - по количеству показов </li> <li>s_max_show_count - по * максимальному количеству показов </li> <li>s_date_last_show - по дате * последнего показа </li> <li>s_click_count - по количеству кликов на баннер * </li> <li>s_max_click_count - по максимальному количеству кликов </li> * <li>s_date_last_click - по дате последнего клика </li> <li>s_active - по флагу * активности </li> <li>s_weight - по весу баннера </li> <li>s_status_sid - по статусу * баннера </li> <li>s_date_show_from - по дате начала показов </li> <li>s_date_show_to - по * дате окончания показов </li> <li>s_ctr - по CTR баннера</li> </ul> * * * * @param varchar &$order Порядок сортировки. Допустимы следующие значения: <ul> <li>desc - по * убыванию (значение по умолчанию) </li> <li>asc - по возрастанию</li> </ul> * * * * @param array $arFilter = array() Массив для фильтрации значений. Необязательный параметр. В * массиве допустимы следующие индексы: <ul> <li>ID - ID баннера * (допускается <a href="http://dev.1c-bitrix.ru/user_help/general/filter.php">сложная логика</a>) * </li> <li>ID_EXACT_MATCH - "Y" - при фильтрации по ID баннера будет искаться * точное совпадение (по умолчанию); "N" - в противном случае будет * искаться вхождение </li> <li>ACTIVE - активность, значения Y/N</li> <li>LAMP - * значение индикатора: "red", "green" </li> <li>LANG - двухсимвольный * идентификатор языковой части сайта в которой будет показываться * баннер </li> <li>SHOW_COUNT_1 - левая часть интервала для числа показов </li> * <li>SHOW_COUNT_2 - правая часть интервала для числа показов </li> <li>CLICK_COUNT_1 - * левая часть интервала для числа кликов </li> <li>CLICK_COUNT_2 - правая * часть интервала для числа кликов </li> <li>CTR_1 - левая часть интервала * для CTR баннера </li> <li>CTR_2 - правая часть интервала для CTR баннера </li> * <li>GROUP - имя группы баннера (допускается <a * href="http://dev.1c-bitrix.ru/user_help/general/filter.php">сложная логика</a>) </li> <li>GROUP_EXACT_MATCH * - "Y" - при фильтрации по имени группы будет искаться точное * совпадение; "N" - в противном случае будет искаться вхождение (по * умолчанию) </li> <li>STATUS_SID - символьный код статуса (допускается <a * href="http://dev.1c-bitrix.ru/user_help/general/filter.php">сложная логика</a>); символьный * код статуса может принимать следующие значения: <ul> <li>PUBLISHED - * баннер подтвержден и опубликован</li> <li>READY - баннер на * рассмотрении</li> <li>REJECTED - баннер отклонен</li> </ul> </li> <li>CONTRACT_ID - ID * контракта (допускается <a href="http://dev.1c-bitrix.ru/user_help/general/filter.php">сложная * логика</a>) </li> <li>CONTRACT_ID_EXACT_MATCH - "Y" - при фильтрации по ID контракта * будет искаться точное совпадение (по умолчанию); "N" - в противном * случае будет искаться вхождение </li> <li>CONTRACT - ID, имя, описание * контракта (допускается <a href="http://dev.1c-bitrix.ru/user_help/general/filter.php">сложная * логика</a>) </li> <li>CONTRACT_EXACT_MATCH - "Y" - при фильтрации по ID, имени, * описанию контракта будет искаться точное совпадение; "N" - в * противном случае будет искаться вхождение (по умолчанию) </li> * <li>TYPE_SID - символьный код типа баннера (допускается <a * href="http://dev.1c-bitrix.ru/user_help/general/filter.php">сложная логика</a>) </li> * <li>TYPE_SID_EXACT_MATCH - "Y" - при фильтрации по символьному коду типа * баннера будет искаться точное совпадение (по умолчанию); "N" - в * противном случае будет искаться вхождение </li> <li>NAME - имя баннера * (допускается <a href="http://dev.1c-bitrix.ru/user_help/general/filter.php">сложная логика</a>) * </li> <li>NAME_EXACT_MATCH - "Y" - при фильтрации по имени баннера будет * искаться точное совпадение; "N" - в противном случае будет искаться * вхождение (по умолчанию) </li> <li>CODE - код баннера (допускается <a * href="http://dev.1c-bitrix.ru/user_help/general/filter.php">сложная логика</a>) </li> <li>CODE_EXACT_MATCH * - "Y" - при фильтрации по коду баннера будет искаться точное * совпадение; "N" - в противном случае будет искаться вхождение (по * умолчанию) </li> <li>COMMENTS - комментарий к баннеру (допускается <a * href="http://dev.1c-bitrix.ru/user_help/general/filter.php">сложная логика</a>) </li> * <li>COMMENTS_EXACT_MATCH - "Y" - при фильтрации по комментарию к баннеру будет * искаться точное совпадение; "N" - в противном случае будет искаться * вхождение (по умолчанию) </li> <li>SITE - для фильтрации по сайтам.</li> </ul> * * * * @param boolean &$is_filtered Переменная возвращающая true в том случае если список баннеров * отфильтрован по какому либо критерию; либо false в противном случае. * * * * @param char(1) $CHECK_RIGHTS = "Y" Параметр проверяет уровень доступа к модулю Реклама * (администратор рекламы, рекламодатель и т.д.). Если параметр * определён как "N", то считается, что текущий пользователь обладает * административными правами доступа к модулю Реклама. Если * параметр пропущен либо равен "Y", то функция проверяет уровень * доступа к модулю. Необязательный параметр. * * * * @return record * * * <h4>Example</h4> * <pre> * <? * $FilterArr = Array( * "find_id", * "find_id_exact_match", * "find_lamp", * "find_lang", * "find_show_count_1", * "find_show_count_2", * "find_click_count_1", * "find_click_count_2", * "find_ctr_1", * "find_ctr_2", * "find_contract_id", * "find_contract", * "find_contract_exact_match", * "find_group", * "find_group_exact_match", * "find_status_sid", * "find_type_sid", * "find_type", * "find_type_exact_match", * "find_name", * "find_name_exact_match", * "find_code", * "find_code_exact_match", * "find_comments", * "find_comments_exact_match" * ); * if (strlen($set_filter)>0) InitFilterEx($FilterArr,"ADV_BANNER_LIST","set"); * else InitFilterEx($FilterArr,"ADV_BANNER_LIST","get"); * if (strlen($del_filter)>0) DelFilterEx($FilterArr,"ADV_BANNER_LIST"); * InitBVar($find_id_exact_match); * InitBVar($find_status_exact_match); * InitBVar($find_group_exact_match); * InitBVar($find_contract_exact_match); * InitBVar($find_type_exact_match); * InitBVar($find_name_exact_match); * InitBVar($find_code_exact_match); * InitBVar($find_comments_exact_match); * $arFilter = Array( * "ID" => $find_id, * "ID_EXACT_MATCH" => $find_id_exact_match, * "LAMP" => $find_lamp, * "LANG" => $find_lang, * "SHOW_COUNT_1" => $find_show_count_1, * "SHOW_COUNT_2" => $find_show_count_2, * "CLICK_COUNT_1" => $find_click_count_1, * "CLICK_COUNT_2" => $find_click_count_2, * "CTR_1" => $find_ctr_1, * "CTR_2" => $find_ctr_2, * "GROUP" => $find_group, * "GROUP_EXACT_MATCH" => $find_group_exact_match, * "STATUS_SID" => $find_status_sid, * "CONTRACT_ID" => $find_contract_id, * "CONTRACT" => $find_contract, * "CONTRACT_EXACT_MATCH" => $find_contract_exact_match, * "TYPE_SID" => $find_type_sid, * "TYPE" => $find_type, * "TYPE_EXACT_MATCH" => $find_type_exact_match, * "NAME" => $find_name, * "NAME_EXACT_MATCH" => $find_name_exact_match, * "CODE" => $find_code, * "CODE_EXACT_MATCH" => $find_code_exact_match, * "COMMENTS" => $find_comments, * "COMMENTS_EXACT_MATCH" => $find_comments_exact_match * ); * $rsBanners = <b>CAdvBanner::GetList</b>($by, $order, $arFilter, $is_filtered, "N"); * $rsBanners->NavStart(20); * $rsBanners->NavPrint("Баннеры"); * while($arBanner = $rsBanners->NavNext(true, "f_")) * { * echo "<pre>"; print_r($arBanner); echo "</pre>"; * } * ?> * </bo * <? * Array * ( * [LAMP] => green * [ID] => 88 * [CONTRACT_ID] => 1 * [TYPE_SID] => TOP * [GROUP_SID] => * [STATUS_SID] => PUBLISHED * [STATUS_COMMENTS] => * [NAME] => * [ACTIVE] => Y * [LID] => * [WEIGHT] => 100 * [MAX_SHOW_COUNT] => 300 * [MAX_CLICK_COUNT] => 100 * [SHOW_COUNT] => 102 * [CLICK_COUNT] => 4 * [IMAGE_ID] => 1032 * [IMAGE_ALT] => * [URL] => http://www.1c-bitrix.ru?banner_param=<code>#EVENT_GID#</code> * [URL_TARGET] => _parent * [CODE] => <TABLE class=smalltext cellSpacing=0 cellPadding=0 width=145> * <TR> * <TD></TD> * <TD> * <DIV align=center> * <A class=righthead href="/ru/partners/partnership.php">Партнёрская программа</A> * </DIV> * </TD></TR> * <TR> * <TD></TD> * <TD height=8></TD></TR> * <TR> * <TD width=5></TD> * <TD vAlign=bottom> * <DIV align=center> * <A href="/ru/partners/partnership.php"> * <IMG height=95 src="/images/advert/free.gif" width=100 border=0></A> * </DIV></TD></TR> * <TR> * <TD></TD> * <TD height=5></TD></TR> * <TR> * <TD></TD> * <TD>Разработчики сайтов и интеграторы получают:<BR> * <B><FONT class=smalltext> * <IMG height=8 src="/images/list_bullet.gif" width=8> * </FONT></B> * <FONT color=#ff5a31>скидки до 50%</FONT> <BR> * <B><FONT class=smalltext> * <IMG height=8 src="/images/list_bullet.gif" width=8> * </FONT></B> * <FONT color=#ff5a31>бесплатную копиию</FONT> * </TD></TR> * <TR> * <TD></TD> * <TD height=5></TD></TR> * <TR> * <TD></TD> * <TD> * <DIV align=right> * <A class=bottomlinks href="/ru/partners/partnership.php">Подробнее</A> * <IMG height=7 src="/images/main_button_more_3.gif" width=7> * </DIV></TD></TR></TABLE> * [CODE_TYPE] => html * [STAT_EVENT_1] => * [STAT_EVENT_2] => * [STAT_EVENT_3] => * [FOR_NEW_GUEST] => * [COMMENTS] => * [CREATED_BY] => 2 * [MODIFIED_BY] => 2 * [CTR] => 3.92 * [DATE_LAST_SHOW] => 24.06.2004 17:39:50 * [DATE_LAST_CLICK] => 24.06.2004 14:47:53 * [DATE_SHOW_FROM] => 10.06.2004 * [DATE_SHOW_TO] => 07.07.2007 * [DATE_CREATE] => 10.06.2004 11:25:59 * [DATE_MODIFY] => 24.06.2004 14:33:56 * [CONTRACT_NAME] => Default * [TYPE_NAME] => Top banner * ) * ?> * </pre> * * * @static * @link http://dev.1c-bitrix.ru/api_help/advertising/classes/cadvbanner/getlist.php * @author Bitrix */ public static function GetList(&$by, &$order, $arFilter = array(), &$is_filtered, $CHECK_RIGHTS = "Y") { $err_mess = CAdvBanner::err_mess() . "<br>Function: GetList<br>Line: "; global $DB, $USER, $APPLICATION; if ($CHECK_RIGHTS == "Y") { $USER_ID = intval($USER->GetID()); $isAdmin = CAdvContract::IsAdmin(); $isDemo = CAdvContract::IsDemo(); $isManager = CAdvContract::IsManager(); $isAdvertiser = CAdvContract::IsAdvertiser(); } else { if (is_object($USER)) { $USER_ID = intval($USER->GetID()); } else { $USER_ID = 0; } $isAdmin = true; $isDemo = true; $isManager = true; $isAdvertiser = true; } $arSqlSearch = array(); $strSqlSearch = ""; $DONT_USE_CONTRACT = COption::GetOptionString("advertising", "DONT_USE_CONTRACT", "N"); if ($DONT_USE_CONTRACT == "Y") { $lamp = "\n\t\t\t\tif ((\n\t\t\t\t\t(B.DATE_SHOW_FROM<=now() or B.DATE_SHOW_FROM is null or length(B.DATE_SHOW_FROM)<=0) and\n\t\t\t\t\t(B.DATE_SHOW_TO>=now() or B.DATE_SHOW_TO is null or length(B.DATE_SHOW_TO)<=0) and\n\t\t\t\t\t(ifnull(B.MAX_SHOW_COUNT,0)>ifnull(B.SHOW_COUNT,0) or ifnull(B.MAX_SHOW_COUNT,0)=0) and\n\t\t\t\t\t(ifnull(B.MAX_CLICK_COUNT,0)>ifnull(B.CLICK_COUNT,0) or ifnull(B.MAX_CLICK_COUNT,0)=0) and\n\t\t\t\t\t(ifnull(B.MAX_VISITOR_COUNT,0)>ifnull(B.VISITOR_COUNT,0) or ifnull(B.MAX_VISITOR_COUNT,0)=0) and\n\t\t\t\t\t(B.ACTIVE='Y') and\n\t\t\t\t\t(B.STATUS_SID='PUBLISHED') and\n\t\t\t\t\t(T.ACTIVE='Y')\n\t\t\t\t\t),\n\t\t\t\t\t'green',\n\t\t\t\t\t'red')\n\t\t\t\t"; } else { $lamp = "\n\t\t\t\tif ((\n\t\t\t\t\t(B.DATE_SHOW_FROM<=now() or B.DATE_SHOW_FROM is null or length(B.DATE_SHOW_FROM)<=0) and\n\t\t\t\t\t(B.DATE_SHOW_TO>=now() or B.DATE_SHOW_TO is null or length(B.DATE_SHOW_TO)<=0) and\n\t\t\t\t\t(ifnull(B.MAX_SHOW_COUNT,0)>ifnull(B.SHOW_COUNT,0) or ifnull(B.MAX_SHOW_COUNT,0)=0) and\n\t\t\t\t\t(ifnull(B.MAX_CLICK_COUNT,0)>ifnull(B.CLICK_COUNT,0) or ifnull(B.MAX_CLICK_COUNT,0)=0) and\n\t\t\t\t\t(ifnull(B.MAX_VISITOR_COUNT,0)>ifnull(B.VISITOR_COUNT,0) or ifnull(B.MAX_VISITOR_COUNT,0)=0) and\n\t\t\t\t\t(B.ACTIVE='Y') and\n\t\t\t\t\t(B.STATUS_SID='PUBLISHED') and\n\t\t\t\t\t(T.ACTIVE='Y') and\n\t\t\t\t\t(C.DATE_SHOW_FROM<=now() or C.DATE_SHOW_FROM is null or length(C.DATE_SHOW_FROM)<=0) and\n\t\t\t\t\t(C.DATE_SHOW_TO>=now() or C.DATE_SHOW_TO is null or length(C.DATE_SHOW_TO)<=0) and\n\t\t\t\t\t(ifnull(C.MAX_SHOW_COUNT,0)>ifnull(C.SHOW_COUNT,0) or ifnull(C.MAX_SHOW_COUNT,0)=0) and\n\t\t\t\t\t(ifnull(C.MAX_CLICK_COUNT,0)>ifnull(C.CLICK_COUNT,0) or ifnull(C.MAX_CLICK_COUNT,0)=0) and\n\t\t\t\t\t(ifnull(C.MAX_VISITOR_COUNT,0)>ifnull(C.VISITOR_COUNT,0) or ifnull(C.MAX_VISITOR_COUNT,0)=0) and\n\t\t\t\t\t(C.ACTIVE='Y')\n\t\t\t\t\t),\n\t\t\t\t\t'green',\n\t\t\t\t\t'red')\n\t\t\t\t"; } if (is_array($arFilter)) { $filter_keys = array_keys($arFilter); for ($i = 0, $n = count($filter_keys); $i < $n; $i++) { $key = $filter_keys[$i]; $val = $arFilter[$filter_keys[$i]]; if (is_array($val) && count($val) <= 0) { continue; } if ($val == '' || $val == "NOT_REF") { continue; } $match_value_set = in_array($key . "_EXACT_MATCH", $filter_keys) ? true : false; $key = strtoupper($key); switch ($key) { case "ID": $match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $match_value_set ? "Y" : "N"; $arSqlSearch[] = GetFilterQuery("B.ID", $val, $match); break; case "LAMP": $arSqlSearch[] = " " . $lamp . " = '" . $DB->ForSQL($val) . "'"; break; case "SITE": if (is_array($val)) { $val = implode(" | ", $val); } $match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $match_value_set ? "Y" : "N"; $arSqlSearch[] = GetFilterQuery("BS.SITE_ID", $val, $match); $left_join = "LEFT JOIN b_adv_banner_2_site BS ON (B.ID = BS.BANNER_ID)"; break; case "DATE_MODIFY_1": $arSqlSearch[] = "B.DATE_MODIFY>=" . $DB->CharToDateFunction($val, "SHORT"); break; case "DATE_MODIFY_2": $arSqlSearch[] = "B.DATE_MODIFY<" . $DB->CharToDateFunction($val, "SHORT") . " + INTERVAL 1 DAY"; break; case "DATE_CREATE_1": $arSqlSearch[] = "B.DATE_CREATE>=" . $DB->CharToDateFunction($val, "SHORT"); break; case "DATE_CREATE_2": $arSqlSearch[] = "B.DATE_CREATE<" . $DB->CharToDateFunction($val, "SHORT") . " + INTERVAL 1 DAY"; break; case "DATE_SHOW_FROM_1": $arSqlSearch[] = "B.DATE_SHOW_FROM>=" . $DB->CharToDateFunction($val, "SHORT"); break; case "DATE_SHOW_FROM_2": $arSqlSearch[] = "B.DATE_SHOW_FROM<" . $DB->CharToDateFunction($val, "SHORT") . " + INTERVAL 1 DAY"; break; case "DATE_SHOW_TO_1": $arSqlSearch[] = "B.DATE_SHOW_TO>=" . $DB->CharToDateFunction($val, "SHORT"); break; case "DATE_SHOW_TO_2": $arSqlSearch[] = "B.DATE_SHOW_TO<" . $DB->CharToDateFunction($val, "SHORT") . " + INTERVAL 1 DAY"; break; case "ACTIVE": case "FIX_SHOW": $arSqlSearch[] = $val == "Y" ? "B." . $key . "='Y'" : "B." . $key . "='N'"; break; case "WEIGHT_1": $arSqlSearch[] = "ifnull(B.WEIGHT,0)>='" . intval($val) . "'"; break; case "WEIGHT_2": $arSqlSearch[] = "ifnull(B.WEIGHT,0)<='" . intval($val) . "'"; break; case "MAX_VISITOR_COUNT_1": $arSqlSearch[] = "ifnull(B.MAX_VISITOR_COUNT,0)>='" . intval($val) . "'"; break; case "MAX_VISITOR_COUNT_2": $arSqlSearch[] = "ifnull(B.MAX_VISITOR_COUNT,0)<='" . intval($val) . "'"; break; case "VISITOR_COUNT_1": $arSqlSearch[] = "ifnull(B.VISITOR_COUNT,0)>='" . intval($val) . "'"; break; case "VISITOR_COUNT_2": $arSqlSearch[] = "ifnull(B.VISITOR_COUNT,0)<='" . intval($val) . "'"; break; case "MAX_SHOW_COUNT_1": $arSqlSearch[] = "ifnull(B.MAX_SHOW_COUNT,0)>='" . intval($val) . "'"; break; case "MAX_SHOW_COUNT_2": $arSqlSearch[] = "ifnull(B.MAX_SHOW_COUNT,0)<='" . intval($val) . "'"; break; case "SHOW_COUNT_1": $arSqlSearch[] = "ifnull(B.SHOW_COUNT,0)>='" . intval($val) . "'"; break; case "SHOW_COUNT_2": $arSqlSearch[] = "ifnull(B.SHOW_COUNT,0)<='" . intval($val) . "'"; break; case "MAX_CLICK_COUNT_1": $arSqlSearch[] = "ifnull(B.MAX_CLICK_COUNT,0)>='" . intval($val) . "'"; break; case "MAX_CLICK_COUNT_2": $arSqlSearch[] = "ifnull(B.MAX_CLICK_COUNT,0)<='" . intval($val) . "'"; break; case "CLICK_COUNT_1": $arSqlSearch[] = "ifnull(B.CLICK_COUNT,0)>='" . intval($val) . "'"; break; case "CLICK_COUNT_2": $arSqlSearch[] = "ifnull(B.CLICK_COUNT,0)<='" . intval($val) . "'"; break; case "CTR_1": $arSqlSearch[] = "if(B.SHOW_COUNT<=0,0,round((B.CLICK_COUNT*100)/B.SHOW_COUNT,2))>='" . DoubleVal(str_replace(',', '.', $val)) . "'"; break; case "CTR_2": $arSqlSearch[] = "if(B.SHOW_COUNT<=0,0,round((B.CLICK_COUNT*100)/B.SHOW_COUNT,2))<='" . DoubleVal(str_replace(',', '.', $val)) . "'"; break; case "GROUP": $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y"; $arSqlSearch[] = GetFilterQuery("B.GROUP_SID", $val, $match); break; case "STATUS": case "STATUS_SID": if (is_array($val)) { $val = implode(" | ", $val); } $arSqlSearch[] = GetFilterQuery("B.STATUS_SID", $val, "N"); break; case "CONTRACT_ID": if (is_array($val)) { $val = implode(" | ", $val); } $match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $match_value_set ? "Y" : "N"; $arSqlSearch[] = GetFilterQuery("B.CONTRACT_ID", $val, $match); break; case "CONTRACT": if (is_array($val)) { $val = implode(" | ", $val); } $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y"; $arSqlSearch[] = GetFilterQuery("B.CONTRACT_ID, C.NAME, C.DESCRIPTION", $val, $match); break; case "TYPE_SID": if (is_array($val)) { $val = implode(" | ", $val); } $match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $match_value_set ? "Y" : "N"; $arSqlSearch[] = GetFilterQuery("B.TYPE_SID", $val, $match); break; case "TYPE": if (is_array($val)) { $val = implode(" | ", $val); } $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y"; $arSqlSearch[] = GetFilterQuery("B.TYPE_SID, T.NAME, T.DESCRIPTION", $val, $match); break; case "SHOW_USER_GROUP": if ($val == "Y") { $arSqlSearch[] = "B.SHOW_USER_GROUP='Y'"; } else { $arSqlSearch[] = "B.SHOW_USER_GROUP <> 'Y'"; } break; case "NAME": case "CODE": case "COMMENTS": $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y"; $arSqlSearch[] = GetFilterQuery("B." . $key, $val, $match); break; // совместимость со старой версией // совместимость со старой версией case "LANG": case "FIRST_SITE_ID": $arSqlSearch[] = GetFilterQuery("B.FIRST_SITE_ID", $val, "N"); break; } } } if ($by == "s_id") { $strSqlOrder = " ORDER BY B.ID "; } elseif ($by == "s_lamp") { $strSqlOrder = " ORDER BY LAMP "; } elseif ($by == "s_name") { $strSqlOrder = " ORDER BY B.NAME "; } elseif ($by == "s_type_sid") { $strSqlOrder = " ORDER BY B.TYPE_SID "; } elseif ($by == "s_contract_id") { $strSqlOrder = " ORDER BY B.CONTRACT_ID "; } elseif ($by == "s_group_sid") { $strSqlOrder = " ORDER BY B.GROUP_SID "; } elseif ($by == "s_visitor_count") { $strSqlOrder = " ORDER BY B.VISITOR_COUNT "; } elseif ($by == "s_max_visitor_count") { $strSqlOrder = " ORDER BY ifnull(B.MAX_VISITOR_COUNT,0) "; } elseif ($by == "s_show_count") { $strSqlOrder = " ORDER BY B.SHOW_COUNT "; } elseif ($by == "s_max_show_count") { $strSqlOrder = " ORDER BY ifnull(B.MAX_SHOW_COUNT,0) "; } elseif ($by == "s_date_last_show") { $strSqlOrder = " ORDER BY B.DATE_LAST_SHOW "; } elseif ($by == "s_click_count") { $strSqlOrder = " ORDER BY B.CLICK_COUNT "; } elseif ($by == "s_max_click_count") { $strSqlOrder = " ORDER BY ifnull(B.MAX_CLICK_COUNT,0) "; } elseif ($by == "s_date_last_click") { $strSqlOrder = " ORDER BY B.DATE_LAST_CLICK "; } elseif ($by == "s_active") { $strSqlOrder = " ORDER BY B.ACTIVE "; } elseif ($by == "s_weight") { $strSqlOrder = " ORDER BY B.WEIGHT "; } elseif ($by == "s_status_sid") { $strSqlOrder = " ORDER BY B.STATUS_SID "; } elseif ($by == "s_date_show_from") { $strSqlOrder = " ORDER BY B.DATE_SHOW_FROM "; } elseif ($by == "s_date_show_to") { $strSqlOrder = " ORDER BY B.DATE_SHOW_TO "; } elseif ($by == "s_dropdown") { $strSqlOrder = " ORDER BY B.CONTRACT_ID desc, B.ID "; } elseif ($by == "s_ctr") { $strSqlOrder = " ORDER BY CTR "; } elseif ($by == "s_date_create") { $strSqlOrder = " ORDER BY B.DATE_CREATE "; } elseif ($by == "s_date_modify") { $strSqlOrder = " ORDER BY B.DATE_MODIFY "; } else { $strSqlOrder = " ORDER BY B.ID "; $by = "s_id"; } if ($order != "asc") { $strSqlOrder .= " desc "; $order = "desc"; } $strSqlSearch = GetFilterSqlSearch($arSqlSearch); if ($isAdmin || $isDemo || $isManager) { $strSql = "\n\t\t\t\tSELECT DISTINCT\n\t\t\t\t\t{$lamp}\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tLAMP,\n\t\t\t\t\tB.*,\n\t\t\t\t\tB.FIRST_SITE_ID,\n\t\t\t\t\tB.FIRST_SITE_ID\t\t\t\t\t\t\t\t\t\t\t\t\t\tLID,\n\t\t\t\t\tif(B.SHOW_COUNT<=0,0,round((B.CLICK_COUNT*100)/B.SHOW_COUNT,2))\t\tCTR,\n\t\t\t\t\t" . $DB->DateToCharFunction("B.DATE_LAST_SHOW") . "\t\t\t\t\t\tDATE_LAST_SHOW,\n\t\t\t\t\t" . $DB->DateToCharFunction("B.DATE_LAST_CLICK") . "\t\t\t\t\tDATE_LAST_CLICK,\n\t\t\t\t\t" . $DB->DateToCharFunction("B.DATE_SHOW_FROM") . "\t\t\tDATE_SHOW_FROM,\n\t\t\t\t\t" . $DB->DateToCharFunction("B.DATE_SHOW_TO") . "\t\t\t\tDATE_SHOW_TO,\n\t\t\t\t\t" . $DB->DateToCharFunction("B.DATE_SHOW_FIRST") . "\t\t\tDATE_SHOW_FIRST,\n\t\t\t\t\t" . $DB->DateToCharFunction("B.DATE_CREATE") . "\t\t\t\t\t\tDATE_CREATE,\n\t\t\t\t\t" . $DB->DateToCharFunction("B.DATE_MODIFY") . "\t\t\t\t\t\tDATE_MODIFY,\n\t\t\t\t\tC.NAME\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tCONTRACT_NAME,\n\t\t\t\t\tT.NAME\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tTYPE_NAME\n\t\t\t\tFROM\n\t\t\t\t\tb_adv_banner B\n\t\t\t\tINNER JOIN b_adv_type T ON (T.SID = B.TYPE_SID)\n\t\t\t\tINNER JOIN b_adv_contract C ON (C.ID = B.CONTRACT_ID)\n\t\t\t\t{$left_join}\n\t\t\t\tWHERE\n\t\t\t\t{$strSqlSearch}\n\t\t\t\t{$strSqlOrder}\n\t\t\t\t"; } else { $strSql = "\n\t\t\t\tSELECT DISTINCT\n\t\t\t\t\t{$lamp}\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tLAMP,\n\t\t\t\t\tB.*,\n\t\t\t\t\tB.FIRST_SITE_ID,\n\t\t\t\t\tB.FIRST_SITE_ID\t\t\t\t\t\t\t\t\t\t\t\t\t\tLID,\n\t\t\t\t\tif(B.SHOW_COUNT<=0,0,round((B.CLICK_COUNT*100)/B.SHOW_COUNT,2))\t\tCTR,\n\t\t\t\t\t" . $DB->DateToCharFunction("B.DATE_LAST_SHOW") . "\t\t\t\t\t\tDATE_LAST_SHOW,\n\t\t\t\t\t" . $DB->DateToCharFunction("B.DATE_LAST_CLICK") . "\t\t\t\t\tDATE_LAST_CLICK,\n\t\t\t\t\t" . $DB->DateToCharFunction("B.DATE_SHOW_FROM") . "\t\t\tDATE_SHOW_FROM,\n\t\t\t\t\t" . $DB->DateToCharFunction("B.DATE_SHOW_TO") . "\t\t\t\tDATE_SHOW_TO,\n\t\t\t\t\t" . $DB->DateToCharFunction("B.DATE_SHOW_FIRST") . "\t\t\tDATE_SHOW_FIRST,\n\t\t\t\t\t" . $DB->DateToCharFunction("B.DATE_CREATE") . "\t\t\t\t\t\tDATE_CREATE,\n\t\t\t\t\t" . $DB->DateToCharFunction("B.DATE_MODIFY") . "\t\t\t\t\t\tDATE_MODIFY,\n\t\t\t\t\tC.NAME\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tCONTRACT_NAME,\n\t\t\t\t\tT.NAME\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tTYPE_NAME\n\t\t\t\tFROM\n\t\t\t\t\tb_adv_banner B\n\t\t\t\tINNER JOIN b_adv_type T ON (T.SID = B.TYPE_SID)\n\t\t\t\tINNER JOIN b_adv_contract C ON (C.ID = B.CONTRACT_ID)\n\t\t\t\tINNER JOIN b_adv_contract_2_user CU ON (CU.CONTRACT_ID=C.ID and CU.USER_ID={$USER_ID})\n\t\t\t\t{$left_join}\n\t\t\t\tWHERE\n\t\t\t\t{$strSqlSearch}\n\t\t\t\t{$strSqlOrder}\n\t\t\t\t"; } $res = $DB->Query($strSql, false, $err_mess . __LINE__); $is_filtered = IsFiltered($strSqlSearch); return $res; }
echo $disabled; ?> type="checkbox" onclick="OnSelectAll(this.checked, '<?php echo $key; ?> ', true)" id="<?php echo $key; ?> "></td> <?php } ?> <td> </td> </tr> <?php $arrCONTRACT_WEEKDAY = CAdvContract::GetWeekdayArray($arContract["ID"]); for ($i = 0; $i <= 23; $i++) { ?> <tr> <td><label for="<?php echo $i; ?> "><?php echo $i . " - " . ($i + 1); ?> </label></td> <?php reset($arrWDAY); while (list($key, $value) = each($arrWDAY)) { $checked = ""; $disabled = "";
} else { if (is_array($arrKEYWORDS)) { echo implode("<br>", $arrKEYWORDS); } else { echo GetMessage("ADV_NOT_SET"); } } ?> </td> </tr> <?php $tabControl->BeginNextTab(); ?> <?php $arrUsers = CAdvContract::GetAdvertisersArray(); $ref = array(); $ref_id = array(); if (is_array($arrUsers)) { foreach ($arrUsers as $arUser) { $ref[] = "[" . $arUser["ID"] . "] (" . $arUser["LOGIN"] . ") " . $arUser["NAME"] . " " . $arUser["LAST_NAME"]; $ref_id[] = $arUser["ID"]; } } if ($isEditRightsMode) { ?> <tr valign="top"> <td width="40%"><?php echo GetMessage("AD_VIEW_STATISTICS"); ?> <br><IMG SRC="/bitrix/images/advertising/mouse.gif" WIDTH="44" HEIGHT="21" BORDER=0 ALT=""></td>
<?php require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php"; $arEventFields = array("ID" => $CONTRACT_ID, "MESSAGE" => $mess, "EMAIL_TO" => implode(",", $EMAIL_TO), "ADMIN_EMAIL" => implode(",", $ADMIN_EMAIL), "ADD_EMAIL" => implode(",", $ADD_EMAIL), "STAT_EMAIL" => implode(",", $VIEW_EMAIL), "EDIT_EMAIL" => implode(",", $EDIT_EMAIL), "OWNER_EMAIL" => implode(",", $OWNER_EMAIL), "BCC" => implode(",", $BCC), "INDICATOR" => GetMessage("AD_" . strtoupper($arContract["LAMP"] . "_CONTRACT_STATUS")), "ACTIVE" => $arContract["ACTIVE"], "NAME" => $arContract["NAME"], "DESCRIPTION" => $description, "MAX_SHOW_COUNT" => $arContract["MAX_SHOW_COUNT"], "SHOW_COUNT" => $arContract["SHOW_COUNT"], "MAX_CLICK_COUNT" => $arContract["MAX_CLICK_COUNT"], "CLICK_COUNT" => $arContract["CLICK_COUNT"], "BANNERS" => $arContract["BANNER_COUNT"], "DATE_SHOW_FROM" => $arContract["DATE_SHOW_FROM"], "DATE_SHOW_TO" => $arContract["DATE_SHOW_TO"], "DATE_CREATE" => $arContract["DATE_CREATE"], "CREATED_BY" => $CREATED_BY, "DATE_MODIFY" => $arContract["DATE_MODIFY"], "MODIFIED_BY" => $MODIFIED_BY); $arrSITE = CAdvContract::GetSiteArray($CONTRACT_ID); CEvent::Send("ADV_CONTRACT_INFO", $arrSITE, $arEventFields);
<?php if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) { die; } if (!CModule::IncludeModule('advertising')) { return; } $dbResult = CAdvContract::GetByID(1); if (!$dbResult->Fetch()) { return; } //Types $arTypes = array(array("SID" => "100x100_ONE", "ACTIVE" => "Y", "SORT" => 1, "NAME" => GetMessage("PORTAL_ADV_100_100_ONE"), "DESCRIPTION" => ""), array("SID" => "100x100_TWO", "ACTIVE" => "Y", "SORT" => 2, "NAME" => GetMessage("PORTAL_ADV_100_100_TWO"), "DESCRIPTION" => ""), array("SID" => "468x60_TOP", "ACTIVE" => "Y", "SORT" => 3, "NAME" => GetMessage("PORTAL_ADV_468_60_TOP"), "DESCRIPTION" => ""), array("SID" => "468x60_BOTTOM", "ACTIVE" => "Y", "SORT" => 4, "NAME" => GetMessage("PORTAL_ADV_468_60_BOTTOM"), "DESCRIPTION" => ""), array("SID" => "INFO", "ACTIVE" => "Y", "NAME" => GetMessage("PORTAL_ADV_INFO"), "SORT" => "5", "DESCRIPTION" => "")); foreach ($arTypes as $arFields) { $dbResult = CAdvType::GetByID($arTypes["SID"], $CHECK_RIGHTS = "N"); if ($dbResult && $dbResult->Fetch()) { continue; } CAdvType::Set($arFields, "", $CHECK_RIGHTS = "N"); } //Matrix $arWeekday = array("SUNDAY" => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23), "MONDAY" => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23), "TUESDAY" => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23), "WEDNESDAY" => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23), "THURSDAY" => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23), "FRIDAY" => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23), "SATURDAY" => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23)); $pathToBanner = WIZARD_SERVICE_ABSOLUTE_PATH . "/banners/" . LANGUAGE_ID; $arBanners = array(array("CONTRACT_ID" => 1, "TYPE_SID" => "468x60_BOTTOM", "STATUS_SID" => "PUBLISHED", "NAME" => GetMessage("PORTAL_ADV_468_60_BOTTOM_NAME"), "ACTIVE" => "Y", "arrSITE" => array(WIZARD_SITE_ID), "WEIGHT" => 100, "FIX_SHOW" => "N", "FIX_CLICK" => "N", "AD_TYPE" => "image", "arrIMAGE_ID" => array("name" => "banner_468x60.gif", "type" => "image/gif", "tmp_name" => $pathToBanner . "/banner_468x60.gif", "error" => "0", "size" => @filesize($pathToBanner . "/banner_468x60.gif"), "MODULE_ID" => "advertising"), "IMAGE_ALT" => GetMessage("PORTAL_ADV_468_60_BOTTOM_NAME"), "URL" => "/company/novice.php", "URL_TARGET" => "_blank", "STAT_EVENT_1" => "banner", "STAT_EVENT_2" => "click", "arrWEEKDAY" => $arWeekday, "COMMENTS" => "banner_468x60.gif"), array("CONTRACT_ID" => 1, "TYPE_SID" => "100x100_ONE", "STATUS_SID" => "PUBLISHED", "NAME" => GetMessage("PORTAL_ADV_100_100_ONE_NAME"), "ACTIVE" => "Y", "FIX_SHOW" => "N", "FIX_CLICK" => "N", "arrSITE" => array(WIZARD_SITE_ID), "WEIGHT" => 100, "AD_TYPE" => "image", "arrIMAGE_ID" => array("name" => "banner_100x100.gif", "type" => "image/gif", "tmp_name" => $pathToBanner . "/banner_100x100.gif", "error" => "0", "size" => @filesize($pathToBanner . "/banner_100x100.gif"), "MODULE_ID" => "advertising"), "IMAGE_ALT" => GetMessage("PORTAL_ADV_100_100_ONE_NAME"), "URL" => "/company/novice.php", "URL_TARGET" => "_blank", "STAT_EVENT_1" => "banner", "STAT_EVENT_2" => "click", "arrWEEKDAY" => $arWeekday, "COMMENTS" => "banner_100x100.gif"), array("CONTRACT_ID" => 1, "TYPE_SID" => "INFO", "STATUS_SID" => "PUBLISHED", "NAME" => GetMessage("PORTAL_ADV_100_100_ONE_NAME"), "ACTIVE" => "Y", "FIX_SHOW" => "Y", "FIX_CLICK" => "N", "arrSITE" => array(WIZARD_SITE_ID), "WEIGHT" => 100, "AD_TYPE" => "image", "arrIMAGE_ID" => array("name" => "new.jpg", "type" => "image/jpeg", "tmp_name" => $_SERVER["DOCUMENT_ROOT"] . "/images/" . LANGUAGE_ID . "/company/about/new.jpg", "error" => "0", "size" => @filesize($_SERVER["DOCUMENT_ROOT"] . "/images/" . LANGUAGE_ID . "/company/about/new.jpg"), "MODULE_ID" => "advertising"), "IMAGE_ALT" => GetMessage("PORTAL_ADV_100_100_ONE_NAME"), "URL" => "/company/novice.php", "URL_TARGET" => "_blank", "STAT_EVENT_1" => "banner", "STAT_EVENT_2" => "click", "arrWEEKDAY" => $arWeekday, "COMMENTS" => "new.jpg", "SHOWS_FOR_VISITOR" => 10), array("CONTRACT_ID" => 1, "TYPE_SID" => "INFO", "STATUS_SID" => "PUBLISHED", "NAME" => GetMessage("PORTAL_ADV_dashboard"), "ACTIVE" => "Y", "arrSITE" => array(WIZARD_SITE_ID), "WEIGHT" => 100, "FIX_SHOW" => "N", "FIX_CLICK" => "N", "AD_TYPE" => "image", "arrIMAGE_ID" => array("name" => "dashboard.gif", "type" => "image/gif", "tmp_name" => $pathToBanner . "/dashboard.gif", "error" => "0", "size" => @filesize($pathToBanner . "/dashboard.gif"), "MODULE_ID" => "advertising"), "IMAGE_ALT" => GetMessage("PORTAL_ADV_dashboard"), "URL" => "/desktop.php", "URL_TARGET" => "_blank", "STAT_EVENT_1" => "banner", "STAT_EVENT_2" => "click", "arrWEEKDAY" => $arWeekday, "COMMENTS" => "dashboard.gif"), array("CONTRACT_ID" => 1, "TYPE_SID" => "468x60_BOTTOM", "STATUS_SID" => "PUBLISHED", "NAME" => GetMessage("PORTAL_ADV_01_absence"), "ACTIVE" => "Y", "arrSITE" => array(WIZARD_SITE_ID), "WEIGHT" => 100, "FIX_SHOW" => "N", "FIX_CLICK" => "N", "AD_TYPE" => "image", "arrIMAGE_ID" => array("name" => "01_absence_02.jpg", "type" => "image/jpeg", "tmp_name" => $pathToBanner . "/01_absence_02.jpg", "error" => "0", "size" => @filesize($pathToBanner . "/01_absence_02.jpg"), "MODULE_ID" => "advertising"), "IMAGE_ALT" => GetMessage("PORTAL_ADV_01_absence"), "URL" => GetMessage("PORTAL_ADV_01_absence_url"), "URL_TARGET" => "_blank", "STAT_EVENT_1" => "banner", "STAT_EVENT_2" => "click", "arrWEEKDAY" => $arWeekday, "COMMENTS" => "01_absence_02.jpg"), array("CONTRACT_ID" => 1, "TYPE_SID" => "100x100_ONE", "STATUS_SID" => "PUBLISHED", "NAME" => GetMessage("PORTAL_ADV_01_absence"), "ACTIVE" => "Y", "arrSITE" => array(WIZARD_SITE_ID), "WEIGHT" => 100, "FIX_SHOW" => "N", "FIX_CLICK" => "N", "AD_TYPE" => "image", "arrIMAGE_ID" => array("name" => "01_absence_01.jpg", "type" => "image/jpeg", "tmp_name" => $pathToBanner . "/01_absence_01.jpg", "error" => "0", "size" => @filesize($pathToBanner . "/01_absence_01.jpg"), "MODULE_ID" => "advertising"), "IMAGE_ALT" => GetMessage("PORTAL_ADV_01_absence"), "URL" => GetMessage("PORTAL_ADV_01_absence_url"), "URL_TARGET" => "_blank", "STAT_EVENT_1" => "banner", "STAT_EVENT_2" => "click", "arrWEEKDAY" => $arWeekday, "COMMENTS" => "01_absence_01.jpg"), array("CONTRACT_ID" => 1, "TYPE_SID" => "468x60_BOTTOM", "STATUS_SID" => "PUBLISHED", "NAME" => GetMessage("PORTAL_ADV_03_outlook"), "ACTIVE" => "Y", "arrSITE" => array(WIZARD_SITE_ID), "WEIGHT" => 100, "FIX_SHOW" => "N", "FIX_CLICK" => "N", "AD_TYPE" => "image", "arrIMAGE_ID" => array("name" => "02_outlook_02.jpg", "type" => "image/jpeg", "tmp_name" => $pathToBanner . "/02_outlook_02.jpg", "error" => "0", "size" => @filesize($pathToBanner . "/02_outlook_02.jpg"), "MODULE_ID" => "advertising"), "IMAGE_ALT" => GetMessage("PORTAL_ADV_03_outlook"), "URL" => GetMessage("PORTAL_ADV_03_outlook_url"), "URL_TARGET" => "_blank", "STAT_EVENT_1" => "banner", "STAT_EVENT_2" => "click", "arrWEEKDAY" => $arWeekday, "COMMENTS" => "02_outlook_02.jpg"), array("CONTRACT_ID" => 1, "TYPE_SID" => "100x100_ONE", "STATUS_SID" => "PUBLISHED", "NAME" => GetMessage("PORTAL_ADV_03_outlook"), "ACTIVE" => "Y", "arrSITE" => array(WIZARD_SITE_ID), "WEIGHT" => 100, "FIX_SHOW" => "N", "FIX_CLICK" => "N", "AD_TYPE" => "image", "arrIMAGE_ID" => array("name" => "02_outlook_02.jpg", "type" => "image/jpeg", "tmp_name" => $pathToBanner . "/02_outlook_02.jpg", "error" => "0", "size" => @filesize($pathToBanner . "/02_outlook_02.jpg"), "MODULE_ID" => "advertising"), "IMAGE_ALT" => GetMessage("PORTAL_ADV_03_outlook"), "URL" => GetMessage("PORTAL_ADV_03_outlook_url"), "URL_TARGET" => "_blank", "STAT_EVENT_1" => "banner", "STAT_EVENT_2" => "click", "arrWEEKDAY" => $arWeekday, "COMMENTS" => "02_outlook_02.jpg"), array("CONTRACT_ID" => 1, "TYPE_SID" => "468x60_BOTTOM", "STATUS_SID" => "PUBLISHED", "NAME" => GetMessage("PORTAL_ADV_05_xmpp"), "ACTIVE" => "Y", "arrSITE" => array(WIZARD_SITE_ID), "WEIGHT" => 100, "FIX_SHOW" => "Y", "FIX_CLICK" => "N", "AD_TYPE" => "image", "arrIMAGE_ID" => array("name" => "03_xmpp_02.jpg", "type" => "image/jpeg", "tmp_name" => $pathToBanner . "/03_xmpp_02.jpg", "error" => "0", "size" => @filesize($pathToBanner . "/03_xmpp_02.jpg"), "MODULE_ID" => "advertising"), "IMAGE_ALT" => GetMessage("PORTAL_ADV_05_xmpp"), "URL" => GetMessage("PORTAL_ADV_05_xmpp_url"), "URL_TARGET" => "_blank", "STAT_EVENT_1" => "banner", "STAT_EVENT_2" => "click", "arrWEEKDAY" => $arWeekday, "COMMENTS" => "03_xmpp_02.jpg"), array("CONTRACT_ID" => 1, "TYPE_SID" => "100x100_ONE", "STATUS_SID" => "PUBLISHED", "NAME" => GetMessage("PORTAL_ADV_05_xmpp"), "ACTIVE" => "Y", "arrSITE" => array(WIZARD_SITE_ID), "WEIGHT" => 100, "FIX_SHOW" => "N", "FIX_CLICK" => "N", "AD_TYPE" => "image", "arrIMAGE_ID" => array("name" => "03_xmpp_01.jpg", "type" => "image/jpeg", "tmp_name" => $pathToBanner . "/03_xmpp_01.jpg", "error" => "0", "size" => @filesize($pathToBanner . "/03_xmpp_01.jpg"), "MODULE_ID" => "advertising"), "IMAGE_ALT" => GetMessage("PORTAL_ADV_05_xmpp"), "URL" => GetMessage("PORTAL_ADV_05_xmpp_url"), "URL_TARGET" => "_blank", "STAT_EVENT_1" => "banner", "STAT_EVENT_2" => "click", "arrWEEKDAY" => $arWeekday, "COMMENTS" => "03_xmpp_01.jpg"), array("CONTRACT_ID" => 1, "TYPE_SID" => "468x60_BOTTOM", "STATUS_SID" => "PUBLISHED", "NAME" => GetMessage("PORTAL_ADV_05_xmpp"), "ACTIVE" => "Y", "arrSITE" => array(WIZARD_SITE_ID), "WEIGHT" => 100, "FIX_SHOW" => "N", "FIX_CLICK" => "N", "AD_TYPE" => "image", "arrIMAGE_ID" => array("name" => "03_xmpp_02_01.jpg", "type" => "image/jpeg", "tmp_name" => $pathToBanner . "/03_xmpp_02_01.jpg", "error" => "0", "size" => @filesize($pathToBanner . "/03_xmpp_02_01.jpg"), "MODULE_ID" => "advertising"), "IMAGE_ALT" => GetMessage("PORTAL_ADV_05_xmpp"), "URL" => GetMessage("PORTAL_ADV_05_xmpp_url"), "URL_TARGET" => "_blank", "STAT_EVENT_1" => "banner", "STAT_EVENT_2" => "click", "arrWEEKDAY" => $arWeekday, "COMMENTS" => "03_xmpp_02_01.jpg"), array("CONTRACT_ID" => 1, "TYPE_SID" => "100x100_ONE", "STATUS_SID" => "PUBLISHED", "NAME" => GetMessage("PORTAL_ADV_05_xmpp"), "ACTIVE" => "Y", "arrSITE" => array(WIZARD_SITE_ID), "WEIGHT" => 100, "FIX_SHOW" => "N", "FIX_CLICK" => "N", "AD_TYPE" => "image", "arrIMAGE_ID" => array("name" => "03_xmpp_02_02.jpg", "type" => "image/jpeg", "tmp_name" => $pathToBanner . "/03_xmpp_02_02.jpg", "error" => "0", "size" => @filesize($pathToBanner . "/03_xmpp_02_02.jpg"), "MODULE_ID" => "advertising"), "IMAGE_ALT" => GetMessage("PORTAL_ADV_05_xmpp"), "URL" => GetMessage("PORTAL_ADV_05_xmpp_url"), "URL_TARGET" => "_blank", "STAT_EVENT_1" => "banner", "STAT_EVENT_2" => "click", "arrWEEKDAY" => $arWeekday, "COMMENTS" => "03_xmpp_02_02.jpg")); foreach ($arBanners as $arFields) { $dbResult = CAdvBanner::GetList($by, $order, array("COMMENTS" => $arFields["COMMENTS"], "COMMENTS_EXACT_MATCH" => "Y"), $is_filtered, "N"); if ($dbResult && $dbResult->Fetch()) { continue; } CAdvBanner::Set($arFields, "", $CHECK_RIGHTS = "N");
$find_what_show = array("visitor", "show", "click", "ctr"); } $arFilter = array("DATE_1" => $find_date1, "DATE_2" => $find_date2, "CONTRACT_ID" => is_array($find_contract_id) && count($find_contract_id) > 0 ? $find_contract_id : array(), "CONTRACT_SUMMA" => $find_contract_summa, "WHAT_SHOW" => $find_what_show); if (count($find_contract_id) < 2) { $find_contract_summa = 'Y'; } $arrDays = CAdvBanner::GetDynamicList($arFilter, $arrLegend, $is_filtered); $arShow = $find_what_show; $filter_selected = 0; if (is_array($find_contract_id) && count($find_contract_id) > 0) { $filter_selected++; } if ($filter_selected > 0) { $is_filtered = true; } $arrStat = CAdvContract::GetStatList($by, $order, $arFilter); $rsData = new CAdminResult($arrStat, $sTableID); //var_dump($arrStat); $rsData->NavStart(); $lAdmin->NavText($rsData->GetNavPrint(GetMessage('ADV_DATE_TABLE_TITLE'))); $arHeaders = array(); $arHeaders[] = array("id" => "DATE", "content" => GetMessage('ADV_DATE'), "sort" => "s_date", "align" => "right", "default" => true); if ($find_contract_summa == "N") { $arHeaders[] = array("id" => "CONTRACT_ID", "content" => GetMessage('ADV_CONTRACT_ID'), "sort" => "s_id", "align" => "right", "default" => false); $arHeaders[] = array("id" => "CONTRACT_NAME", "content" => GetMessage('ADV_CONTRACT'), "sort" => false, "align" => "left", "default" => true); } $arHeaders[] = array("id" => "VISITORS", "content" => GetMessage('AD_VISITOR'), "sort" => "s_visitors", "align" => "right", "default" => true); $arHeaders[] = array("id" => "CTR", "content" => GetMessage('AD_CTR'), "sort" => "s_ctr", "align" => "right", "default" => true); $arHeaders[] = array("id" => "SHOWS", "content" => GetMessage('AD_SHOW'), "sort" => "s_show", "align" => "right", "default" => true); $lAdmin->AddHeaders($arHeaders); while ($arRes = $rsData->NavNext(true, "f_")) {
/* ############################################## # Bitrix: SiteManager # # Copyright (c) 2004 Bitrix # # http://www.bitrix.ru # # mailto:admin@bitrix.ru # ############################################## */ require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_before.php"; require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/advertising/prolog.php"; require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/advertising/include.php"; $isAdmin = CAdvContract::IsAdmin(); $isDemo = CAdvContract::IsDemo(); $isManager = CAdvContract::IsManager(); $isAdvertiser = CAdvContract::IsAdvertiser(); if (!$isAdmin && !$isDemo && !$isManager && !$isAdvertiser) { $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED")); } IncludeModuleLangFile(__FILE__); IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/advertising/admin/adv_stat_list.php"); include $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/advertising/colors.php"; require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/img.php"; /*************************************************************************** ќбработка GET | POST ****************************************************************************/ $strError = ''; $banner_ref = array(); $banner_ref_id = array(); $group_ref_id = array(); $group_ref = array();
$DB->Rollback(); } $DB->Commit(); } } // обработка действий групповых и одиночных if (($arID = $lAdmin->GroupAction()) && $isAdmin) { if ($_REQUEST['action_target'] == 'selected') { $arID = array(); $rsData = CAdvContract::GetList($by, $order, $arFilter); while ($arRes = $rsData->Fetch()) { $arID[] = $arRes['ID']; } } foreach ($arID as $ID) { $ob = new CAdvContract(); if (IntVal($ID) <= 0) { continue; } $ID = IntVal($ID); switch ($_REQUEST['action']) { case "delete": if (!CAdvContract::Delete($ID)) { $lAdmin->AddGroupError(GetMessage("DELETE_ERROR"), $ID); } break; case "activate": case "deactivate": $arFields = array("ACTIVE" => $_REQUEST['action'] == "activate" ? "Y" : "N"); if (!$ob->Set($arFields, $ID)) { $lAdmin->AddGroupError(GetMessage("MAIN_EDIT_ERROR") . $ob->LAST_ERROR, $ID);
} __IncludeLang(GetLangFileName(dirname(__FILE__) . "/lang/", '/' . basename(__FILE__))); //Matrix $arWeekday = array("SUNDAY" => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23), "MONDAY" => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23), "TUESDAY" => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23), "WEDNESDAY" => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23), "THURSDAY" => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23), "FRIDAY" => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23), "SATURDAY" => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23)); $contractId = false; $rsADV = CAdvContract::GetList($v1 = "s_sort", $v2 = "desc", array("NAME" => 'Eshop', 'DESCRIPTION' => GetMessage("CONTRACT_DESC") . " [" . WIZARD_SITE_ID . "]"), $is_filtered); if ($arADV = $rsADV->Fetch()) { $contractId = $arADV["ID"]; if (WIZARD_INSTALL_DEMO_DATA) { CAdvContract::Delete($arADV["ID"]); $contractId = false; } } if ($contractId == false) { $arFields = array('ACTIVE' => 'Y', 'NAME' => 'Eshop', 'SORT' => 1000, 'DESCRIPTION' => GetMessage("CONTRACT_DESC") . " [" . WIZARD_SITE_ID . "]", 'EMAIL_COUNT' => 1, 'arrTYPE' => array('ALL'), 'arrWEEKDAY' => $arWeekday, 'arrSITE' => array(WIZARD_SITE_ID)); $contractId = CAdvContract::Set($arFields, 0, 'N'); //Types $arTypes = array(array("SID" => "MAIN", "ACTIVE" => "Y", "SORT" => 1, "NAME" => GetMessage("DEMO_ADV_MAIN_TYPE"), "DESCRIPTION" => ""), array("SID" => "PARALLAX", "ACTIVE" => "Y", "SORT" => 2, "NAME" => GetMessage("DEMO_ADV_PARALLAX_TYPE"), "DESCRIPTION" => "")); foreach ($arTypes as $arFields) { $dbResult = CAdvType::GetByID($arTypes["SID"], $CHECK_RIGHTS = "N"); if ($dbResult && $dbResult->Fetch()) { continue; } CAdvType::Set($arFields, "", $CHECK_RIGHTS = "N"); } $pathToBanner = str_replace("\\", "/", dirname(__FILE__)); $lang = in_array(LANGUAGE_ID, array("ru", "en", "de")) ? LANGUAGE_ID : \Bitrix\Main\Localization\Loc::getDefaultLang(LANGUAGE_ID); $pathToBanner = $pathToBanner . "/lang/" . $lang; if (CModule::IncludeModule("iblock")) { $IBLOCK_CATALOG_ID = $_SESSION["WIZARD_CATALOG_IBLOCK_ID"]; $arSectionLinks = array();