Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

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

   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  
  25  namespace tool_dataprivacy\output;
  26  
  27  defined('MOODLE_INTERNAL') || die();
  28  
  29  use coding_exception;
  30  use html_writer;
  31  use moodle_exception;
  32  use 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   */
  41  class 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       * @return string The HTML for the link.
  59       */
  60      public function render_contact_dpo_link() {
  61          $params = [
  62              'data-action' => 'contactdpo',
  63          ];
  64          return html_writer::link('#', get_string('contactdataprotectionofficer', 'tool_dataprivacy'), $params);
  65      }
  66  
  67      /**
  68       * Render the data requests page for the DPO.
  69       *
  70       * @param data_requests_page $page
  71       * @return string html for the page
  72       * @throws moodle_exception
  73       */
  74      public function render_data_requests_page(data_requests_page $page) {
  75          $data = $page->export_for_template($this);
  76          return parent::render_from_template('tool_dataprivacy/data_requests', $data);
  77      }
  78  
  79      /**
  80       * Render the data registry.
  81       *
  82       * @param data_registry_page $page
  83       * @return string html for the page
  84       * @throws moodle_exception
  85       */
  86      public function render_data_registry_page(data_registry_page $page) {
  87          $data = $page->export_for_template($this);
  88          return parent::render_from_template('tool_dataprivacy/data_registry', $data);
  89      }
  90  
  91      /**
  92       * Render the data compliance registry.
  93       *
  94       * @param data_registry_compliance_page $page
  95       * @return string html for the page
  96       * @throws moodle_exception
  97       */
  98      public function render_data_registry_compliance_page(data_registry_compliance_page $page) {
  99          $data = $page->export_for_template($this);
 100          return parent::render_from_template('tool_dataprivacy/data_registry_compliance', $data);
 101      }
 102  
 103      /**
 104       * Render the purposes management page.
 105       *
 106       * @param purposes $page
 107       * @return string html for the page
 108       * @throws moodle_exception
 109       */
 110      public function render_purposes(purposes $page) {
 111          $data = $page->export_for_template($this);
 112          return parent::render_from_template('tool_dataprivacy/purposes', $data);
 113      }
 114  
 115      /**
 116       * Render the categories management page.
 117       *
 118       * @param categories $page
 119       * @return string html for the page
 120       * @throws moodle_exception
 121       */
 122      public function render_categories(categories $page) {
 123          $data = $page->export_for_template($this);
 124          return parent::render_from_template('tool_dataprivacy/categories', $data);
 125      }
 126  
 127      /**
 128       * Render the review page for the deletion of expired contexts.
 129       *
 130       * @param data_deletion_page $page
 131       * @return string html for the page
 132       * @throws moodle_exception
 133       */
 134      public function render_data_deletion_page(data_deletion_page $page) {
 135          $data = $page->export_for_template($this);
 136          return parent::render_from_template('tool_dataprivacy/data_deletion', $data);
 137      }
 138  
 139      /**
 140       * Render the user data retention summary page.
 141       *
 142       * @param  summary_page $page
 143       * @return string html for the page.
 144       */
 145      public function render_summary_page(summary_page $page) {
 146          $data = $page->export_for_template($this);
 147          return parent::render_from_template('tool_dataprivacy/summary', $data);
 148      }
 149  }