MDL-62670 policy: Remove footer link when there are not active policies

This commit is contained in:
Sara Arjona 2018-07-04 07:52:47 +02:00
parent f61ee4e857
commit 0138ad60b0
3 changed files with 11 additions and 3 deletions

View File

@ -92,6 +92,7 @@ $string['moveup'] = 'Move up';
$string['mustagreetocontinue'] = 'Before continuing you must agree to all these policies.';
$string['newpolicy'] = 'New policy';
$string['newversion'] = 'New version';
$string['noactivepolicies'] = 'There are no policies with an active version.';
$string['nofiltersapplied'] = 'No filters applied';
$string['nopermissiontoagreedocs'] = 'No permission to agree to the policies';
$string['nopermissiontoagreedocs_desc'] = 'Sorry, you do not have the required permissions to agree to the policies.<br />You will not be able to use this site until the following policies are agreed:';

View File

@ -104,9 +104,12 @@ function tool_policy_standard_footer_html() {
$output = '';
if (!empty($CFG->sitepolicyhandler)
&& $CFG->sitepolicyhandler == 'tool_policy') {
$url = (new moodle_url('/admin/tool/policy/viewall.php'))->out();
$output .= html_writer::link($url, get_string('userpolicysettings', 'tool_policy'));
$output = html_writer::div($output, 'policiesfooter');
$policies = api::get_current_versions_ids();
if (!empty($policies)) {
$url = (new moodle_url('/admin/tool/policy/viewall.php'))->out();
$output .= html_writer::link($url, get_string('userpolicysettings', 'tool_policy'));
$output = html_writer::div($output, 'policiesfooter');
}
}
return $output;

View File

@ -58,6 +58,10 @@
</ul>
</div>
{{^policies }}
{{# str }} noactivepolicies, tool_policy {{/ str }}
{{/policies }}
{{#policies }}
<hr>
<div class="policy_version m-b-3">