protected function initialise_stage_form() {
        global $PAGE;
        if ($this->stageform === null) {
            $form = new restore_settings_form($this, $PAGE->url);
            // Store as a variable so we can iterate by reference.
            $tasks = $this->ui->get_tasks();
            $headingprinted = false;
            // Iterate all tasks by reference.
            foreach ($tasks as &$task) {
                // For the initial stage we are only interested in the root settings.
                if ($task instanceof restore_root_task) {
                    if (!$headingprinted) {
                        $form->add_heading('rootsettings', get_string('restorerootsettings', 'backup'));
                        $headingprinted = true;
                    }
                    $settings = $task->get_settings();
                    // First add all settings except the filename setting.
                    foreach ($settings as &$setting) {
                        if ($setting->get_name() == 'filename') {
                            continue;
                        }
                        $form->add_setting($setting, $task);
                    }
                    // Then add all dependencies.
                    foreach ($settings as &$setting) {
                        if ($setting->get_name() == 'filename') {
                            continue;
                        }
                        $form->add_dependencies($setting);
                    }
                }
            }
            $this->stageform = $form;
        }
        // Return the form.
        return $this->stageform;
    }
protected function initialise_stage_form() {
        global $PAGE;
        if ($this->stageform === null) {
            $form = new restore_settings_form($this, $PAGE->url);
            // Store as a variable so we can iterate by reference.
            $tasks = $this->ui->get_tasks();
            $headingprinted = false;
            // Iterate all tasks by reference.
            foreach ($tasks as &$task) {
                // For the initial stage we are only interested in the root settings.
                if ($task instanceof restore_root_task) {
                    if (!$headingprinted) {
                        $form->add_heading('rootsettings', get_string('restorerootsettings', 'backup'));
                        $headingprinted = true;
                    }
                    $settings = $task->get_settings();
                    // First add all settings except the filename setting.
                    foreach ($settings as &$setting) {
                        if ($setting->get_name() == 'filename') {
                            continue;
                        }
                        $form->add_setting($setting, $task);
                    }
                    // Then add all dependencies.
                    foreach ($settings as &$setting) {
                        if ($setting->get_name() == 'filename') {
                            continue;
                        }
                        $form->add_dependencies($setting);
                    }
                }
            }
            $this->stageform = $form;
        }
        // Return the form.
        return $this->stageform;
    }
protected function initialise_stage_form ( ) { global $ PAGE ; if ( $ this -> stageform === null ) { $ form = new restore_settings_form ( $ this , $ PAGE -> url ) ; // Store as a variable so we can iterate by reference. $ tasks = $ this -> ui -> get_tasks ( ) ; $ headingprinted = false ; // Iterate all tasks by reference. foreach ( $ tasks as & $ task ) { // For the initial stage we are only interested in the root settings. if ( $ task instanceof restore_root_task ) { if ( ! $ headingprinted ) { $ form -> add_heading ( 'rootsettings' , get_string ( 'restorerootsettings' , 'backup' ) ) ; $ headingprinted = true ; } $ settings = $ task -> get_settings ( ) ; // First add all settings except the filename setting. foreach ( $ settings as & $ setting ) { if ( $ setting -> get_name ( ) == 'filename' ) { continue ; } $ form -> add_setting ( $ setting , $ task ) ; } // Then add all dependencies. foreach ( $ settings as & $ setting ) { if ( $ setting -> get_name ( ) == 'filename' ) { continue ; } $ form -> add_dependencies ( $ setting ) ; } } } $ this -> stageform = $ form ; } // Return the form. return $ this -> stageform ; }
Initialise the stage form.

@return backup_moodleform|base_moodleform|restore_settings_form
@throws coding_exception
Initialise the stage form .