Skip to content

Commit c48758d

Browse files
committed
#13: Error: out_as_local_url called on a non-local URL
1 parent a02b182 commit c48758d

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

mod_form.php

+12-3
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,7 @@ public function completion_rule_enabled($data) {
632632
* Only available on moodleform_mod.
633633
*
634634
* @param stdClass $data the form data to be modified.
635+
* @throws moodle_exception
635636
*/
636637
public function data_postprocessing($data) {
637638
parent::data_postprocessing($data);
@@ -670,15 +671,23 @@ public function data_postprocessing($data) {
670671
if ($data->exescormtype === EXESCORM_TYPE_EXESCORMNET ) {
671672
if (! isset($data->showgradingmanagement)) {
672673
if (isset($data->exebutton)) {
673-
// Editar y visualizar.
674+
// Edit and view.
674675
$returnto = new moodle_url("/mod/exescorm/view.php", ['id' => $data->coursemodule, 'forceview' => 1]);
675676
} else if (isset($data->exebutton2)) {
676-
// Editar y volver al curso.
677+
// Edit and return to the course.
677678
$returnto = course_get_url($data->course, $data->coursesection ?? null, ['sr' => $data->sr]);
678679
} else {
679-
// Fallback por si no se pulsó ningún botón personalizado.
680+
// Fallback in case no custom button was pressed.
680681
$returnto = course_get_url($data->course);
681682
}
683+
684+
// If for some reason the return URL is the qualifier, we force redirection to the activity.
685+
if (strpos($returnto->out(false), '/grade/report/') !== false) {
686+
$returnto = new moodle_url("/mod/exescorm/view.php", [
687+
'id' => $data->coursemodule,
688+
'forceview' => 1
689+
]);
690+
}
682691
// Set this becouse modedit.php expects it.
683692
$data->submitbutton = true;
684693
// If send template is true, we'll always make an edition. On new activities,

0 commit comments

Comments
 (0)