MDL-57791 analytics: Replace settings by get_archetype_roles

This commit is contained in:
David Monllao 2017-06-13 12:14:26 +02:00
parent f39cebbb3c
commit 3a217fc394
8 changed files with 19 additions and 59 deletions

View file

@ -78,29 +78,5 @@ if ($hassiteconfig) {
$defaultmodeloutputdir = rtrim($CFG->dataroot, '/') . DIRECTORY_SEPARATOR . 'models';
$settings->add(new admin_setting_configdirectory('analytics/modeloutputdir', new lang_string('modeloutputdir', 'analytics'),
new lang_string('modeloutputdirinfo', 'analytics'), $defaultmodeloutputdir));
$studentdefaultroles = [];
$teacherdefaultroles = [];
// Student and teacher roles.
$allroles = role_fix_names(get_all_roles());
$rolechoices = [];
foreach ($allroles as $role) {
$rolechoices[$role->id] = $role->localname;
if ($role->shortname == 'student') {
$studentdefaultroles[] = $role->id;
} else if ($role->shortname == 'teacher') {
$teacherdefaultroles[] = $role->id;
} else if ($role->shortname == 'editingteacher') {
$teacherdefaultroles[] = $role->id;
}
}
$settings->add(new admin_setting_configmultiselect('analytics/teacherroles', new lang_string('teacherroles', 'analytics'),
'', $teacherdefaultroles, $rolechoices));
$settings->add(new admin_setting_configmultiselect('analytics/studentroles', new lang_string('studentroles', 'analytics'),
'', $studentdefaultroles, $rolechoices));
}
}