Hi,
I'm trying to develop a new module and the problem I have is the following: when adding a new instance of the new module I have to edit two pages, and before I can edit the second one I need the new instance id. The instance id is provided by mod.php. Thus, between mod.html (first page form) and second.php (second page form) I have to go through mod.php and then redirect. But I can thing of no way of passing the instance id to second.php.
Is this a "bug" in mod.php? My solution has been to alter mod.php as shown below. But that would imply updating the core of moodle. Is there a way to do the same without modifying mod.php?
My solution has been to to set the session returnpage in mod/newmodule/mod.html
$SESSION->returnpage="../mod/newmodule/second.php";
and then add the module instance before redirection in course/mod.php
if (!empty($SESSION->returnpage)) {
$return = $SESSION->returnpage;
unset($SESSION->returnpage);
$return=$return . "?a=$mod->instance";
redirect($return);
} else {
redirect("view.php?id=$course->id");
}
therefore receiving the module instance in second.php through the parameter a.
Best,
Pau