MDL-33442 Course: actions bring you back where you came from

This commit is contained in:
Frederic Massart 2012-06-07 09:29:40 +08:00
parent 778121751d
commit 76055f5de4
6 changed files with 41 additions and 31 deletions

View file

@ -104,7 +104,8 @@ if (!empty($add)) {
echo $OUTPUT->confirm(
get_string('duplicateconfirm', 'core', $a),
new single_button(
new moodle_url('/course/modduplicate.php', array('cmid' => $cm->id, 'course' => $course->id)),
new moodle_url('/course/modduplicate.php', array(
'cmid' => $cm->id, 'course' => $course->id, 'sr' => $sectionreturn)),
get_string('continue'),
'post'),
new single_button(
@ -130,8 +131,7 @@ if (!empty($add)) {
if (!$confirm or !confirm_sesskey()) {
$fullmodulename = get_string('modulename', $cm->modname);
$optionsyes = array('confirm'=>1, 'delete'=>$cm->id, 'sesskey'=>sesskey());
$optionsno = array('id'=>$cm->course);
$optionsyes = array('confirm'=>1, 'delete'=>$cm->id, 'sesskey'=>sesskey(), 'sr' => $sectionreturn);
$strdeletecheck = get_string('deletecheck', '', $fullmodulename);
$strdeletecheckfull = get_string('deletecheckfull', '', "$fullmodulename '$cm->name'");
@ -145,7 +145,7 @@ if (!empty($add)) {
// print_simple_box_start('center', '60%', '#FFAAAA', 20, 'noticebox');
echo $OUTPUT->box_start('noticebox');
$formcontinue = new single_button(new moodle_url("$CFG->wwwroot/course/mod.php", $optionsyes), get_string('yes'));
$formcancel = new single_button(new moodle_url($return, $optionsno), get_string('no'), 'get');
$formcancel = new single_button($return, get_string('no'), 'get');
echo $OUTPUT->confirm($strdeletecheckfull, $formcontinue, $formcancel);
echo $OUTPUT->box_end();
echo $OUTPUT->footer();
@ -226,9 +226,11 @@ if ((!empty($movetosection) or !empty($moveto)) and confirm_sesskey()) {
moveto_module($cm, $section, $beforecm);
$sectionreturn = $USER->activitycopysectionreturn;
unset($USER->activitycopy);
unset($USER->activitycopycourse);
unset($USER->activitycopyname);
unset($USER->activitycopysectionreturn);
rebuild_course_cache($section->course);
@ -340,9 +342,10 @@ if ((!empty($movetosection) or !empty($moveto)) and confirm_sesskey()) {
$section = $DB->get_record('course_sections', array('id'=>$cm->section), '*', MUST_EXIST);
$USER->activitycopy = $copy;
$USER->activitycopycourse = $cm->course;
$USER->activitycopyname = $cm->name;
$USER->activitycopy = $copy;
$USER->activitycopycourse = $cm->course;
$USER->activitycopyname = $cm->name;
$USER->activitycopysectionreturn = $sectionreturn;
redirect(course_get_url($course, $sectionreturn));