mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
When updating we don't always want to change visibility and groupmode bug 2561
This commit is contained in:
parent
1c66bf597d
commit
9df665e7bf
1 changed files with 14 additions and 18 deletions
|
@ -51,8 +51,10 @@
|
|||
switch ($mod->mode) {
|
||||
case "update":
|
||||
|
||||
if (trim($mod->name) == '') {
|
||||
unset($mod->name);
|
||||
if (isset($mod->name)) {
|
||||
if (trim($mod->name) == '') {
|
||||
unset($mod->name);
|
||||
}
|
||||
}
|
||||
|
||||
$return = $updateinstancefunction($mod);
|
||||
|
@ -64,23 +66,19 @@
|
|||
}
|
||||
error("Could not update the $mod->modulename", "view.php?id=$course->id");
|
||||
}
|
||||
|
||||
if (isset($mod->visible)) {
|
||||
set_coursemodule_visible($mod->coursemodule, $mod->visible);
|
||||
}
|
||||
|
||||
if (isset($mod->groupmode)) {
|
||||
set_coursemodule_groupmode($mod->coursemodule, $mod->groupmode);
|
||||
}
|
||||
|
||||
if (is_string($return)) {
|
||||
error($return, "view.php?id=$course->id");
|
||||
}
|
||||
|
||||
// to deal with pre-1.5 modules
|
||||
if (!isset($mod->visible)) {
|
||||
//We get the section's visible field status
|
||||
$mod->visible = get_field("course_sections","visible","id",$sectionid);
|
||||
}
|
||||
if (!isset($mod->groupmode)) {
|
||||
$cm = get_record('course_modules', 'id', $mod->coursemodule);
|
||||
$mod->groupmode = groupmode($course, $cm);
|
||||
}
|
||||
|
||||
set_coursemodule_visible($mod->coursemodule, $mod->visible);
|
||||
set_coursemodule_groupmode($mod->coursemodule, $mod->groupmode);
|
||||
|
||||
if (isset($mod->redirect)) {
|
||||
$SESSION->returnpage = $mod->redirecturl;
|
||||
} else {
|
||||
|
@ -134,9 +132,7 @@
|
|||
error("Could not update the course module with the correct section");
|
||||
}
|
||||
|
||||
// to deal with pre-1.5 modules
|
||||
if (!isset($mod->visible)) {
|
||||
//We get the section's visible field status
|
||||
if (!isset($mod->visible)) { // We get the section's visible field status
|
||||
$mod->visible = get_field("course_sections","visible","id",$sectionid);
|
||||
}
|
||||
// make sure visibility is set correctly (in particular in calendar)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue