1 |
efrain |
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 |
namespace tool_dataprivacy;
|
|
|
18 |
|
|
|
19 |
use html_writer;
|
|
|
20 |
use moodle_url;
|
|
|
21 |
|
|
|
22 |
/**
|
|
|
23 |
* Hook callbacks for tool_dataprivacy.
|
|
|
24 |
*
|
|
|
25 |
* @package tool_dataprivacy
|
|
|
26 |
* @copyright 2024 Andrew Lyons <andrew@nicols.co.uk>
|
|
|
27 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
28 |
*/
|
|
|
29 |
class hook_callbacks {
|
|
|
30 |
/**
|
|
|
31 |
* Add the privacy summary to the footer.
|
|
|
32 |
*
|
|
|
33 |
* @param \core\hook\output\before_standard_footer_html_generation $hook
|
|
|
34 |
*/
|
|
|
35 |
public static function standard_footer_html(\core\hook\output\before_standard_footer_html_generation $hook): void {
|
|
|
36 |
// A returned 0 means that the setting was set and disabled, false means that there is no value for the provided setting.
|
|
|
37 |
$showsummary = get_config('tool_dataprivacy', 'showdataretentionsummary');
|
|
|
38 |
if ($showsummary === false) {
|
|
|
39 |
// This means that no value is stored in db. We use the default value in this case.
|
|
|
40 |
$showsummary = true;
|
|
|
41 |
}
|
|
|
42 |
|
|
|
43 |
if ($showsummary) {
|
|
|
44 |
$url = new moodle_url('/admin/tool/dataprivacy/summary.php');
|
|
|
45 |
$hook->add_html(
|
|
|
46 |
html_writer::div(
|
|
|
47 |
html_writer::link($url, get_string('dataretentionsummary', 'tool_dataprivacy')),
|
|
|
48 |
'tool_dataprivacy',
|
|
|
49 |
),
|
|
|
50 |
);
|
|
|
51 |
}
|
|
|
52 |
}
|
|
|
53 |
}
|