c08f07fbc7ad1d9bd19cfa28ff9a0762c2b629a3
[moodle.git] / admin / tool / dataprivacy / classes / output / renderer.php
1 <?php
2 // This file is part of Moodle - http://moodle.org/
3 //
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.
8 //
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.
13 //
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/>.
17 /**
18  * Renderer class for tool_dataprivacy
19  *
20  * @package    tool_dataprivacy
21  * @copyright  2018 Jun Pataleta
22  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23  */
25 namespace tool_dataprivacy\output;
27 defined('MOODLE_INTERNAL') || die();
29 use coding_exception;
30 use html_writer;
31 use moodle_exception;
32 use plugin_renderer_base;
34 /**
35  * Renderer class for tool_dataprivacy.
36  *
37  * @package    tool_dataprivacy
38  * @copyright  2018 Jun Pataleta
39  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
40  */
41 class renderer extends plugin_renderer_base {
43     /**
44      * Render the user's data requests page.
45      *
46      * @param my_data_requests_page $page
47      * @return string html for the page
48      * @throws moodle_exception
49      */
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);
53     }
55     /**
56      * Render the contact DPO link.
57      *
58      * @param string $replytoemail The Reply-to email address
59      * @return string The HTML for the link.
60      * @throws coding_exception
61      */
62     public function render_contact_dpo_link($replytoemail) {
63         $params = [
64             'data-action' => 'contactdpo',
65             'data-replytoemail' => $replytoemail
66         ];
67         return html_writer::link('#', get_string('contactdataprotectionofficer', 'tool_dataprivacy'), $params);
68     }
70     /**
71      * Render the data requests page for the DPO.
72      *
73      * @param data_requests_page $page
74      * @return string html for the page
75      * @throws moodle_exception
76      */
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);
80     }
82     /**
83      * Render the data registry.
84      *
85      * @param data_registry_page $page
86      * @return string html for the page
87      * @throws moodle_exception
88      */
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);
92     }
94     /**
95      * Render the purposes management page.
96      *
97      * @param purposes $page
98      * @return string html for the page
99      * @throws moodle_exception
100      */
101     public function render_purposes(purposes $page) {
102         $data = $page->export_for_template($this);
103         return parent::render_from_template('tool_dataprivacy/purposes', $data);
104     }
106     /**
107      * Render the categories management page.
108      *
109      * @param categories $page
110      * @return string html for the page
111      * @throws moodle_exception
112      */
113     public function render_categories(categories $page) {
114         $data = $page->export_for_template($this);
115         return parent::render_from_template('tool_dataprivacy/categories', $data);
116     }
118     /**
119      * Render the review page for the deletion of expired contexts.
120      *
121      * @param data_deletion_page $page
122      * @return string html for the page
123      * @throws moodle_exception
124      */
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);
128     }