if (!CModule::IncludeModule("meeting")) { return ShowError(GetMessage("ME_MODULE_NOT_INSTALLED")); } $arParams['MEETING_ID'] = intval($arParams['MEETING_ID']); $arParams['COPY'] = $arParams['COPY'] == 'Y'; $arParams['GROUP_ID'] = intval($arParams['GROUP_ID']); $arParams['NAME_TEMPLATE'] = empty($arParams['NAME_TEMPLATE']) ? CSite::GetNameFormat(false) : str_replace(array("#NOBR#", "#/NOBR#"), array("", ""), $arParams["NAME_TEMPLATE"]); if ($arParams['MEETING_ID'] && !$arParams['COPY']) { $arParams['ITEM_URL'] .= '?from=' . $arParams['MEETING_ID']; } //$arParams['CALENDAR_ID'] = intval($arParams['CALENDAR_ID']); $arParams['EDIT'] = $arParams['EDIT'] == 'Y' || $arParams['MEETING_ID'] <= 0 || $arParams['COPY']; $arResult['IS_NEW_CALENDAR'] = CMeeting::IsNewCalendar(); $arResult['START_INDEX'] = 0; 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'];
if (IsModuleInstalled('meeting') && CModule::IncludeModule('meeting')) { $forumId = COption::GetOptionInt('meeting', 'comments_forum_id', 0, SITE_ID); if ($arResult['FORUM']['ID'] == $forumId) { $meetingID = false; $xmlID = $arResult['MESSAGE']['FT_XML_ID']; preg_match('/MEETING_ITEM_([0-9]+)/', $xmlID, $matches); if (sizeof($matches) > 0) { $meetingItemID = $matches[1]; if (CMeetingItem::HasAccess($meetingItemID)) { $arParams['PERMISSION'] = 'M'; } } preg_match('/MEETING_([0-9]+)/', $xmlID, $matches); if (sizeof($matches) > 0) { $meetingID = $matches[1]; if (CMeeting::GetUserRole($meetingID) !== false) { $arParams['PERMISSION'] = 'M'; } } } } if (IsModuleInstalled('tasks') && CModule::IncludeModule('tasks')) { $tasksIsTasksJurisdiction = false; // Insurance for cross-modules version compatibility if (method_exists('CTasksTools', 'ListTasksForumsAsArray')) { try { $arTasksForums = CTasksTools::ListTasksForumsAsArray(); if (in_array((int) $arResult['FORUM']['ID'], $arTasksForums, true)) { $tasksIsTasksJurisdiction = true; } } catch (TasksException $e) {
$checkedFileId = $arRes['FILE_ID']; } } } } if ($checkedFileId > 0) { $arFile = CFile::GetFileArray($checkedFileId); if (is_array($arFile)) { CFile::ViewByUser($arFile, array("force_download" => true)); } } die; } $MEETING_ID = intval($_REQUEST['MEETING_ID']); if ($MEETING_ID > 0) { $ACCESS = CMeeting::GetUserRole($MEETING_ID); if ($ACCESS) { if ($ACCESS == CMeeting::ROLE_OWNER || $ACCESS == CMeeting::ROLE_KEEPER) { $new_state = $_REQUEST['STATE']; if ($new_state && check_bitrix_sessid()) { $arFields = array('CURRENT_STATE' => $new_state); switch ($new_state) { case CMeeting::STATE_ACTION: $arFields['DATE_START'] = ConvertTimeStamp(false, 'FULL'); break; case CMeeting::STATE_CLOSED: $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:
return ShowError(GetMessage("ME_MODULE_NOT_INSTALLED")); } $dbRes = CMeetingItem::GetList(array(), array('ID' => $arParams['ITEM_ID'])); if (!($arResult['ITEM'] = $dbRes->Fetch())) { return ShowError(GetMessage("ME_MEETING_ITEM_NOT_FOUND")); } $arResult['FROM_MEETING'] = intval($_REQUEST['from']); $bHasAccess = false; $arResult['ITEM']['INSTANCES'] = array(); $arResult['CAN_EDIT'] = false; $arUserIDs = array(); $dbRes = CMeetingInstance::GetList(array('ID' => 'DESC'), array('ITEM_ID' => $arParams['ITEM_ID'])); while ($arInstance = $dbRes->Fetch()) { $dbMeeting = CMeeting::GetList(array(), array('ID' => $arInstance['MEETING_ID']), false, false, array('*')); if ($arMeeting = $dbMeeting->Fetch()) { $arMeeting['ACCESS'] = CMeeting::GetUserRole($arInstance['MEETING_ID']); if ($arMeeting['ACCESS']) { $bHasAccess = true; if ($arMeeting['ACCESS'] == CMeeting::ROLE_OWNER || $arMeeting['ACCESS'] == CMeeting::ROLE_KEEPER) { $arResult['CAN_EDIT'] = true; } } $arUserIDs[] = $arMeeting['OWNER_ID']; $arInstance['MEETING'] = $arMeeting; } $arInstance['RESPONSIBLE'] = CMeetingInstance::GetResponsible($arInstance['ID']); $arUserIDs = array_merge($arUserIDs, $arInstance['RESPONSIBLE']); $arInstance['B_RESPONSIBLE'] = in_array($USER->GetID(), $arInstance['RESPONSIBLE']); $arInstance['B_EDIT'] = $arInstance['B_RESPONSIBLE'] && $arMeeting['CURRENT_STATE'] != CMeeting::STATE_CLOSED; $arInstance['REPORTS'] = array(); $arReportsMap = array();