示例#1
0
     if ($_POST['submit_event']) {
         $event_start = (int) $_POST['fyear'] . '-' . (int) $_POST['fmonth'] . '-' . (int) $_POST['fday'] . ' ' . (int) $_POST['fhour'] . ':' . (int) $_POST['fminute'] . ':00';
         $event_stop = (int) $_POST['end_fyear'] . '-' . (int) $_POST['end_fmonth'] . '-' . (int) $_POST['end_fday'] . ' ' . (int) $_POST['end_fhour'] . ':' . (int) $_POST['end_fminute'] . ':00';
         $id = agenda_add_item($_POST['title'], $_POST['content'], $event_start, $event_stop);
         display_agenda_items();
     } else {
         show_add_form();
     }
     break;
 case "edit":
     if (!(api_is_course_coach() && !api_is_element_in_the_session(TOOL_AGENDA, intval($_REQUEST['id'])))) {
         // a coach can only delete an element belonging to his session
         if ($_POST['submit_event']) {
             $my_id_attach = (int) $_REQUEST['id_attach'];
             $my_file_comment = Database::escape_string($_REQUEST['file_comment']);
             store_edited_agenda_item($my_id_attach, $my_file_comment);
             display_agenda_items();
         } else {
             $id = (int) $_GET['id'];
             show_add_form($id);
         }
     } else {
         display_agenda_items();
     }
     break;
 case "delete":
     $id = (int) $_GET['id'];
     if (!(api_is_course_coach() && !api_is_element_in_the_session(TOOL_AGENDA, $id))) {
         // a coach can only delete an element belonging to his session
         if (api_is_allowed_to_edit() && !api_is_anonymous()) {
             if (!empty($id)) {
示例#2
0
         if (!$is_ical) {
             Display::display_error_message(get_lang('IsNotiCalFormatFile'));
             display_ical_import_form();
             break;
         } else {
             Display::display_confirmation_message(get_lang('AddSuccess'));
             echo $agenda_result;
         }
     } else {
         display_ical_import_form();
     }
     break;
 case 'edit':
     // a coach can only delete an element belonging to his session
     if ($_POST['submit_event']) {
         store_edited_agenda_item($event_id, $_REQUEST['id_attach'], $_REQUEST['file_comment']);
         $action = 'view';
     } else {
         show_add_form($event_id, $event_type);
     }
     break;
 case "delete":
     if (!(api_is_course_coach() && !api_is_element_in_the_session(TOOL_AGENDA, $event_id))) {
         // a coach can only delete an element belonging to his session
         delete_agenda_item($event_id);
         $action = 'view';
     }
     break;
 case "showhide":
     if (!(api_is_course_coach() && !api_is_element_in_the_session(TOOL_AGENDA, $event_id))) {
         // a coach can only delete an element belonging to his session