From: moodler Date: Tue, 12 Sep 2006 08:28:36 +0000 (+0000) Subject: DOn't show "Add" links if you can't use them X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=ecf22ff31c63b7d517e11f19e229159c29f3f8a6;p=moodle.git DOn't show "Add" links if you can't use them --- 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.