mirror of
https://github.com/moodle/moodle.git
synced 2025-04-12 20:12:15 +02:00
Merge branch 'MDL-39376-master' of git://github.com/FMCorz/moodle
This commit is contained in:
commit
20ac3aa5e5
@ -111,9 +111,9 @@ if ($ADMIN->fulltree) {
|
||||
|
||||
$settings->add(new admin_setting_configtext('enrol_database/newcoursecategory', get_string('newcoursecategory', 'enrol_database'), '', ''));
|
||||
|
||||
if (!during_initial_install()) {
|
||||
$settings->add(new admin_setting_configselect('enrol_database/defaultcategory', get_string('defaultcategory', 'enrol_database'), get_string('defaultcategory_desc', 'enrol_database'), 1, make_categories_options()));
|
||||
}
|
||||
require_once($CFG->dirroot.'/enrol/database/settingslib.php');
|
||||
|
||||
$settings->add(new enrol_database_admin_setting_category('enrol_database/defaultcategory', get_string('defaultcategory', 'enrol_database'), get_string('defaultcategory_desc', 'enrol_database')));
|
||||
|
||||
$settings->add(new admin_setting_configtext('enrol_database/templatecourse', get_string('templatecourse', 'enrol_database'), get_string('templatecourse_desc', 'enrol_database'), ''));
|
||||
}
|
||||
|
46
enrol/database/settingslib.php
Normal file
46
enrol/database/settingslib.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Database enrolment plugin custom settings.
|
||||
*
|
||||
* @package enrol_database
|
||||
* @copyright 2013 Darko Miletic
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Class implements new specialized setting for course categories that are loaded
|
||||
* only when required
|
||||
* @author Darko Miletic
|
||||
*
|
||||
*/
|
||||
class enrol_database_admin_setting_category extends admin_setting_configselect {
|
||||
public function __construct($name, $visiblename, $description) {
|
||||
parent::__construct($name, $visiblename, $description, 1, null);
|
||||
}
|
||||
|
||||
public function load_choices() {
|
||||
if (is_array($this->choices)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$this->choices = make_categories_options();
|
||||
return true;
|
||||
}
|
||||
}
|
@ -94,10 +94,7 @@ if ($ADMIN->fulltree) {
|
||||
$settings->add(new admin_setting_heading('enrol_ldap_autocreation_settings', get_string('autocreation_settings', 'enrol_ldap'), ''));
|
||||
$options = $yesno;
|
||||
$settings->add(new admin_setting_configselect('enrol_ldap/autocreate', get_string('autocreate_key', 'enrol_ldap'), get_string('autocreate', 'enrol_ldap'), 0, $options));
|
||||
if (!during_initial_install()) {
|
||||
$options = make_categories_options();
|
||||
$settings->add(new admin_setting_configselect('enrol_ldap/category', get_string('category_key', 'enrol_ldap'), get_string('category', 'enrol_ldap'), key($options), $options));
|
||||
}
|
||||
$settings->add(new enrol_ldap_admin_setting_category('enrol_ldap/category', get_string('category_key', 'enrol_ldap'), get_string('category', 'enrol_ldap')));
|
||||
$settings->add(new admin_setting_configtext_trim_lower('enrol_ldap/template', get_string('template_key', 'enrol_ldap'), get_string('template', 'enrol_ldap'), ''));
|
||||
|
||||
//--- course update settings ---
|
||||
|
@ -193,3 +193,25 @@ class admin_setting_ldap_rolemapping extends admin_setting {
|
||||
$this->description, true, '', '', $query);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class implements new specialized setting for course categories that are loaded
|
||||
* only when required
|
||||
* @author Darko Miletic
|
||||
*
|
||||
*/
|
||||
class enrol_ldap_admin_setting_category extends admin_setting_configselect {
|
||||
public function __construct($name, $visiblename, $description) {
|
||||
parent::__construct($name, $visiblename, $description, null, null);
|
||||
}
|
||||
|
||||
public function load_choices() {
|
||||
if (is_array($this->choices)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$this->choices = make_categories_options();
|
||||
$this->defaultsetting = key($this->choices);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user