Browse Source

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 years ago
parent
commit
ffd0b9a5cf
1 changed files with 4 additions and 2 deletions
  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()) {
 if ($mform->is_cancelled()) {
   // Handle form cancel operation, if cancel button is present on form
   // 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()) {
 } else if ($formdata = $mform->get_data()) {
 
 
   validate_formdata($formdata);
   validate_formdata($formdata);
@@ -94,7 +95,8 @@ if ($mform->is_cancelled()) {
 
 
   store_files($context, $cm, $entry);
   store_files($context, $cm, $entry);
   // When complete redirect to view.php
   // 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 {
 } else {
   // This branch is executed if the form is submitted but the data doesn't validate and the form should be redisplayed
   // This branch is executed if the form is submitted but the data doesn't validate and the form should be redisplayed