1C-Bitrix
25.700.0
Toggle main menu visibility
Титульная страница
Пространства имен
Пространства имен
Члены пространств имен
Указатель
$
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
Функции
_
a
c
d
e
f
g
h
i
k
l
m
o
p
r
s
t
u
v
w
Переменные
$
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
v
w
Перечисления
a
b
c
d
e
f
g
l
m
n
o
p
r
s
t
u
v
w
Элементы перечислений
a
b
c
d
e
f
g
i
l
m
n
o
p
r
s
t
u
v
w
Структуры данных
Структуры данных
Алфавитный указатель структур данных
Иерархия классов
Поля структур
Указатель
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Функции
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Переменные
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Перечисления
Элементы перечислений
Файлы
Файлы
Список членов всех файлов
Указатель
$
(
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
y
б
в
к
л
о
п
с
т
ю
Функции
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Переменные
$
(
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
y
б
в
к
л
о
п
с
т
ю
Блог
Хостинг
•
Указатель
Структуры данных
Пространства имен
Файлы
Функции
Переменные
Перечисления
Элементы перечислений
Страницы
Загрузка...
Поиск...
Не найдено
background.php
См. документацию.
1
<?php
2
namespace
Bitrix\Landing\Hook\Page;
3
4
use Bitrix\Landing\Field;
5
use Bitrix\Landing\File;
6
use Bitrix\Landing\Manager;
7
use Bitrix\Landing\PublicAction;
8
use Bitrix\Main\Localization\Loc;
9
use Bitrix\Main\Page\Asset;
10
11
Loc::loadMessages(__FILE__);
12
13
class
Background
extends
\Bitrix\Landing\Hook\Page
14
{
19
protected
function
getMap
()
20
{
21
return
array
(
22
'USE'
=>
new
Field
\
Checkbox
(
'USE'
,
array
(
23
'title'
=> Loc::getMessage(
'LANDING_HOOK_BG_USE'
),
24
'help'
=> Loc::getMessage(
'LANDING_HOOK_BG_DESCRIPTION'
),
25
)),
26
'PICTURE'
=>
new
Field
\
Hidden
(
'PICTURE'
,
array
(
27
'title'
=> Loc::getMessage(
'LANDING_HOOK_BG_PICTURE'
),
28
'fetch_data_modification'
=>
function
($value)
29
{
30
if
(PublicAction::restApplication())
31
{
32
if
($value > 0)
33
{
34
$path
=
File::getFilePath
($value);
35
if
(
$path
)
36
{
37
$path
=
Manager::getUrlFromFile
(
$path
);
38
return
$path
;
39
}
40
}
41
}
42
return
$value;
43
}
44
)),
45
'POSITION'
=>
new
Field\Select
(
'POSITION'
,
array
(
46
'title'
=> Loc::getMessage(
'LANDING_HOOK_BG_POSITION'
),
47
'help'
=> Loc::getMessage(
'LANDING_HOOK_BG_POSITION_HELP_3'
),
48
'htmlHelp'
=>
true
,
49
'options'
=>
array
(
50
'center'
=> Loc::getMessage(
'LANDING_HOOK_BG_POSITION_CENTER_2'
),
51
'repeat'
=> Loc::getMessage(
'LANDING_HOOK_BG_POSITION_REPEAT_2'
),
52
'center_repeat_y'
=> Loc::getMessage(
'LANDING_HOOK_BG_POSITION_CENTER_REPEAT_Y'
),
53
'no_repeat'
=> Loc::getMessage(
'LANDING_HOOK_BG_POSITION_CENTER_NO_REPEAT'
),
54
)
55
)),
56
'COLOR'
=>
new
Field\Text
(
'COLOR'
,
array
(
57
'title'
=> Loc::getMessage(
'LANDING_HOOK_BG_COLOR'
)
58
)),
59
);
60
}
19
protected
function
getMap
() {
…
}
61
66
public
function
getTitle
()
67
{
68
return
Loc::getMessage(
'LANDING_HOOK_BG_NAME'
);
69
}
66
public
function
getTitle
() {
…
}
70
75
public
function
getDescription
(): string
76
{
77
return
Loc::getMessage(
'LANDING_HOOK_BG_DESCRIPTION'
);
78
}
75
public
function
getDescription
(): string {
…
}
79
84
public
function
enabled
()
85
{
86
if
($this->
issetCustomExec
())
87
{
88
return
true
;
89
}
90
91
return
$this->fields[
'USE'
]->getValue() ==
'Y'
;
92
}
84
public
function
enabled
() {
…
}
93
98
public
function
exec
()
99
{
100
if
($this->
execCustom
())
101
{
102
return
;
103
}
104
105
$picture =
\htmlspecialcharsbx
(trim($this->fields[
'PICTURE'
]->getValue()));
106
$color =
\htmlspecialcharsbx
(trim($this->fields[
'COLOR'
]->getValue()));
107
$position = trim($this->fields[
'POSITION'
]->getValue());
108
109
$this->
setBackground
($picture, $color, $position);
110
}
98
public
function
exec
() {
…
}
111
119
public
static
function
setBackground
(?
string
$picture, ?
string
$color =
null
, ?
string
$position =
null
): void
120
{
126
127
if
($picture && is_numeric($picture) && (
int
)$picture > 0)
128
{
129
$picture =
\htmlspecialcharsbx
(
130
File::getFilePath
((
int
)$picture)
131
);
132
}
133
134
if
($picture)
135
{
136
if
($position ===
'center'
)
137
{
138
Asset::getInstance()->addString(
139
'<style type="text/css">
140
body {
141
background-image: url("'
. $picture .
'");
142
background-attachment: fixed;
143
background-size: cover;
144
background-position: center;
145
background-repeat: no-repeat;
146
}
147
.bx-ios.bx-touch body:before {
148
content: "";
149
background-image: url("'
. $picture .
'");
150
background-position: center;
151
background-size: cover;
152
position: fixed;
153
left: 0;
154
right: 0;
155
top: 0;
156
bottom: 0;
157
z-index: -1;
158
}
159
.bx-ios.bx-touch body {
160
background-image: none;
161
}
162
</style>'
163
);
164
}
165
elseif
($position ===
'repeat'
)
166
{
167
Asset::getInstance()->addString(
168
'<style type="text/css">
169
body {
170
background-image: url("'
. $picture .
'");
171
background-attachment: fixed;
172
background-position: center;
173
background-repeat: repeat;
174
}
175
</style>'
176
);
177
}
178
elseif
($position ===
'no_repeat'
)
179
{
180
Asset::getInstance()->addString(
181
'<style type="text/css">
182
body {
183
background-image: url("'
. $picture .
'");
184
background-size: 100%;
185
background-attachment: fixed;
186
background-position: top center;
187
background-repeat: no-repeat;
188
}
189
</style>'
190
);
191
}
192
else
193
{
194
Asset::getInstance()->addString(
195
'<style type="text/css">
196
body {
197
background-image: url("'
. $picture .
'");
198
background-attachment: scroll;
199
background-position: top;
200
background-repeat: repeat-y;
201
background-size: 100%;
202
}
203
</style>'
204
);
205
}
206
}
207
208
if
($color)
209
{
210
Asset::getInstance()->addString(
211
'<style type="text/css">
212
body {
213
background-color: '
. $color .
'!important;
214
}
215
</style>'
216
);
217
}
218
}
119
public
static
function
setBackground
(?
string
$picture, ?
string
$color =
null
, ?
string
$position =
null
): void {
…
}
219
}
13
class
Background
extends
\Bitrix\Landing\Hook\Page
{
…
};
$path
$path
Определения
access_edit.php:21
Bitrix\Landing\Field\Checkbox
Определения
checkbox.php:5
Bitrix\Landing\Field\Hidden
Определения
hidden.php:5
Bitrix\Landing\Field\Select
Определения
select.php:9
Bitrix\Landing\Field\Text
Определения
text.php:5
Bitrix\Landing\File\getFilePath
static getFilePath($fileId)
Определения
file.php:600
Bitrix\Landing\Hook\Page\Background
Определения
background.php:14
Bitrix\Landing\Hook\Page\Background\getDescription
getDescription()
Определения
background.php:75
Bitrix\Landing\Hook\Page\Background\setBackground
static setBackground(?string $picture, ?string $color=null, ?string $position=null)
Определения
background.php:119
Bitrix\Landing\Hook\Page\Background\getMap
getMap()
Определения
background.php:19
Bitrix\Landing\Hook\Page\Background\getTitle
getTitle()
Определения
background.php:66
Bitrix\Landing\Hook\Page\Background\enabled
enabled()
Определения
background.php:84
Bitrix\Landing\Hook\Page\Background\exec
exec()
Определения
background.php:98
Bitrix\Landing\Hook\Page\issetCustomExec
issetCustomExec()
Определения
page.php:253
Bitrix\Landing\Hook\Page\execCustom
execCustom()
Определения
page.php:262
Bitrix\Landing\Manager\getUrlFromFile
static getUrlFromFile($file)
Определения
manager.php:1082
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
htmlspecialcharsbx
htmlspecialcharsbx($string, $flags=ENT_COMPAT, $doubleEncode=true)
Определения
tools.php:2701
Bitrix\Landing\Field
Определения
checkbox.php:2
Bitrix\Landing\Hook\Page
Определения
b24button.php:2
elseif
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения
prolog_main_admin.php:393
bitrix
modules
landing
lib
hook
page
background.php
Создано системой
1.14.0