mirror of
https://github.com/moodle/moodle.git
synced 2025-04-15 21:45:37 +02:00
MDL-59388 core_calendar: display calendar footer options
This commit is contained in:
parent
86775ced89
commit
644b2e982e
33
calendar/templates/footer_options.mustache
Normal file
33
calendar/templates/footer_options.mustache
Normal file
@ -0,0 +1,33 @@
|
||||
{{!
|
||||
This file is part of Moodle - http://moodle.org/
|
||||
|
||||
Moodle is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Moodle is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
}}
|
||||
{{!
|
||||
@template core_calendar/footer_options
|
||||
|
||||
Displays export options on the calendar footer.
|
||||
|
||||
Example context (json):
|
||||
{
|
||||
"exportcalendarbutton": "<button class='btn btn-secondary'>Export calendar</button>",
|
||||
"managesubscriptionbutton": "<button class='btn btn-secondary'>Manage subscriptions</button>",
|
||||
"icalurl": "http://example.com/"
|
||||
}
|
||||
}}
|
||||
<div class="bottom">
|
||||
{{{exportcalendarbutton}}}
|
||||
{{{managesubscriptionbutton}}}
|
||||
<a href="{{icalurl}}" title="{{#str}} quickdownloadcalendar, calendar {{/str}}" class="ical-link m-l-1">iCal</a>
|
||||
</div>
|
@ -152,32 +152,14 @@ if ($view == 'day' || $view == 'upcoming') {
|
||||
echo $renderer->show_upcoming_events($calendar, $lookahead, $maxevents);
|
||||
break;
|
||||
}
|
||||
|
||||
//Link to calendar export page.
|
||||
echo $OUTPUT->container_start('bottom');
|
||||
if (!empty($CFG->enablecalendarexport)) {
|
||||
echo $OUTPUT->single_button(new moodle_url('export.php', array('course'=>$courseid)), get_string('exportcalendar', 'calendar'));
|
||||
if (calendar_user_can_add_event($course)) {
|
||||
$manageurl = new moodle_url('/calendar/managesubscriptions.php', ['course' => $courseid]);
|
||||
echo $OUTPUT->single_button($manageurl, get_string('managesubscriptions', 'calendar'));
|
||||
}
|
||||
if (isloggedin()) {
|
||||
$authtoken = sha1($USER->id . $DB->get_field('user', 'password', array('id' => $USER->id)) . $CFG->calendar_exportsalt);
|
||||
$link = new moodle_url(
|
||||
'/calendar/export_execute.php',
|
||||
array('preset_what'=>'all', 'preset_time' => 'recentupcoming', 'userid' => $USER->id, 'authtoken'=>$authtoken)
|
||||
);
|
||||
echo html_writer::tag('a', 'iCal',
|
||||
array('href' => $link, 'title' => get_string('quickdownloadcalendar', 'calendar'), 'class' => 'ical-link m-l-1'));
|
||||
}
|
||||
}
|
||||
|
||||
echo $OUTPUT->container_end();
|
||||
} else if ($view == 'month') {
|
||||
list($data, $template) = calendar_get_view($calendar, $view);
|
||||
echo $renderer->render_from_template($template, $data);
|
||||
}
|
||||
echo html_writer::end_tag('div');
|
||||
echo $renderer->complete_layout();
|
||||
|
||||
list($data, $template) = calendar_get_footer_options($calendar);
|
||||
echo $renderer->render_from_template($template, $data);
|
||||
|
||||
$PAGE->requires->js_call_amd('core_calendar/calendar', 'init');
|
||||
echo $OUTPUT->footer();
|
||||
|
Loading…
x
Reference in New Issue
Block a user