From 79e250dbdcc2ddebdf7c2816f10494ae277ff3de Mon Sep 17 00:00:00 2001 From: Rex Lorenzo Date: Mon, 13 Aug 2012 16:24:12 -0700 Subject: [PATCH 1/2] MDL-34866 - Make "course display" default a site configurable option --- admin/settings/courses.php | 5 +++++ course/edit_form.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/admin/settings/courses.php b/admin/settings/courses.php index 92722eb082f..277501fa0a0 100644 --- a/admin/settings/courses.php +++ b/admin/settings/courses.php @@ -47,6 +47,11 @@ if ($hassiteconfig $temp->add(new admin_setting_configselect('moodlecourse/legacyfiles', new lang_string('courselegacyfiles'), new lang_string('courselegacyfiles_help'), key($choices), $choices)); } + $choices = array(); + $choices[0] = new lang_string('coursedisplay_single'); + $choices[1] = new lang_string('coursedisplay_multi'); + $temp->add(new admin_setting_configselect('moodlecourse/coursedisplay', new lang_string('coursedisplay'), new lang_string('coursedisplay_help'), 0, $choices)); + $temp->add(new admin_setting_heading('groups', new lang_string('groups', 'group'), '')); $choices = array(); $choices[NOGROUPS] = new lang_string('groupsnone', 'group'); diff --git a/course/edit_form.php b/course/edit_form.php index be69a6ff377..355e790efa6 100644 --- a/course/edit_form.php +++ b/course/edit_form.php @@ -124,7 +124,7 @@ class course_edit_form extends moodleform { array(COURSE_DISPLAY_SINGLEPAGE => get_string('coursedisplay_single'), COURSE_DISPLAY_MULTIPAGE => get_string('coursedisplay_multi'))); $mform->addHelpButton('coursedisplay', 'coursedisplay'); - $mform->setDefault('coursedisplay', COURSE_DISPLAY_SINGLEPAGE); + $mform->setDefault('coursedisplay', $courseconfig->coursedisplay); for ($i = 0; $i <= $courseconfig->maxsections; $i++) { $sectionmenu[$i] = "$i"; From 1f09018af7e287cbe7b55d4da435c1d4718bbaec Mon Sep 17 00:00:00 2001 From: Rex Lorenzo Date: Tue, 14 Aug 2012 12:12:14 -0700 Subject: [PATCH 2/2] MDL-34866 - Make "course display" default a site configurable option * Moved COURSE_DISPLAY_SINGLEPAGE and COURSE_DISPLAY_MULTIPAGE constants from courselib to moodlelib.php * Using course display constants in course default admin setting page --- admin/settings/courses.php | 6 +++--- course/lib.php | 3 --- lib/moodlelib.php | 6 ++++++ 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/admin/settings/courses.php b/admin/settings/courses.php index 277501fa0a0..01b37a26225 100644 --- a/admin/settings/courses.php +++ b/admin/settings/courses.php @@ -48,9 +48,9 @@ if ($hassiteconfig } $choices = array(); - $choices[0] = new lang_string('coursedisplay_single'); - $choices[1] = new lang_string('coursedisplay_multi'); - $temp->add(new admin_setting_configselect('moodlecourse/coursedisplay', new lang_string('coursedisplay'), new lang_string('coursedisplay_help'), 0, $choices)); + $choices[COURSE_DISPLAY_SINGLEPAGE] = new lang_string('coursedisplay_single'); + $choices[COURSE_DISPLAY_MULTIPAGE] = new lang_string('coursedisplay_multi'); + $temp->add(new admin_setting_configselect('moodlecourse/coursedisplay', new lang_string('coursedisplay'), new lang_string('coursedisplay_help'), COURSE_DISPLAY_SINGLEPAGE, $choices)); $temp->add(new admin_setting_heading('groups', new lang_string('groups', 'group'), '')); $choices = array(); diff --git a/course/lib.php b/course/lib.php index 06fb241774c..75cc734e453 100644 --- a/course/lib.php +++ b/course/lib.php @@ -47,9 +47,6 @@ define('FIRSTUSEDEXCELROW', 3); define('MOD_CLASS_ACTIVITY', 0); define('MOD_CLASS_RESOURCE', 1); -define('COURSE_DISPLAY_SINGLEPAGE', 0); // display all sections on one page -define('COURSE_DISPLAY_MULTIPAGE', 1); // split pages into a page per section - function make_log_url($module, $url) { switch ($module) { case 'course': diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 313f92f35de..c23f89d3984 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -485,6 +485,12 @@ define('MOODLE_OFFICIAL_MOBILE_SERVICE', 'moodle_mobile_app'); */ define('USER_CAN_IGNORE_FILE_SIZE_LIMITS', -1); +/** + * Course display settings + */ +define('COURSE_DISPLAY_SINGLEPAGE', 0); // display all sections on one page +define('COURSE_DISPLAY_MULTIPAGE', 1); // split pages into a page per section + /// PARAMETER HANDLING //////////////////////////////////////////////////// /**