Merge branch 'wip-MDL-42441-master' of git://github.com/marinaglancy/moodle
authorDan Poltawski <dan@moodle.com>
Tue, 29 Oct 2013 09:28:25 +0000 (17:28 +0800)
committerDan Poltawski <dan@moodle.com>
Tue, 29 Oct 2013 09:28:25 +0000 (17:28 +0800)
1  2 
course/dnduploadlib.php

diff --combined course/dnduploadlib.php
@@@ -599,8 -599,6 +599,8 @@@ class dndupload_ajax_processor 
       * Create the coursemodule to hold the file/content that has been uploaded
       */
      protected function create_course_module() {
 +        global $CFG;
 +
          if (!course_allowed_module($this->course, $this->module->name)) {
              throw new coding_exception("The module {$this->module->name} is not allowed to be added to this course");
          }
          // Set the correct default for completion tracking.
          $this->cm->completion = COMPLETION_TRACKING_NONE;
          $completion = new completion_info($this->course);
 -        if ($completion->is_enabled()) {
 +        if ($completion->is_enabled() && $CFG->completiondefault) {
              if (plugin_supports('mod', $this->cm->modulename, FEATURE_MODEDIT_DEFAULT_COMPLETION, true)) {
                  $this->cm->completion = COMPLETION_TRACKING_MANUAL;
              }
          if (!$this->cm->id = add_course_module($this->cm)) {
              throw new coding_exception("Unable to create the course module");
          }
-         // The following are used inside some few core functions, so may as well set them here.
          $this->cm->coursemodule = $this->cm->id;
-         $groupbuttons = ($this->course->groupmode or (!$this->course->groupmodeforce));
-         if ($groupbuttons and plugin_supports('mod', $this->module->name, FEATURE_GROUPS, 0)) {
-             $this->cm->groupmodelink = (!$this->course->groupmodeforce);
-         } else {
-             $this->cm->groupmodelink = false;
-             $this->cm->groupmode = false;
-         }
      }
  
      /**
              throw new moodle_exception('errorcreatingactivity', 'moodle', '', $this->module->name);
          }
          $mod = $info->get_cm($this->cm->id);
-         $mod->groupmodelink = $this->cm->groupmodelink;
-         $mod->groupmode = $this->cm->groupmode;
  
          // Trigger course module created event.
          $event = \core\event\course_module_created::create(array(