$id = intVal($_POST['event_id']); $sectId = intVal($_POST['sect_id']); $newMeeting = $_POST['new_meeting'] == 'Y'; $from_ts = $_POST['from_ts']; $to_ts = $_POST['to_ts']; if (isset($_POST['skip_time']) && $_POST['skip_time'] == 'Y') { $from_ts = CCalendar::_fixTimestamp($from_ts); $to_ts = CCalendar::_fixTimestamp($to_ts); } $arFields = array("ID" => $id, "CAL_TYPE" => $_POST['cal_type'], "OWNER_ID" => $_POST['owner_id'], "DT_FROM_TS" => $from_ts, "DT_TO_TS" => $to_ts, "SKIP_TIME" => isset($_POST['skip_time']) && $_POST['skip_time'] == 'Y', 'NAME' => CMobile::ConvertFromUtf(trim($_POST['name'])), 'DESCRIPTION' => CMobile::ConvertFromUtf(trim($_POST['desc'])), 'SECTIONS' => array($sectId), 'ACCESSIBILITY' => $_POST['accessibility'], 'IMPORTANCE' => $_POST['importance'], 'PRIVATE_EVENT' => $_POST['private_event'] == "Y", "REMIND" => $_POST['remind'], 'LOCATION' => array(), "IS_MEETING" => !empty($_POST['attendees'])); // LOCATION if (is_array($_POST['location']) && !empty($_POST['location'])) { $arFields['LOCATION'] = $_POST['location']; $arFields['LOCATION']['CHANGED'] = $arFields['LOCATION']['CHANGED'] == 'Y'; $arFields['LOCATION']['NEW'] = CMobile::ConvertFromUtf($arFields['LOCATION']['NEW']); $arFields['LOCATION']['OLD'] = CMobile::ConvertFromUtf($arFields['LOCATION']['OLD']); if ($arFields['LOCATION']['CHANGED']) { $loc = CCalendar::UnParseTextLocation($arFields['LOCATION']['NEW']); $arFields['LOCATION']['NEW'] = $loc['NEW']; } } if (isset($_POST['rrule']) && $_POST['rrule'] == '') { $arFields['RRULE'] = ''; } if ($arFields['IS_MEETING']) { $arFields['ATTENDEES'] = $_POST['attendees']; $arFields['ATTENDEES'] = $_POST['attendees']; if ($newMeeting && !in_array($ownerId, $arFields['ATTENDEES'])) { $arFields['ATTENDEES'][] = $ownerId; } $arFields['MEETING_HOST'] = $ownerId;