From e69858f9eff52c89eb525b223ecd502835ee62db Mon Sep 17 00:00:00 2001 From: Dan Marsden Date: Thu, 13 Aug 2015 23:00:49 +1200 Subject: [PATCH] obtain context and re-use to make for cleaner code. --- renderables.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/renderables.php b/renderables.php index 053ca18..575803e 100644 --- a/renderables.php +++ b/renderables.php @@ -66,37 +66,37 @@ class attendance_tabs implements renderable { */ public function get_tabs() { $toprow = array(); - + $context = $this->att->context; $capabilities = array( 'mod/attendance:manageattendances', 'mod/attendance:takeattendances', 'mod/attendance:changeattendances' ); - if (has_any_capability($capabilities, $this->att->context)) { + if (has_any_capability($capabilities, $context)) { $toprow[] = new tabobject(self::TAB_SESSIONS, $this->att->url_manage()->out(), get_string('sessions', 'attendance')); } - if (has_capability('mod/attendance:manageattendances', $this->att->context)) { + if (has_capability('mod/attendance:manageattendances', $context)) { $toprow[] = new tabobject(self::TAB_ADD, $this->att->url_sessions()->out(true, array('action' => att_sessions_page_params::ACTION_ADD)), get_string('add', 'attendance')); } - if (has_capability('mod/attendance:viewreports', $this->att->context)) { + if (has_capability('mod/attendance:viewreports', $context)) { $toprow[] = new tabobject(self::TAB_REPORT, $this->att->url_report()->out(), get_string('report', 'attendance')); } - if (has_capability('mod/attendance:export', $this->att->context)) { + if (has_capability('mod/attendance:export', $context)) { $toprow[] = new tabobject(self::TAB_EXPORT, $this->att->url_export()->out(), get_string('export', 'attendance')); } - if (has_capability('mod/attendance:changepreferences', $this->att->context)) { + if (has_capability('mod/attendance:changepreferences', $context)) { $toprow[] = new tabobject(self::TAB_PREFERENCES, $this->att->url_preferences()->out(), get_string('settings', 'attendance')); } - if (has_capability('mod/attendance:managetemporaryusers', $this->att->context)) { + if (has_capability('mod/attendance:managetemporaryusers', $context)) { $toprow[] = new tabobject(self::TAB_TEMPORARYUSERS, $this->att->url_managetemp()->out(), get_string('tempusers', 'attendance')); }