Merge branch 'MDL-62414-master' of git://github.com/junpataleta/moodle

This commit is contained in:
David Monllao 2018-05-14 11:44:13 +02:00
commit 4557b4e065
3 changed files with 14 additions and 3 deletions

View File

@ -57,7 +57,7 @@ if (!\tool_dataprivacy\api::can_contact_dpo()) {
redirect($returnurl, get_string('contactdpoviaprivacypolicy', 'tool_dataprivacy'), \core\output\notification::NOTIFY_ERROR);
}
$mform = new tool_dataprivacy_data_request_form($url->out(false));
$mform = new tool_dataprivacy_data_request_form($url->out(false), ['manage' => !empty($manage)]);
// Data request cancelled.
if ($mform->is_cancelled()) {
@ -68,7 +68,13 @@ if ($mform->is_cancelled()) {
if ($data = $mform->get_data()) {
\tool_dataprivacy\api::create_data_request($data->userid, $data->type, $data->comments);
redirect($returnurl, get_string('requestsubmitted', 'tool_dataprivacy'));
if ($manage) {
$foruser = core_user::get_user($data->userid);
$redirectmessage = get_string('datarequestcreatedforuser', 'tool_dataprivacy', fullname($foruser));
} else {
$redirectmessage = get_string('requestsubmitted', 'tool_dataprivacy');
}
redirect($returnurl, $redirectmessage);
}
$title = get_string('contactdataprotectionofficer', 'tool_dataprivacy');

View File

@ -38,6 +38,9 @@ require_once($CFG->libdir.'/formslib.php');
*/
class tool_dataprivacy_data_request_form extends moodleform {
/** @var bool Flag to indicate whether this form is being rendered for managing data requests or for regular requests. */
protected $manage = false;
/**
* Form definition.
*
@ -49,7 +52,8 @@ class tool_dataprivacy_data_request_form extends moodleform {
global $DB, $USER;
$mform =& $this->_form;
if (api::is_site_dpo($USER->id)) {
$this->manage = $this->_customdata['manage'];
if ($this->manage) {
$options = [
'ajax' => 'tool_dataprivacy/form-user-selector',
'multiple' => false

View File

@ -67,6 +67,7 @@ $string['dataprivacy:managedatarequests'] = 'Manage data requests';
$string['dataprivacy:managedataregistry'] = 'Manage data registry';
$string['dataregistry'] = 'Data registry';
$string['dataregistryinfo'] = 'The data registry enables categories (types of data) and purposes (the reasons for processing data) to be set for all content on the site - from users and courses down to activities and blocks. For each purpose, a retention period may be set. When a retention period has expired, the data is flagged and listed for deletion, awaiting admin confirmation.';
$string['datarequestcreatedforuser'] = 'Data request created for {$a}';
$string['datarequestemailsubject'] = 'Data request: {$a}';
$string['datarequests'] = 'Data requests';
$string['daterequested'] = 'Date requested';