Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 3.9.x will end* 10 May 2021 (12 months).
  • Bug fixes for security issues in 3.9.x will end* 8 May 2023 (36 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 39 and 311] [Versions 39 and 400] [Versions 39 and 401] [Versions 39 and 402] [Versions 39 and 403]

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