From ecf22ff31c63b7d517e11f19e229159c29f3f8a6 Mon Sep 17 00:00:00 2001 From: moodler Date: Tue, 12 Sep 2006 08:28:36 +0000 Subject: [PATCH] DOn't show "Add" links if you can't use them --- blocks/calendar_upcoming/block_calendar_upcoming.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/blocks/calendar_upcoming/block_calendar_upcoming.php b/blocks/calendar_upcoming/block_calendar_upcoming.php index b69b932329..f0e1566b80 100644 --- a/blocks/calendar_upcoming/block_calendar_upcoming.php +++ b/blocks/calendar_upcoming/block_calendar_upcoming.php @@ -31,10 +31,13 @@ class block_calendar_upcoming extends block_base { $this->content->footer = '
'. get_string('gotocalendar', 'calendar').'...'; - $this->content->footer .= '
'. - get_string('newevent', 'calendar').'...'; - + $context = get_context_instance(CONTEXT_COURSE, $courseshown); + if (has_capability('moodle/calendar:manageentries', $context) || + has_capability('moodle/calendar:manageownentries', $context)) { + $this->content->footer .= '
'. + get_string('newevent', 'calendar').'...'; + } if ($courseshown == SITEID) { // Being displayed at site level. This will cause the filter to fall back to auto-detecting // the list of courses it will be grabbing events from. -- 2.39.5