コード例 #1
0
 /**
  * Creates the backup_confirmation_form instance this stage requires
  *
  * @return backup_confirmation_form
  */
 protected function initialise_stage_form()
 {
     global $PAGE;
     if ($this->stageform === null) {
         // Get the form.
         $form = new restore_review_form($this, $PAGE->url);
         $content = '';
         $courseheading = false;
         $progress = $this->ui->get_progress_reporter();
         $tasks = $this->ui->get_tasks();
         $progress->start_progress('initialise_stage_form', count($tasks));
         $done = 1;
         foreach ($tasks as $task) {
             if ($task instanceof restore_root_task) {
                 // If its a backup root add a root settings heading to group nicely.
                 $form->add_heading('rootsettings', get_string('rootsettings', 'backup'));
             } else {
                 if (!$courseheading) {
                     // We haven't already add a course heading.
                     $form->add_heading('coursesettings', get_string('coursesettings', 'backup'));
                     $courseheading = true;
                 }
             }
             // Iterate all settings, doesnt need to happen by reference.
             foreach ($task->get_settings() as $setting) {
                 $form->add_fixed_setting($setting, $task);
             }
             // Update progress.
             $progress->progress($done++);
         }
         $progress->end_progress();
         $this->stageform = $form;
     }
     return $this->stageform;
 }
コード例 #2
0
 /**
  * Creates the backup_confirmation_form instance this stage requires
  *
  * @return backup_confirmation_form
  */
 protected function initialise_stage_form()
 {
     global $PAGE;
     if ($this->stageform === null) {
         // Get the form
         $form = new restore_review_form($this, $PAGE->url);
         $content = '';
         $courseheading = false;
         foreach ($this->ui->get_tasks() as $task) {
             if ($task instanceof restore_root_task) {
                 // If its a backup root add a root settings heading to group nicely
                 $form->add_heading('rootsettings', get_string('rootsettings', 'backup'));
             } else {
                 if (!$courseheading) {
                     // we havn't already add a course heading
                     $form->add_heading('coursesettings', get_string('coursesettings', 'backup'));
                     $courseheading = true;
                 }
             }
             // Iterate all settings, doesnt need to happen by reference
             foreach ($task->get_settings() as $setting) {
                 $form->add_fixed_setting($setting, $task);
             }
         }
         $this->stageform = $form;
     }
     return $this->stageform;
 }