MDL-36795 - lib / administration: maxsections now limits the default setting for...
[moodle.git] / course / format / weeks / lib.php
index ba1f54f..a5c1153 100644 (file)
@@ -219,7 +219,11 @@ class format_weeks extends format_base {
         if ($foreditform && !isset($courseformatoptions['coursedisplay']['label'])) {
             $courseconfig = get_config('moodlecourse');
             $sectionmenu = array();
-            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";
             }
             $courseformatoptionsedit = array(