1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
Entity.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Im\V2\Chat\Collab;
4
5
use Bitrix\Im\V2\Common\ContextCustomer;
6
use Bitrix\Im\V2\Rest\RestConvertible;
7
use Bitrix\Main\Loader;
8
use Bitrix\Main\LoaderException;
9
use Bitrix\Socialnetwork\Collab\Link\LinkManager;
10
use Bitrix\Socialnetwork\Collab\Link\LinkParts;
11
use Bitrix\Socialnetwork\Collab\Link\LinkType;
12
13
abstract
class
Entity
implements
RestConvertible
14
{
15
use ContextCustomer;
16
17
protected
int
$groupId
;
18
protected
LinkManager
$linkManager
;
19
protected
LinkParts
$linkParts
;
20
24
public
function
__construct
(
int
$groupId
)
25
{
26
Loader::requireModule
(
'socialnetwork'
);
27
$this->groupId =
$groupId
;
28
$this->linkManager = LinkManager::getInstance();
29
$this->linkParts =
new
LinkParts
($this->getContext()->getUserId(),
$groupId
);
30
}
31
32
public
function
toRestFormat
(
array
$option
= []): ?
array
33
{
34
return
[
35
'counter'
=> $this->
getCounter
(),
36
'url'
=> $this->
getUrl
(),
37
];
38
}
39
40
public
function
getCounter
(): int
41
{
42
if
(!static::isAvailable())
43
{
44
return
0;
45
}
46
47
return
$this->
getCounterInternal
();
48
}
49
50
public
function
getUrl
(): string
51
{
52
if
(!static::isAvailable())
53
{
54
return
''
;
55
}
56
57
return
$this->
getUrlInternal
();
58
}
59
60
public
function
getUrlInternal
(): string
61
{
62
return
'/'
. $this->linkManager->get($this->
getLinkType
(), $this->linkParts);
63
}
64
65
abstract
protected
function
getLinkType
():
LinkType
;
66
67
abstract
public
function
getCounterInternal
(): int;
68
69
abstract
public
static
function
isAvailable
(): bool;
70
}
Bitrix\Im\V2\Chat\Collab\Entity\toRestFormat
toRestFormat(array $option=[])
Определения
Entity.php:32
Bitrix\Im\V2\Chat\Collab\Entity\$linkParts
LinkParts $linkParts
Определения
Entity.php:19
Bitrix\Im\V2\Chat\Collab\Entity\__construct
__construct(int $groupId)
Определения
Entity.php:24
Bitrix\Im\V2\Chat\Collab\Entity\getCounter
getCounter()
Определения
Entity.php:40
Bitrix\Im\V2\Chat\Collab\Entity\$linkManager
LinkManager $linkManager
Определения
Entity.php:18
Bitrix\Im\V2\Chat\Collab\Entity\isAvailable
static isAvailable()
Bitrix\Im\V2\Chat\Collab\Entity\$groupId
int $groupId
Определения
Entity.php:17
Bitrix\Im\V2\Chat\Collab\Entity\getUrlInternal
getUrlInternal()
Определения
Entity.php:60
Bitrix\Im\V2\Chat\Collab\Entity\getUrl
getUrl()
Определения
Entity.php:50
Bitrix\Im\V2\Chat\Collab\Entity\getCounterInternal
getCounterInternal()
Bitrix\Im\V2\Chat\Collab\Entity\getLinkType
getLinkType()
Bitrix\Main\Loader\requireModule
static requireModule($moduleName)
Определения
loader.php:174
Bitrix\Socialnetwork\Collab\Link\LinkManager
Определения
LinkManager.php:12
Bitrix\Socialnetwork\Collab\Link\LinkParts
Определения
LinkParts.php:8
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\Im\V2\Rest\RestConvertible
Определения
RestConvertible.php:6
Bitrix\Main\Entity
Определения
ufield.php:9
Bitrix\Socialnetwork\Collab\Link\LinkType
LinkType
Определения
LinkType.php:8
$option
$option
Определения
options.php:1711
bitrix
modules
im
lib
V2
Chat
Collab
Entity.php
Создано системой
1.14.0