Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-36795 - lib / administration: maxsections now limits the default …

…setting for numsections.

In the default course settings, setting the maximum number topics / weeks  to 0 would not
change the default number of sections on the same page as any other number would.
A more appropriate check has been put in place.

This also incorporates a fix for MDL-28584. The course edit screen now also checks to see
if maxsections is set or numeric. If it is not set or numeric then it defaults to 52.
  • Loading branch information...
commit d22b5faae897ba430f2f6d62a759ea67af9a0ccc 1 parent 5f1d8f2
Adrian Greeve abgreeve authored
Showing with 6 additions and 2 deletions.
  1. +5 −1 course/edit_form.php
  2. +1 −1  lib/adminlib.php
6 course/edit_form.php
View
@@ -126,7 +126,11 @@ function definition() {
$mform->addHelpButton('coursedisplay', 'coursedisplay');
$mform->setDefault('coursedisplay', $courseconfig->coursedisplay);
- for ($i = 0; $i <= $courseconfig->maxsections; $i++) {
+ $max = $courseconfig->maxsections;
+ if (!isset($max) || !is_numeric($max)) {
+ $max = 52;
+ }
+ for ($i = 0; $i <= $max; $i++) {
$sectionmenu[$i] = "$i";
}
$mform->addElement('select', 'numsections', get_string('numberweeks'), $sectionmenu);
2  lib/adminlib.php
View
@@ -3626,7 +3626,7 @@ public function __construct($name, $visiblename, $description, $defaultsetting)
/** Lazy-load the available choices for the select box */
public function load_choices() {
$max = get_config('moodlecourse', 'maxsections');
- if (empty($max)) {
+ if (!isset($max) || !is_numeric($max)) {
$max = 52;
}
for ($i = 0; $i <= $max; $i++) {
Please sign in to comment.
Something went wrong with that request. Please try again.