break; case 'edit_event': if (!api_is_allowed_to_edit(null, true) && $type == 'course') { break; } $id_list = explode('_', $_REQUEST['id']); $id = $id_list[1]; $agenda->edit_event($id, $_REQUEST['start'], $_REQUEST['end'], $_REQUEST['all_day'], $_REQUEST['view'], $_REQUEST['title'], $_REQUEST['content']); break; case 'delete_event': if (!api_is_allowed_to_edit(null, true) && $type == 'course') { break; } $id_list = explode('_', $_REQUEST['id']); $id = $id_list[1]; $agenda->delete_event($id); break; case 'resize_event': if (!api_is_allowed_to_edit(null, true) && $type == 'course') { break; } $day_delta = $_REQUEST['day_delta']; $minute_delta = $_REQUEST['minute_delta']; $id = explode('_', $_REQUEST['id']); $id = $id[1]; $agenda->resize_event($id, $day_delta, $minute_delta); break; case 'move_event': if (!api_is_allowed_to_edit(null, true) && $type == 'course') { break; }
} $event['action'] = 'edit'; $event['id'] = $eventId; $form = $agenda->getForm($event); if ($form->validate()) { $values = $form->getSubmitValues(); $allDay = isset($values['all_day']) ? 'true' : 'false'; $startDate = $values['date_range_start']; $endDate = $values['date_range_end']; $sendAttachment = isset($_FILES['user_upload']) ? true : false; $attachment = $sendAttachment ? $_FILES['user_upload'] : null; $attachmentComment = isset($values['file_comment']) ? $values['file_comment'] : null; $comment = isset($values['comment']) ? $values['comment'] : null; // This is a sub event. Delete the current and create another BT#7803 if (!empty($event['parent_event_id'])) { $agenda->delete_event($eventId); $eventId = $agenda->addEvent($startDate, $endDate, $allDay, $values['title'], $values['content'], $values['users_to_send'], false, null, $attachment, $attachmentComment, $comment); Display::return_message(get_lang('Updated'), 'confirmation'); header("Location: {$agendaUrl}"); exit; } // Editing normal event. $agenda->editEvent($eventId, $startDate, $endDate, $allDay, $values['title'], $values['content'], $values['users_to_send'], $attachment, $attachmentComment, $comment); if (!empty($values['repeat']) && !empty($eventId)) { // End date is always set as 23:59:59 $endDate = substr($values['repeat_end_day'], 0, 10) . ' 23:59:59'; $agenda->addRepeatedItem($eventId, $values['repeat_type'], $endDate, $values['users_to_send']); } $deleteAttachment = isset($values['delete_attachment']) ? true : false; if ($deleteAttachment && isset($event['attachment']) && !empty($event['attachment'])) { $agenda->deleteAttachmentFile($event['attachment']['id'], $agenda->course);
case 'edit_event': if (!api_is_allowed_to_edit(null, true) && $type == 'course') { break; } $id_list = explode('_', $_REQUEST['id']); $id = $id_list[1]; $agenda->editEvent($id, $_REQUEST['start'], $_REQUEST['end'], $_REQUEST['all_day'], $_REQUEST['title'], $_REQUEST['content']); break; case 'delete_event': if (!api_is_allowed_to_edit(null, true) && $type == 'course') { break; } $id_list = explode('_', $_REQUEST['id']); $id = $id_list[1]; $deleteAllEventsFromSerie = isset($_REQUEST['delete_all_events']) ? true : false; $agenda->delete_event($id, $deleteAllEventsFromSerie); break; case 'resize_event': if (!api_is_allowed_to_edit(null, true) && $type == 'course') { break; } $day_delta = $_REQUEST['day_delta']; $minute_delta = $_REQUEST['minute_delta']; $id = explode('_', $_REQUEST['id']); $id = $id[1]; $agenda->resize_event($id, $day_delta, $minute_delta); break; case 'move_event': if (!api_is_allowed_to_edit(null, true) && $type == 'course') { break; }