|
@ -66,37 +66,37 @@ class attendance_tabs implements renderable { |
|
|
*/ |
|
|
*/ |
|
|
public function get_tabs() { |
|
|
public function get_tabs() { |
|
|
$toprow = array(); |
|
|
$toprow = array(); |
|
|
|
|
|
$context = $this->att->context; |
|
|
$capabilities = array( |
|
|
$capabilities = array( |
|
|
'mod/attendance:manageattendances', |
|
|
'mod/attendance:manageattendances', |
|
|
'mod/attendance:takeattendances', |
|
|
'mod/attendance:takeattendances', |
|
|
'mod/attendance:changeattendances' |
|
|
'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(), |
|
|
$toprow[] = new tabobject(self::TAB_SESSIONS, $this->att->url_manage()->out(), |
|
|
get_string('sessions', 'attendance')); |
|
|
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, |
|
|
$toprow[] = new tabobject(self::TAB_ADD, |
|
|
$this->att->url_sessions()->out(true, array('action' => att_sessions_page_params::ACTION_ADD)), |
|
|
$this->att->url_sessions()->out(true, array('action' => att_sessions_page_params::ACTION_ADD)), |
|
|
get_string('add', 'attendance')); |
|
|
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(), |
|
|
$toprow[] = new tabobject(self::TAB_REPORT, $this->att->url_report()->out(), |
|
|
get_string('report', 'attendance')); |
|
|
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(), |
|
|
$toprow[] = new tabobject(self::TAB_EXPORT, $this->att->url_export()->out(), |
|
|
get_string('export', 'attendance')); |
|
|
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(), |
|
|
$toprow[] = new tabobject(self::TAB_PREFERENCES, $this->att->url_preferences()->out(), |
|
|
get_string('settings', 'attendance')); |
|
|
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(), |
|
|
$toprow[] = new tabobject(self::TAB_TEMPORARYUSERS, $this->att->url_managetemp()->out(), |
|
|
get_string('tempusers', 'attendance')); |
|
|
get_string('tempusers', 'attendance')); |
|
|
} |
|
|
} |
|
|