Skip to content

Commit

Permalink
Merge branch 'MDL-62768' of https://github.com/paulholden/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
stronk7 committed Mar 4, 2020
2 parents 5cc0ef4 + 95f2f7c commit f41bec7
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 12 deletions.
10 changes: 9 additions & 1 deletion admin/tool/dataprivacy/createdatarequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,22 @@
$context = context_system::instance();
// Make sure the user has the proper capability.
require_capability('tool/dataprivacy:managedatarequests', $context);
navigation_node::override_active_url($returnurl);
} else {
// For the case where a user makes request for themselves (or for their children if they are the parent).
$returnurl = new moodle_url($CFG->wwwroot . '/admin/tool/dataprivacy/mydatarequests.php');
$context = context_user::instance($USER->id);
}

$PAGE->set_context($context);

if (!$manage && $profilenode = $PAGE->settingsnav->find('myprofile', null)) {
$profilenode->make_active();
}

$title = get_string('createnewdatarequest', 'tool_dataprivacy');
$PAGE->navbar->add($title);

// If contactdataprotectionofficer is disabled, send the user back to the profile page, or the privacy policy page.
// That is, unless you have sufficient capabilities to perform this on behalf of a user.
if (!$manage && !\tool_dataprivacy\api::can_contact_dpo()) {
Expand Down Expand Up @@ -104,7 +113,6 @@
redirect($returnurl, $redirectmessage);
}

$title = get_string('createnewdatarequest', 'tool_dataprivacy');
$PAGE->set_heading($SITE->fullname);
$PAGE->set_title($title);
echo $OUTPUT->header();
Expand Down
8 changes: 7 additions & 1 deletion admin/tool/dataprivacy/mydatarequests.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,20 @@
$usercontext = context_user::instance($USER->id);
$PAGE->set_context($usercontext);

if ($profilenode = $PAGE->settingsnav->find('myprofile', null)) {
$profilenode->make_active();
}

$title = get_string('datarequests', 'tool_dataprivacy');
$PAGE->navbar->add($title);

// Return URL.
$params = ['id' => $USER->id];
if ($courseid) {
$params['course'] = $courseid;
}
$returnurl = new moodle_url('/user/profile.php', $params);

$title = get_string('datarequests', 'tool_dataprivacy');
$PAGE->set_heading($title);
$PAGE->set_title($title);
echo $OUTPUT->header();
Expand Down
12 changes: 3 additions & 9 deletions admin/tool/dataprivacy/resubmitrequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,10 @@
$requestid = required_param('requestid', PARAM_INT);
$confirm = optional_param('confirm', null, PARAM_INT);

$PAGE->set_url(new moodle_url('/admin/tool/dataprivacy/resubmitrequest.php', ['requestid' => $requestid]));
$url = new moodle_url('/admin/tool/dataprivacy/resubmitrequest.php', ['requestid' => $requestid]);
$title = get_string('resubmitrequestasnew', 'tool_dataprivacy');

require_login();

$PAGE->set_context(\context_system::instance());
require_capability('tool/dataprivacy:managedatarequests', $PAGE->context);
\tool_dataprivacy\page_helper::setup($url, $title, 'datarequests', 'tool/dataprivacy:managedatarequests');

$manageurl = new moodle_url('/admin/tool/dataprivacy/datarequests.php');

Expand All @@ -53,10 +51,6 @@
redirect($manageurl, get_string('resubmittedrequest', 'tool_dataprivacy', $stringparams));
}

$heading = get_string('resubmitrequest', 'tool_dataprivacy', $stringparams);
$PAGE->set_title($heading);
$PAGE->set_heading($heading);

echo $OUTPUT->header();

$confirmstring = get_string('confirmrequestresubmit', 'tool_dataprivacy', $stringparams);
Expand Down
7 changes: 7 additions & 0 deletions admin/tool/dataprivacy/summary.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@
$PAGE->set_title($title);
$PAGE->set_heading($SITE->fullname);

// If user is logged in, then use profile navigation in breadcrumbs.
if ($profilenode = $PAGE->settingsnav->find('myprofile', null)) {
$profilenode->make_active();
}

$PAGE->navbar->add($title);

$output = $PAGE->get_renderer('tool_dataprivacy');
echo $output->header();
$summarypage = new \tool_dataprivacy\output\summary_page();
Expand Down
16 changes: 15 additions & 1 deletion admin/tool/policy/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,29 @@
if (!has_capability('tool/policy:acceptbehalf', $context)) {
require_capability('tool/policy:viewacceptances', $context);
}

$user = core_user::get_user($userid);
$PAGE->navigation->extend_for_user($user);
}

$title = get_string('policiesagreements', 'tool_policy');

$PAGE->set_context($context);
$PAGE->set_pagelayout('standard');
$PAGE->set_url(new moodle_url('/admin/tool/policy/user.php', ['userid' => $userid]));
$PAGE->set_title($title);

if ($userid == $USER->id &&
($profilenode = $PAGE->settingsnav->find('myprofile', null))) {

$profilenode->make_active();
}

$PAGE->navbar->add($title);

$output = $PAGE->get_renderer('tool_policy');
echo $output->header();
echo $output->heading(get_string('policiesagreements', 'tool_policy'));
echo $output->heading($title);
$acceptances = new \tool_policy\output\acceptances($userid, $returnurl);
echo $output->render($acceptances);
$PAGE->requires->js_call_amd('tool_policy/acceptmodal', 'getInstance', [context_system::instance()->id]);
Expand Down

0 comments on commit f41bec7

Please sign in to comment.