MDL-62768 tool_policy: add page title & breadcrumb navigation.
authorPaul Holden <paulh@moodle.com>
Tue, 25 Feb 2020 21:56:21 +0000 (21:56 +0000)
committerPaul Holden <paulh@moodle.com>
Tue, 25 Feb 2020 22:03:09 +0000 (22:03 +0000)
admin/tool/policy/user.php

index 56b5acb..104d259 100644 (file)
@@ -39,15 +39,29 @@ if ($userid != $USER->id) {
     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]);