MDL-59388 core_calendar: convert manage subscription button

This commit is contained in:
Simey Lameze 2017-08-16 10:10:48 +08:00
parent bd33760372
commit 1a1e8ab029
2 changed files with 7 additions and 5 deletions

View File

@ -90,14 +90,13 @@ class footer_options_exporter extends exporter {
/**
* Get manage subscription button.
*
* @param renderer_base $output
* @return string The manage subscription button html.
*/
protected function get_manage_subscriptions_button(renderer_base $output) {
protected function get_manage_subscriptions_button() {
if (calendar_user_can_add_event($this->calendar->course)) {
$managesubscriptionurl = new moodle_url('/calendar/managesubscriptions.php',
['course' => $this->calendar->course->id]);
return $output->single_button($managesubscriptionurl->out(false),
return new \single_button($managesubscriptionurl,
get_string('managesubscriptions', 'calendar'));
}
}
@ -115,8 +114,9 @@ class footer_options_exporter extends exporter {
if (!empty($CFG->enablecalendarexport)) {
$exportbutton = $this->get_export_calendar_button();
$managesubscriptionbutton = $this->get_manage_subscriptions_button();
$values->exportcalendarbutton = $exportbutton->export_for_template($output);
$values->managesubscriptionbutton = $this->get_manage_subscriptions_button($output);
$values->managesubscriptionbutton = $managesubscriptionbutton->export_for_template($output);
$values->icalurl = $this->get_ical_url()->out(false);
}

View File

@ -30,6 +30,8 @@
{{#exportcalendarbutton}}
{{> core/single_button }}
{{/exportcalendarbutton}}
{{{managesubscriptionbutton}}}
{{#managesubscriptionbutton}}
{{> core/single_button }}
{{/managesubscriptionbutton}}
<a href="{{icalurl}}" title="{{#str}} quickdownloadcalendar, calendar {{/str}}" class="ical-link m-l-1">iCal</a>
</div>