2 // This file is part of Moodle - http://moodle.org/
4 // Moodle is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
9 // Moodle is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
18 * Renderer class for tool_dataprivacy
20 * @package tool_dataprivacy
21 * @copyright 2018 Jun Pataleta
22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
25 namespace tool_dataprivacy\output;
27 defined('MOODLE_INTERNAL') || die();
32 use plugin_renderer_base;
35 * Renderer class for tool_dataprivacy.
37 * @package tool_dataprivacy
38 * @copyright 2018 Jun Pataleta
39 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
41 class renderer extends plugin_renderer_base {
44 * Render the user's data requests page.
46 * @param my_data_requests_page $page
47 * @return string html for the page
48 * @throws moodle_exception
50 public function render_my_data_requests_page(my_data_requests_page $page) {
51 $data = $page->export_for_template($this);
52 return parent::render_from_template('tool_dataprivacy/my_data_requests', $data);
56 * Render the contact DPO link.
58 * @param string $replytoemail The Reply-to email address
59 * @return string The HTML for the link.
60 * @throws coding_exception
62 public function render_contact_dpo_link($replytoemail) {
64 'data-action' => 'contactdpo',
65 'data-replytoemail' => $replytoemail
67 return html_writer::link('#', get_string('contactdataprotectionofficer', 'tool_dataprivacy'), $params);
71 * Render the data requests page for the DPO.
73 * @param data_requests_page $page
74 * @return string html for the page
75 * @throws moodle_exception
77 public function render_data_requests_page(data_requests_page $page) {
78 $data = $page->export_for_template($this);
79 return parent::render_from_template('tool_dataprivacy/data_requests', $data);
83 * Render the data registry.
85 * @param data_registry_page $page
86 * @return string html for the page
87 * @throws moodle_exception
89 public function render_data_registry_page(data_registry_page $page) {
90 $data = $page->export_for_template($this);
91 return parent::render_from_template('tool_dataprivacy/data_registry', $data);
95 * Render the purposes management page.
97 * @param purposes $page
98 * @return string html for the page
99 * @throws moodle_exception
101 public function render_purposes(purposes $page) {
102 $data = $page->export_for_template($this);
103 return parent::render_from_template('tool_dataprivacy/purposes', $data);
107 * Render the categories management page.
109 * @param categories $page
110 * @return string html for the page
111 * @throws moodle_exception
113 public function render_categories(categories $page) {
114 $data = $page->export_for_template($this);
115 return parent::render_from_template('tool_dataprivacy/categories', $data);
119 * Render the review page for the deletion of expired contexts.
121 * @param data_deletion_page $page
122 * @return string html for the page
123 * @throws moodle_exception
125 public function render_data_deletion_page(data_deletion_page $page) {
126 $data = $page->export_for_template($this);
127 return parent::render_from_template('tool_dataprivacy/data_deletion', $data);