Search code examples
settingseditmaxmoodle

moodle 2.2 change maximum number of topics


The maximum number of weeks/topics in moodle is 52. The course I'm trying to implement has 100 topics, so I would like to increase the max number to be able to select "100" in the dropdown list (now it only goes up to 52).

I've been looking around in the moodle files, and found a couple of statements that seem to be setting the amount to 52:

  • In admin/settings/courses.php:

    $temp->add(new admin_setting_configtext('moodlecourse/maxsections', get_string('maxnumberweeks'), get_string('maxnumberweeks_desc'), 52));

  • In lib/adminlib.php:

    class admin_settings_num_course_sections extends admin_setting_configselect {
    public function __construct($name, $visiblename, $description, $defaultsetting) {
        parent::__construct($name, $visiblename, $description, $defaultsetting, array());
    }
    
    /** Lazy-load the available choices for the select box */
    public function load_choices() {
        $max = get_config('moodlecourse', 'maxsections');
        if (empty($max)) {
            $max = 52;
        }
        for ($i = 0; $i <= $max; $i++) {
            $this->choices[$i] = "$i";
        }
        return true;
    }
    }
    

I've tried setting those "52" to "100" but nothing changes, when I go to the edit course page the dropdown list still only goes from 1 to 52.

I'm sure there has to be a way of doing this. I found a way of how to do it in moodle 1.9 (editin the "52" value in the edit_form.php file), but that file is different now in moodle 2.2

Any ideas?


Solution

  • This configuration is stored in database in table mdl_config_plugins.

    The name of the parameter is maxsections and you can get it with the following SQL:

    SELECT * FROM `mdl_config_plugins` m WHERE m.`name` like "maxsections";
    

    You can change this value directly in database with the following SQL statement:

    UPDATE `mdl_config_plugins` SET value="100" WHERE `name` LIKE "maxsections";
    

    That said I strongly urge you to rethink the structure because it is far too much content for a course to be usable.