Permalink
Browse files

MDL-28705 enrol_imsenterprise Adjust mapping of names for ims groups

  • Loading branch information...
1 parent 8ccaa29 commit b1cabb40eb672e57024b8086bf222c805384f96f @acspike acspike committed with dmonllao May 18, 2011
Showing with 15 additions and 13 deletions.
  1. +15 −13 enrol/imsenterprise/lib.php
@@ -315,15 +315,17 @@ function process_group_tag($tagcontents) {
if (preg_match('{<sourcedid>.*?<id>(.+?)</id>.*?</sourcedid>}is', $tagcontents, $matches)) {
$group->coursecode = trim($matches[1]);
}
- if (preg_match('{<description>.*?<long>(.*?)</long>.*?</description>}is', $tagcontents, $matches)){
- $group->description = trim($matches[1]);
+
+ if (preg_match('{<description>.*?<long>(.*?)</long>.*?</description>}is', $tagcontents, $matches)) {
+ $group->longname = trim($matches[1]);
}
if (preg_match('{<description>.*?<short>(.*?)</short>.*?</description>}is', $tagcontents, $matches)) {
- $group->shortName = trim($matches[1]);
+ $group->shortname = trim($matches[1]);
}
if (preg_match('{<description>.*?<full>(.*?)</full>.*?</description>}is', $tagcontents, $matches)) {
- $group->fulldescription = trim($matches[1]);
+ $group->full = trim($matches[1]);
}
+
if (preg_match('{<org>.*?<orgunit>(.*?)</orgunit>.*?</org>}is', $tagcontents, $matches)) {
$group->category = trim($matches[1]);
}
@@ -362,26 +364,26 @@ function process_group_tag($tagcontents) {
$this->log_line("Course $coursecode not found in Moodle's course idnumbers.");
} else {
// Set shortname to description or description to shortname if one is set but not the other.
- $nodescription = !isset($group->description);
- $noshortname = !isset($group->shortName);
+ $nodescription = !isset($group->longname);
+ $noshortname = !isset($group->shortname);
if ( $nodescription && $noshortname) {
// If neither short nor long description are set let if fail
$this->log_line("Neither long nor short name are set for $coursecode");
} else if ($nodescription) {
// If short and ID exist, then give the long short's value, then give short the ID's value
- $group->description = $group->shortName;
- $group->shortName = $coursecode;
+ $group->longname = $group->shortname;
+ $group->shortname = $coursecode;
} else if ($noshortname) {
// If long and ID exist, then map long to long, then give short the ID's value.
- $group->shortName = $coursecode;
+ $group->shortname = $coursecode;
}
// Create the (hidden) course(s) if not found
$courseconfig = get_config('moodlecourse'); // Load Moodle Course shell defaults
$course = new stdClass();
- $course->fullname = $group->description;
- $course->shortname = $group->shortName;
- if (!empty($group->fulldescription)) {
- $course->summary = format_text($group->fulldescription, FORMAT_HTML);
+ $course->fullname = $group->longname;
+ $course->shortname = $group->shortname;
+ if (!empty($group->full)) {
+ $course->summary = format_text($group->full, FORMAT_HTML);
}
$course->idnumber = $coursecode;
$course->format = $courseconfig->format;

0 comments on commit b1cabb4

Please sign in to comment.