MDL-26319 moved cancel_backup() from backup_ui to cancel_process() in base_ui and...
authorAparup Banerjee <aparup@moodle.com>
Wed, 6 Apr 2011 06:41:20 +0000 (14:41 +0800)
committerAparup Banerjee <aparup@moodle.com>
Thu, 7 Apr 2011 02:39:34 +0000 (10:39 +0800)
backup/util/ui/backup_ui.class.php
backup/util/ui/backup_ui_stage.class.php
backup/util/ui/base_ui.class.php
backup/util/ui/restore_ui_stage.class.php

index 70c7166..91c412f 100644 (file)
@@ -130,19 +130,7 @@ class backup_ui extends base_ui {
         }
         return $backupid;
     }
-    /**
-     * Cancels the current backup and redirects the user back to the relevant place
-     */
-    public function cancel_backup() {
-        global $PAGE;
-        // Determine the approriate URL to redirect the user to
-        if ($PAGE->context->contextlevel == CONTEXT_MODULE && $PAGE->cm !== null) {
-            $relevanturl = new moodle_url('/mod/'.$PAGE->cm->modname.'/view.php', array('id'=>$PAGE->cm->id));
-        } else {
-            $relevanturl = new moodle_url('/course/view.php', array('id'=>$PAGE->course->id));
-        }
-        redirect($relevanturl);
-    }
+
     /**
      * Gets an array of progress bar items that can be displayed through the backup renderer.
      * @return array Array of items for the progress bar
index a5bb1a7..0251449 100644 (file)
@@ -81,7 +81,7 @@ class backup_ui_stage_initial extends backup_ui_stage {
         $form = $this->initialise_stage_form();
 
         if ($form->is_cancelled()) {
-            $this->ui->cancel_backup();
+            $this->ui->cancel_process();
         }
 
         $data = $form->get_data();
@@ -180,7 +180,7 @@ class backup_ui_stage_schema extends backup_ui_stage {
         $form = $this->initialise_stage_form();
         // Check it wasn't cancelled
         if ($form->is_cancelled()) {
-            $this->ui->cancel_backup();
+            $this->ui->cancel_process();
         }
 
         // Check it has been submit
@@ -288,7 +288,7 @@ class backup_ui_stage_confirmation extends backup_ui_stage {
         $form = $this->initialise_stage_form();
         // Check it hasn't been cancelled
         if ($form->is_cancelled()) {
-            $this->ui->cancel_backup();
+            $this->ui->cancel_process();
         }
 
         $data = $form->get_data();
index e156120..7be6b04 100644 (file)
@@ -226,6 +226,21 @@ abstract class base_ui {
     public static function load_controller($uniqueid=false) {
         throw new coding_exception('load_controller() method needs to be overridden in each subclass of base_ui');
     }
+
+    /**
+     * Cancels the current backup/restore and redirects the user back to the relevant place
+     */
+    public function cancel_process() {
+        global $PAGE;
+        // Determine the appropriate URL to redirect the user to
+        if ($PAGE->context->contextlevel == CONTEXT_MODULE && $PAGE->cm !== null) {
+            $relevanturl = new moodle_url('/mod/'.$PAGE->cm->modname.'/view.php', array('id'=>$PAGE->cm->id));
+        } else {
+            $relevanturl = new moodle_url('/course/view.php', array('id'=>$PAGE->course->id));
+        }
+        redirect($relevanturl);
+    }
+
     /**
      * Gets an array of progress bar items that can be displayed through the backup renderer.
      * @return array Array of items for the progress bar
index 42b591d..8374fd5 100644 (file)
@@ -392,7 +392,7 @@ class restore_ui_stage_schema extends restore_ui_stage {
         $form = $this->initialise_stage_form();
         // Check it wasn't cancelled
         if ($form->is_cancelled()) {
-            $this->ui->cancel_backup();
+            $this->ui->cancel_process();
         }
 
         // Check it has been submit
@@ -500,7 +500,7 @@ class restore_ui_stage_review extends restore_ui_stage {
         $form = $this->initialise_stage_form();
         // Check it hasn't been cancelled
         if ($form->is_cancelled()) {
-            $this->ui->cancel_backup();
+            $this->ui->cancel_process();
         }
 
         $data = $form->get_data();