Skip to content

Commit

Permalink
MDL-72845 core: add services and support link to help popover
Browse files Browse the repository at this point in the history
  • Loading branch information
lameze committed Dec 22, 2021
1 parent 9dc03a9 commit be018b7
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 8 deletions.
1 change: 1 addition & 0 deletions lang/en/moodle.php
Original file line number Diff line number Diff line change
Expand Up @@ -1334,6 +1334,7 @@
$string['moodledocslink'] = 'Help and documentation';
$string['moodleversion'] = 'Moodle version';
$string['moodlerelease'] = 'Moodle release';
$string['moodleservicesandsupport'] = 'Services and support';
$string['more'] = 'more';
$string['morehelp'] = 'More help';
$string['morehelpaboutmodule'] = 'More help about the {$a} activity';
Expand Down
1 change: 1 addition & 0 deletions lib/classes/output/icon_system_fontawesome.php
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ public function get_core_icon_map() {
'core:t/index_drawer' => 'fa-list',
'core:t/left' => 'fa-arrow-left',
'core:t/less' => 'fa-caret-up',
'core:t/life-ring' => 'fa-life-ring',
'core:t/locked' => 'fa-lock',
'core:t/lock' => 'fa-unlock',
'core:t/locktime' => 'fa-lock',
Expand Down
30 changes: 30 additions & 0 deletions lib/outputrenderers.php
Original file line number Diff line number Diff line change
Expand Up @@ -4146,6 +4146,36 @@ public function supportemail(): string {
return html_writer::tag('a', $icon . $label, ['href' => 'mailto:' . $supportemail]);
}

/**
* Returns the services and support link for the help pop-up.
*
* @return string
*/
public function services_support_link(): string {
global $CFG;

if ((isset($CFG->showservicesandsupportcontent) && $CFG->showservicesandsupportcontent == false) || !is_siteadmin()) {
return '';
}

$liferingicon = $this->pix_icon('t/life-ring', '', 'moodle', ['class' => 'fa fa-life-ring']);
$newwindowicon = $this->pix_icon('i/externallink', get_string('opensinnewwindow'), 'moodle',
['class' => 'fa fa-externallink fa-fw']);
$link = 'https://moodle.com/help/?utm_source=CTA-banner&utm_medium=platform&utm_campaign=name~Moodle4+cat~lms+mp~no';
$content = $liferingicon . get_string('moodleservicesandsupport') . $newwindowicon;

return html_writer::tag('a', $content, ['target' => '_blank', 'href' => $link]);
}

/**
* Helper function to decide whether to show the help popover header or not.
*
* @return bool
*/
public function has_popover_links(): bool {
return !empty($this->services_support_link()) || !empty($this->page_doc_link()) || !empty($this->supportemail());
}

/**
* Returns the page heading menu.
*
Expand Down
25 changes: 17 additions & 8 deletions theme/boost/templates/footer.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
"output": {
"page_doc_link": "Help and documentation",
"supportemail": "<a href=\"#\">Contact site support</a>",
"has_popover_links": true,
"services_support": "Services and support",
"login_info": "You are logged in as cute kitten",
"moodle_release": "90210"
}
Expand All @@ -37,14 +39,21 @@
</button>
</div>
<div class="footer-content-popover container" data-region="footer-content-popover">
<div class="footer-section p-3 border-bottom">
{{# output.page_doc_link }}
<div>{{{ output.page_doc_link }}}</div>
{{/ output.page_doc_link }}
{{# output.supportemail }}
<div>{{{ output.supportemail }}}</div>
{{/ output.supportemail }}
</div>
{{# output.has_popover_links }}
<div class="footer-section p-3 border-bottom">
{{# output.page_doc_link }}
<div>{{{ output.page_doc_link }}}</div>
{{/ output.page_doc_link }}

{{# output.services_support_link }}
<div>{{{ output.services_support_link }}}</div>
{{/ output.services_support_link }}

{{# output.supportemail }}
<div>{{{ output.supportemail }}}</div>
{{/ output.supportemail }}
</div>
{{/ output.has_popover_links }}
<div class="footer-section p-3 border-bottom">
<div class="logininfo">
{{{ output.login_info }}}
Expand Down

0 comments on commit be018b7

Please sign in to comment.