Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Some small changes to IMS Enterprise enrol - improved some logic and …

…logging
  • Loading branch information...
commit 395ec1ed68d52dc6d861c5c0fc7933f32028e7dc 1 parent 4369f73
danstowell authored
View
4 enrol/imsenterprise/config.html
@@ -8,14 +8,14 @@
<tr valign="top">
<td align="right"><?php print_string("location", "enrol_imsenterprise") ?>:</td>
<td colspan="2">
- <input type="text" size="50" name="enrol_imsfilelocation" value="<?php echo $frm->enrol_imsfilelocation ?>" />
+ <input type="text" size="50" name="enrol_imsfilelocation" value="<?php echo ($frm->enrol_imsfilelocation ? $frm->enrol_imsfilelocation : '') ?>" />
</td>
</tr>
<tr valign="top">
<td align="right"><?php print_string("logtolocation", "enrol_imsenterprise") ?>:</td>
<td colspan="2">
- <input type="text" size="50" name="enrol_logtolocation" value="<?php echo $frm->enrol_logtolocation ?>" />
+ <input type="text" size="50" name="enrol_logtolocation" value="<?php echo ($frm->enrol_logtolocation ? $frm->enrol_logtolocation : '') ?>" />
</td>
</tr>
View
12 enrol/imsenterprise/enrol.php
@@ -143,7 +143,8 @@ function process_config($config) {
}
set_config('enrol_imsrestricttarget', $config->enrol_imsrestricttarget);
-
+ set_config('enrol_ims_prev_md5', ''); // Forget the MD5 - to force re-processing if we change the config setting
+ set_config('enrol_ims_prev_time', ''); // Ditto
return true;
}
@@ -418,7 +419,10 @@ function process_group_tag($tagcontents){
// Third, check if the course(s) exist
foreach($group->coursecode as $coursecode){
$coursecode = trim($coursecode);
- if(!get_field('course', 'id', 'idnumber', $coursecode) && $CFG->enrol_createnewcourses){
+ if(!get_field('course', 'id', 'idnumber', $coursecode)) {
+ if(!$CFG->enrol_createnewcourses) {
+ $this->log_line("Course $coursecode not found in Moodle's course idnumbers.");
+ } else {
// Create the (hidden) course(s) if not found
$course->fullname = $group->description;
$course->shortname = $coursecode;
@@ -495,6 +499,7 @@ function process_group_tag($tagcontents){
}else{
$this->log_line('Failed to create course '.$coursecode.' in Moodle');
}
+ }
}elseif($recstatus==3 && ($courseid = get_field('course', 'id', 'idnumber', $coursecode))){
// If course does exist, but recstatus==3 (delete), then set the course as hidden
set_field('course', 'visible', '0', 'id', $courseid);
@@ -680,6 +685,7 @@ function process_membership_tag($tagcontents){
$memberstoreobj->course = $ship->courseid;
$memberstoreobj->time = time();
$memberstoreobj->timemodified = time();
+ if($memberstoreobj->userid)
switch($member->roletype){
case '01':
case 'Student':
@@ -736,7 +742,7 @@ function process_membership_tag($tagcontents){
if(intval($member->status) == 1){
// Enrol
if (! add_teacher($memberstoreobj->userid, $memberstoreobj->course, 0, '', $timeframe->begin, $timeframe->end, 'imsenterprise')) {
- $this->log_line('Error adding teacher to course');
+ $this->log_line("Error adding teacher $memberstoreobj->userid to course");
}else{
$teacherstally++;
}
View
2  enrol/imsenterprise/examples/example.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
+<?xml version="1.0" encoding="ISO-8859-1"?>
<enterprise>
<properties lang="EN"><!-- c -->
<datasource>sits:vision</datasource>
Please sign in to comment.
Something went wrong with that request. Please try again.