瀏覽代碼

Changed redirection after submission either completed or cancelled to a moodle url built from full path to view.php
instead of relative path from mod base folder.

Bernardo 2 年之前
父節點
當前提交
ffd0b9a5cf
共有 1 個文件被更改,包括 4 次插入2 次删除
  1. 4 2
      forms/submission/submission.php

+ 4 - 2
forms/submission/submission.php

@@ -80,7 +80,8 @@ $mform = new mod_gradeimporter_submission_form(null, array('submission' => $entr
 
 if ($mform->is_cancelled()) {
   // Handle form cancel operation, if cancel button is present on form
-  redirect("view.php?id=$cm->id&edit=1");
+  $viewurl = new moodle_url('/mod/gradeimporter/view.php', ['id' => $cm->id, 'edit' => 1]);
+  redirect($viewurl);
 } else if ($formdata = $mform->get_data()) {
 
   validate_formdata($formdata);
@@ -94,7 +95,8 @@ if ($mform->is_cancelled()) {
 
   store_files($context, $cm, $entry);
   // When complete redirect to view.php
-  redirect("view.php?id=$cm->id&edit=1");
+  $viewurl = new moodle_url('/mod/gradeimporter/view.php', ['id' => $cm->id, 'edit' => 1]);
+  redirect($viewurl);
 
 } else {
   // This branch is executed if the form is submitted but the data doesn't validate and the form should be redisplayed