diff --git a/main/calendar/agenda.inc.php b/main/calendar/agenda.inc.php index ee6e74cd7a..744b489251 100644 --- a/main/calendar/agenda.inc.php +++ b/main/calendar/agenda.inc.php @@ -1556,7 +1556,11 @@ function change_visibility($tool, $id, $visibility) function display_courseadmin_links($filter = 0) { if (!api_get_course_int_id()) { - return "".Display::return_icon('calendar.png', get_lang('Agenda'), '', ICON_SIZE_MEDIUM).""; + $type = isset($_REQUEST['type']) ? Security::remove_XSS($_REQUEST['type']) : 'personal'; + if ($type == 'platform') { + $type = 'admin'; + } + return "".Display::return_icon('calendar.png', get_lang('Agenda'), '', ICON_SIZE_MEDIUM).""; } $form = null; if (!isset($_GET['action'])) { @@ -1690,7 +1694,6 @@ function store_edited_agenda_item($event_id, $id_attach, $file_comment) $agendaObj->edit_event($id, $start_date, $end_date, $all_day, null, $title, $content); - if (empty($id_attach)) { add_agenda_attachment_file($file_comment, $id); } else { @@ -2230,7 +2233,7 @@ function display_one_agenda_item($agenda_id) * @param integer id, the id of the agenda item we are editing. By default this is empty which means that we are adding an * agenda item. */ -function show_add_form($id = '') +function show_add_form($id = '', $type = null) { global $MonthsLong; $htmlHeadXtra[] = to_javascript(); @@ -2298,13 +2301,16 @@ function show_add_form($id = '') // if the id is set then we are editing an agenda item if (!empty($id)) { $course_info = api_get_course_info(); - $agendaObj = new Agenda(); if (!empty($course_info)) { $agendaObj->set_course($course_info); $agendaObj->type = 'course'; } else { - $agendaObj->type = 'personal'; + if (api_is_platform_admin() && $type == 'platform') { + $agendaObj->type = 'admin'; + } else { + $agendaObj->type = 'personal'; + } } $agendaItem = $agendaObj->get_event($id); @@ -2356,7 +2362,7 @@ function show_add_form($id = '') -