1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
syspage.php
См. документацию.
1
<?php
2
namespace
Bitrix\Landing;
3
4
use \Bitrix\Landing\Internals\SyspageTable;
5
6
class
Syspage
7
{
12
protected
static
$allowedTypes
=
array
(
13
'mainpage'
,
14
'catalog'
,
15
'personal'
,
16
'cart'
,
17
'order'
,
18
'payment'
,
19
'compare'
,
20
'feedback'
,
21
);
22
30
public
static
function
set
($id,
$type
, $lid =
false
)
31
{
32
if
(!is_string(
$type
))
33
{
34
return
;
35
}
36
37
$id = intval($id);
38
$type
= trim(
$type
);
39
40
if
(!in_array(
$type
, self::$allowedTypes))
41
{
42
return
;
43
}
44
45
if
(!
Rights::hasAccessForSite
($id,
Rights::ACCESS_TYPES
[
'sett'
]))
46
{
47
return
;
48
}
49
50
$res
= SyspageTable::getList(
array
(
51
'select'
=>
array
(
52
'ID'
53
),
54
'filter'
=>
array
(
55
'SITE_ID'
=> $id,
56
'=TYPE'
=>
$type
57
)
58
));
59
if
($row =
$res
->fetch())
60
{
61
if
($lid ===
false
)
62
{
63
SyspageTable::delete($row[
'ID'
]);
64
}
65
else
66
{
67
SyspageTable::update($row[
'ID'
],
array
(
68
'LANDING_ID'
=> (
int
)$lid
69
));
70
}
71
}
72
else
if
($lid !==
false
)
73
{
74
$check =
Site::getList
([
75
'select'
=> [
76
'ID'
77
],
78
'filter'
=> [
79
'ID'
=> $id
80
]
81
])->fetch();
82
if
($check)
83
{
84
SyspageTable::add(
array
(
85
'SITE_ID'
=> $id,
86
'TYPE'
=>
$type
,
87
'LANDING_ID'
=> (
int
)$lid
88
));
89
}
90
}
91
}
92
100
public
static
function
get
(
int
$id,
bool
$active =
false
,
bool
$force =
false
):
array
101
{
102
static
$types =
array
();
103
$id = intval($id);
104
105
// check items for un active elements
106
$removeHidden =
function
(
array
$items
) use($active)
107
{
108
if
(!$active)
109
{
110
return
$items
;
111
}
112
foreach
(
$items
as
$k
=> $item)
113
{
114
if
(
115
$item[
'DELETED'
] ==
'Y'
||
116
$item[
'ACTIVE'
] ==
'N'
117
)
118
{
119
unset(
$items
[
$k
]);
120
}
121
}
122
return
$items
;
123
};
124
125
if
(
126
!$force
127
&& isset($types[$id])
128
&&
count
($types[$id]) > 0
129
)
130
{
131
return
$removeHidden($types[$id]);
132
}
133
134
$types[$id] =
array
();
135
136
$res
= SyspageTable::getList(
array
(
137
'select'
=>
array
(
138
'TYPE'
,
139
'LANDING_ID'
,
140
'TITLE'
=>
'LANDING.TITLE'
,
141
'DELETED'
=>
'LANDING.DELETED'
,
142
'ACTIVE'
=>
'LANDING.ACTIVE'
143
),
144
'filter'
=>
array
(
145
'SITE_ID'
=> $id
146
),
147
'runtime'
=>
array
(
148
new
\
Bitrix
\
Main
\
Entity
\ReferenceField(
149
'LANDING'
,
150
'\Bitrix\Landing\Internals\LandingTable'
,
151
array
(
'=this.LANDING_ID'
=>
'ref.ID'
)
152
)
153
)
154
));
155
while
($row =
$res
->fetch())
156
{
157
$types[$id][$row[
'TYPE'
]] = $row;
158
}
159
160
// event for external changes
161
$event
= new \Bitrix\Main\Event(
'landing'
,
'onLandingSyspageRetrieve'
, [
162
'types'
=> $types
163
]);
164
$event
->send();
165
foreach
(
$event
->getResults() as
$result
)
166
{
167
$params
=
$result
->getParameters();
168
if
(is_array(
$params
))
169
{
170
$types =
$params
;
171
}
172
}
173
174
return
$removeHidden($types[$id]);
175
}
176
182
public
static
function
deleteForSite
($id)
183
{
184
$id = intval($id);
185
$res
= SyspageTable::getList(
array
(
186
'filter'
=>
array
(
187
'SITE_ID'
=> $id
188
)
189
));
190
while
($row =
$res
->fetch())
191
{
192
SyspageTable::delete($row[
'ID'
]);
193
}
194
}
195
201
public
static
function
deleteForLanding
($id)
202
{
203
$id = intval($id);
204
$res
= SyspageTable::getList(
array
(
205
'filter'
=>
array
(
206
'LANDING_ID'
=> $id
207
)
208
));
209
while
($row =
$res
->fetch())
210
{
211
SyspageTable::delete($row[
'ID'
]);
212
}
213
}
214
223
public
static
function
getSpecialPage
(
$siteId
,
$type
,
array
$additional = [])
224
{
225
$url
=
''
;
226
$siteId
= (int)
$siteId
;
227
228
if
(!is_string(
$type
))
229
{
230
return
$url
;
231
}
232
233
$res
= SyspageTable::getList([
234
'select'
=> [
235
'LANDING_ID'
236
],
237
'filter'
=> [
238
'SITE_ID'
=>
$siteId
,
239
'=TYPE'
=>
$type
240
]
241
]);
242
if
($row =
$res
->fetch())
243
{
244
$landing = Landing::createInstance(0);
245
$url
= $landing->getPublicUrl($row[
'LANDING_ID'
]);
246
if
($additional)
247
{
248
$uri
= new \Bitrix\Main\Web\Uri(
$url
);
249
$uri
->addParams($additional);
250
$url
=
$uri
->getUri();
251
unset(
$uri
);
252
}
253
}
254
unset($row,
$res
);
255
256
return
$url
;
257
}
258
}
$type
$type
Определения
options.php:106
Bitrix\Landing\PublicAction\Site\getList
static getList(array $params=[], $initiator=null)
Определения
site.php:99
Bitrix\Landing\PublicAction\Syspage
Определения
syspage.php:12
Bitrix\Landing\Rights\ACCESS_TYPES
const ACCESS_TYPES
Определения
rights.php:21
Bitrix\Landing\Rights\hasAccessForSite
static hasAccessForSite($siteId, $accessType, $deleted=false)
Определения
rights.php:546
Bitrix\Landing\Syspage\deleteForSite
static deleteForSite($id)
Определения
syspage.php:182
Bitrix\Landing\Syspage\getSpecialPage
static getSpecialPage($siteId, $type, array $additional=[])
Определения
syspage.php:223
Bitrix\Landing\Syspage\$allowedTypes
static $allowedTypes
Определения
syspage.php:12
Bitrix\Landing\Syspage\deleteForLanding
static deleteForLanding($id)
Определения
syspage.php:201
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$res
$res
Определения
filter_act.php:7
$result
$result
Определения
get_property_values.php:14
$uri
if(file_exists($_SERVER['DOCUMENT_ROOT'] . "/urlrewrite.php")) $uri
Определения
urlrewrite.php:61
$siteId
$siteId
Определения
ajax.php:8
Bitrix\Main\Entity
Определения
ufield.php:9
Bitrix\Main
Bitrix
$event
$event
Определения
prolog_after.php:141
count
</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
$params
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения
template.php:799
$items
$items
Определения
template.php:224
$k
$k
Определения
template_pdf.php:567
$url
$url
Определения
iframe.php:7
bitrix
modules
landing
lib
syspage.php
Создано системой
1.14.0