Skip to content
Browse files

MDL-33074 Course drag and drop upload - fixed incorrect group mode bu…

…tton
  • Loading branch information...
1 parent f729015 commit 82d2a840023fdede501fce76c87401c7dd41197b @davosmith davosmith committed
Showing with 9 additions and 7 deletions.
  1. +9 −7 course/dnduploadlib.php
View
16 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);
}

0 comments on commit 82d2a84

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