Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
consentinstaller.php
1
<?php
2
3
namespace
Bitrix\Sender\Preset\Consent
;
4
5
6
use
Bitrix\Main\Localization\Loc
;
7
use
Bitrix\Main\UserConsent\Agreement
;
8
use
Bitrix\Main\UserConsent\Internals\AgreementTable
;
9
Loc::loadMessages
(__FILE__);
10
11
class
ConsentInstaller
12
{
13
public
static
function
run
(
string
$lang): string
14
{
15
self::createConsent(
'sender_approve_confirmation_'
, $lang);
16
17
return
''
;
18
}
19
20
private
static
function
createConsent(
string
$code,
string
$lang)
21
{
22
$preparedCode = $code.$lang;
23
$existed = AgreementTable::getList(array(
24
'select'
=> [
'ID'
],
25
'filter'
=> [
26
'=CODE'
=> $preparedCode,
27
'=LANGUAGE_ID'
=> $lang,
28
],
29
'limit'
=> 1
30
));
31
32
33
if
($existed->fetch())
34
{
35
return
''
;
36
}
37
38
$title =
Loc::getMessage
($code.
'title'
,
null
, $lang);
39
if
(!$title)
40
{
41
return
'\\Bitrix\\Sender\\Preset\\Consent\\ConsentInstaller::run(\''
.$lang.
'\'
)
';
42
}
43
44
AgreementTable::add(array(
45
"CODE" => $preparedCode,
46
"NAME" => $title,
47
"TYPE" => Agreement::TYPE_CUSTOM,
48
"LANGUAGE_ID" => $lang,
49
"AGREEMENT_TEXT" => Loc::getMessage($code . '
text
',null, $lang),
50
"LABEL_TEXT" => Loc::getMessage($code . '
label
', null, $lang),
51
));
52
}
53
}
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\loadMessages
static loadMessages($file)
Definition
loc.php:64
Bitrix\Main\Localization\Loc\getMessage
static getMessage($code, $replace=null, $language=null)
Definition
loc.php:29
Bitrix\Main\UserConsent\Agreement
Definition
agreement.php:25
Bitrix\Main\UserConsent\Internals\AgreementTable
Definition
agreement.php:36
Bitrix\Sender\Preset\Consent\ConsentInstaller
Definition
consentinstaller.php:12
Bitrix\Sender\Preset\Consent\ConsentInstaller\run
static run(string $lang)
Definition
consentinstaller.php:13
Bitrix\Sender\Preset\Consent
Definition
consentinstaller.php:3
modules
sender
lib
preset
consent
consentinstaller.php
Создано системой
1.10.0