From acbdf41d8343b9dd389a214d88a4e97d181c99b6 Mon Sep 17 00:00:00 2001 From: Dan Poltawski Date: Thu, 15 Oct 2015 10:03:59 +0100 Subject: [PATCH] MDL-51651 lang: add consitency for application of firstdayofweek 1) Set the site-wide default based on language pack 2) Use the site/user preference for js popups, like we do in /calendar/ --- admin/settings/appearance.php | 3 ++- lib/formslib.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/admin/settings/appearance.php b/admin/settings/appearance.php index 58677118e0e..a8b6c6aeb45 100644 --- a/admin/settings/appearance.php +++ b/admin/settings/appearance.php @@ -64,7 +64,8 @@ preferences,moodle|/user/preferences.php|preferences', array('0' => new lang_string('default', 'calendar'), '%I:%M %p' => new lang_string('timeformat_12', 'calendar'), '%H:%M' => new lang_string('timeformat_24', 'calendar')))); - $temp->add(new admin_setting_configselect('calendar_startwday', new lang_string('configstartwday', 'admin'), new lang_string('helpstartofweek', 'admin'), 0, + $temp->add(new admin_setting_configselect('calendar_startwday', new lang_string('configstartwday', 'admin'), + new lang_string('helpstartofweek', 'admin'), get_string('firstdayofweek', 'langconfig'), array( 0 => new lang_string('sunday', 'calendar'), 1 => new lang_string('monday', 'calendar'), diff --git a/lib/formslib.php b/lib/formslib.php index 8fc5a7e0e7d..949b95706af 100644 --- a/lib/formslib.php +++ b/lib/formslib.php @@ -77,10 +77,11 @@ function form_init_date_js() { global $PAGE; static $done = false; if (!$done) { + $calendar = \core_calendar\type_factory::get_calendar_instance(); $module = 'moodle-form-dateselector'; $function = 'M.form.dateselector.init_date_selectors'; $config = array(array( - 'firstdayofweek' => get_string('firstdayofweek', 'langconfig'), + 'firstdayofweek' => $calendar->get_starting_weekday(), 'mon' => date_format_string(strtotime("Monday"), '%a', 99), 'tue' => date_format_string(strtotime("Tuesday"), '%a', 99), 'wed' => date_format_string(strtotime("Wednesday"), '%a', 99),