Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
logfollow.php
1
<?php
8
namespace
Bitrix\Socialnetwork
;
9
10
use
Bitrix\Main
;
11
use
Bitrix\Main\Config\Option
;
12
use
Bitrix\Main\Entity
;
13
use
Bitrix\Main\Localization\Loc
;
14
use
Bitrix\Main\NotImplementedException
;
15
16
Loc::loadMessages
(__FILE__);
17
34
class
LogFollowTable
extends
Entity\DataManager
35
{
36
public
static
function
getTableName
()
37
{
38
return
'b_sonet_log_follow'
;
39
}
40
41
public
static
function
getMap
()
42
{
43
$fieldsMap = array(
44
'USER_ID'
=> array(
45
'data_type'
=>
'integer'
,
46
'primary'
=>
true
47
),
48
'CODE'
=> array(
49
'data_type'
=>
'string'
,
50
'primary'
=>
true
51
),
52
'TYPE'
=> array(
53
'data_type'
=>
'boolean'
,
54
'values'
=> array(
'N'
,
'Y'
)
55
),
56
);
57
58
return
$fieldsMap;
59
}
60
61
public
static
function
getDefaultValue
($params = array())
62
{
63
global $USER;
64
65
$siteId = (
66
isset($params[
'SITE_ID'
])
67
? $params[
'SITE_ID'
]
68
: SITE_ID
69
);
70
71
$defaultValue = Option::get(
"socialnetwork"
,
"follow_default_type"
,
"Y"
, $siteId);
72
73
$userId = (
74
isset($params[
'USER_ID'
])
75
? $params[
'USER_ID'
]
76
: ($USER->isAuthorized() ? $USER->getId() :
false
)
77
);
78
79
if
(intval($userId) <= 0)
80
{
81
return
$defaultValue;
82
}
83
84
$res = self::getList(array(
85
'filter'
=> array(
86
"USER_ID"
=> $userId,
87
"=CODE"
=>
"**"
88
),
89
'select'
=> array(
'TYPE'
)
90
)
91
);
92
if
($follow = $res->fetch())
93
{
94
$defaultValue = $follow[
'TYPE'
];
95
}
96
97
return
$defaultValue;
98
}
99
100
public
static
function
add
(array $data)
101
{
102
throw
new
NotImplementedException
(
"Use add() method of the class."
);
103
}
104
105
public
static
function
update
($primary, array $data)
106
{
107
throw
new
NotImplementedException
(
"Use update() method of the class."
);
108
}
109
}
Bitrix\Main\Config\Option
Definition
option.php:15
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\loadMessages
static loadMessages($file)
Definition
loc.php:64
Bitrix\Main\NotImplementedException
Definition
exception.php:147
Bitrix\Main\ORM\Entity
Definition
entity.php:26
Bitrix\Socialnetwork\LogFollowTable
Definition
logfollow.php:35
Bitrix\Socialnetwork\LogFollowTable\getMap
static getMap()
Definition
logfollow.php:41
Bitrix\Socialnetwork\LogFollowTable\getDefaultValue
static getDefaultValue($params=array())
Definition
logfollow.php:61
Bitrix\Socialnetwork\LogFollowTable\add
static add(array $data)
Definition
logfollow.php:100
Bitrix\Socialnetwork\LogFollowTable\update
static update($primary, array $data)
Definition
logfollow.php:105
Bitrix\Socialnetwork\LogFollowTable\getTableName
static getTableName()
Definition
logfollow.php:36
Bitrix\Main
Bitrix\Socialnetwork
modules
socialnetwork
lib
logfollow.php
Создано системой
1.10.0