From 82d2a840023fdede501fce76c87401c7dd41197b Mon Sep 17 00:00:00 2001 From: Davo Smith Date: Mon, 21 May 2012 22:11:38 +0100 Subject: [PATCH] MDL-33074 Course drag and drop upload - fixed incorrect group mode button --- course/dnduploadlib.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/course/dnduploadlib.php b/course/dnduploadlib.php index 01eb3c119ac5d..c0ed633ac60cc 100644 --- a/course/dnduploadlib.php +++ b/course/dnduploadlib.php @@ -557,7 +557,13 @@ protected function create_course_module() { } // The following are used inside some few core functions, so may as well set them here. $this->cm->coursemodule = $this->cm->id; - $this->cm->groupmodelink = (!$this->course->groupmodeforce); + $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; + } } /** @@ -619,6 +625,8 @@ protected function finish_setup_course_module($instanceid) { throw new moodle_exception('errorcreatingactivity', 'moodle', '', $this->module->name); } $mod = $info->cms[$this->cm->id]; + $mod->groupmodelink = $this->cm->groupmodelink; + $mod->groupmode = $this->cm->groupmode; // Trigger mod_created event with information about this module. $eventdata = new stdClass(); @@ -636,12 +644,6 @@ protected function finish_setup_course_module($instanceid) { "view.php?id=$mod->id", "$instanceid", $mod->id); - if ($this->cm->groupmodelink && plugin_supports('mod', $mod->modname, FEATURE_GROUPS, 0)) { - $mod->groupmodelink = $this->cm->groupmodelink; - } else { - $mod->groupmodelink = false; - } - $this->send_response($mod); }