Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

MDL-29290 fix spacing

  • Loading branch information...
commit 20d694ac59c30c4edba183a1c32ca710377a7cfc 1 parent cffd976
Dan Marsden danmarsden authored

Showing 1 changed file with 58 additions and 58 deletions. Show diff stats Hide diff stats

  1. +58 58 enrol/imsenterprise/lib.php
116 enrol/imsenterprise/lib.php
@@ -352,72 +352,72 @@ function process_group_tag($tagcontents){
352 352 foreach($group->coursecode as $coursecode){
353 353 $coursecode = trim($coursecode);
354 354 if(!$DB->get_field('course', 'id', array('idnumber'=>$coursecode))) {
355   - if(!$createnewcourses) {
356   - $this->log_line("Course $coursecode not found in Moodle's course idnumbers.");
357   - } else {
358   - // Create the (hidden) course(s) if not found
359   - $courseconfig = get_config('moodlecourse'); // Load Moodle Course shell defaults
360   - $course = new stdClass();
361   - $course->fullname = $group->description;
362   - $course->shortname = $coursecode;
363   - $course->idnumber = $coursecode;
364   - $course->format = $courseconfig->format;
365   - $course->visible = $courseconfig->visible;
366   - $course->numsections = $courseconfig->numsections;
367   - $course->hiddensections = $courseconfig->hiddensections;
368   - $course->newsitems = $courseconfig->newsitems;
369   - $course->showgrades = $courseconfig->showgrades;
370   - $course->showreports = $courseconfig->showreports;
371   - $course->maxbytes = $courseconfig->maxbytes;
372   - $course->groupmode = $courseconfig->groupmode;
373   - $course->groupmodeforce = $courseconfig->groupmodeforce;
374   - $course->enablecompletion = $courseconfig->enablecompletion;
375   - $course->completionstartonenrol = $courseconfig->completionstartonenrol;
376   - // Insert default names for teachers/students, from the current language
377   - $site = get_site();
378   -
379   - // Handle course categorisation (taken from the group.org.orgunit field if present)
380   - if(strlen($group->category)>0){
381   - // If the category is defined and exists in Moodle, we want to store it in that one
382   - if($catid = $DB->get_field('course_categories', 'id', array('name'=>$group->category))){
383   - $course->category = $catid;
384   - } elseif($createnewcategories) {
385   - // Else if we're allowed to create new categories, let's create this one
386   - $newcat = new stdClass();
387   - $newcat->name = $group->category;
388   - $newcat->visible = 0;
389   - $catid = $DB->insert_record('course_categories', $newcat);
390   - $course->category = $catid;
391   - $this->log_line("Created new (hidden) category, #$catid: $newcat->name");
  355 + if(!$createnewcourses) {
  356 + $this->log_line("Course $coursecode not found in Moodle's course idnumbers.");
  357 + } else {
  358 + // Create the (hidden) course(s) if not found
  359 + $courseconfig = get_config('moodlecourse'); // Load Moodle Course shell defaults
  360 + $course = new stdClass();
  361 + $course->fullname = $group->description;
  362 + $course->shortname = $coursecode;
  363 + $course->idnumber = $coursecode;
  364 + $course->format = $courseconfig->format;
  365 + $course->visible = $courseconfig->visible;
  366 + $course->numsections = $courseconfig->numsections;
  367 + $course->hiddensections = $courseconfig->hiddensections;
  368 + $course->newsitems = $courseconfig->newsitems;
  369 + $course->showgrades = $courseconfig->showgrades;
  370 + $course->showreports = $courseconfig->showreports;
  371 + $course->maxbytes = $courseconfig->maxbytes;
  372 + $course->groupmode = $courseconfig->groupmode;
  373 + $course->groupmodeforce = $courseconfig->groupmodeforce;
  374 + $course->enablecompletion = $courseconfig->enablecompletion;
  375 + $course->completionstartonenrol = $courseconfig->completionstartonenrol;
  376 + // Insert default names for teachers/students, from the current language
  377 + $site = get_site();
  378 +
  379 + // Handle course categorisation (taken from the group.org.orgunit field if present)
  380 + if(strlen($group->category)>0){
  381 + // If the category is defined and exists in Moodle, we want to store it in that one
  382 + if($catid = $DB->get_field('course_categories', 'id', array('name'=>$group->category))){
  383 + $course->category = $catid;
  384 + } elseif($createnewcategories) {
  385 + // Else if we're allowed to create new categories, let's create this one
  386 + $newcat = new stdClass();
  387 + $newcat->name = $group->category;
  388 + $newcat->visible = 0;
  389 + $catid = $DB->insert_record('course_categories', $newcat);
  390 + $course->category = $catid;
  391 + $this->log_line("Created new (hidden) category, #$catid: $newcat->name");
  392 + }else{
  393 + // If not found and not allowed to create, stick with default
  394 + $this->log_line('Category '.$group->category.' not found in Moodle database, so using default category instead.');
  395 + $course->category = 1;
  396 + }
392 397 }else{
393   - // If not found and not allowed to create, stick with default
394   - $this->log_line('Category '.$group->category.' not found in Moodle database, so using default category instead.');
395 398 $course->category = 1;
396 399 }
397   - }else{
398   - $course->category = 1;
399   - }
400   - $course->timecreated = time();
401   - $course->startdate = time();
402   - // Choose a sort order that puts us at the start of the list!
403   - $course->sortorder = 0;
  400 + $course->timecreated = time();
  401 + $course->startdate = time();
  402 + // Choose a sort order that puts us at the start of the list!
  403 + $course->sortorder = 0;
404 404
405   - $courseid = $DB->insert_record('course', $course);
  405 + $courseid = $DB->insert_record('course', $course);
406 406
407   - // Setup the blocks
408   - $course = $DB->get_record('course', array('id' => $courseid));
409   - blocks_add_default_course_blocks($course);
  407 + // Setup the blocks
  408 + $course = $DB->get_record('course', array('id' => $courseid));
  409 + blocks_add_default_course_blocks($course);
410 410
411   - $section = new stdClass();
412   - $section->course = $course->id; // Create a default section.
413   - $section->section = 0;
414   - $section->summaryformat = FORMAT_HTML;
415   - $section->id = $DB->insert_record("course_sections", $section);
  411 + $section = new stdClass();
  412 + $section->course = $course->id; // Create a default section.
  413 + $section->section = 0;
  414 + $section->summaryformat = FORMAT_HTML;
  415 + $section->id = $DB->insert_record("course_sections", $section);
416 416
417   - add_to_log(SITEID, "course", "new", "view.php?id=$course->id", "$course->fullname (ID $course->id)");
  417 + add_to_log(SITEID, "course", "new", "view.php?id=$course->id", "$course->fullname (ID $course->id)");
418 418
419   - $this->log_line("Created course $coursecode in Moodle (Moodle ID is $course->id)");
420   - }
  419 + $this->log_line("Created course $coursecode in Moodle (Moodle ID is $course->id)");
  420 + }
421 421 }elseif($recstatus==3 && ($courseid = $DB->get_field('course', 'id', array('idnumber'=>$coursecode)))){
422 422 // If course does exist, but recstatus==3 (delete), then set the course as hidden
423 423 $DB->set_field('course', 'visible', '0', array('id'=>$courseid));

0 comments on commit 20d694a

Please sign in to comment.
Something went wrong with that request. Please try again.