/* MAIN CODE */
$show_announcement_list = true;
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;
// Form was posted?
if (isset($_POST['action'])) {
    $action_todo = true;
}
// Actions
switch ($action) {
    case 'make_visible':
    case 'make_invisible':
        $status = false;
        if ($action == 'make_visible') {
            $status = true;
        }
        SystemAnnouncementManager::set_visibility($_GET['id'], $_GET['person'], $status);
        break;
    case 'delete':
        // Delete an announcement.
        SystemAnnouncementManager::delete_announcement($_GET['id']);
        Display::display_confirmation_message(get_lang('AnnouncementDeleted'));
        break;
    case 'delete_selected':
        foreach ($_POST['id'] as $index => $id) {
            SystemAnnouncementManager::delete_announcement($id);
        }
        Display::display_confirmation_message(get_lang('AnnouncementDeleted'));
        $action_todo = false;
        break;
    case 'add':
        // Add an announcement.