1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
logsubscribe.php
См. документацию.
1
<?php
8
namespace
Bitrix\Socialnetwork;
9
10
use Bitrix\Main\Application;
11
use Bitrix\Main\Entity;
12
29
class
LogSubscribeTable
extends
Entity\DataManager
30
{
31
const
TYPE_COUNTER_COMMENT_PUSH
=
'CCP'
;
32
const
TTL
= 1209600;
//60*60*24*14
33
34
private
static
function
getTypes()
35
{
36
return
array
(
37
self::TYPE_COUNTER_COMMENT_PUSH
38
);
39
}
40
41
public
static
function
getTableName
()
42
{
43
return
'b_sonet_log_subscribe'
;
44
}
45
46
public
static
function
getMap
()
47
{
48
$fieldsMap =
array
(
49
'USER_ID'
=>
array
(
50
'data_type'
=>
'integer'
,
51
'primary'
=>
true
52
),
53
'LOG_ID'
=>
array
(
54
'data_type'
=>
'integer'
,
55
'primary'
=>
true
56
),
57
'TYPE'
=>
array
(
58
'data_type'
=>
'string'
,
59
'primary'
=>
true
60
),
61
'END_DATE'
=>
array
(
62
'data_type'
=>
'datetime'
,
63
),
64
);
65
66
return
$fieldsMap;
67
}
68
69
public
static
function
set
(
$params
=
array
())
70
{
71
$userId
= (isset(
$params
[
'userId'
]) ? intval(
$params
[
'userId'
]) : 0);
72
$logId = (isset(
$params
[
'logId'
]) ? intval(
$params
[
'logId'
]) : 0);
73
$type
= (isset(
$params
[
'type'
]) ?
$params
[
'type'
] :
''
);
74
75
if
(
76
$userId
<= 0
77
|| $logId <= 0
78
)
79
{
80
return
false
;
81
}
82
83
if
(is_array(
$type
))
84
{
85
$typeList =
$type
;
86
foreach
($typeList as
$type
)
87
{
88
$params
[
'type'
] =
$type
;
89
self::set
(
$params
);
90
}
91
return
true
;
92
}
93
94
if
(!in_array(
$type
, self::getTypes()))
95
{
96
return
false
;
97
}
98
99
$connection
= Application::getConnection();
100
$helper =
$connection
->getSqlHelper();
101
102
$insertFields =
array
(
103
"USER_ID"
=>
$userId
,
104
"LOG_ID"
=> $logId,
105
"TYPE"
=> $helper->forSql(
$type
),
106
);
107
108
$updateFields =
array
(
109
);
110
111
if
(
112
isset(
$params
[
'endDate'
])
113
&&
$params
[
'endDate'
] instanceof \
Bitrix
\
Main
\
Type
\
DateTime
114
)
115
{
116
$insertFields[
"END_DATE"
] =
$params
[
'endDate'
];
117
$updateFields[
"END_DATE"
] =
$params
[
'endDate'
];
118
}
119
elseif
(!empty(
$params
[
'ttl'
]))
120
{
121
$endDate =
\Bitrix\Main\Type\DateTime::createFromTimestamp
(time() + self::TTL);
122
$insertFields[
"END_DATE"
] = $endDate;
123
$updateFields[
"END_DATE"
] = $endDate;
124
}
125
else
126
{
127
$updateFields[
"END_DATE"
] =
false
;
128
}
129
130
$merge = $helper->prepareMerge(
131
static::getTableName(),
132
array
(
"USER_ID"
,
"LOG_ID"
,
"TYPE"
),
133
$insertFields,
134
$updateFields
135
);
136
137
if
($merge[0] !=
""
)
138
{
139
$connection
->query($merge[0]);
140
}
141
142
return
true
;
143
}
144
}
$connection
$connection
Определения
actionsdefinitions.php:38
$type
$type
Определения
options.php:106
$userId
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения
check_mail.php:18
Bitrix\Main\Type\DateTime
Определения
datetime.php:9
Bitrix\Main\Type\DateTime\createFromTimestamp
static createFromTimestamp($timestamp)
Определения
datetime.php:246
Bitrix\Socialnetwork\LogSubscribeTable
Определения
logsubscribe.php:30
Bitrix\Socialnetwork\LogSubscribeTable\set
static set($params=array())
Определения
logsubscribe.php:69
Bitrix\Socialnetwork\LogSubscribeTable\TYPE_COUNTER_COMMENT_PUSH
const TYPE_COUNTER_COMMENT_PUSH
Определения
logsubscribe.php:31
Bitrix\Socialnetwork\LogSubscribeTable\getMap
static getMap()
Определения
logsubscribe.php:46
Bitrix\Socialnetwork\LogSubscribeTable\TTL
const TTL
Определения
logsubscribe.php:32
Bitrix\Socialnetwork\LogSubscribeTable\getTableName
static getTableName()
Определения
logsubscribe.php:41
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
Bitrix\Main\Type
Определения
collection.php:2
Bitrix\Main
Bitrix
elseif
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения
prolog_main_admin.php:393
$params
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения
template.php:799
bitrix
modules
socialnetwork
lib
logsubscribe.php
Создано системой
1.14.0