public function load_choices() {
        if (is_array($this->choices)) {
            return true;
        }
        $this->choices = array();

        global $CFG, $DB;
        $records = $DB->get_records('modules', array('visible'=>1), 'name');
        foreach ($records as $record) {
            // Exclude modules if the code doesn't exist
            if (file_exists("$CFG->dirroot/mod/$record->name/lib.php")) {
                // Also exclude system modules (if specified)
                if (!($this->excludesystem &&
                        plugin_supports('mod', $record->name, FEATURE_MOD_ARCHETYPE) ===
                        MOD_ARCHETYPE_SYSTEM)) {
                    $this->choices[$record->id] = $record->name;
                }
            }
        }
        return true;
    }
public function load_choices() {
        if (is_array($this->choices)) {
            return true;
        }
        $this->choices = array();

        global $CFG, $DB;
        $records = $DB->get_records('modules', array('visible'=>1), 'name');
        foreach ($records as $record) {
            // Exclude modules if the code doesn't exist
            if (file_exists("$CFG->dirroot/mod/$record->name/lib.php")) {
                // Also exclude system modules (if specified)
                if (!($this->excludesystem &&
                        plugin_supports('mod', $record->name, FEATURE_MOD_ARCHETYPE) ===
                        MOD_ARCHETYPE_SYSTEM)) {
                    $this->choices[$record->id] = $record->name;
                }
            }
        }
        return true;
    }
public function load_choices ( ) { if ( is_array ( $ this -> choices ) ) { return true ; } $ this -> choices = array ( ) ; global $ CFG , $ DB ; $ records = $ DB -> get_records ( 'modules' , array ( 'visible' => 1 ) , 'name' ) ; foreach ( $ records as $ record ) { // Exclude modules if the code doesn't exist if ( file_exists ( "$CFG->dirroot/mod/$record->name/lib.php" ) ) { // Also exclude system modules (if specified) if ( ! ( $ this -> excludesystem && plugin_supports ( 'mod' , $ record -> name , FEATURE_MOD_ARCHETYPE ) === MOD_ARCHETYPE_SYSTEM ) ) { $ this -> choices [ $ record -> id ] = $ record -> name ; } } } return true ; }
Loads an array of current module choices

@return bool always return true
Loads an array of current module choices