$arFields['DATE_FINISH'] = ConvertTimeStamp(false, 'FULL'); break; // TODO we lose original DATE_START here; fix it later during calendar integration // TODO we lose original DATE_START here; fix it later during calendar integration case CMeeting::STATE_PREPARE: $arFields['DATE_FINISH'] = ''; break; } CMeeting::Update($MEETING_ID, $arFields); } } $dbRes = CMeeting::GetByID($MEETING_ID); if ($arMeeting = $dbRes->Fetch()) { if ($arMeeting['EVENT_ID'] > 0) { $ownerId = $USER->GetID(); $arMeeting['USERS'] = CMeeting::GetUsers($MEETING_ID); foreach ($arMeeting['USERS'] as $userId => $userRole) { if ($userRole == CMeeting::ROLE_OWNER) { $ownerId = $userId; } } $arMeeting['OWNER_ID'] = $ownerId; $arMeeting['REINVITE'] = false; CMeeting::AddEvent($MEETING_ID, $arMeeting); } Header('Content-Type: application/json'); echo "{id: '" . $MEETING_ID . "', state: '" . $arMeeting['CURRENT_STATE'] . "', date_start: '" . MakeTimeStamp($arMeeting['DATE_START']) . "000'}"; } } } elseif (isset($_REQUEST['PLACE_ID'])) { $arPlace = CMeeting::CheckPlace($_REQUEST['PLACE_ID']);
if ($arParams['MEETING_ID'] > 0) { $arResult['ACCESS'] = CMeeting::GetUserRole($arParams['MEETING_ID']); if ($arResult['ACCESS']) { if ($_REQUEST['DELETE'] == 'Y' && $arResult['ACCESS'] == CMeeting::ROLE_OWNER && check_bitrix_sessid()) { CMeeting::Delete($arParams['MEETING_ID']); $APPLICATION->RestartBuffer(); die; } $dbRes = CMeeting::GetList(array(), array('ID' => $arParams['MEETING_ID']), false, false, array('*')); if (!($arResult['MEETING'] = $dbRes->GetNext())) { return ShowError(GetMessage("ME_MEETING_NOT_FOUND")); } if (CMeeting::CheckPlace($arResult["MEETING"]["PLACE"])) { $arResult["MEETING"]["PLACE_ID"] = $arResult["MEETING"]["PLACE"]; } $arResult['MEETING']['USERS'] = CMeeting::GetUsers($arParams['MEETING_ID']); $arResult['MEETING']['CURRENT_RIGHTS'] = $arResult['ACCESS']; //$arResult['MEETING']['USERS'][$USER->GetID()]; // not arParams[USER_ID]! if (!$arResult['MEETING']['CURRENT_RIGHTS']) { return ShowError(GetMessage("ME_MEETING_ACCESS_DENIED")); } $arResult['MEETING']['FILES'] = array(); $dbFiles = CMeeting::GetFiles($arParams['MEETING_ID']); while ($arFile = $dbFiles->Fetch()) { $arResult['MEETING']['FILES'][$arFile['FILE_ID']] = $arFile; } if (!$arParams['COPY'] && $arResult['MEETING']['EVENT_ID'] > 0) { if ($arResult['IS_NEW_CALENDAR']) { $arResult['MEETING']['EVENT'] = CMeeting::GetEvent($arResult['MEETING']['EVENT_ID']); } $arResult['MEETING']['USERS_EVENT'] = array();
} $arResult['MEETING_ROOMS_LIST'] = array(); if ($arParams['RESERVE_MEETING_IBLOCK_ID'] || $arParams['RESERVE_VMEETING_IBLOCK_ID']) { $dbMeetingsList = CIBlockSection::GetList(array('IBLOCK_ID' => 'ASC', 'NAME' => 'ASC', 'ID' => 'DESC'), array('IBLOCK_ID' => array(intval($arParams['RESERVE_MEETING_IBLOCK_ID']), intval($arParams['RESERVE_VMEETING_IBLOCK_ID']))), false, array('ID', 'IBLOCK_ID', 'NAME', 'DESCRIPTION')); while ($arRoom = $dbMeetingsList->GetNext()) { $arResult['MEETING_ROOMS_LIST'][CMeeting::MakePlace($arRoom["IBLOCK_ID"], $arRoom["ID"])] = $arRoom; } } //echo '<pre>'; print_r($arFilter); echo '</pre>'; $dbRes = CMeeting::GetList(array("ID" => 'DESC'), $arFilter, false, $arNavParams, array('ID', 'TITLE', 'CURRENT_STATE', 'DATE_START', 'OWNER_ID', 'PLACE')); $arResult["NAV_STRING"] = $dbRes->GetPageNavStringEx($navComponentObject = null, $arParams["PAGER_TITLE"]); while ($arRes = $dbRes->GetNext()) { $arRes['URL'] = str_replace('#MEETING_ID#', $arRes['ID'], $arParams['MEETING_URL']); $arRes['URL_EDIT'] = str_replace('#MEETING_ID#', $arRes['ID'], $arParams['MEETING_EDIT_URL']); $arRes['URL_COPY'] = str_replace('#MEETING_ID#', $arRes['ID'], $arParams['MEETING_COPY_URL']); $arRes['USERS'] = CMeeting::GetUsers($arRes['ID']); foreach ($arRes['USERS'] as $u => $r) { if ($r == CMeeting::ROLE_OWNER) { $arRes['OWNER_ID'] = $u; } } $arUserIDs = array_merge($arUserIDs, array_keys($arRes['USERS'])); if (strlen($arRes['PLACE']) > 0 && array_key_exists($arRes['PLACE'], $arResult['MEETING_ROOMS_LIST'])) { $arRes['PLACE'] = $arResult['MEETING_ROOMS_LIST'][$arRes['PLACE']]['NAME']; } $arResult['MEETINGS'][] = $arRes; } $title = GetMessage('ML_LIST_TITLE' . ($arParams['USER_ID'] == $USER->GetID() ? '' : '_NOT_MINE')); $APPLICATION->SetTitle($title); if ($arParams['SET_NAVCHAIN'] !== 'N') { $APPLICATION->AddChainItem($title, $arParams['LIST_URL']);