Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
timemanreport.php
1
<?php
2
3
namespace
Bitrix\Socialnetwork\Livefeed
;
4
5
use
Bitrix\Main\Config\Option
;
6
use
Bitrix\Main\Loader
;
7
use
Bitrix\Main\Localization\Loc
;
8
9
Loc::loadMessages
(__FILE__);
10
11
final
class
TimemanReport
extends
Provider
12
{
13
public
const
PROVIDER_ID
=
'TIMEMAN_REPORT'
;
14
public
const
CONTENT_TYPE_ID
=
'TIMEMAN_REPORT'
;
15
16
public
static
function
getId
(): string
17
{
18
return
static::PROVIDER_ID;
19
}
20
21
public
function
getEventId
(): array
22
{
23
return
[
'report'
];
24
}
25
26
public
function
getType
(): string
27
{
28
return
Provider::TYPE_POST
;
29
}
30
31
public
function
getCommentProvider
():
Provider
32
{
33
return
new
ForumPost
();
34
}
35
36
public
function
initSourceFields
()
37
{
38
static
$cache = [];
39
40
$timemanReportId =
$this->entityId
;
41
42
if
($timemanReportId <= 0)
43
{
44
return
;
45
}
46
47
if
(isset($cache[$timemanReportId]))
48
{
49
$timemanReport = $cache[$timemanReportId];
50
}
51
elseif (Loader::includeModule(
'timeman'
))
52
{
53
$res = \CTimeManReportFull::getById($timemanReportId);
54
$timemanReport = $res->fetch();
55
$cache[$timemanReportId] = $timemanReport;
56
}
57
58
if
(!empty($timemanReport))
59
{
60
$this->
setSourceFields
($timemanReport);
61
62
$userName =
''
;
63
$res = \CUser::getById($timemanReport[
'USER_ID'
]);
64
if
($userFields = $res->fetch())
65
{
66
$userName = \CUser::formatName(
67
\CSite::getNameFormat(),
68
$userFields,
69
true
,
70
false
71
);
72
}
73
74
$this->
setSourceTitle
(
Loc::getMessage
(
'SONET_LIVEFEED_TIMEMAN_REPORT_TITLE'
, array(
75
'#USER_NAME#'
=> $userName,
76
'#DATE#'
=> FormatDate(
'j F'
, MakeTimeStamp($timemanReport[
'DATE_FROM'
])).
" - "
.FormatDate(
'j F'
, MakeTimeStamp($timemanReport[
'DATE_TO'
]))
77
)));
78
}
79
else
80
{
81
$this->
setSourceTitle
($this->
getUnavailableTitle
());
82
}
83
}
84
85
public
static
function
canRead
($params): bool
86
{
87
return
true
;
88
}
89
90
protected
function
getPermissions
(array $post): string
91
{
92
return
self::PERMISSION_READ
;
93
}
94
95
public
function
getLiveFeedUrl
(): string
96
{
97
$pathToLogEntry =
''
;
98
99
$logId
= $this->
getLogId
();
100
if
(
$logId
)
101
{
102
$pathToLogEntry = Option::get(
'socialnetwork'
,
'log_entry_page'
,
''
, $this->
getSiteId
());
103
if
(!empty($pathToLogEntry))
104
{
105
$pathToLogEntry = \CComponentEngine::makePathFromTemplate($pathToLogEntry, array(
"log_id"
=>
$logId
));
106
}
107
}
108
return
$pathToLogEntry;
109
}
110
}
Bitrix\Main\Config\Option
Definition
option.php:15
Bitrix\Main\Loader
Definition
loader.php:12
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\loadMessages
static loadMessages($file)
Definition
loc.php:64
Bitrix\Main\Localization\Loc\getMessage
static getMessage($code, $replace=null, $language=null)
Definition
loc.php:29
Bitrix\Socialnetwork\Livefeed\ForumPost
Definition
forumpost.php:22
Bitrix\Socialnetwork\Livefeed\Provider
Definition
provider.php:22
Bitrix\Socialnetwork\Livefeed\Provider\$logId
$logId
Definition
provider.php:54
Bitrix\Socialnetwork\Livefeed\Provider\setSourceFields
setSourceFields(array $fields)
Definition
provider.php:627
Bitrix\Socialnetwork\Livefeed\Provider\getUnavailableTitle
getUnavailableTitle()
Definition
provider.php:1472
Bitrix\Socialnetwork\Livefeed\Provider\setSourceTitle
setSourceTitle($title)
Definition
provider.php:665
Bitrix\Socialnetwork\Livefeed\Provider\getSiteId
getSiteId()
Definition
provider.php:94
Bitrix\Socialnetwork\Livefeed\Provider\PERMISSION_READ
const PERMISSION_READ
Definition
provider.php:47
Bitrix\Socialnetwork\Livefeed\Provider\TYPE_POST
const TYPE_POST
Definition
provider.php:25
Bitrix\Socialnetwork\Livefeed\Provider\$entityId
$entityId
Definition
provider.php:52
Bitrix\Socialnetwork\Livefeed\Provider\getLogId
getLogId($params=[])
Definition
provider.php:333
Bitrix\Socialnetwork\Livefeed\TimemanReport
Definition
timemanreport.php:12
Bitrix\Socialnetwork\Livefeed\TimemanReport\initSourceFields
initSourceFields()
Definition
timemanreport.php:36
Bitrix\Socialnetwork\Livefeed\TimemanReport\getCommentProvider
getCommentProvider()
Definition
timemanreport.php:31
Bitrix\Socialnetwork\Livefeed\TimemanReport\CONTENT_TYPE_ID
const CONTENT_TYPE_ID
Definition
timemanreport.php:14
Bitrix\Socialnetwork\Livefeed\TimemanReport\getPermissions
getPermissions(array $post)
Definition
timemanreport.php:90
Bitrix\Socialnetwork\Livefeed\TimemanReport\getType
getType()
Definition
timemanreport.php:26
Bitrix\Socialnetwork\Livefeed\TimemanReport\getLiveFeedUrl
getLiveFeedUrl()
Definition
timemanreport.php:95
Bitrix\Socialnetwork\Livefeed\TimemanReport\getEventId
getEventId()
Definition
timemanreport.php:21
Bitrix\Socialnetwork\Livefeed\TimemanReport\canRead
static canRead($params)
Definition
timemanreport.php:85
Bitrix\Socialnetwork\Livefeed\TimemanReport\getId
static getId()
Definition
timemanreport.php:16
Bitrix\Socialnetwork\Livefeed\TimemanReport\PROVIDER_ID
const PROVIDER_ID
Definition
timemanreport.php:13
Bitrix\Socialnetwork\Livefeed
Definition
bitrix24newuser.php:3
modules
socialnetwork
lib
livefeed
timemanreport.php
Создано системой
1.10.0