MDL-62768 tool_dataprivacy: add page breadcrumbs to navigation.
[moodle.git] / admin / tool / dataprivacy / mydatarequests.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 * Prints the contact form to the site's Data Protection Officer
19 *
20 * @copyright 2018 onwards Jun Pataleta
21 * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
22 * @package tool_dataprivacy
23 */
24
25require_once("../../../config.php");
26require_once('lib.php');
27
28$courseid = optional_param('course', 0, PARAM_INT);
29
30$url = new moodle_url('/admin/tool/dataprivacy/mydatarequests.php');
31if ($courseid) {
32 $url->param('course', $courseid);
33}
34
35$PAGE->set_url($url);
36
37require_login();
38if (isguestuser()) {
39 print_error('noguest');
40}
41
42$usercontext = context_user::instance($USER->id);
43$PAGE->set_context($usercontext);
44
bff97f15
PH
45if ($profilenode = $PAGE->settingsnav->find('myprofile', null)) {
46 $profilenode->make_active();
47}
48
49$title = get_string('datarequests', 'tool_dataprivacy');
50$PAGE->navbar->add($title);
51
5efc1f9e
DM
52// Return URL.
53$params = ['id' => $USER->id];
54if ($courseid) {
55 $params['course'] = $courseid;
56}
57$returnurl = new moodle_url('/user/profile.php', $params);
58
5efc1f9e
DM
59$PAGE->set_heading($title);
60$PAGE->set_title($title);
61echo $OUTPUT->header();
62echo $OUTPUT->heading($title);
63
b4ecfa38 64$requests = tool_dataprivacy\api::get_data_requests($USER->id, [], [], [], 'timecreated DESC');
5efc1f9e
DM
65$requestlist = new tool_dataprivacy\output\my_data_requests_page($requests);
66$requestlistoutput = $PAGE->get_renderer('tool_dataprivacy');
67echo $requestlistoutput->render($requestlist);
68
69echo $OUTPUT->footer();