Permalink
Browse files

Merge branch 'w51_MDL-30687_m22_ldapnewcourse' of git://github.com/sk…

…odak/moodle into MOODLE_22_STABLE
  • Loading branch information...
2 parents 02af565 + 8d7ec82 commit 6aabb69f9e593aa3e1c18ad9379f04dadb828058 Sam Hemelryk committed Dec 12, 2011
Showing with 21 additions and 3 deletions.
  1. +21 −3 enrol/ldap/lib.php
View
@@ -885,16 +885,34 @@ function create_course($course_ext, $skip_fix_course_sortorder=false) {
require_once("$CFG->dirroot/course/lib.php");
// Override defaults with template course
- $course = new stdClass();
+ $template = false;
if ($this->get_config('template')) {
- if($template = $DB->get_record('course', array('shortname'=>$this->get_config('template')))) {
+ if ($template = $DB->get_record('course', array('shortname'=>$this->get_config('template')))) {
unset($template->id); // So we are clear to reinsert the record
unset($template->fullname);
unset($template->shortname);
unset($template->idnumber);
- $course = $template;
}
}
+ if (!$template) {
+ $courseconfig = get_config('moodlecourse');
+ $template = new stdClass();
+ $template->summary = '';
+ $template->summaryformat = FORMAT_HTML;
+ $template->format = $courseconfig->format;
+ $template->numsections = $courseconfig->numsections;
+ $template->hiddensections = $courseconfig->hiddensections;
+ $template->newsitems = $courseconfig->newsitems;
+ $template->showgrades = $courseconfig->showgrades;
+ $template->showreports = $courseconfig->showreports;
+ $template->maxbytes = $courseconfig->maxbytes;
+ $template->groupmode = $courseconfig->groupmode;
+ $template->groupmodeforce = $courseconfig->groupmodeforce;
+ $template->visible = $courseconfig->visible;
+ $template->lang = $courseconfig->lang;
+ $template->groupmodeforce = $courseconfig->groupmodeforce;
+ }
+ $course = $template;
$course->category = $this->get_config('category');
if (!$DB->record_exists('course_categories', array('id'=>$this->get_config('category')))) {

0 comments on commit 6aabb69

Please sign in to comment.