Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
socnetgroup.php
1
<?php
9
namespace
Bitrix\Main\UI\AccessRights\Entity
;
10
11
12
use
Bitrix\Main\Access\AccessCode
;
13
use
Bitrix\Main\Web\Uri
;
14
use
Bitrix\Socialnetwork\WorkgroupTable
;
15
16
class
SocnetGroup
extends
EntityBase
17
{
18
private
static
$modelsCache = [];
19
20
public
function
getType
(): string
21
{
22
return
AccessCode::TYPE_SOCNETGROUP;
23
}
24
25
public
function
getName
(): string
26
{
27
if
($this->model)
28
{
29
return
$this->model->getName();
30
}
31
return
''
;
32
}
33
34
public
function
getUrl
(): string
35
{
36
$groupUrlTemplate = \COption::GetOptionString(
"socialnetwork"
,
"group_path_template"
,
"/workgroups/group/#group_id#/"
, SITE_ID);
37
return
str_replace(array(
"#group_id#"
,
"#GROUP_ID#"
), $this->
getId
(), $groupUrlTemplate);
38
}
39
40
public
function
getAvatar
(
int
$width = 58,
int
$height = 58): ?string
41
{
42
if
($this->model)
43
{
44
$arFile = \CFile::GetFileArray($this->model->getImageId());
45
if
(is_array($arFile))
46
{
47
return
$arFile[
'SRC'
];
48
}
49
}
50
return
''
;
51
}
52
53
protected
function
loadModel
()
54
{
55
if
(!$this->model)
56
{
57
if
(array_key_exists($this->
id
, self::$modelsCache))
58
{
59
$this->model = self::$modelsCache[
$this->id
];
60
}
61
else
62
{
63
$this->model = WorkgroupTable::getList([
64
'select'
=> [
65
'ID'
,
66
'NAME'
,
67
'IMAGE_ID'
,
68
],
69
'filter'
=> [
70
'=ID'
=> $this->
id
,
71
],
72
'limit'
=> 1,
73
])->fetchObject();
74
75
self::$modelsCache[
$this->id
] =
$this->model
;
76
}
77
}
78
}
79
}
Bitrix\Main\Access\AccessCode
Definition
accesscode.php:13
Bitrix\Main\UI\AccessRights\Entity\EntityBase
Definition
entitybase.php:13
Bitrix\Main\UI\AccessRights\Entity\EntityBase\$model
$model
Definition
entitybase.php:15
Bitrix\Main\UI\AccessRights\Entity\EntityBase\getId
getId()
Definition
entitybase.php:23
Bitrix\Main\UI\AccessRights\Entity\EntityBase\$id
$id
Definition
entitybase.php:14
Bitrix\Main\UI\AccessRights\Entity\SocnetGroup
Definition
socnetgroup.php:17
Bitrix\Main\UI\AccessRights\Entity\SocnetGroup\getName
getName()
Definition
socnetgroup.php:25
Bitrix\Main\UI\AccessRights\Entity\SocnetGroup\loadModel
loadModel()
Definition
socnetgroup.php:53
Bitrix\Main\UI\AccessRights\Entity\SocnetGroup\getAvatar
getAvatar(int $width=58, int $height=58)
Definition
socnetgroup.php:40
Bitrix\Main\UI\AccessRights\Entity\SocnetGroup\getType
getType()
Definition
socnetgroup.php:20
Bitrix\Main\UI\AccessRights\Entity\SocnetGroup\getUrl
getUrl()
Definition
socnetgroup.php:34
Bitrix\Main\Web\Uri
Definition
uri.php:17
Bitrix\Socialnetwork\WorkgroupTable
Definition
workgroup.php:33
Bitrix\Main\UI\AccessRights\Entity
Definition
accessdirector.php:4
modules
main
lib
ui
accessrights
entity
socnetgroup.php
Создано системой
1.10.0