public static function GetList($arSort=array(), $arFilter=array(), $arNavParams=false, $arUserField)
	{
		$rs = false;

		if(\CModule::IncludeModule("statistic"))
		{
			$arAliases = array("ID" => "CITY_ID", "NAME" => "CITY_NAME");

			$ob = new \CCity();
			$rs = new CUserTypeLocationEnum($ob->GetList(
				static::__makeArrayFromAlias($arSort, $arAliases),
				static::__makeArrayFromAlias($arFilter, $arAliases)
			));

			// getlist is not supported pagenavigation yet
			if(is_array($arNavParams) && is_set($arNavParams, "nTopCount"))
			{
				$arr = array();
				while($ar = $rs->Fetch())
				{
					if(count($arr) >= intval($arNavParams["nTopCount"]))
						break;
					$arr[] = $ar;
				}
				$rs = new CUserTypeLocationEnum();
				$rs->InitFromArray($arr);
			}
		}

		return $rs;
	}
Example #2
0
</td>
	</tr>
	<?php 
}
?>

	<?php 
if (CModule::IncludeModule("statistic")) {
    $arDisplay = array();
    if ($str_STAT_TYPE === "CITY") {
        if (is_array($arrSTAT_TYPE_VALUES) && count($arrSTAT_TYPE_VALUES) > 0) {
            $arFilter = array();
            foreach ($arrSTAT_TYPE_VALUES as $ar) {
                $arFilter[] = $ar["CITY_ID"];
            }
            $rs = CCity::GetList("CITY", array("=CITY_ID" => $arFilter));
            while ($ar = $rs->GetNext()) {
                $arDisplay[$ar["CITY_ID"]] = "[" . $ar["COUNTRY_ID"] . "] [" . $ar["REGION_NAME"] . "] " . $ar["CITY_NAME"];
            }
        }
    } elseif ($str_STAT_TYPE === "REGION") {
        if (is_array($arrSTAT_TYPE_VALUES)) {
            foreach ($arrSTAT_TYPE_VALUES as $ar) {
                $arDisplay[$ar["COUNTRY_ID"] . "|" . $ar["REGION"]] = "[" . $ar["COUNTRY_ID"] . "] " . $ar["REGION"];
            }
        }
    } else {
        if (is_array($arrSTAT_TYPE_VALUES) && count($arrSTAT_TYPE_VALUES) > 0) {
            $arr = array_flip($arrSTAT_TYPE_VALUES);
            $v1 = "s_id";
            $rs = CStatCountry::GetList($v1, $v2, array(), $v3);
Example #3
0
 public static function GetPageWeights_RS()
 {
     $err_mess = CAdvBanner::err_mess() . "<br>Function: GetPageWeights_RS<br>Line: ";
     global $APPLICATION, $DB, $USER;
     $stat_adv_id = intval($_SESSION["SESS_LAST_ADV_ID"]);
     $stat_country_id = trim($_SESSION["SESS_COUNTRY_ID"]);
     $stat_city_id = intval($_SESSION["SESS_CITY_ID"]);
     if ($stat_city_id > 0 && CModule::IncludeModule('statistic')) {
         $rsCity = CCity::GetList(array(), array("=CITY_ID" => $stat_city_id));
         if ($arCity = $rsCity->Fetch()) {
             $stat_region = $arCity["REGION_NAME"];
         }
     }
     $new_guest = $_SESSION["SESS_GUEST_NEW"] == "N" ? "N" : "Y";
     $url = CAdvBanner::GetCurUri();
     $arrTime = getdate();
     $weekday = strtoupper($arrTime["weekday"]);
     $hour = intval($arrTime["hours"]);
     $strUserGroups = $USER->GetUserGroupString();
     $DONT_USE_CONTRACT = COption::GetOptionString("advertising", "DONT_USE_CONTRACT", "N");
     if ($DONT_USE_CONTRACT == "N") {
         $strSql = "\n\t\t\t\tSELECT DISTINCT\n\t\t\t\t\tB.TYPE_SID,\n\t\t\t\t\tB.ID\t\t\t\t\tBANNER_ID,\n\t\t\t\t\tB.WEIGHT\t\t\t\tBANNER_WEIGHT,\n\t\t\t\t\tB.SHOWS_FOR_VISITOR,\n\t\t\t\t\tB.FIX_CLICK,\n\t\t\t\t\tB.FIX_SHOW,\n\t\t\t\t\tB.KEYWORDS\t\t\t\tBANNER_KEYWORDS,\n\t\t\t\t\t" . $DB->DateToCharFunction("B.DATE_SHOW_FIRST") . "\t\tDATE_SHOW_FIRST,\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\tDATE_SHOW_TO,\n\t\t\t\t\tB.FLYUNIFORM\t\t\tFLYUNIFORM,\n\t\t\t\t\tB.MAX_SHOW_COUNT\t\tMAX_SHOW_COUNT,\n\t\t\t\t\tB.SHOW_COUNT\t\t\tSHOW_COUNT,\n\t\t\t\t\tC.ID\t\t\t\t\tCONTRACT_ID,\n\t\t\t\t\tC.WEIGHT\t\t\t\tCONTRACT_WEIGHT,\n\t\t\t\t\tC.KEYWORDS\t\t\t\tCONTRACT_KEYWORDS\n\t\t\t\tFROM\n\t\t\t\t\tb_adv_type T\n\n\t\t\t\tINNER JOIN b_adv_banner B ON (\n\t\t\t\t\t\tB.ACTIVE='Y'\n\t\t\t\t\tand\tB.TYPE_SID = T.SID\n\t\t\t\t\tand\tB.STATUS_SID = 'PUBLISHED'\n\t\t\t\t\tand (B.FOR_NEW_GUEST is null or B.FOR_NEW_GUEST='{$new_guest}')\n\t\t\t\t\tand\t(ifnull(B.MAX_SHOW_COUNT,0)>ifnull(B.SHOW_COUNT,0) or ifnull(B.MAX_SHOW_COUNT,0)=0)\n\t\t\t\t\tand (ifnull(B.MAX_CLICK_COUNT,0)>ifnull(B.CLICK_COUNT,0) or ifnull(B.MAX_CLICK_COUNT,0)=0)\n\t\t\t\t\tand (ifnull(B.MAX_VISITOR_COUNT,0)>ifnull(B.VISITOR_COUNT,0) or ifnull(B.MAX_VISITOR_COUNT,0)=0)\n\t\t\t\t\tand (B.DATE_SHOW_FROM<=now() or B.DATE_SHOW_FROM is null or length(B.DATE_SHOW_FROM)<=0)\n\t\t\t\t\tand (B.DATE_SHOW_TO>=now() or B.DATE_SHOW_TO is null or length(B.DATE_SHOW_TO)<=0))\n\n\t\t\t\tINNER JOIN b_adv_banner_2_site BS ON (\n\t\t\t\t\t\tBS.BANNER_ID = B.ID\n\t\t\t\t\tand BS.SITE_ID = '" . SITE_ID . "')\n\n\t\t\t\tINNER JOIN b_adv_contract C ON (\n\t\t\t\t\t\tC.ID = B.CONTRACT_ID\n\t\t\t\t\tand C.ACTIVE='Y'\n\t\t\t\t\tand\t(ifnull(C.MAX_SHOW_COUNT,0)>ifnull(C.SHOW_COUNT,0) or ifnull(C.MAX_SHOW_COUNT,0)=0)\n\t\t\t\t\tand (ifnull(C.MAX_CLICK_COUNT,0)>ifnull(C.CLICK_COUNT,0) or ifnull(C.MAX_CLICK_COUNT,0)=0)\n\t\t\t\t\tand (ifnull(C.MAX_VISITOR_COUNT,0)>ifnull(C.VISITOR_COUNT,0) or ifnull(C.MAX_VISITOR_COUNT,0)=0)\n\t\t\t\t\tand (C.DATE_SHOW_FROM<=now() or C.DATE_SHOW_FROM is null or length(C.DATE_SHOW_FROM)<=0)\n\t\t\t\t\tand (C.DATE_SHOW_TO>=now() or C.DATE_SHOW_TO is null or length(C.DATE_SHOW_TO)<=0))\n\n\t\t\t\tINNER JOIN b_adv_contract_2_site CS ON (\n\t\t\t\t\t\tCS.CONTRACT_ID = B.CONTRACT_ID\n\t\t\t\t\tand CS.SITE_ID = '" . SITE_ID . "')\n\n\t\t\t\tINNER JOIN b_adv_contract_2_type CT ON (\n\t\t\t\t\t\tCT.CONTRACT_ID = C.ID\n\t\t\t\t\tand (CT.TYPE_SID = 'ALL' or CT.TYPE_SID = T.SID))\n\n\t\t\t\tINNER JOIN b_adv_banner_2_weekday BW ON (\n\t\t\t\t\t\tBW.BANNER_ID = B.ID\n\t\t\t\t\tand BW.C_WEEKDAY='" . $DB->ForSql($weekday, 10) . "'\n\t\t\t\t\tand BW.C_HOUR = '{$hour}')\n\n\t\t\t\tINNER JOIN b_adv_contract_2_weekday CW ON (\n\t\t\t\t\t\tCW.CONTRACT_ID = C.ID\n\t\t\t\t\tand CW.C_WEEKDAY='" . $DB->ForSql($weekday, 10) . "'\n\t\t\t\t\tand CW.C_HOUR = '{$hour}')\n\n\t\t\t\tLEFT JOIN b_adv_banner_2_group UG1 ON (\n\t\t\t\t\t(UG1.BANNER_ID = B.ID\n\t\t\t\t\tand UG1.GROUP_ID in (" . $strUserGroups . ") and UG1.GROUP_ID<>2)\n\t\t\t\t)\n\n\t\t\t\tLEFT JOIN b_adv_banner_2_page BP1 ON (\n\t\t\t\t\t\tBP1.BANNER_ID = B.ID\n\t\t\t\t\tand BP1.SHOW_ON_PAGE='Y')\n\n\t\t\t\tLEFT JOIN b_adv_banner_2_page BP2 ON (\n\t\t\t\t\t\tBP2.BANNER_ID = B.ID\n\t\t\t\t\tand BP2.SHOW_ON_PAGE='N'\n\t\t\t\t\tand '" . $DB->ForSQL($url) . "' like concat(BP2.PAGE, '%'))\n\n\t\t\t\tLEFT JOIN b_adv_contract_2_page\tCP1 ON (\n\t\t\t\t\t\tCP1.CONTRACT_ID = C.ID\n\t\t\t\t\tand CP1.SHOW_ON_PAGE='Y')\n\n\t\t\t\tLEFT JOIN b_adv_contract_2_page CP2 ON (\n\t\t\t\t\t\tCP2.CONTRACT_ID = C.ID\n\t\t\t\t\tand CP2.SHOW_ON_PAGE='N'\n\t\t\t\t\tand '" . $DB->ForSQL($url) . "' like concat(CP2.PAGE, '%'))\n\n\t\t\t\tLEFT JOIN b_adv_banner_2_stat_adv\tBA\tON BA.BANNER_ID = B.ID\n\t\t\t\tLEFT JOIN b_adv_banner_2_country BC ON BC.BANNER_ID = B.ID AND (\n\t\t\t\t\t(\n\t\t\t\t\t\t(B.STAT_TYPE is null OR length(B.STAT_TYPE)=0 OR B.STAT_TYPE='COUNTRY')\n\t\t\t\t\t\tAND BC.COUNTRY_ID='" . $DB->ForSql($stat_country_id, 2) . "'\n\t\t\t\t\t) OR (\n\t\t\t\t\t\tB.STAT_TYPE='REGION'\n\t\t\t\t\t\tAND BC.COUNTRY_ID='" . $DB->ForSql($stat_country_id, 2) . "'\n\t\t\t\t\t\tAND BC.REGION='" . $DB->ForSql($stat_region) . "'\n\t\t\t\t\t) OR (\n\t\t\t\t\t\tB.STAT_TYPE='CITY'\n\t\t\t\t\t\tAND BC.CITY_ID='" . intval($stat_city_id) . "'\n\t\t\t\t\t)\n\t\t\t\t)\n\n\t\t\t\tWHERE\n\t\t\t\t\tT.ACTIVE = 'Y'\n\n\t\t\t\tand (\n\t\t\t\t\tB.STAT_COUNT is null\n\t\t\t\t\tor B.STAT_COUNT = 0\n\t\t\t\t\tor BC.BANNER_ID is not null\n\t\t\t\t)\n\t\t\t\tand BP2.ID is null\n\t\t\t\tand CP2.ID is null\n\t\t\t\tand (BP1.ID is null or '" . $DB->ForSQL($url) . "' like concat(BP1.PAGE, '%'))\n\t\t\t\tand (CP1.ID is null or '" . $DB->ForSQL($url) . "' like concat(CP1.PAGE, '%'))\n\t\t\t\tand (BA.STAT_ADV_ID is null or BA.STAT_ADV_ID='" . $stat_adv_id . "')\n\t\t\t\tand (BC.COUNTRY_ID is null or BC.COUNTRY_ID='" . $DB->ForSql($stat_country_id, 2) . "')\n\n\t\t\t\tand\n\t\t\t\t(\n\t\t\t\t\t(B.SHOW_USER_GROUP = 'Y' and UG1.GROUP_ID is not null)\n\t\t\t\t\tor\n\t\t\t\t\t(B.SHOW_USER_GROUP <> 'Y' and UG1.GROUP_ID is null)\n\t\t\t\t)\n\n\t\t\t\tORDER BY B.TYPE_SID desc, C.ID desc\n\t\t\t\t";
     } else {
         $strSql = "\n\t\t\t\tSELECT DISTINCT\n\t\t\t\t\tB.TYPE_SID,\n\t\t\t\t\tB.ID\t\t\t\t\tBANNER_ID,\n\t\t\t\t\tB.WEIGHT\t\t\t\tBANNER_WEIGHT,\n\t\t\t\t\tB.SHOWS_FOR_VISITOR,\n\t\t\t\t\tB.FIX_CLICK,\n\t\t\t\t\tB.FIX_SHOW,\n\t\t\t\t\tB.KEYWORDS\t\t\t\tBANNER_KEYWORDS\n\t\t\t\tFROM\n\t\t\t\t\tb_adv_type T\n\n\t\t\t\tINNER JOIN b_adv_banner B ON (\n\t\t\t\t\t\tB.ACTIVE='Y'\n\t\t\t\t\tand\tB.TYPE_SID = T.SID\n\t\t\t\t\tand\tB.STATUS_SID = 'PUBLISHED'\n\t\t\t\t\tand (B.FOR_NEW_GUEST is null or B.FOR_NEW_GUEST='{$new_guest}')\n\t\t\t\t\tand\t(ifnull(B.MAX_SHOW_COUNT,0)>ifnull(B.SHOW_COUNT,0) or ifnull(B.MAX_SHOW_COUNT,0)=0)\n\t\t\t\t\tand (ifnull(B.MAX_CLICK_COUNT,0)>ifnull(B.CLICK_COUNT,0) or ifnull(B.MAX_CLICK_COUNT,0)=0)\n\t\t\t\t\tand (ifnull(B.MAX_VISITOR_COUNT,0)>ifnull(B.VISITOR_COUNT,0) or ifnull(B.MAX_VISITOR_COUNT,0)=0)\n\t\t\t\t\tand (B.DATE_SHOW_FROM<=now() or B.DATE_SHOW_FROM is null or length(B.DATE_SHOW_FROM)<=0)\n\t\t\t\t\tand (B.DATE_SHOW_TO>=now() or B.DATE_SHOW_TO is null or length(B.DATE_SHOW_TO)<=0))\n\n\t\t\t\tINNER JOIN b_adv_banner_2_site BS ON (\n\t\t\t\t\t\tBS.BANNER_ID = B.ID\n\t\t\t\t\tand BS.SITE_ID = '" . SITE_ID . "')\n\n\t\t\t\tINNER JOIN b_adv_banner_2_weekday BW ON (\n\t\t\t\t\t\tBW.BANNER_ID = B.ID\n\t\t\t\t\tand BW.C_WEEKDAY='" . $DB->ForSql($weekday, 10) . "'\n\t\t\t\t\tand BW.C_HOUR = '{$hour}')\n\n\t\t\t\tLEFT JOIN b_adv_banner_2_group UG1 ON (\n\t\t\t\t\t(UG1.BANNER_ID = B.ID\n\t\t\t\t\tand UG1.GROUP_ID in (" . $strUserGroups . ") and UG1.GROUP_ID<>2)\n\t\t\t\t)\n\n\t\t\t\tLEFT JOIN b_adv_banner_2_page BP1 ON (\n\t\t\t\t\t\tBP1.BANNER_ID = B.ID\n\t\t\t\t\tand BP1.SHOW_ON_PAGE='Y')\n\n\t\t\t\tLEFT JOIN b_adv_banner_2_page BP2 ON (\n\t\t\t\t\t\tBP2.BANNER_ID = B.ID\n\t\t\t\t\tand BP2.SHOW_ON_PAGE='N'\n\t\t\t\t\tand '" . $DB->ForSQL($url) . "' like concat(BP2.PAGE, '%'))\n\n\t\t\t\tLEFT JOIN b_adv_banner_2_stat_adv\tBA\tON BA.BANNER_ID = B.ID\n\t\t\t\tLEFT JOIN b_adv_banner_2_country BC ON BC.BANNER_ID = B.ID AND (\n\t\t\t\t\t(\n\t\t\t\t\t\t(B.STAT_TYPE is null OR length(B.STAT_TYPE)=0 OR B.STAT_TYPE='COUNTRY')\n\t\t\t\t\t\tAND BC.COUNTRY_ID='" . $DB->ForSql($stat_country_id, 2) . "'\n\t\t\t\t\t) OR (\n\t\t\t\t\t\tB.STAT_TYPE='REGION'\n\t\t\t\t\t\tAND BC.COUNTRY_ID='" . $DB->ForSql($stat_country_id, 2) . "'\n\t\t\t\t\t\tAND BC.REGION='" . $DB->ForSql($stat_region) . "'\n\t\t\t\t\t) OR (\n\t\t\t\t\t\tB.STAT_TYPE='CITY'\n\t\t\t\t\t\tAND BC.CITY_ID='" . intval($stat_city_id) . "'\n\t\t\t\t\t)\n\t\t\t\t)\n\n\t\t\t\tWHERE\n\t\t\t\t\tT.ACTIVE = 'Y'\n\n\t\t\t\tand (\n\t\t\t\t\tB.STAT_COUNT is null\n\t\t\t\t\tor B.STAT_COUNT = 0\n\t\t\t\t\tor BC.BANNER_ID is not null\n\t\t\t\t)\n\t\t\t\tand BP2.ID is null\n\t\t\t\tand (BP1.ID is null or '" . $DB->ForSQL($url) . "' like concat(BP1.PAGE, '%'))\n\t\t\t\tand (BA.STAT_ADV_ID is null or BA.STAT_ADV_ID='" . $stat_adv_id . "')\n\t\t\t\tand (BC.COUNTRY_ID is null or BC.COUNTRY_ID='" . $DB->ForSql($stat_country_id, 2) . "')\n\t\t\t\tand\n\t\t\t\t(\n\t\t\t\t\t(B.SHOW_USER_GROUP = 'Y' and UG1.GROUP_ID is not null)\n\t\t\t\t\tor\n\t\t\t\t\t(B.SHOW_USER_GROUP <> 'Y' and UG1.GROUP_ID is null)\n\t\t\t\t)\n\t\t\t\tORDER BY B.TYPE_SID desc";
     }
     $rs = $DB->Query($strSql, false, $err_mess . __LINE__);
     return $rs;
 }
    }
}
IncludeModuleLangFile(__FILE__);
$sTableID = "tbl_stat_city_multiselect";
$oSort = new CAdminSorting($sTableID, "CITY", "asc");
$lAdmin = new CAdminList($sTableID, $oSort);
$FilterArr = array("find", "find_type", "find_country_id", "find_country_id_exact_match", "find_country_short_name", "find_country_short_name_exact_match", "find_country_name", "find_country_name_exact_match", "find_region_name", "find_region_name_exact_match", "find_city_name", "find_city_name_exact_match");
$lAdmin->InitFilter($FilterArr);
$arFilter = array(($find_country_id_exact_match == "Y" ? "=" : "%") . "COUNTRY_ID" => $find != "" && $find_type == "county_id" ? $find : $find_country_id, ($find_country_short_name_exact_match == "Y" ? "=" : "%") . "COUNTRY_SHORT_NAME" => $find != "" && $find_type == "county_short_name" ? $find : $find_country_short_name, ($find_country_name_exact_match == "Y" ? "=" : "%") . "COUNTRY_NAME" => $find != "" && $find_type == "county_name" ? $find : $find_country_name, ($find_region_name_exact_match == "Y" ? "=" : "%") . "REGION_NAME" => $find != "" && $find_type == "region_name" ? $find : $find_region_name, ($find_city_name_exact_match == "Y" ? "=" : "%") . "CITY_NAME" => $find != "" && $find_type == "city_name" ? $find : $find_city_name);
foreach ($arFilter as $i => $flt) {
    if (trim($flt) == "") {
        unset($arFilter[$i]);
    }
}
$cData = new CCity();
$rsData = $cData->GetList(array($by => $order), $arFilter, $is_filtered);
$rsData = new CAdminResult($rsData, $sTableID);
$rsData->NavStart();
$lAdmin->NavText($rsData->GetNavPrint(GetMessage("STAT_CITY_MSEL_PAGES")));
$arHeaders = array(array("id" => "COUNTRY_ID", "content" => GetMessage("STAT_CITY_MSEL_COUNTRY_ID"), "sort" => "CITY", "default" => true), array("id" => "COUNTRY_SHORT_NAME", "content" => GetMessage("STAT_CITY_MSEL_COUNTRY_SHORT_NAME"), "sort" => "COUNTRY_SHORT_NAME", "default" => true), array("id" => "COUNTRY_NAME", "content" => GetMessage("STAT_CITY_MSEL_COUNTRY_NAME"), "sort" => "COUNTRY_NAME", "default" => true), array("id" => "REGION_NAME", "content" => GetMessage("STAT_CITY_MSEL_REGION_NAME"), "sort" => "REGION_NAME", "default" => true), array("id" => "CITY_NAME", "content" => GetMessage("STAT_CITY_MSEL_CITY_NAME"), "sort" => "CITY_NAME", "default" => true));
$lAdmin->AddHeaders($arHeaders);
while ($arRes = $rsData->NavNext(true, "f_")) {
    $row =& $lAdmin->AddRow($f_CITY_ID, $arRes);
    $row->AddViewField("COUNTRY_ID", $f_COUNTRY_ID . '<input type="hidden" name="CITY_NAME[' . $f_CITY_ID . ']" id="CITY_NAME[' . $f_CITY_ID . ']" value="[' . $f_COUNTRY_ID . '] [' . $f_REGION_NAME . '] ' . $f_CITY_NAME . '">');
}
$arFooter = array();
$arFooter[] = array("title" => GetMessage("MAIN_ADMIN_LIST_SELECTED"), "value" => $rsData->SelectedRowsCount());
$arFooter[] = array("counter" => true, "title" => GetMessage("MAIN_ADMIN_LIST_CHECKED"), "value" => "0");
$lAdmin->AddFooter($arFooter);
$lAdmin->AddGroupActionTable(array(array("action" => "setTargetValue(0, 'form_" . $sTableID . "', '" . CUtil::JSEscape($_REQUEST["field"]) . "')", "value" => "select", "type" => "button", "title" => GetMessage("STAT_CITY_MSEL_SELECT_TITLE"), "name" => GetMessage("STAT_CITY_MSEL_SELECT"))), array("disable_action_target" => true));
$lAdmin->CheckListMode();