diff --git a/admin/settings/appearance.php b/admin/settings/appearance.php index 3e9d484d6cd..b0289ef2f0f 100644 --- a/admin/settings/appearance.php +++ b/admin/settings/appearance.php @@ -14,10 +14,17 @@ $temp->add(new admin_setting_configcheckbox('tabselectedtofront', get_string('ta $ADMIN->add('themes', $temp); $ADMIN->add('themes', new admin_externalpage('themeselector', get_string('themeselector','admin'), $CFG->wwwroot . '/theme/index.php')); +# for CALENDAR_TF_12 and CALENDAR_TF_24 ... +require_once($CFG->dirroot . '/calendar/lib.php'); // calendar $temp = new admin_settingpage('calendar', get_string('calendarsettings','admin')); $temp->add(new admin_setting_special_adminseesall()); +$temp->add(new admin_setting_configselect('calendar_site_timeformat', get_string('pref_timeformat', 'calendar'), get_string('explain_site_timeformat', 'calendar'), '0', +array( 0 => get_string('default', 'calendar'), + CALENDAR_TF_12 => get_string('timeformat_12', 'calendar'), + CALENDAR_TF_24 => get_string('timeformat_24', 'calendar') + ))); $temp->add(new admin_setting_configselect('calendar_startwday', get_string('configstartwday', 'admin'), get_string('helpstartofweek', 'admin'), 0, array( 0 => get_string('sunday', 'calendar'), diff --git a/calendar/lib.php b/calendar/lib.php index 822efde1e62..8d22fd4c510 100644 --- a/calendar/lib.php +++ b/calendar/lib.php @@ -832,6 +832,9 @@ function calendar_time_representation($time) { $langtimeformat = get_string('strftimetime'); } $timeformat = get_user_preferences('calendar_timeformat'); + if(empty($timeformat)){ + $timeformat = get_config(NULL,'calendar_site_timeformat'); + } // The ? is needed because the preference might be present, but empty return userdate($time, empty($timeformat) ? $langtimeformat : $timeformat); } diff --git a/lang/en_utf8/calendar.php b/lang/en_utf8/calendar.php index 10871ffbda6..3f5e9944676 100644 --- a/lang/en_utf8/calendar.php +++ b/lang/en_utf8/calendar.php @@ -46,6 +46,7 @@ $string['explain_maxevents'] = 'This sets the maximum number of upcoming events $string['explain_persistflt'] = 'If this is enabled, then Moodle will remember your last event filter settings and automatically restore them each time you login.'; $string['explain_startwday'] = 'Calendar weeks will be shown as starting on the day that you select here.'; $string['explain_timeformat'] = 'You can choose to see times in either 12 or 24 hour format. If you choose \"default\", then the format will be automatically chosen according to the language you use in the site.'; +$string['explain_site_timeformat'] = 'You can choose to see times in either 12 or 24 hour format for the whole site. If you choose \"default\", then the format will be automatically chosen according to the language you use in the site. This setting can be overridden by user preferences.'; $string['export'] = 'Export'; $string['exportcalendar'] = 'Export calendar'; $string['exportbutton'] = 'Export';