From 74f64f62bb2d59d1fb80e056da0e94e70d1421b5 Mon Sep 17 00:00:00 2001 From: Petr Skoda Date: Sun, 25 Jul 2010 17:33:14 +0000 Subject: [PATCH] MDL-22783 fixing default roles in ims settings --- enrol/imsenterprise/settings.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/enrol/imsenterprise/settings.php b/enrol/imsenterprise/settings.php index 5c76b76684..0722e1af07 100644 --- a/enrol/imsenterprise/settings.php +++ b/enrol/imsenterprise/settings.php @@ -55,13 +55,12 @@ $settings->add(new admin_setting_heading('enrol_imsenterprise_usersettings_roles', get_string('roles', 'enrol_imsenterprise'), get_string('imsrolesdescription', 'enrol_imsenterprise'))); if (!during_initial_install()) { - $sitecontext = get_context_instance(CONTEXT_SYSTEM); - $assignableroles = get_assignable_roles($sitecontext); + $coursecontext = get_context_instance(CONTEXT_COURSE, SITEID); + $assignableroles = get_assignable_roles($coursecontext); $assignableroles = array('0' => get_string('ignore', 'enrol_imsenterprise')) + $assignableroles; $imsroles = new imsenterprise_roles(); - foreach ($imsroles->get_imsroles() as $imsrolenum => $imsrolename) { - $settings->add(new admin_setting_configselect('enrol_imsenterprise/imsrolemap'.$imsrolenum, format_string('"'.$imsrolename.'" ('.$imsrolenum.')'), '', $imsroles->determine_default_rolemapping($imsrolenum), $assignableroles)); + $settings->add(new admin_setting_configselect('enrol_imsenterprise/imsrolemap'.$imsrolenum, format_string('"'.$imsrolename.'" ('.$imsrolenum.')'), '', (int)$imsroles->determine_default_rolemapping($imsrolenum), $assignableroles)); } }