MDL-29596 use optgroups to highlight enabled auth plugins

This commit is contained in:
Petr Škoda 2013-01-13 16:52:05 +01:00
parent ca48fe5f97
commit c5772ede5b

View File

@ -47,11 +47,17 @@ class user_editadvanced_form extends moodleform {
$mform->setType('username', PARAM_RAW);
$auths = get_plugin_list('auth');
$auth_options = array();
$enabled = get_string('pluginenabled', 'core_plugin');
$disabled = get_string('plugindisabled', 'core_plugin');
$auth_options = array($enabled=>array(), $disabled=>array());
foreach ($auths as $auth => $unused) {
$auth_options[$auth] = get_string('pluginname', "auth_{$auth}");
if (is_enabled_auth($auth)) {
$auth_options[$enabled][$auth] = get_string('pluginname', "auth_{$auth}");
} else {
$auth_options[$disabled][$auth] = get_string('pluginname', "auth_{$auth}");
}
}
$mform->addElement('select', 'auth', get_string('chooseauthmethod','auth'), $auth_options);
$mform->addElement('selectgroups', 'auth', get_string('chooseauthmethod','auth'), $auth_options);
$mform->addHelpButton('auth', 'chooseauthmethod', 'auth');
$mform->addElement('advcheckbox', 'suspended', get_string('suspended','auth'));