- Модуль: calendar
- Путь к файлу: ~/bitrix/modules/calendar/classes/general/calendar_event.php
- Класс: CCalendarEvent
- Вызов: CCalendarEvent::getAttendeeList
static function getAttendeeList($entryIdList = []): array
{
global $DB;
$attendeeList = [];
$userIdList = [];
if (CCalendar::IsSocNet())
{
$entryIdList =
is_array($entryIdList)
? array_map(
function($entryId) {return (int)$entryId;} ,
array_unique($entryIdList)
)
: [(int)$entryIdList]
;
if (!empty($entryIdList))
{
$strSql = "
SELECT
CE.OWNER_ID AS USER_ID,
CE.ID, CE.PARENT_ID, CE.MEETING_STATUS, CE.MEETING_HOST
FROM
b_calendar_event CE
WHERE
CE.ACTIVE = 'Y' AND
CE.CAL_TYPE = 'user' AND
CE.DELETED = 'N' AND
CE.PARENT_ID in (".implode(',', $entryIdList).")"
;
$res = $DB->Query($strSql, false, "File: ".__FILE__."
Line: ".__LINE__);
while($entry = $res->Fetch())
{
$entry['USER_ID'] = (int)$entry['USER_ID'];
if (!isset($attendeeList[$entry['PARENT_ID']]))
{
$attendeeList[$entry['PARENT_ID']] = [];
}
$entry["STATUS"] = trim($entry["MEETING_STATUS"]);
if ($entry['PARENT_ID'] === $entry['ID'] || $entry['USER_ID'] === $entry['MEETING_HOST'])
{
$entry["STATUS"] = "H";
}
$attendeeList[$entry['PARENT_ID']][] = [
'id' => $entry['USER_ID'],
'entryId' => $entry['ID'],
'status' => $entry["STATUS"]
];
if (!in_array($entry['USER_ID'], $userIdList, true))
{
$userIdList[] = $entry['USER_ID'];
}
}
}
}
return [
'attendeeList' => $attendeeList,
'userIdList' => $userIdList
];
}