1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
path.php
См. документацию.
1<?php
2class CPath
3{
4 public static function GetList($PARENT_ID = '', $COUNTER_TYPE = 'COUNTER_FULL_PATH', $by = 's_counter', $order = 'desc', $arFilter = [])
5 {
6 $DB = CDatabase::GetModuleConnection('statistic');
7 if ($COUNTER_TYPE!="COUNTER_FULL_PATH")
8 $COUNTER_TYPE = "COUNTER";
9 $arSqlSearch = Array();
10
11 $counter = "P.".$COUNTER_TYPE;
12 $where_counter = "and P.".$COUNTER_TYPE.">0";
13
14 if ($PARENT_ID == '' && $COUNTER_TYPE=="COUNTER")
15 {
16 $where_parent = "and (P.PARENT_PATH_ID is null or ".$DB->Length("P.PARENT_PATH_ID")."<=0)";
17 }
18 elseif ($COUNTER_TYPE=="COUNTER")
19 {
20 $where_parent = "and P.PARENT_PATH_ID = '".$DB->ForSql($PARENT_ID)."'";
21 }
22 else
23 {
24 $where_parent = "";
25 }
26
27 $from_adv = "";
28 $where_adv = "";
29 $ADV_EXIST = "N";
30
31 if (is_array($arFilter))
32 {
33 if ($arFilter["ADV"] <> '')
34 {
35 $from_adv = " , b_stat_path_adv A ";
36 $where_adv = "and A.PATH_ID = P.PATH_ID and A.DATE_STAT = P.DATE_STAT ";
37 $ADV_EXIST = "Y";
38 if ($arFilter["ADV_DATA_TYPE"]=="B")
39 {
40 $counter = $DB->IsNull("A.".$COUNTER_TYPE."_BACK","0");
41 $where_counter = "and ".$counter.">0";
42 }
43 elseif ($arFilter["ADV_DATA_TYPE"]=="P")
44 {
45 $counter = $DB->IsNull("A.".$COUNTER_TYPE,"0");
46 $where_counter = "and ".$counter.">0";
47 }
48 elseif ($arFilter["ADV_DATA_TYPE"]=="S")
49 {
50 $counter = $DB->IsNull("A.".$COUNTER_TYPE,"0")." + ".$DB->IsNull("A.".$COUNTER_TYPE."_BACK","0");
51 $where_counter = "and (".$counter.")>0";
52 }
53 }
54
55 foreach ($arFilter as $key => $val)
56 {
57 if(is_array($val))
58 {
59 if(count($val) <= 0)
60 continue;
61 }
62 else
63 {
64 if( ((string)$val == '') || ($val === "NOT_REF") )
65 continue;
66 }
67 $match_value_set = array_key_exists($key."_EXACT_MATCH", $arFilter);
68 $key = strtoupper($key);
69 switch($key)
70 {
71 case "PATH_ID":
72 $match = ($arFilter[$key."_EXACT_MATCH"]=="N" && $match_value_set) ? "Y" : "N";
73 $arSqlSearch[] = GetFilterQuery("P.PATH_ID", $val, $match);
74 break;
75 case "DATE1":
77 {
78 $arSqlSearch[] = "P.DATE_STAT >= ".$DB->CharToDateFunction($val, "SHORT");
79 if ($ADV_EXIST=="Y")
80 $arSqlSearch[] = "A.DATE_STAT >= ".$DB->CharToDateFunction($val, "SHORT");
81 }
82 break;
83 case "DATE2":
85 {
86 $arSqlSearch[] = "P.DATE_STAT < ".CStatistics::DBDateAdd($DB->CharToDateFunction($val, "SHORT"), 1);
87 if ($ADV_EXIST=="Y")
88 $arSqlSearch[] = "A.DATE_STAT < ".CStatistics::DBDateAdd($DB->CharToDateFunction($val, "SHORT"), 1);
89 }
90 break;
91 case "FIRST_PAGE":
92 case "LAST_PAGE":
93 $match = ($arFilter[$key."_EXACT_MATCH"]=="Y" && $match_value_set) ? "N" : "Y";
94 $arSqlSearch[] = GetFilterQuery("P.".$key,$val,$match,array("/","\\",".","?","#",":"));
95 break;
96 case "FIRST_PAGE_SITE_ID":
97 case "LAST_PAGE_SITE_ID":
98 $match = ($arFilter[$key."_EXACT_MATCH"]=="N" && $match_value_set) ? "Y" : "N";
99 $arSqlSearch[] = GetFilterQuery("P.".$key, $val, $match);
100 break;
101 case "FIRST_PAGE_404":
102 case "LAST_PAGE_404":
103 $arSqlSearch[] = ($val=="Y") ? "P.".$key."='Y'" : "P.".$key."='N'";
104 break;
105 case "PAGE":
106 $arSqlSearch[] = GetFilterQuery("P.PAGES", $val, "Y", array("/","\\",".","?","#",":"));
107 break;
108 case "PAGE_SITE_ID":
109 $arSqlSearch[] = GetFilterQuery("P.PAGES", "[".$val."]", "Y", array("[","]"));
110 break;
111 case "PAGE_404":
112 $arSqlSearch[] = ($val=="Y") ? "P.PAGES like '%ERROR_404:%'" : "P.PAGES not like '%ERROR_404:%'";
113 break;
114 case "ADV":
115 $match = ($arFilter[$key."_EXACT_MATCH"]=="N" && $match_value_set) ? "Y" : "N";
116 $arSqlSearch[] = GetFilterQuery("A.ADV_ID",$val,$match);
117 break;
118 case "STEPS1":
119 $arSqlSearch[] = "P.STEPS>='".intval($val)."'";
120 break;
121 case "STEPS2":
122 $arSqlSearch[] = "P.STEPS<='".intval($val)."'";
123 break;
124 }
125 }
126 }
127
128 if ($COUNTER_TYPE=="COUNTER")
129 {
130 $select1 = "P.LAST_PAGE, P.LAST_PAGE_404, P.LAST_PAGE_SITE_ID";
131 }
132 elseif($COUNTER_TYPE=="COUNTER_FULL_PATH")
133 {
134 $select1 = "P.PAGES";
135 }
136 else
137 {
138 $select1 = "";
139 }
140
141 $strSqlSearch = GetFilterSqlSearch($arSqlSearch);
142 if ($by == "s_last_page" && $COUNTER_TYPE=="COUNTER") $strSqlOrder = "ORDER BY P.LAST_PAGE";
143 elseif ($by == "s_pages" && $COUNTER_TYPE=="COUNTER_FULL_PATH") $strSqlOrder = "ORDER BY P.PAGES";
144 elseif ($by == "s_counter") $strSqlOrder = "ORDER BY COUNTER";
145 else
146 {
147 $strSqlOrder = "ORDER BY COUNTER desc, ".$select1;
148 }
149
150 if ($order != "asc")
151 {
152 $strSqlOrder .= " desc ";
153 }
154
155 $strSql = "
156 SELECT /*TOP*/
157 P.PATH_ID,
158 $select1,
159 sum($counter) as COUNTER
160 FROM
161 b_stat_path P
162 $from_adv
163 WHERE
164 $strSqlSearch
165 $where_parent
166 $where_adv
167 $where_counter
168 GROUP BY P.PATH_ID, $select1
169 $strSqlOrder
170 ";
171
172 $res = $DB->Query(CStatistics::DBTopSql($strSql));
173
174 return $res;
175 }
176
177 public static function GetByID($ID)
178 {
179 $DB = CDatabase::GetModuleConnection('statistic');
180 $strSql = "SELECT /*TOP*/ * FROM b_stat_path WHERE PATH_ID = '".$DB->ForSql($ID)."'";
181 return $DB->Query(CStatistics::DBTopSql($strSql, 1));
182 }
183}
Определения path.php:3
static GetList($PARENT_ID='', $COUNTER_TYPE='COUNTER_FULL_PATH', $by='s_counter', $order='desc', $arFilter=[])
Определения path.php:4
static GetByID($ID)
Определения path.php:177
static DBTopSql($strSql, $nTopCount=false)
Определения statistic.php:628
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$res
Определения filter_act.php:7
GetFilterSqlSearch($arSqlSearch=array(), $FilterLogic="FILTER_logic")
Определения filter_tools.php:397
GetFilterQuery($field, $val, $procent="Y", $ex_sep=array(), $clob="N", $div_fields="Y", $clob_upper="N")
Определения filter_tools.php:383
if($ajaxMode) $ID
Определения get_user.php:27
global $DB
Определения cron_frame.php:29
CheckDateTime($datetime, $format=false)
Определения tools.php:398
$order
Определения payment.php:8
$counter
Определения options.php:5
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
if(empty($signedUserToken)) $key
Определения quickway.php:257
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
Определения waybill.php:936
$val
Определения options.php:1793
$arFilter
Определения user_search.php:106