Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 310 and 401]

Backup user interface stages This file contains the classes required to manage the stages that make up the backup user interface. These will be primarily operated a {@link backup_ui} instance.

Copyright: 2010 Sam Hemelryk
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 651 lines (24 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 6 classes

backup_ui_stage:: (2 methods):
  __construct()
  get_backupid()

backup_ui_stage_initial:: (4 methods):
  __construct()
  process()
  get_next_stage()
  initialise_stage_form()

backup_ui_stage_schema:: (3 methods):
  __construct()
  process()
  initialise_stage_form()

backup_ui_stage_confirmation:: (3 methods):
  __construct()
  process()
  initialise_stage_form()

backup_ui_stage_final:: (4 methods):
  __construct()
  process()
  initialise_stage_form()
  display()

backup_ui_stage_complete:: (2 methods):
  __construct()
  display()


Class: backup_ui_stage  - X-Ref

Abstract stage class

This class should be extended by all backup stages (a requirement of many backup ui functions).
Each stage must then define two abstract methods
- process : To process the stage
- initialise_stage_form : To get a backup_moodleform instance for the stage

__construct(backup_ui $ui, array $params = null)   X-Ref
Constructor.

param: backup_ui $ui
param: array $params

get_backupid()   X-Ref
The backup id from the backup controller

return: string

Class: backup_ui_stage_initial  - X-Ref

Class representing the initial stage of a backup.

In this stage the user is required to set the root level settings.

__construct(backup_ui $ui, array $params = null)   X-Ref
Initial backup stage constructor

param: backup_ui $ui
param: array $params

process(base_moodleform $m = null)   X-Ref
Processes the initial backup stage

param: base_moodleform $m
return: int The number of changes

get_next_stage()   X-Ref
Gets the next stage for the backup.

We override this function to implement the one click backup.
When the user performs a one click backup we jump straight to the final stage.

return: int

initialise_stage_form()   X-Ref
Initialises the backup_moodleform instance for this stage

return: backup_initial_form

Class: backup_ui_stage_schema  - X-Ref

Schema stage of backup process

During the schema stage the user is required to set the settings that relate
to the area that they are backing up as well as its children.

__construct(backup_ui $ui, array $params = null)   X-Ref
Schema stage constructor

param: backup_ui $ui
param: array $params

process(base_moodleform $form = null)   X-Ref
Processes the schema stage

param: base_moodleform $form
return: int The number of changes the user made

initialise_stage_form()   X-Ref
Creates the backup_schema_form instance for this stage

return: backup_schema_form

Class: backup_ui_stage_confirmation  - X-Ref

Confirmation stage

On this stage the user reviews the setting for the backup and can change the filename
of the file that will be generated.

__construct($ui, array $params = null)   X-Ref
Constructs the stage

param: backup_ui $ui
param: array $params

process(base_moodleform $form = null)   X-Ref
Processes the confirmation stage

param: base_moodleform $form
return: int The number of changes the user made

initialise_stage_form()   X-Ref
Creates the backup_confirmation_form instance this stage requires

return: backup_confirmation_form

Class: backup_ui_stage_final  - X-Ref

Final stage of backup

This stage is special in that it is does not make use of a form. The reason for
this is the order of procession of backup at this stage.
The processesion is:
1. The final stage will be intialise.
2. The confirmation stage will be processed.
3. The backup will be executed
4. The complete stage will be loaded by execution
5. The complete stage will be displayed

This highlights that we neither need a form nor a display method for this stage
we simply need to process.

__construct(backup_ui $ui, array $params = null)   X-Ref
Constructs the final stage

param: backup_ui $ui
param: array $params

process(base_moodleform $form = null)   X-Ref
Processes the final stage.

In this case it ALWAYS passes processing to the previous stage (confirmation)

param: base_moodleform $form
return: bool

initialise_stage_form()   X-Ref
should NEVER be called... throws an exception


display(core_backup_renderer $renderer)   X-Ref
should NEVER be called... throws an exception

param: core_backup_renderer $renderer
return: void

Class: backup_ui_stage_complete  - X-Ref

The completed backup stage

At this stage everything is done and the user will be redirected to view the
backup file in the file browser.

__construct(backup_ui $ui, array $params = null, array $results = null)   X-Ref
Constructs the complete backup stage

param: backup_ui $ui
param: array $params
param: array $results

display(core_backup_renderer $renderer)   X-Ref
Displays the completed backup stage.

Currently this just involves redirecting to the file browser with an
appropriate message.

param: core_backup_renderer $renderer
return: string HTML code to echo