mirror of
https://github.com/moodle/moodle.git
synced 2025-02-13 03:45:49 +01:00
* backup moodleforms for specific stages are now cached between stage processing and display making it possible to leave all validation up to the bridge. * The backup stage now relies entirely on the backup controllers save, load, and check methods + dependency checks rather then previous stage processing to ensure accuracy. * filename is now a required field and validated to ensure it ends with .zip and is a valid filename. * There is now a previous button for backup stages after the initial and before the complete. * The progress bar previous stages are now links as well allowing the user to jump to previous stages (not linked on complete of course). * The root settings are only shown on the schema stage now if they were changed because of dependency. * Stages are now numbered in the progress bar. * The complete page now shows a notice that the backup was complete and provides a continue button to view the backup file. * Adds administration blocks to the backup pages.
66 lines
2.2 KiB
PHP
66 lines
2.2 KiB
PHP
<?php
|
|
|
|
// This file is part of Moodle - http://moodle.org/
|
|
//
|
|
// Moodle is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// Moodle is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
/**
|
|
* This file contains backup and restore output renderers
|
|
*
|
|
* @package moodlecore
|
|
* @copyright 2010 Sam Hemelryk
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
*/
|
|
|
|
/**
|
|
* The primary renderer for the backup.
|
|
*
|
|
* Can be retrieved with the following code:
|
|
* <?php
|
|
* $renderer = $PAGE->get_renderer('core','backup');
|
|
* ?>
|
|
*
|
|
* @copyright 2010 Sam Hemelryk
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
*/
|
|
class core_backup_renderer extends plugin_renderer_base {
|
|
/**
|
|
* 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
|
|
*/
|
|
public function progress_bar(array $items) {
|
|
foreach ($items as &$item) {
|
|
$text = $item['text'];
|
|
unset($item['text']);
|
|
if (array_key_exists('link', $item)) {
|
|
$link = $item['link'];
|
|
unset($item['link']);
|
|
$item = html_writer::link($link, $text, $item);
|
|
} else {
|
|
$item = html_writer::tag('span', $text, $item);
|
|
}
|
|
}
|
|
return html_writer::tag('div', join(get_separator(), $items), array('class'=>'backup_progress clearfix'));
|
|
}
|
|
/**
|
|
* Prints a dependency notification
|
|
* @param string $message
|
|
* @return string
|
|
*/
|
|
public function dependency_notification($message) {
|
|
return html_writer::tag('div', $message, array('class'=>'notification dependencies_enforced'));
|
|
}
|
|
} |