Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
urlrewrite.php
1
<?php
2
namespace
Bitrix\Landing\Internals
;
3
4
use \Bitrix\Main\Localization\Loc;
5
use \Bitrix\Main\Entity;
6
use \Bitrix\Landing\Manager;
7
8
Loc::loadMessages
(__FILE__);
9
26
class
UrlRewriteTable
extends
Entity\DataManager
27
{
32
public
static
function
getTableName
()
33
{
34
return
'b_landing_urlrewrite'
;
35
}
36
41
public
static
function
getMap
()
42
{
43
return
array(
44
'ID'
=>
new
Entity
\
IntegerField
(
'ID'
, array(
45
'primary'
=>
true
,
46
'autocomplete'
=>
true
,
47
'title'
=>
'ID'
48
)),
49
'SITE_ID'
=>
new
Entity
\
IntegerField
(
'SITE_ID'
, array(
50
'title'
=>
Loc::getMessage
(
'LANDING_TABLE_FIELD_SITE_ID'
),
51
'required'
=>
true
52
)),
53
'RULE'
=>
new
Entity
\
StringField
(
'RULE'
, array(
54
'title'
=>
Loc::getMessage
(
'LANDING_TABLE_FIELD_RULE'
),
55
'required'
=>
true
56
)),
57
'LANDING_ID'
=>
new
Entity
\
IntegerField
(
'LANDING_ID'
, array(
58
'title'
=>
Loc::getMessage
(
'LANDING_TABLE_FIELD_LANDING_ID'
),
59
'required'
=>
true
60
)),
61
'CREATED_BY_ID'
=>
new
Entity
\
IntegerField
(
'CREATED_BY_ID'
, array(
62
'title'
=>
Loc::getMessage
(
'LANDING_TABLE_FIELD_CREATED_BY_ID'
),
63
'required'
=>
true
64
)),
65
'MODIFIED_BY_ID'
=>
new
Entity
\
IntegerField
(
'MODIFIED_BY_ID'
, array(
66
'title'
=>
Loc::getMessage
(
'LANDING_TABLE_FIELD_MODIFIED_BY_ID'
),
67
'required'
=>
true
68
)),
69
'DATE_CREATE'
=>
new
Entity
\
DatetimeField
(
'DATE_CREATE'
, array(
70
'title'
=>
Loc::getMessage
(
'LANDING_TABLE_FIELD_DATE_CREATE'
),
71
'required'
=>
true
72
)),
73
'DATE_MODIFY'
=>
new
Entity
\
DatetimeField
(
'DATE_MODIFY'
, array(
74
'title'
=>
Loc::getMessage
(
'LANDING_TABLE_FIELD_DATE_MODIFY'
),
75
'required'
=>
true
76
))
77
);
78
}
79
85
public
static
function
add
(array $fields)
86
{
87
$uid =
Manager::getUserId
();
88
$uid = $uid ? $uid : 1;
89
$date = new \Bitrix\Main\Type\DateTime;
90
91
if
(!isset($fields[
'CREATED_BY_ID'
]))
92
{
93
$fields[
'CREATED_BY_ID'
] = $uid;
94
}
95
if
(!isset($fields[
'MODIFIED_BY_ID'
]))
96
{
97
$fields[
'MODIFIED_BY_ID'
] = $uid;
98
}
99
if
(!isset($fields[
'DATE_CREATE'
]))
100
{
101
$fields[
'DATE_CREATE'
] = $date;
102
}
103
if
(!isset($fields[
'DATE_MODIFY'
]))
104
{
105
$fields[
'DATE_MODIFY'
] = $date;
106
}
107
108
return
parent::add($fields);
109
}
110
117
public
static
function
update
($id, array $fields = array())
118
{
119
$uid =
Manager::getUserId
();
120
$date = new \Bitrix\Main\Type\DateTime;
121
122
if
(!isset($fields[
'MODIFIED_BY_ID'
]))
123
{
124
$fields[
'MODIFIED_BY_ID'
] = $uid;
125
}
126
if
(!isset($fields[
'DATE_MODIFY'
]))
127
{
128
$fields[
'DATE_MODIFY'
] = $date;
129
}
130
if
(!$fields[
'DATE_MODIFY'
])
131
{
132
unset($fields[
'DATE_MODIFY'
]);
133
}
134
135
return
parent::update($id, $fields);
136
}
137
}
Bitrix\Landing\Internals\UrlRewriteTable
Definition
urlrewrite.php:27
Bitrix\Landing\Internals\UrlRewriteTable\getMap
static getMap()
Definition
urlrewrite.php:41
Bitrix\Landing\Internals\UrlRewriteTable\update
static update($id, array $fields=array())
Definition
urlrewrite.php:117
Bitrix\Landing\Internals\UrlRewriteTable\add
static add(array $fields)
Definition
urlrewrite.php:85
Bitrix\Landing\Internals\UrlRewriteTable\getTableName
static getTableName()
Definition
urlrewrite.php:32
Bitrix\Landing\Manager\getUserId
static getUserId()
Definition
manager.php:107
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\Main\ORM\Fields\DatetimeField
Definition
datetimefield.php:22
Bitrix\Main\ORM\Fields\IntegerField
Definition
integerfield.php:20
Bitrix\Main\ORM\Fields\StringField
Definition
stringfield.php:20
Bitrix\Landing\Internals
Definition
base.php:2
modules
landing
lib
internals
urlrewrite.php
Создано системой
1.10.0