- Модуль: timeman
- Путь к файлу: ~/bitrix/modules/timeman/classes/general/timeman.php
- Класс: _CTimeManCalendarNew
- Вызов: _CTimeManCalendarNew::Get
public function Get($arParams)
{
global $USER;
$arEvents = CCalendarEvent::GetList(
[
'arFilter' => [
"ID" => $arParams['ID'],
"DELETED" => "N",
],
'parseRecursion' => true,
'fetchAttendees' => true,
'checkPermissions' => true,
]
);
if (is_array($arEvents) && count($arEvents) > 0)
{
$arEvent = $arEvents[0];
if ($arEvent['IS_MEETING'])
{
$arEvent['GUESTS'] = [];
if (is_array($arEvent['ATTENDEE_LIST']))
{
$userIndex = CCalendarEvent::getUserIndex();
foreach ($arEvent['ATTENDEE_LIST'] as $attendee)
{
if (isset($userIndex[$attendee["id"]]))
{
$arEvent['GUESTS'][] = [
'id' => $attendee['id'],
'name' => $userIndex[$attendee["id"]]['DISPLAY_NAME'],
'status' => $attendee['status'],
'accessibility' => $arEvent['ACCESSIBILITY'],
'bHost' => $attendee['id'] == $arEvent['MEETING_HOST'],
];
if ($attendee['id'] == $USER->GetID())
{
$arEvent['STATUS'] = $attendee['status'];
}
}
}
}
elseif (is_array($arEvent['~ATTENDEES']))
{
foreach ($arEvent['~ATTENDEES'] as $guest)
{
$arEvent['GUESTS'][] = [
'id' => $guest['USER_ID'],
'name' => CUser::FormatName(CSite::GetNameFormat(false), $guest, true),
'status' => $guest['STATUS'],
'accessibility' => $guest['ACCESSIBILITY'],
'bHost' => $guest['USER_ID'] == $arEvent['MEETING_HOST'],
];
if ($guest['USER_ID'] == $USER->GetID())
{
$arEvent['STATUS'] = $guest['STATUS'];
}
}
}
}
$set = CCalendar::GetSettings();
$url = str_replace(
'#user_id#', $arEvent['CREATED_BY'], $set['path_to_user_calendar']
) . '?EVENT_ID=' . $arEvent['ID'];
return [
'ID' => $arEvent['ID'],
'NAME' => $arEvent['NAME'],
'DETAIL_TEXT' => $arEvent['DESCRIPTION'],
'DATE_FROM' => $arEvent['DATE_FROM'],
'DATE_TO' => $arEvent['DATE_TO'],
'ACCESSIBILITY' => $arEvent['ACCESSIBILITY'],
'IMPORTANCE' => $arEvent['IMPORTANCE'],
'STATUS' => $arEvent['STATUS'],
'IS_MEETING' => $arEvent['IS_MEETING'] ? 'Y' : 'N',
'GUESTS' => $arEvent['GUESTS'],
'URL' => $url,
];
}
}