]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-8165 - Admin setting to control which roles are synced to metacourses
authortjhunt <tjhunt>
Fri, 12 Jan 2007 18:03:36 +0000 (18:03 +0000)
committertjhunt <tjhunt>
Fri, 12 Jan 2007 18:03:36 +0000 (18:03 +0000)
admin/settings/users.php
lang/en_utf8/admin.php
lib/moodlelib.php

index ef49ac922b42c559ffb0a7ee743bf1fdf1f85395..2332faa9dcc5a84066cc5b6b4b6d8a015223f3e6 100644 (file)
@@ -43,6 +43,10 @@ $temp->add(new admin_setting_configselect('defaultcourseroleid', get_string('def
               get_string('configdefaultcourseroleid', 'admin'), $studentrole->id, $assignableroles));
 
 $temp->add(new admin_setting_configcheckbox('autologinguests', get_string('autologinguests', 'admin'), get_string('configautologinguests', 'admin'), 0));
+
+$temp->add(new admin_setting_configmultiselect('nonmetacoursesyncroleids', get_string('nonmetacoursesyncroleids', 'admin'),
+              get_string('confignonmetacoursesyncroleids', 'admin'), '', $assignableroles));
+
 //$temp->add(new admin_setting_configcheckbox('allusersaresitestudents', get_string('allusersaresitestudents', 'admin'), get_string('configallusersaresitestudents','admin'), 1));
 $temp->add(new admin_setting_configmultiselect('hiddenuserfields', get_string('hiddenuserfields', 'admin'),
            get_string('confighiddenuserfields', 'admin'), array(),
index 4e67aa2d61e318fc0bb5a1ebfc9de7ff73be431b..25f8855f8e3f7b1d23f7a03e4416e857be15a9fd 100644 (file)
@@ -125,6 +125,7 @@ $string['configmaxeditingtime'] = 'This specifies the amount of time people have
 $string['configmaxevents'] = 'Events to Lookahead';
 $string['configmessaging'] = 'Should the messaging system between site users be enabled?';
 $string['configmymoodleredirect'] = 'This setting forces redirects to /my on login for non-admins and replaces the top level site breadcrumb with /my';
+$string['confignonmetacoursesyncroleids'] = 'By default all enrolments from child courses are synchronised to metacourses. Roles that are selected here will not be included in the synchronisation process.';
 $string['confignoreplyaddress'] = 'Emails are sometimes sent out on behalf of a user (eg forum posts). The email address you specify here will be used as the \"From\" address in those cases when the recipients should not be able to reply directly to the user (eg when a user chooses to keep their address private).';
 $string['confignotifyloginfailures'] = 'If login failures have been recorded, email notifications can be sent out.  Who should see these notifications?';
 $string['confignotifyloginthreshold'] = 'If notifications about failed logins are active, how many failed login attempts by one user or one IP address is it worth notifying about?';
@@ -360,6 +361,7 @@ $string['nobookmarksforuser'] = 'You do not have any bookmarks.';
 $string['nolangupdateneeded'] = 'All your language packs are up to date, no update is needed';
 $string['nonewsettings'] = 'No new settings were added during this upgrade.';
 $string['nonexistentbookmark'] = 'The bookmark you requested does not exist.';
+$string['nonmetacoursesyncroleids'] = 'Roles that are not synchronised to metacourses';
 $string['noreplyaddress'] = 'No-reply address';
 $string['noresults'] = 'No results found.';
 $string['notifications'] = 'Notifications';
index 12f290212552385384d38150ad815442472b0bf4..c18904ea8e23b7b10bce2d88dd544dee96a8d450 100644 (file)
@@ -1990,6 +1990,13 @@ function sync_metacourse($course) {
         return false;
     }
 
+    // Get a list of roles that should not be synced.
+    if ($CFG->nonmetacoursesyncroleids) {
+        $roleexclusions = 'ra.roleid NOT IN (' . $CFG->nonmetacoursesyncroleids . ') AND';
+    } else { 
+        $roleexclusions = '';
+    }
+
     // Get the context of the metacourse.
     $context = get_context_instance(CONTEXT_COURSE, $course->id); // SITEID can not be a metacourse
 
@@ -2014,6 +2021,7 @@ function sync_metacourse($course) {
                 con.contextlevel = " . CONTEXT_COURSE . " AND
                 con.instanceid = cm.child_course AND
                 cm.parent_course = {$course->id} AND
+                $roleexclusions
                 NOT EXISTS (
                     SELECT 1 FROM
                         {$CFG->prefix}role_assignments ra2
@@ -2035,6 +2043,7 @@ function sync_metacourse($course) {
                 {$CFG->prefix}role_assignments ra
             WHERE
                 ra.contextid = {$context->id} AND
+                $roleexclusions
                 NOT EXISTS (
                     SELECT 1 FROM
                         {$CFG->prefix}role_assignments ra2,