Skip to content

Commit

Permalink
Possible
Browse files Browse the repository at this point in the history
  • Loading branch information
gjb2048 committed Sep 28, 2023
1 parent ff0a5c5 commit dbaa0e2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
12 changes: 5 additions & 7 deletions format.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,11 @@
global $DB;
$numsections = $DB->get_field_sql('SELECT max(section) from {course_sections}
WHERE course = ?', [$course->id]);
if (empty($numsections)) {
/* Sections not created, so we need to use the default course setting,
which could be zero but this will still work. */
$numsections = get_config('moodlecourse', 'numsections');
}
$format->set_gnumsections($numsections);
$courseformatoptions['gnumsections'] = $numsections;
if (!empty($numsections)) {
// Sections created, so we need set gnumsections to this.
$courseformatoptions['gnumsections'] = $numsections;
} // Else remain the same.
$format->set_gnumsections($courseformatoptions['gnumsections']);
$courseformatoptions['gnumsectionsnewcourse'] = 0;
}

Expand Down
8 changes: 0 additions & 8 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -539,14 +539,6 @@ public function create_edit_form_elements(&$mform, $forsection = false) {
"$CFG->dirroot/course/format/grid/form/sectionfilemanager.php",
'MoodleQuickForm_sectionfilemanager');

if (!$forsection) {
// The course edit form is displayed, so user intent rather than from backup / course upload.
$data = [
'gnumsectionsnewcourse' => 0,
];
$this->update_course_format_options($data);
}

$elements = parent::create_edit_form_elements($mform, $forsection);

/* Increase the number of sections combo box values if the user has increased the number of sections
Expand Down

0 comments on commit dbaa0e2

Please sign in to comment.