Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
list.php
1
<?php
8
namespace
Bitrix\Sender
;
9
10
use
Bitrix\Main\Entity
;
11
use
Bitrix\Main\Localization\Loc
;
12
use
Bitrix\Main\Type
as
MainType
;
13
use
Bitrix\Main\DB\SqlExpression
;
14
15
Loc::loadMessages
(__FILE__);
16
33
class
ListTable
extends
Entity\DataManager
34
{
40
public
static
function
getTableName
()
41
{
42
return
'b_sender_list'
;
43
}
44
50
public
static
function
getMap
()
51
{
52
return
array(
53
'ID'
=> array(
54
'data_type'
=>
'integer'
,
55
'autocomplete'
=>
true
,
56
'primary'
=>
true
,
57
),
58
'CODE'
=> array(
59
'data_type'
=>
'string'
,
60
'validation'
=> array(__CLASS__,
'validateCode'
),
61
'title'
=>
Loc::getMessage
(
'SENDER_ENTITY_LIST_FIELD_TITLE_CODE'
),
62
),
63
'NAME'
=> array(
64
'data_type'
=>
'string'
,
65
'required'
=>
true
,
66
'default_value'
=>
Loc::getMessage
(
67
'SENDER_ENTITY_LIST_FIELD_NAME_PATTERN'
,
68
[
'%date%'
=> Internals\PrettyDate::formatDate()]
69
),
70
'title'
=>
Loc::getMessage
(
'SENDER_ENTITY_LIST_FIELD_TITLE_NAME'
),
71
),
72
'SORT'
=> array(
73
'data_type'
=>
'integer'
,
74
'default_value'
=> 100,
75
'required'
=>
true
,
76
'title'
=>
Loc::getMessage
(
'SENDER_ENTITY_LIST_FIELD_TITLE_SORT'
),
77
),
78
'CONTACT_LIST'
=> array(
79
'data_type'
=>
'Bitrix\Sender\ContactListTable'
,
80
'reference'
=> array(
'=this.ID'
=>
'ref.LIST_ID'
),
81
),
82
);
83
}
84
90
public
static
function
validateCode
()
91
{
92
return
array(
93
new
Entity
\
Validator
\Length(
null
, 60),
94
);
95
}
96
103
public
static
function
onAfterDelete
(
Entity
\
Event
$event)
104
{
105
$result =
new
Entity\EventResult
;
106
$data = $event->
getParameters
();
107
108
$primary = array(
'LIST_ID'
=> $data[
'primary'
][
'ID'
]);
109
ContactListTable::deleteList
($primary);
110
111
return
$result;
112
}
113
122
public
static
function
addIfNotExist
($code, $name)
123
{
124
$id =
false
;
125
if
( !($arList = static::getList(array(
'filter'
=> array(
'CODE'
=> $code)))->fetch() ))
126
{
127
$resultAdd = static::add(array(
'CODE'
=> $code,
'NAME'
=> $name));
128
if
($resultAdd->isSuccess())
129
{
130
$id = $resultAdd->getId();
131
}
132
}
133
else
134
{
135
$id = $arList[
'ID'
];
136
}
137
138
return
$id;
139
}
140
}
Bitrix\Main\Access\Entity\DataManager
Definition
datamanager.php:15
Bitrix\Main\Access\Event\EventResult
Definition
eventresult.php:13
Bitrix\Main\DB\SqlExpression
Definition
sqlexpression.php:19
Bitrix\Main\Event
Definition
event.php:5
Bitrix\Main\EventResult\getParameters
getParameters()
Definition
eventresult.php:44
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\ORM\Entity
Definition
entity.php:26
Bitrix\Sender\ContactListTable\deleteList
static deleteList(array $filter)
Definition
contactlist.php:105
Bitrix\Sender\ListTable
Definition
list.php:34
Bitrix\Sender\ListTable\addIfNotExist
static addIfNotExist($code, $name)
Definition
list.php:122
Bitrix\Sender\ListTable\getMap
static getMap()
Definition
list.php:50
Bitrix\Sender\ListTable\onAfterDelete
static onAfterDelete(Entity\Event $event)
Definition
list.php:103
Bitrix\Sender\ListTable\getTableName
static getTableName()
Definition
list.php:40
Bitrix\Sender\ListTable\validateCode
static validateCode()
Definition
list.php:90
Bitrix\Sender\Recipient\Validator
Definition
validator.php:19
Bitrix\Main\Type
Definition
collection.php:2
Bitrix\Sender
modules
sender
lib
list.php
Создано системой
1.10.0