Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
timemanreport.php
1<?php
2
4
8
9Loc::loadMessages(__FILE__);
10
11final 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 {
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 {
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}
static loadMessages($file)
Definition loc.php:64
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29
Definition forumpost.php:22