Línea 24... |
Línea 24... |
24 |
*/
|
24 |
*/
|
Línea 25... |
Línea 25... |
25 |
|
25 |
|
26 |
defined('MOODLE_INTERNAL') || die();
|
26 |
defined('MOODLE_INTERNAL') || die();
|
Línea -... |
Línea 27... |
- |
|
27 |
require_once(__DIR__ . '/../../../../../cohort/lib.php');
|
- |
|
28 |
|
- |
|
29 |
if ($ADMIN->fulltree) {
|
- |
|
30 |
$settings->add(new admin_setting_heading('factor_cohort/description', '',
|
- |
|
31 |
new lang_string('settings:description', 'factor_cohort')));
|
27 |
require_once(__DIR__ . '/../../../../../cohort/lib.php');
|
32 |
$settings->add(new admin_setting_heading('factor_cohort/settings', new lang_string('settings', 'moodle'), ''));
|
28 |
|
33 |
|
29 |
$enabled = new admin_setting_configcheckbox('factor_cohort/enabled',
|
34 |
$enabled = new admin_setting_configcheckbox('factor_cohort/enabled',
|
30 |
new lang_string('settings:enablefactor', 'tool_mfa'),
|
35 |
new lang_string('settings:enablefactor', 'tool_mfa'),
|
31 |
new lang_string('settings:enablefactor_help', 'tool_mfa'), 0);
|
36 |
new lang_string('settings:enablefactor_help', 'tool_mfa'), 0);
|
32 |
$enabled->set_updatedcallback(function () {
|
37 |
$enabled->set_updatedcallback(function () {
|
33 |
\tool_mfa\manager::do_factor_action('cohort', get_config('factor_cohort', 'enabled') ? 'enable' : 'disable');
|
38 |
\tool_mfa\manager::do_factor_action('cohort', get_config('factor_cohort', 'enabled') ? 'enable' : 'disable');
|
34 |
});
|
39 |
});
|
35 |
$settings->add($enabled);
|
40 |
$settings->add($enabled);
|
36 |
|
41 |
|
37 |
$settings->add(new admin_setting_configtext('factor_cohort/weight',
|
42 |
$settings->add(new admin_setting_configtext('factor_cohort/weight',
|
38 |
new lang_string('settings:weight', 'tool_mfa'),
|
43 |
new lang_string('settings:weight', 'tool_mfa'),
|
39 |
new lang_string('settings:weight_help', 'tool_mfa'), 100, PARAM_INT));
|
44 |
new lang_string('settings:weight_help', 'tool_mfa'), 100, PARAM_INT));
|
40 |
|
45 |
|
41 |
$cohorts = cohort_get_all_cohorts();
|
46 |
$cohorts = cohort_get_all_cohorts();
|
42 |
$choices = [];
|
47 |
$choices = [];
|
43 |
|
48 |
|
44 |
foreach ($cohorts['cohorts'] as $cohort) {
|
49 |
foreach ($cohorts['cohorts'] as $cohort) {
|
45 |
$choices[$cohort->id] = $cohort->name;
|
50 |
$choices[$cohort->id] = $cohort->name;
|
46 |
}
|
51 |
}
|
47 |
|
52 |
|
48 |
if (!empty($choices)) {
|
53 |
if (!empty($choices)) {
|
49 |
$settings->add(new admin_setting_configmultiselect('factor_cohort/cohorts',
|
54 |
$settings->add(new admin_setting_configmultiselect('factor_cohort/cohorts',
|
- |
|
55 |
new lang_string('settings:cohort', 'factor_cohort'),
|
50 |
new lang_string('settings:cohort', 'factor_cohort'),
|
56 |
new lang_string('settings:cohort_help', 'factor_cohort'), [], $choices));
|