blob: e68982e3b5f14f00a9c1f662cc874ec92f085a5c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
<?php
class ConsultationNavigation extends Navigation
{
/** @var Range */
protected $range;
public function __construct(Range $range)
{
$this->range = $range;
parent::__construct($range->getConfiguration()->CONSULTATION_TAB_TITLE);
}
public function initItem()
{
parent::initItem();
if ($this->range->isEditableByUser()) {
$this->setURL('dispatch.php/consultation/admin');
}
}
/**
* Determine whether this navigation item is active.
*/
public function isActive()
{
$active = parent::isActive();
if ($active) {
if ($this->range instanceof User) {
URLHelper::addLinkParam('username', $this->range->username);
} elseif ($this->range instanceof Course || $this->range instanceof Institute) {
URLHelper::addLinkParam('cid', $this->range->id);
}
}
return $active;
}
/**
* Initialize the subnavigation of this item. This method
* is called once before the first item is added or removed.
*/
public function initSubNavigation()
{
parent::initSubNavigation();
if ($this->range->isEditableByUser()) {
$this->addSubNavigation('admin', new Navigation(
_('Verwaltung'),
'dispatch.php/consultation/admin'
));
return;
}
if (!ConsultationBooking::userMayCreateBookingForRange($this->range, User::findCurrent())) {
return;
}
// Create visitor navigation
$this->addSubNavigation('overview', new Navigation(_('Übersicht'), 'dispatch.php/consultation/overview'));
$this->addSubNavigation('booked', new Navigation(_('Meine Buchungen'), 'dispatch.php/consultation/overview/booked'));
}
}
|