Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 310 and 311] [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403] [Versions 39 and 310]

This file contains backup and restore output renderers

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

Defines 2 classes


Class: core_backup_renderer  - X-Ref

The primary renderer for the backup.

Can be retrieved with the following code:
<?php
$renderer = $PAGE->get_renderer('core', 'backup');
?>

progress_bar(array $items)   X-Ref
Renderers a progress bar for the backup or restore given the items that make it up.

param: array $items An array of items
return: string

log_display($loghtml)   X-Ref
The backup and restore pages may display a log (if any) in a scrolling box.

param: string $loghtml Log content in HTML format
return: string HTML content that shows the log

set_samesite_notification()   X-Ref
Set the same site backup notification.


get_samesite_notification()   X-Ref
Get the same site backup notification.


dependency_notification($message)   X-Ref
Prints a dependency notification

param: string $message
return: string

backup_details($details, $nextstageurl)   X-Ref
Displays the details of a backup file

param: stdClass $details
param: moodle_url $nextstageurl
return: string

backup_details_nonstandard($nextstageurl, array $details)   X-Ref
Displays the general information about a backup file with non-standard format

param: moodle_url $nextstageurl URL to send user to
param: array $details basic info about the file (format, type)
return: string HTML code to display

backup_details_unknown(moodle_url $nextstageurl)   X-Ref
Displays the general information about a backup file with unknown format

param: moodle_url $nextstageurl URL to send user to
return: string HTML code to display

course_selector(moodle_url $nextstageurl, $wholecourse = true, restore_category_search $categories = null,restore_course_search $courses = null, $currentcourse = null)   X-Ref
Displays a course selector for restore

param: moodle_url $nextstageurl
param: bool $wholecourse true if we are restoring whole course (as with backup::TYPE_1COURSE), false otherwise
param: restore_category_search $categories
param: restore_course_search $courses
param: int $currentcourse
return: string

import_course_selector(moodle_url $nextstageurl, import_course_search $courses = null)   X-Ref
Displays the import course selector

param: moodle_url $nextstageurl
param: import_course_search $courses
return: string

backup_detail_pair($label, $value)   X-Ref
Creates a detailed pairing (key + value)

param: string $label
param: string $value
return: string

make_unique_id(string $prefix)   X-Ref
Creates a unique id string by appending an incremental number to the prefix.

param: string $prefix To be used as the left part of the id string.
return: string

backup_detail_input($label, $type, $name, $value, array $attributes = array()   X-Ref
Created a detailed pairing with an input

param: string $label
param: string $type
param: string $name
param: string $value
param: array $attributes
param: string|null $description
return: string

backup_detail_select($label, $name, $options, $selected = '', $nothing = false, array $attributes = array()   X-Ref
Creates a detailed pairing with a select

param: string $label
param: string $name
param: array $options
param: string $selected
param: bool $nothing
param: array $attributes
param: string|null $description
return: string

precheck_notices($results)   X-Ref
Displays precheck notices

param: array $results
return: string

substage_buttons($haserrors)   X-Ref
Displays substage buttons

param: bool $haserrors
return: string

role_mappings($rolemappings, $roles)   X-Ref
Displays a role mapping interface

param: array $rolemappings
param: array $roles
return: string

continue_button($url, $method = 'post')   X-Ref
Displays a continue button

param: string|moodle_url $url
param: string $method
return: string

backup_files_viewer(array $options = null)   X-Ref
Print a backup files tree

param: array $options
return: string

get_status_display($statuscode, $backupid, $restoreid=null, $operation='backup')   X-Ref
Generate the status indicator markup for display in the
backup restore file area UI.

param: int $statuscode The status code of the backup.
param: string $backupid The backup record id.
return: string|boolean $status The status indicator for the operation.

render_backup_files_viewer(backup_files_viewer $viewer)   X-Ref
Displays a backup files viewer

param: backup_files_viewer $viewer
return: string

render_restore_course_search(restore_course_search $component)   X-Ref
Renders a restore course search object

param: restore_course_search $component
return: string

render_import_course_search(import_course_search $component)   X-Ref
Renders an import course search object

param: import_course_search $component
return: string

render_restore_category_search(restore_category_search $component)   X-Ref
Renders a restore category search object

param: restore_category_search $component
return: string

restore_progress_viewer($userid, $context)   X-Ref
Get markup to render table for all of a users async
in progress restores.

param: int $userid The Moodle user id.
param: \context $context The Moodle context for these restores.
return: string $html The table HTML.

copy_progress_viewer(int $userid, int $courseid)   X-Ref
Get markup to render table for all of a users course copies.

param: int $userid The Moodle user id.
param: int $courseid The id of the course to get the backups for.
return: string $html The table HTML.

Class: backup_files_viewer  - X-Ref

Data structure representing backup files viewer

__construct(array $options = null)   X-Ref
Constructor of backup_files_viewer class

param: array $options