Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 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.
   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   * Display the request reject + resubmit confirmation page.
  19   *
  20   * @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
  21   * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
  22   * @package tool_dataprivacy
  23   */
  24  
  25  require_once('../../../config.php');
  26  
  27  $requestid = required_param('requestid', PARAM_INT);
  28  $confirm = optional_param('confirm', null, PARAM_INT);
  29  
  30  $url = new moodle_url('/admin/tool/dataprivacy/resubmitrequest.php', ['requestid' => $requestid]);
  31  $title = get_string('resubmitrequestasnew', 'tool_dataprivacy');
  32  
  33  \tool_dataprivacy\page_helper::setup($url, $title, 'datarequests', 'tool/dataprivacy:managedatarequests');
  34  
  35  $manageurl = new moodle_url('/admin/tool/dataprivacy/datarequests.php');
  36  
  37  $originalrequest = \tool_dataprivacy\api::get_request($requestid);
  38  $user = \core_user::get_user($originalrequest->get('userid'));
  39  $stringparams = (object) [
  40          'username' => fullname($user),
  41          'type' => \tool_dataprivacy\local\helper::get_shortened_request_type_string($originalrequest->get('type')),
  42      ];
  43  
  44  if (null !== $confirm && confirm_sesskey()) {
  45      if ($originalrequest->get('type') == \tool_dataprivacy\api::DATAREQUEST_TYPE_DELETE
  46          && !\tool_dataprivacy\api::can_create_data_deletion_request_for_other()) {
  47          throw new required_capability_exception(context_system::instance(),
  48              'tool/dataprivacy:requestdeleteforotheruser', 'nopermissions', '');
  49      }
  50      $originalrequest->resubmit_request();
  51      redirect($manageurl, get_string('resubmittedrequest', 'tool_dataprivacy', $stringparams));
  52  }
  53  
  54  echo $OUTPUT->header();
  55  
  56  $confirmstring = get_string('confirmrequestresubmit', 'tool_dataprivacy', $stringparams);
  57  $confirmurl = new \moodle_url($PAGE->url, ['confirm' => 1]);
  58  echo $OUTPUT->confirm($confirmstring, $confirmurl, $manageurl);
  59  echo $OUTPUT->footer();