- Модуль: calendar
- Путь к файлу: ~/bitrix/modules/calendar/classes/general/calendar_event.php
- Класс: CCalendarEvent
- Вызов: CCalendarEvent::GetAttendees
static function GetAttendees($eventIdList = [])
{
global $DB;
$attendees = [];
if (CCalendar::IsSocNet())
{
$eventIdList = is_array($eventIdList) ? array_map('intval', array_unique($eventIdList)) : array((int)$eventIdList);
if (!empty($eventIdList))
{
$strSql = "
SELECT
CE.OWNER_ID AS USER_ID,
CE.ID, CE.PARENT_ID, CE.MEETING_STATUS, CE.MEETING_HOST,
U.LOGIN, U.NAME, U.LAST_NAME, U.SECOND_NAME, U.EMAIL, U.PERSONAL_PHOTO, U.WORK_POSITION, U.EXTERNAL_AUTH_ID,
BUF.UF_DEPARTMENT
FROM
b_calendar_event CE
LEFT JOIN b_user U ON (U.ID=CE.OWNER_ID)
LEFT JOIN b_uts_user BUF ON (BUF.VALUE_ID = CE.OWNER_ID)
WHERE
CE.ACTIVE = 'Y' AND
CE.CAL_TYPE = 'user' AND
CE.DELETED = 'N' AND
CE.PARENT_ID in (".implode(',', $eventIdList).")";
$res = $DB->Query($strSql, false, "File: ".__FILE__."
Line: ".__LINE__);
while($entry = $res->Fetch())
{
$parentId = (int)$entry['PARENT_ID'];
$attendeeId = (int)$entry['USER_ID'];
if (!isset($attendees[$parentId]))
{
$attendees[$parentId] = [];
}
$entry["STATUS"] = trim($entry["MEETING_STATUS"]);
if ($parentId === (int)$entry['ID'] || $attendeeId === (int)$entry['MEETING_HOST'])
{
$entry["STATUS"] = "H";
}
CCalendar::SetUserDepartment($attendeeId, (empty($entry['UF_DEPARTMENT'])
? []
: unserialize($entry['UF_DEPARTMENT'], ['allowed_classes' => false])));
$entry['DISPLAY_NAME'] = CCalendar::GetUserName($entry);
$entry['URL'] = CCalendar::GetUserUrl($attendeeId);
$entry['AVATAR'] = CCalendar::GetUserAvatarSrc($entry['ID']);
$entry['EVENT_ID'] = $entry['ID'];
unset($entry['ID'], $entry['PARENT_ID'], $entry['UF_DEPARTMENT'], $entry['LOGIN']);
$attendees[$parentId][] = $entry;
}
}
}
return $attendees;
}