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.

This file contains the restore user interface class

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

Defines 2 classes

restore_ui:: (19 methods):
  initialise_stage()
  process()
  is_independent()
  get_uniqueid()
  get_restoreid()
  get_progress_reporter()
  set_progress_reporter()
  execute()
  cleanup()
  is_temporary_course_created()
  enforce_changed_dependencies()
  load_controller()
  engage_independent_stage()
  cancel_process()
  get_progress_bar()
  get_name()
  get_first_stage_id()
  requires_substage()
  display()

restore_ui_exception:: (0 methods):


Class: restore_ui  - X-Ref

This is the restore user interface class

The restore user interface class manages the user interface and restore for
Moodle.

initialise_stage($stage = null, array $params = null)   X-Ref
Intialises what ever stage is requested. If none are requested we check
params for 'stage' and default to initial

param: int|null $stage The desired stage to intialise or null for the default
param: array $params
return: restore_ui_stage_initial|restore_ui_stage_schema|restore_ui_stage_confirmation|restore_ui_stage_final

process()   X-Ref
This processes the current stage of the restore

return: bool

is_independent()   X-Ref
Returns true if the stage is independent (not requiring a restore controller)

return: bool

get_uniqueid()   X-Ref
Gets the unique ID associated with this UI

return: string

get_restoreid()   X-Ref
Gets the restore id from the controller

return: string

get_progress_reporter()   X-Ref
Gets the progress reporter object in use for this restore UI.

IMPORTANT: This progress reporter is used only for UI progress that is
outside the restore controller. The restore controller has its own
progress reporter which is used for progress during the main restore.
Use the restore controller's progress reporter to report progress during
a restore operation, not this one.

This extra reporter is necessary because on some restore UI screens,
there are long-running tasks even though there is no restore controller
in use.

return: \core\progress\none

set_progress_reporter(\core\progress\base $progressreporter)   X-Ref
Sets the progress reporter that will be returned by get_progress_reporter.

param: \core\progress\base $progressreporter Progress reporter

execute()   X-Ref
Executes the restore plan

return: bool

cleanup()   X-Ref
Delete course which is created by restore process


is_temporary_course_created($courseid)   X-Ref
Checks if the course is not restored fully and current controller has created it.

param: int $courseid id of the course which needs to be checked
return: bool

enforce_changed_dependencies()   X-Ref
Returns true if enforce_dependencies changed any settings

return: bool

load_controller($restoreid = false)   X-Ref
Loads the restore controller if we are tracking one

param: string|bool $restoreid
return: string

engage_independent_stage($stage, $contextid)   X-Ref
Initialised the requested independent stage

param: int $stage One of self::STAGE_*
param: int $contextid
return: restore_ui_stage_confirm|restore_ui_stage_destination

cancel_process()   X-Ref
Cancels the current restore and redirects the user back to the relevant place


get_progress_bar()   X-Ref
Gets an array of progress bar items that can be displayed through the restore renderer.

return: array Array of items for the progress bar

get_name()   X-Ref
Gets the name of this UI

return: string

get_first_stage_id()   X-Ref
Gets the first stage for this UI

return: int STAGE_CONFIRM

requires_substage()   X-Ref
Returns true if this stage has substages of which at least one needs to be displayed

return: bool

display(core_backup_renderer $renderer)   X-Ref
Displays this stage

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

Class: restore_ui_exception  - X-Ref

Restore user interface exception. Modelled off the restore_exception class