Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
logright.php
1
<?php
8
namespace
Bitrix\Socialnetwork
;
9
10
use
Bitrix\Main\Entity
;
11
use
Bitrix\Main\DB\SqlExpression
;
12
use
Bitrix\Main\Application
;
13
30
class
LogRightTable
extends
Entity\DataManager
31
{
32
public
static
function
getTableName
()
33
{
34
return
'b_sonet_log_right'
;
35
}
36
37
public
static
function
getMap
()
38
{
39
$fieldsMap = array(
40
'ID'
=> array(
41
'data_type'
=>
'integer'
,
42
'primary'
=>
true
,
43
'autocomplete'
=>
true
,
44
),
45
'LOG_ID'
=> array(
46
'data_type'
=>
'integer'
,
47
'primary'
=>
true
48
),
49
'LOG'
=> array(
50
'data_type'
=>
'\Bitrix\Socialnetwork\Log'
,
51
'reference'
=> array(
'=this.LOG_ID'
=>
'ref.ID'
)
52
),
53
'GROUP_CODE'
=> array(
54
'data_type'
=>
'string'
,
55
),
56
'LOG_UPDATE'
=> array(
57
'data_type'
=>
'datetime'
58
)
59
);
60
61
return
$fieldsMap;
62
}
63
64
public
static
function
setLogUpdate
($params = array())
65
{
66
$logId = (isset($params[
'logId'
]) ? intval($params[
'logId'
]) : 0);
67
$value = (!empty($params[
'value'
]) ? $params[
'value'
] :
false
);
68
69
if
($logId <= 0)
70
{
71
return
false
;
72
}
73
74
$connection =
Application::getConnection
();
75
$helper = $connection->getSqlHelper();
76
77
$now = $helper->getCurrentDateTimeFunction();
78
if
(
79
!$value
80
|| mb_strtolower($value) == mb_strtolower($now)
81
)
82
{
83
$value =
new
SqlExpression
($now);
84
}
85
86
$updateFields = array(
87
"LOG_UPDATE"
=> $value,
88
);
89
90
$tableName =
self::getTableName
();
91
list($prefix, $values) = $helper->prepareUpdate($tableName, $updateFields);
92
$connection->queryExecute(
"UPDATE {$tableName} SET {$prefix} WHERE LOG_ID = "
.$logId);
93
94
return
true
;
95
}
96
97
public
static
function
deleteByGroupCode
($value =
''
)
98
{
99
if
($value ==
''
)
100
{
101
return
false
;
102
}
103
104
$connection =
Application::getConnection
();
105
$helper = $connection->getSqlHelper();
106
107
$tableName =
self::getTableName
();
108
$connection->queryExecute(
"DELETE FROM {$tableName} WHERE GROUP_CODE = '"
.$helper->forSql($value).
"'"
);
109
110
return
true
;
111
}
112
}
Bitrix\Main\Application
Definition
application.php:28
Bitrix\Main\Application\getConnection
static getConnection($name="")
Definition
application.php:611
Bitrix\Main\DB\SqlExpression
Definition
sqlexpression.php:19
Bitrix\Main\ORM\Entity
Definition
entity.php:26
Bitrix\Socialnetwork\LogRightTable
Definition
logright.php:31
Bitrix\Socialnetwork\LogRightTable\getMap
static getMap()
Definition
logright.php:37
Bitrix\Socialnetwork\LogRightTable\setLogUpdate
static setLogUpdate($params=array())
Definition
logright.php:64
Bitrix\Socialnetwork\LogRightTable\deleteByGroupCode
static deleteByGroupCode($value='')
Definition
logright.php:97
Bitrix\Socialnetwork\LogRightTable\getTableName
static getTableName()
Definition
logright.php:32
Bitrix\Socialnetwork
modules
socialnetwork
lib
logright.php
Создано системой
1.10.0