# This patch file was generated by NetBeans IDE
# This patch can be applied using context Tools: Apply Diff Patch action on respective folder.
# It uses platform neutral UTF-8 encoding.
# Above lines and this line are ignored by the patching process.
Index: moodle/backup/util/ui/backup_moodleform.class.php
--- moodle/backup/util/ui/backup_moodleform.class.php Base (1.9)
+++ moodle/backup/util/ui/backup_moodleform.class.php Locally Modified (Based On 1.9)
@@ -78,13 +78,18 @@
         $mform = $this->_form;
         $stage = $mform->addElement('hidden', 'stage', $this->uistage->get_stage());
         $stage = $mform->addElement('hidden', 'backup', $this->uistage->get_backupid());
+        $params = $this->uistage->get_params();
+        if (is_array($params) && count($params) > 0) {
+            foreach ($params as $name=>$value) {
+                $stage = $mform->addElement('hidden', $name, $value);
     }
+        }
+    }
     /**
      * Definition applied after the data is organised.. why's it here? because I want
      * to add elements on the fly.
      */
     function definition_after_data() {
-
\ No newline at end of file
         $buttonarray=array();
         if ($this->uistage->get_stage() > backup_ui::STAGE_INITIAL) {
             $buttonarray[] = $this->_form->createElement('submit', 'previous', get_string('previousstage','backup'));
Index: moodle/backup/util/ui/backup_ui.class.php
--- moodle/backup/util/ui/backup_ui.class.php Base (1.5)
+++ moodle/backup/util/ui/backup_ui.class.php Locally Modified (Based On 1.5)
@@ -73,10 +73,10 @@
      * Yay for constructors
      * @param backup_controller $controller
      */
-    public function __construct(backup_controller $controller) {
+    public function __construct(backup_controller $controller, array $params=null) {
         $this->controller = $controller;
         $this->progress = self::PROGRESS_INTIAL;
-        $this->stage = $this->initialise_stage();
+        $this->stage = $this->initialise_stage(null, $params);
         // Process UI event before to be safe
         $this->controller->process_ui_event();
     }
@@ -87,22 +87,22 @@
      * @param int|null $stage The desired stage to intialise or null for the default
      * @return backup_ui_stage_initial|backup_ui_stage_schema|backup_ui_stage_confirmation|backup_ui_stage_final
      */
-    protected function initialise_stage($stage = null) {
+    protected function initialise_stage($stage = null, array $params=null) {
         if ($stage == null) {
             $stage = optional_param('stage', self::STAGE_INITIAL, PARAM_INT);
         }
         switch ($stage) {
             case backup_ui::STAGE_INITIAL:
-                $stage = new backup_ui_stage_initial($this);
+                $stage = new backup_ui_stage_initial($this, $params);
                 break;
             case backup_ui::STAGE_SCHEMA:
-                $stage = new backup_ui_stage_schema($this);
+                $stage = new backup_ui_stage_schema($this, $params);
                 break;
             case backup_ui::STAGE_CONFIRMATION:
-                $stage = new backup_ui_stage_confirmation($this);
+                $stage = new backup_ui_stage_confirmation($this, $params);
                 break;
             case backup_ui::STAGE_FINAL:
-                $stage = new backup_ui_stage_final($this);
+                $stage = new backup_ui_stage_final($this, $params);
                 break;
             default:
                 $stage = false;
@@ -121,7 +121,7 @@
         $this->progress = self::PROGRESS_PROCESSED;
 
         if (optional_param('previous', false, PARAM_BOOL) && $this->stage->get_stage() > self::STAGE_INITIAL) {
-            $this->stage = $this->initialise_stage($this->stage->get_prev_stage());
+            $this->stage = $this->initialise_stage($this->stage->get_prev_stage(), $this->stage->get_params());
             return false;
         }
 
@@ -129,7 +129,7 @@
         $processoutcome = $this->stage->process();
 
         if ($processoutcome !== false) {
-            $this->stage = $this->initialise_stage($this->stage->get_next_stage());
+            $this->stage = $this->initialise_stage($this->stage->get_next_stage(), $this->stage->get_params());
         }
 
         // Process UI event after to check changes are valid
@@ -214,7 +214,7 @@
         $this->progress = self::PROGRESS_EXECUTED;
         $this->controller->finish_ui();
         $this->controller->execute_plan();
-        $this->stage = new backup_ui_stage_complete($this, $this->controller->get_results());
\ No newline at end of file
+        $this->stage = new backup_ui_stage_complete($this, $this->stage->get_params(), $this->controller->get_results());
\ No newline at end of file
         return true;
     }
     /**
Index: moodle/backup/util/ui/backup_ui_stage.class.php
--- moodle/backup/util/ui/backup_ui_stage.class.php Base (1.4)
+++ moodle/backup/util/ui/backup_ui_stage.class.php Locally Modified (Based On 1.4)
@@ -55,13 +55,25 @@
      */
     protected $stageform = null;
     /**
+     * Custom form params that will be added as hidden inputs
+     */
+    protected $params = null;
+    /**
      *
      * @param backup_ui $ui
      */
-    public function __construct(backup_ui $ui) {
+    public function __construct(backup_ui $ui, array $params=null) {
         $this->ui = $ui;
+        $this->params = $params;
     }
     /**
+     * Returns the custom params for this stage
+     * @return array|null
+     */
+    final public function get_params() {
+        return $this->params;
+    }
+    /**
      * The current stage
      * @return int
      */
@@ -140,9 +152,9 @@
      * Initial backup stage constructor
      * @param backup_ui $ui
      */
-    public function __construct(backup_ui $ui) {
+    public function __construct(backup_ui $ui, array $params=null) {
         $this->stage = backup_ui::STAGE_INITIAL;
-        parent::__construct($ui);
+        parent::__construct($ui, $params);
     }
 
     /**
@@ -240,9 +252,9 @@
      * Schema stage constructor
      * @param backup_moodleform $ui
      */
-    public function __construct(backup_ui $ui) {
+    public function __construct(backup_ui $ui, array $params=null) {
         $this->stage = backup_ui::STAGE_SCHEMA;
-        parent::__construct($ui);
+        parent::__construct($ui, $params);
     }
     /**
      * Processes the schema stage
@@ -348,9 +360,9 @@
      * Constructs the stage
      * @param backup_ui $ui
      */
-    public function __construct($ui) {
+    public function __construct($ui, array $params=null) {
         $this->stage = backup_ui::STAGE_CONFIRMATION;
-        parent::__construct($ui);
+        parent::__construct($ui, $params);
     }
     /**
      * Processes the confirmation stage
@@ -460,9 +472,9 @@
      * Constructs the final stage
      * @param backup_ui $ui
      */
-    public function __construct(backup_ui $ui) {
+    public function __construct(backup_ui $ui, array $params=null) {
         $this->stage = backup_ui::STAGE_FINAL;
-        parent::__construct($ui);
+        parent::__construct($ui, $params);
     }
     /**
      * Processes the final stage.
@@ -504,11 +516,12 @@
     /**
      * Constructs the complete backup stage
      * @param backup_ui $ui
+     * @param array|null $params
      * @param array $results
      */
-    public function __construct(backup_ui $ui, $results) {
+    public function __construct(backup_ui $ui, array $params=null, array $results=null) {
         $this->results = $results;
-        parent::__construct($ui);
+        parent::__construct($ui, $params);
         $this->stage = backup_ui::STAGE_COMPLETE;
     }
     /**
