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:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user