From 5c29dd438498666c9253aa332a42145eca848105 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Mon, 16 Sep 2013 15:01:35 +0200 Subject: [PATCH] Adding a global default_calendar_view setting in the agenda. see BT#6695 --- main/calendar/agenda_js.php | 11 ++++++++++- main/template/default/agenda/month.tpl | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/main/calendar/agenda_js.php b/main/calendar/agenda_js.php index b5a9bee020..2f1ce308d7 100644 --- a/main/calendar/agenda_js.php +++ b/main/calendar/agenda_js.php @@ -38,7 +38,6 @@ if (api_is_platform_admin() && $type == 'admin') { $type = 'admin'; } -//if (api_get_course_id() != -1 && $type == 'course') { if (isset($_REQUEST['cidReq']) && !empty($_REQUEST['cidReq'])) { $type = 'course'; } @@ -153,6 +152,16 @@ if ($type == 'course' && !empty($group_id)) { $type_label = get_lang('GroupCalendar'); } +$defaultView = api_get_setting('default_calendar_view'); + +if (empty($defaultView)) { + $defaultView = 'month'; +} + +/* month, basicWeek,agendaWeek,agendaDay */ + +$tpl->assign('default_view', $defaultView); + if ($type == 'course' && !empty($session_id)) { $type_event_class = 'session_event'; $type_label = get_lang('SessionCalendar'); diff --git a/main/template/default/agenda/month.tpl b/main/template/default/agenda/month.tpl index 5c32d26db7..28e4a5edda 100644 --- a/main/template/default/agenda/month.tpl +++ b/main/template/default/agenda/month.tpl @@ -103,6 +103,7 @@ $(document).ready(function() { ], {% endif %} + defaultView: '{{ default_view }}', buttonText: {{ button_text }}, monthNames: {{ month_names }}, monthNamesShort:{{ month_names_short }},