コード例 #1
0
     }
     Display::display_confirmation_message(get_lang('AnnouncementDeleted'));
     $action_todo = false;
     break;
 case 'add':
     // Add an announcement.
     $values['action'] = 'add';
     // Set default time window: NOW -> NEXT WEEK
     $values['start'] = date('Y-m-d H:i:s', api_strtotime(api_get_local_time()));
     $values['end'] = date('Y-m-d H:i:s', api_strtotime(api_get_local_time()) + 7 * 24 * 60 * 60);
     $values['range'] = substr(api_get_local_time(time()), 0, 16) . ' / ' . substr(api_get_local_time(time() + 7 * 24 * 60 * 60), 0, 16);
     $action_todo = true;
     break;
 case 'edit':
     // Edit an announcement.
     $announcement = SystemAnnouncementManager::get_announcement($_GET['id']);
     $values['id'] = $announcement->id;
     $values['title'] = $announcement->title;
     $values['content'] = $announcement->content;
     $values['start'] = api_get_local_time($announcement->date_start);
     $values['end'] = api_get_local_time($announcement->date_end);
     $values['range'] = substr(api_get_local_time($announcement->date_start), 0, 16) . ' / ' . substr(api_get_local_time($announcement->date_end), 0, 16);
     $values['visible_teacher'] = $announcement->visible_teacher;
     $values['visible_student'] = $announcement->visible_student;
     $values['visible_guest'] = $announcement->visible_guest;
     $values['lang'] = $announcement->lang;
     $values['action'] = 'edit';
     $groups = SystemAnnouncementManager::get_announcement_groups($announcement->id);
     $values['group'] = isset($groups['group_id']) ? $groups['group_id'] : 0;
     $action_todo = true;
     break;