mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
MDL-62341 privacy: Add link to previous page in viewall policies page
This commit is contained in:
parent
6e445671c1
commit
e55e9df388
@ -48,12 +48,15 @@ use tool_policy\policy_version;
|
||||
*/
|
||||
class page_viewalldoc implements renderable, templatable {
|
||||
|
||||
/** @var string Return url */
|
||||
private $returnurl;
|
||||
|
||||
/**
|
||||
* Prepare the page for rendering.
|
||||
*
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
public function __construct($returnurl) {
|
||||
$this->returnurl = $returnurl;
|
||||
$this->prepare_global_page_access();
|
||||
$this->prepare_policies();
|
||||
}
|
||||
@ -99,6 +102,9 @@ class page_viewalldoc implements renderable, templatable {
|
||||
];
|
||||
|
||||
$data->policies = array_values($this->policies);
|
||||
if (!empty($this->returnurl)) {
|
||||
$data->returnurl = $this->returnurl;
|
||||
}
|
||||
|
||||
array_walk($data->policies, function($item, $key) {
|
||||
$item->policytypestr = get_string('policydoctype'.$item->type, 'tool_policy');
|
||||
|
@ -50,6 +50,7 @@ $string['agreedyesonbehalfwithlinkall'] = 'Consent given on behalf of user; clic
|
||||
$string['agreedyeswithlink'] = 'Consent given; click to withdraw user consent for {$a}';
|
||||
$string['agreedyeswithlinkall'] = 'Consent given; click to withdraw user consent for all policies';
|
||||
$string['agreepolicies'] = 'Please agree to the following policies';
|
||||
$string['backtoprevious'] = 'Go back to previous page';
|
||||
$string['backtotop'] = 'Back to top';
|
||||
$string['consentbulk'] = 'Consent';
|
||||
$string['consentdetails'] = 'Give consent on behalf of user';
|
||||
|
@ -96,17 +96,17 @@ function tool_policy_before_standard_html_head() {
|
||||
/**
|
||||
* Callback to add footer elements.
|
||||
*
|
||||
* @return str valid html footer content
|
||||
* @return string HTML footer content
|
||||
*/
|
||||
function tool_policy_standard_footer_html() {
|
||||
global $CFG;
|
||||
global $CFG, $PAGE;
|
||||
|
||||
$output = '';
|
||||
if (!empty($CFG->sitepolicyhandler)
|
||||
&& $CFG->sitepolicyhandler == 'tool_policy') {
|
||||
$policies = api::get_current_versions_ids();
|
||||
if (!empty($policies)) {
|
||||
$url = (new moodle_url('/admin/tool/policy/viewall.php'))->out();
|
||||
$url = new moodle_url('/admin/tool/policy/viewall.php', ['returnurl' => $PAGE->url]);
|
||||
$output .= html_writer::link($url, get_string('userpolicysettings', 'tool_policy'));
|
||||
$output = html_writer::div($output, 'policiesfooter');
|
||||
}
|
||||
|
@ -26,10 +26,12 @@
|
||||
-
|
||||
|
||||
Context variables required for this template:
|
||||
* returnurl - url to the previous page
|
||||
* policies - policy array
|
||||
|
||||
Example context (json):
|
||||
{
|
||||
"returnurl": "#",
|
||||
"policies": [
|
||||
{
|
||||
"id": "2",
|
||||
@ -51,6 +53,12 @@
|
||||
}
|
||||
}}
|
||||
|
||||
{{#returnurl}}
|
||||
<div class="text-right m-b-1">
|
||||
<a href="{{returnurl}}">{{# str }} backtoprevious, tool_policy {{/ str }}</a>
|
||||
</div>
|
||||
{{/returnurl}}
|
||||
|
||||
<a id="top"></a>
|
||||
<div id="policies_index">
|
||||
<h1>{{# str }} listactivepolicies, tool_policy {{/ str }}</h1>
|
||||
|
@ -34,7 +34,9 @@ define('NO_SITEPOLICY_CHECK', true);
|
||||
// @codingStandardsIgnoreLine See the {@link page_viewalldoc} for the access control checks.
|
||||
require(__DIR__.'/../../../config.php');
|
||||
|
||||
$viewallpage = new page_viewalldoc();
|
||||
$returnurl = optional_param('returnurl', '', PARAM_LOCALURL); // A return URL.
|
||||
|
||||
$viewallpage = new page_viewalldoc($returnurl);
|
||||
|
||||
$output = $PAGE->get_renderer('tool_policy');
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user