MDL-26319 moved cancel_backup() from backup_ui to cancel_process() in base_ui and renamed callers. fix for method inheritance in restore_ui.

This commit is contained in:
Aparup Banerjee
2011-04-07 10:39:34 +08:00
parent 6b14adf210
commit ca3617c513
4 changed files with 21 additions and 18 deletions
+1 -13
View 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
+3 -3
View 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();
+15
View 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
+2 -2
View 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();