Exemplo n.º 1
0
     $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();
     $arGuests = CMeeting::GetEventGuests($arResult['MEETING']['EVENT_ID'], $USER->GetID());
     foreach ($arGuests as $guest) {
         $arResult['MEETING']['USERS_EVENT'][$guest['id']] = $guest['status'];
     }
 }
 $arResult['CAN_EDIT'] = $arParams['COPY'] || $arResult['MEETING']['CURRENT_RIGHTS'] == CMeeting::ROLE_OWNER || $arResult['MEETING']['CURRENT_RIGHTS'] == CMeeting::ROLE_KEEPER;
 $arResult['MEETING']['AGENDA'] = array();
 if (!$arParams['COPY']) {
     $dbRes = CMeeting::GetItems($arParams['MEETING_ID']);
     while ($arRes = $dbRes->GetNext()) {
         // if ($arParams['COPY'] && $arRes['INSTANCE_TYPE'] == CMeetingInstance::TYPE_AGENDA)
         // continue;
         $arRes['RESPONSIBLE'] = CMeetingInstance::GetResponsible($arRes['ID']);
Exemplo n.º 2
0
                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 (is_array($arPlace) && $arPlace['ROOM_IBLOCK'] > 0 && $arPlace['ROOM_ID'] > 0) {
        $eventId = intval($_REQUEST['EVENT_ID']);
        $eventStart = CMeeting::MakeDateTime($_REQUEST['DATE_START_DATE'], $_REQUEST['DATE_START_TIME']);
        $eventFinish = CMeeting::MakeDateTime($_REQUEST['DATE_START_DATE'], $_REQUEST['DATE_START_TIME'], $_REQUEST['DURATION']);
        $arFilter = array("ACTIVE" => "Y", "IBLOCK_ID" => $arPlace['ROOM_IBLOCK'], "SECTION_ID" => $arPlace['ROOM_ID'], "<DATE_ACTIVE_FROM" => $eventFinish, ">DATE_ACTIVE_TO" => $eventStart, "PROPERTY_PERIOD_TYPE" => "NONE");
        $reservationId = 0;
        if ($eventId > 0) {
            $arEvent = CMeeting::GetEvent($eventId);
            if (is_array($arEvent) && is_array($arEvent['LOCATION']) && $arEvent['LOCATION']['mrevid'] > 0) {
                $reservationId = $arEvent['LOCATION']['mrevid'];
                $arFilter["!=ID"] = $reservationId;
            }
        }
        $bReserved = false;
        $dbElements = CIBlockElement::GetList(array("DATE_ACTIVE_FROM" => "ASC"), $arFilter, false, false, array('ID'));
        if ($dbElements->Fetch()) {
            $bReserved = true;
        } else {
            // copy-paste sucks!
            include_once $_SERVER['DOCUMENT_ROOT'] . "/bitrix/components/bitrix/intranet.reserve_meeting/init.php";
            $arPeriodicElements = __IRM_SearchPeriodic($eventStart, $eventFinish, $arPlace['ROOM_IBLOCK'], $arPlace['ROOM_ID']);
            for ($i = 0, $l = count($arPeriodicElements); $i < $l; $i++) {
                if (!$reservationId || $arPeriodicElements[$i]['ID'] != $reservationId) {