Commit | Line | Data |
---|---|---|
1904e9b3 SH |
1 | <?php |
2 | ||
3 | // This file is part of Moodle - http://moodle.org/ | |
4 | // | |
5 | // Moodle is free software: you can redistribute it and/or modify | |
6 | // it under the terms of the GNU General Public License as published by | |
7 | // the Free Software Foundation, either version 3 of the License, or | |
8 | // (at your option) any later version. | |
9 | // | |
10 | // Moodle is distributed in the hope that it will be useful, | |
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | // GNU General Public License for more details. | |
14 | // | |
15 | // You should have received a copy of the GNU General Public License | |
16 | // along with Moodle. If not, see <http://www.gnu.org/licenses/>. | |
17 | ||
18 | /** | |
19 | * This file contains backup and restore output renderers | |
20 | * | |
21 | * @package moodlecore | |
22 | * @copyright 2010 Sam Hemelryk | |
23 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | |
24 | */ | |
25 | ||
26 | /** | |
27 | * The primary renderer for the backup. | |
28 | * | |
29 | * Can be retrieved with the following code: | |
30 | * <?php | |
31 | * $renderer = $PAGE->get_renderer('core','backup'); | |
32 | * ?> | |
33 | * | |
34 | * @copyright 2010 Sam Hemelryk | |
35 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | |
36 | */ | |
37 | class core_backup_renderer extends plugin_renderer_base { | |
38 | /** | |
39 | * Renderers a progress bar for the backup or restore given the items that | |
40 | * make it up. | |
41 | * @param array $items An array of items | |
42 | * @return string | |
43 | */ | |
44 | public function progress_bar(array $items) { | |
45 | foreach ($items as &$item) { | |
46 | $text = $item['text']; | |
47 | unset($item['text']); | |
4886029c SH |
48 | if (array_key_exists('link', $item)) { |
49 | $link = $item['link']; | |
50 | unset($item['link']); | |
51 | $item = html_writer::link($link, $text, $item); | |
52 | } else { | |
53 | $item = html_writer::tag('span', $text, $item); | |
54 | } | |
1904e9b3 SH |
55 | } |
56 | return html_writer::tag('div', join(get_separator(), $items), array('class'=>'backup_progress clearfix')); | |
57 | } | |
58 | /** | |
59 | * Prints a dependency notification | |
60 | * @param string $message | |
61 | * @return string | |
62 | */ | |
63 | public function dependency_notification($message) { | |
64 | return html_writer::tag('div', $message, array('class'=>'notification dependencies_enforced')); | |
65 | } | |
66 | } |