fix for error in logic about where to redirect to after a cancel or after activity mod is successfully added or update.

This commit is contained in:
jamiesensei 2006-12-05 13:23:18 +00:00
parent 0befbdfd8f
commit 0b82f5b913
2 changed files with 4 additions and 8 deletions

View File

@ -47,7 +47,7 @@
if (file_exists("../mod/$modname/mod_form.php")) {
$id = required_param('id', PARAM_INT);
$section = required_param('section', PARAM_INT);
$returntomod = optional_param('return', PARAM_BOOL);
$returntomod = optional_param('return', 0, PARAM_BOOL);
redirect("modedit.php?add=$add&course=$id&section=$section&return=$returntomod");
}
@ -59,7 +59,7 @@
md.id = cm.module")){
error('Invalid course module id!');
}
$returntomod = optional_param('return', PARAM_BOOL);
$returntomod = optional_param('return', 0, PARAM_BOOL);
if (file_exists("../mod/$modname/mod_form.php")) {
redirect("modedit.php?update=$update&return=$returntomod");
}

View File

@ -40,7 +40,7 @@
$form->instance = "";
$form->coursemodule = "";
$form->add=$add;
$form->return=0;//must be false if this is an add, go back to course view
$form->return=0;//must be false if this is an add, go back to course view on cancel
if (!empty($type)) {
$form->type = $type;
}
@ -254,11 +254,7 @@
rebuild_course_cache($course->id);
if ($return && isset($cm)){
redirect("$CFG->wwwroot/mod/$module->name/view.php?id=$cm->id");
} else {
redirect("view.php?id=$course->id#section-".$cousesection);
}
redirect("$CFG->wwwroot/mod/$module->name/view.php?id=$fromform->coursemodule");
exit;
}else{