Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 400 and 401]

   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  
  25  require_once("../../../config.php");
  26  require_once ('lib.php');
  27  
  28  $courseid = optional_param('course', 0, PARAM_INT);
  29  
  30  $url = new moodle_url('/admin/tool/dataprivacy/mydatarequests.php');
  31  if ($courseid) {
  32      $url->param('course', $courseid);
  33  }
  34  
  35  $PAGE->set_url($url);
  36  
  37  require_login();
  38  if (isguestuser()) {
  39      throw new \moodle_exception('noguest');
  40  }
  41  
  42  $usercontext = context_user::instance($USER->id);
  43  $PAGE->set_context($usercontext);
  44  
  45  if ($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  
  52  // Return URL.
  53  $params = ['id' => $USER->id];
  54  if ($courseid) {
  55      $params['course'] = $courseid;
  56  }
  57  $returnurl = new moodle_url('/user/profile.php', $params);
  58  
  59  $PAGE->set_heading($title);
  60  $PAGE->set_title($title);
  61  echo $OUTPUT->header();
  62  echo $OUTPUT->heading($title);
  63  
  64  $requests = tool_dataprivacy\api::get_data_requests($USER->id, [], [], [], 'timecreated DESC');
  65  $requestlist = new tool_dataprivacy\output\my_data_requests_page($requests);
  66  $requestlistoutput = $PAGE->get_renderer('tool_dataprivacy');
  67  echo $requestlistoutput->render($requestlist);
  68  
  69  echo $OUTPUT->footer();