backup MDL-22142 P17 - backup_ui class now calls backup_controller::process_ui_event on init and after changes to ensure validity

This commit is contained in:
Sam Hemelryk
2010-05-02 03:25:18 +00:00
parent 81623fad7a
commit 232d4fac42
2 changed files with 10 additions and 2 deletions
+1 -1
View File
@@ -110,7 +110,7 @@ abstract class backup_moodleform extends moodleform {
* @return bool
*/
function add_setting(backup_setting $setting, backup_task $task=null) {
if ($setting->get_status() == backup_setting::NOT_LOCKED && $setting->get_visibility() != backup_setting::VISIBLE) {
if ($setting->get_status() == backup_setting::NOT_LOCKED && $setting->get_visibility() == backup_setting::VISIBLE) {
// First add the formatting for this setting
$this->add_html_formatting($setting);
// The call the add method with the get_element_properties array
+9 -1
View File
@@ -76,6 +76,8 @@ class backup_ui {
$this->controller = $controller;
$this->progress = self::PROGRESS_INTIAL;
$this->stage = $this->initialise_stage();
// Process UI event before to be safe
$this->controller->process_ui_event();
}
/**
* Intialises what ever stage is requested. If none are requested we check
@@ -165,7 +167,11 @@ class backup_ui {
throw new backup_ui_exception('backupuialreadyprocessed');
}
$this->progress = self::PROGRESS_PROCESSED;
return $this->stage->process();
// Process the stage
$processoutcome = $this->stage->process();
// Process UI event after to check changes are valid
$this->controller->process_ui_event();
return $processoutcome;
}
/**
* Saves the backup controller.
@@ -181,6 +187,8 @@ class backup_ui {
$this->progress = self::PROGRESS_SAVED;
// First enforce dependencies
$this->enforce_dependencies();
// Process UI event after to check any changes are valid
$this->controller->process_ui_event();
// Save the controller
$this->controller->save_controller();
return true;