MDL-62373 tool_dataprivacy: Get rid of profile's contact dpo left-margin
[moodle.git] / admin / tool / dataprivacy / classes / output / renderer.php
CommitLineData
5efc1f9e
DM
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/>.
16
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 */
24
25namespace tool_dataprivacy\output;
26
27defined('MOODLE_INTERNAL') || die();
28
29use coding_exception;
30use html_writer;
31use moodle_exception;
32use plugin_renderer_base;
33
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 */
41class renderer extends plugin_renderer_base {
42
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 }
54
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',
7258bf0b
DM
65 'data-replytoemail' => $replytoemail,
66 'class' => 'contactdpo'
5efc1f9e
DM
67 ];
68 return html_writer::link('#', get_string('contactdataprotectionofficer', 'tool_dataprivacy'), $params);
69 }
70
71 /**
72 * Render the data requests page for the DPO.
73 *
74 * @param data_requests_page $page
75 * @return string html for the page
76 * @throws moodle_exception
77 */
78 public function render_data_requests_page(data_requests_page $page) {
79 $data = $page->export_for_template($this);
80 return parent::render_from_template('tool_dataprivacy/data_requests', $data);
81 }
82
83 /**
84 * Render the data registry.
85 *
86 * @param data_registry_page $page
87 * @return string html for the page
88 * @throws moodle_exception
89 */
90 public function render_data_registry_page(data_registry_page $page) {
91 $data = $page->export_for_template($this);
92 return parent::render_from_template('tool_dataprivacy/data_registry', $data);
93 }
94
d6ff9edd
AG
95 /**
96 * Render the data compliance registry.
97 *
bb4030ff 98 * @param data_registry_compliance_page $page
d6ff9edd
AG
99 * @return string html for the page
100 * @throws moodle_exception
101 */
102 public function render_data_registry_compliance_page(data_registry_compliance_page $page) {
103 $data = $page->export_for_template($this);
104 return parent::render_from_template('tool_dataprivacy/data_registry_compliance', $data);
105 }
106
5efc1f9e
DM
107 /**
108 * Render the purposes management page.
109 *
110 * @param purposes $page
111 * @return string html for the page
112 * @throws moodle_exception
113 */
114 public function render_purposes(purposes $page) {
115 $data = $page->export_for_template($this);
116 return parent::render_from_template('tool_dataprivacy/purposes', $data);
117 }
118
119 /**
120 * Render the categories management page.
121 *
122 * @param categories $page
123 * @return string html for the page
124 * @throws moodle_exception
125 */
126 public function render_categories(categories $page) {
127 $data = $page->export_for_template($this);
128 return parent::render_from_template('tool_dataprivacy/categories', $data);
129 }
130
131 /**
132 * Render the review page for the deletion of expired contexts.
133 *
134 * @param data_deletion_page $page
135 * @return string html for the page
136 * @throws moodle_exception
137 */
138 public function render_data_deletion_page(data_deletion_page $page) {
139 $data = $page->export_for_template($this);
140 return parent::render_from_template('tool_dataprivacy/data_deletion', $data);
141 }
142}