Skip to content

Commit

Permalink
mnet/enrolment MDL-21459 fixed a few small issues in admin/mnet/enrol…
Browse files Browse the repository at this point in the history
…ment
  • Loading branch information
Penny Leach committed Jan 28, 2010
1 parent 30ec3ee commit 72bb7e3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
13 changes: 10 additions & 3 deletions admin/mnet/enr_course_enrol.php
Expand Up @@ -100,7 +100,6 @@
}
}

$all_enrolled_usernames = '';
$timemodified = array();
/// List all the users (homed on this server) who are enrolled on the course
/// This will include mnet-enrolled users, and those who have enrolled
Expand Down Expand Up @@ -150,6 +149,16 @@

foreach($enrolledusers as $user) {

// if this user is not remotely enrolled....
if (!array_key_exists($user->username, $all_enrolled_users)) {
// check to see if we have a record of enrolment and delete it if it's there
if ( $user->wehaverecord) {
$DB->delete_record('mnet_enrol_assignments', array('id'=>$user->enrolid));
}
// and keep going
continue;
}

$dataobj = new stdClass();
$dataobj->userid = $user->id;
$dataobj->hostid = $mnet_peer->id;
Expand All @@ -163,8 +172,6 @@
} elseif (array_key_exists($user->username, $all_enrolled_users)) {
$dataobj->id = $user->enrolid;
$DB->update_record('mnet_enrol_assignments', $dataobj);
} elseif (is_array($all_enrolled_users) && count($all_enrolled_users)) {
$DB->delete_record('mnet_enrol_assignments', array('id'=>$user->enrolid));
}
}
unset($enrolledusers);
Expand Down
1 change: 1 addition & 0 deletions admin/mnet/enr_courses.php
Expand Up @@ -4,6 +4,7 @@

require_once(dirname(__FILE__) . "/../../config.php");
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->dirroot.'/mnet/lib.php');

if (!confirm_sesskey()) {
print_error('confirmsesskeybad', 'error');
Expand Down
1 change: 1 addition & 0 deletions admin/mnet/enr_hosts.php
Expand Up @@ -4,6 +4,7 @@

require_once(dirname(__FILE__) . "/../../config.php");
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->dirroot.'/mnet/lib.php');

admin_externalpage_setup('mnetenrol');

Expand Down

0 comments on commit 72bb7e3

Please sign in to comment.