--- lib.php 2010-12-11 04:02:13.000000000 +1100 +++ lib.php 2011-05-05 12:29:31.000000000 +1000 @@ -156,48 +156,6 @@ fix_course_sortorder(); } // end of if(file_open) for first pass - /* - - - SECOND PASS REMOVED - Since the IMS specification v1.1 insists that "memberships" should come last, - and since vendors seem to have done this anyway (even with 1.0), - we can sensibly perform the import in one fell swoop. - - - // SECOND PASS: Now go through the file and process the membership entries - $this->xmlcache = ''; - if (($fh = fopen($filename, "r")) != false) { - $line = 0; - while ((!feof($fh)) && $this->continueprocessing) { - $line++; - $curline = fgets($fh); - $this->xmlcache .= $curline; // Add a line onto the XML cache - - while(true){ - // Must always make sure to remove tags from cache so they don't clog up our memory - if($tagcontents = $this->full_tag_found_in_cache('group', $curline)){ - $this->remove_tag_from_cache('group'); - }elseif($tagcontents = $this->full_tag_found_in_cache('person', $curline)){ - $this->remove_tag_from_cache('person'); - }elseif($tagcontents = $this->full_tag_found_in_cache('membership', $curline)){ - $this->process_membership_tag($tagcontents); - $this->remove_tag_from_cache('membership'); - }elseif($tagcontents = $this->full_tag_found_in_cache('comments', $curline)){ - $this->remove_tag_from_cache('comments'); - }elseif($tagcontents = $this->full_tag_found_in_cache('properties', $curline)){ - $this->remove_tag_from_cache('properties'); - }else{ - break; - } - } - } // end of while loop - fclose($fh); - } // end of if(file_open) for second pass - - - */ - $timeelapsed = time() - $starttime; $this->log_line('Process has completed. Time taken: '.$timeelapsed.' seconds.'); @@ -318,6 +276,9 @@ if(preg_match('{.*?(.*?).*?}is', $tagcontents, $matches)){ $group->description = trim($matches[1]); } + if(preg_match('{.*?(.*?).*?}is', $tagcontents, $matches)){ + $group->description = trim($matches[1]); + } if(preg_match('{.*?(.*?).*?}is', $tagcontents, $matches)){ $group->category = trim($matches[1]); } @@ -356,11 +317,13 @@ $this->log_line("Course $coursecode not found in Moodle's course idnumbers."); } else { // Create the (hidden) course(s) if not found + // Added following line, Load System Defaults + $courseconfig = get_config('moodlecourse'); $course = new stdClass(); $course->fullname = $group->description; $course->shortname = $coursecode; $course->idnumber = $coursecode; - $course->format = 'topics'; + $course->format = $courseconfig->format; $course->visible = 0; // Insert default names for teachers/students, from the current language $site = get_site(); @@ -388,7 +351,15 @@ } $course->timecreated = time(); $course->startdate = time(); - $course->numsections = 1; + //$course->numsections = 1; Blanked for system defaults below + //Use System Defaults - Added (Line 321 Approx) + $course->numsections = $courseconfig->numsections; + $course->hiddensections = $courseconfig->hiddensections; + $course->newsitems = $courseconfig->newsitems; + $course->showgrades = $courseconfig->showgrades; + $course->showreports = $courseconfig->showreports; + $course->maxbytes = $courseconfig->maxbytes; + // End System Defaults // Choose a sort order that puts us at the start of the list! $course->sortorder = 0;