1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
workgroupfavorites.php
См. документацию.
1
<?php
8
namespace
Bitrix\Socialnetwork;
9
10
use Bitrix\Main;
11
use Bitrix\Main\Entity;
12
use Bitrix\Main\NotImplementedException;
13
41
class
WorkgroupFavoritesTable
extends
Entity\DataManager
42
{
43
public
static
function
getTableName
()
44
{
45
return
'b_sonet_group_favorites'
;
46
}
47
52
public
static
function
getMap
()
53
{
54
$fieldsMap =
array
(
55
'USER_ID'
=>
array
(
56
'data_type'
=>
'integer'
,
57
'primary'
=>
true
58
),
59
'USER'
=>
array
(
60
'data_type'
=>
'\Bitrix\Main\User'
,
61
'reference'
=>
array
(
'=this.USER_ID'
=>
'ref.ID'
)
62
),
63
'GROUP_ID'
=>
array
(
64
'data_type'
=>
'integer'
,
65
'primary'
=>
true
66
),
67
'GROUP'
=>
array
(
68
'data_type'
=>
'\Bitrix\Socialnetwork\Workgroup'
,
69
'reference'
=>
array
(
'=this.GROUP_ID'
=>
'ref.ID'
)
70
),
71
'DATE_ADD'
=>
array
(
72
'data_type'
=>
'datetime'
73
),
74
);
75
76
return
$fieldsMap;
77
}
78
85
public
static
function
set
(
$params
=
array
())
86
{
87
global
$USER
,
$CACHE_MANAGER
;
88
$res
=
false
;
89
90
if
(
91
!is_array(
$params
)
92
|| !isset(
$params
[
'GROUP_ID'
])
93
|| intval(
$params
[
'GROUP_ID'
]) <= 0
94
)
95
{
96
throw
new
Main\SystemException
(
"Empty groupId."
);
97
}
98
99
$groupId = intval(
$params
[
'GROUP_ID'
]);
100
101
$userId
= (
102
isset(
$params
[
'USER_ID'
])
103
&& intval(
$params
[
'USER_ID'
]) > 0
104
? intval(
$params
[
'USER_ID'
])
105
:
$USER
->getId()
106
);
107
108
if
(intval(
$userId
) <= 0)
109
{
110
throw
new
Main\SystemException
(
"Empty userId."
);
111
}
112
113
$connection
=
\Bitrix\Main\Application::getConnection
();
114
$helper =
$connection
->getSqlHelper();
115
116
$insertFields =
array
(
117
"USER_ID"
=>
$userId
,
118
"GROUP_ID"
=> $groupId,
119
"DATE_ADD"
=>
new
\
Bitrix
\
Main
\
DB
\
SqlExpression
($helper->getCurrentDateTimeFunction()),
120
);
121
122
$updateFields =
array
(
123
"DATE_ADD"
=>
new
\
Bitrix
\
Main
\
DB
\
SqlExpression
($helper->getCurrentDateTimeFunction()),
124
);
125
126
$merge = $helper->prepareMerge(
127
static::getTableName(),
128
array
(
"USER_ID"
,
"GROUP_ID"
),
129
$insertFields,
130
$updateFields
131
);
132
133
if
($merge[0] !=
""
)
134
{
135
$res
=
$connection
->query($merge[0]);
136
}
137
138
if
(
139
$res
140
&& defined(
"BX_COMP_MANAGED_CACHE"
)
141
)
142
{
143
$CACHE_MANAGER
->clearByTag(
"sonet_group_favorites_U"
.
$userId
);
144
}
145
146
return
$res
;
147
}
148
149
public
static
function
add
(
array
$data
)
150
{
151
throw
new
NotImplementedException
(
"Use set() method of the class."
);
152
}
153
154
public
static
function
update
($primary,
array
$data
)
155
{
156
throw
new
NotImplementedException
(
"Use set() method of the class."
);
157
}
158
}
$connection
$connection
Определения
actionsdefinitions.php:38
$userId
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения
check_mail.php:18
Bitrix\Main\Application\getConnection
static getConnection($name="")
Определения
application.php:638
Bitrix\Main\DB\SqlExpression
Определения
sqlexpression.php:21
Bitrix\Main\NotImplementedException
Определения
NotImplementedException.php:9
Bitrix\Main\SystemException
Определения
SystemException.php:9
Bitrix\Socialnetwork\WorkgroupFavoritesTable
Определения
workgroupfavorites.php:42
Bitrix\Socialnetwork\WorkgroupFavoritesTable\getMap
static getMap()
Определения
workgroupfavorites.php:52
Bitrix\Socialnetwork\WorkgroupFavoritesTable\add
static add(array $data)
Определения
workgroupfavorites.php:149
Bitrix\Socialnetwork\WorkgroupFavoritesTable\update
static update($primary, array $data)
Определения
workgroupfavorites.php:154
Bitrix\Socialnetwork\WorkgroupFavoritesTable\getTableName
static getTableName()
Определения
workgroupfavorites.php:43
$CACHE_MANAGER
global $CACHE_MANAGER
Определения
clear_component_cache.php:7
$data
$data['IS_AVAILABLE']
Определения
.description.php:13
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$res
$res
Определения
filter_act.php:7
$USER
global $USER
Определения
csv_new_run.php:40
Bitrix\Main\DB
Определения
arrayresult.php:2
Bitrix\Main
Bitrix
$params
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения
template.php:799
bitrix
modules
socialnetwork
lib
workgroupfavorites.php
Создано системой
1.14.0