/**
  * Creates the backup_schema_form instance for this stage
  *
  * @return backup_schema_form
  */
 protected function initialise_stage_form()
 {
     global $PAGE;
     if ($this->stageform === null) {
         $form = new restore_schema_form($this, $PAGE->url);
         $tasks = $this->ui->get_tasks();
         $content = '';
         $courseheading = false;
         foreach ($tasks as $task) {
             if (!$task instanceof restore_root_task) {
                 if (!$courseheading) {
                     // If we havn't already display a course heading to group nicely
                     $form->add_heading('coursesettings', get_string('coursesettings', 'backup'));
                     $courseheading = true;
                 }
                 // First add each setting
                 foreach ($task->get_settings() as $setting) {
                     $form->add_setting($setting, $task);
                 }
                 // The add all the dependencies
                 foreach ($task->get_settings() as $setting) {
                     $form->add_dependencies($setting);
                 }
             } else {
                 if ($this->ui->enforce_changed_dependencies()) {
                     // Only show these settings if dependencies changed them.
                     // Add a root settings heading to group nicely
                     $form->add_heading('rootsettings', get_string('rootsettings', 'backup'));
                     // Iterate all settings and add them to the form as a fixed
                     // setting. We only want schema settings to be editable
                     foreach ($task->get_settings() as $setting) {
                         if ($setting->get_name() != 'filename') {
                             $form->add_fixed_setting($setting, $task);
                         }
                     }
                 }
             }
         }
         $this->stageform = $form;
     }
     return $this->stageform;
 }