Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/conpherence/view/ConpherenceMenuItemView.php
12256 views
1
<?php
2
3
final class ConpherenceMenuItemView extends AphrontTagView {
4
5
private $title;
6
private $subtitle;
7
private $imageURI;
8
private $href;
9
private $epoch;
10
private $unreadCount;
11
12
public function setUnreadCount($unread_count) {
13
$this->unreadCount = $unread_count;
14
return $this;
15
}
16
public function getUnreadCount() {
17
return $this->unreadCount;
18
}
19
20
public function setEpoch($epoch) {
21
$this->epoch = $epoch;
22
return $this;
23
}
24
public function getEpoch() {
25
return $this->epoch;
26
}
27
28
public function setHref($href) {
29
$this->href = $href;
30
return $this;
31
}
32
public function getHref() {
33
return $this->href;
34
}
35
36
public function setImageURI($image_uri) {
37
$this->imageURI = $image_uri;
38
return $this;
39
}
40
public function getImageURI() {
41
return $this->imageURI;
42
}
43
44
public function setSubtitle($subtitle) {
45
$this->subtitle = $subtitle;
46
return $this;
47
}
48
public function getSubtitle() {
49
return $this->subtitle;
50
}
51
52
public function setTitle($title) {
53
$this->title = $title;
54
return $this;
55
}
56
57
public function getTitle() {
58
return $this->title;
59
}
60
61
protected function getTagName() {
62
return 'a';
63
}
64
65
protected function getTagAttributes() {
66
$classes = array();
67
$classes[] = 'conpherence-menu-item-view';
68
$classes[] = 'phui-list-item-href';
69
return array(
70
'class' => implode(' ', $classes),
71
'href' => $this->href,
72
);
73
}
74
75
protected function getTagContent() {
76
$image = null;
77
if ($this->imageURI) {
78
$image = phutil_tag(
79
'span',
80
array(
81
'class' => 'conpherence-menu-item-image',
82
'style' => 'background-image: url('.$this->imageURI.');',
83
),
84
'');
85
}
86
$title = null;
87
if ($this->title) {
88
$title = phutil_tag(
89
'span',
90
array(
91
'class' => 'conpherence-menu-item-title',
92
),
93
$this->title);
94
}
95
$subtitle = null;
96
if ($this->subtitle) {
97
$subtitle = phutil_tag(
98
'span',
99
array(
100
'class' => 'conpherence-menu-item-subtitle',
101
),
102
$this->subtitle);
103
}
104
$unread_count = null;
105
if ($this->unreadCount) {
106
$unread_count = phutil_tag(
107
'span',
108
array(
109
'class' => 'conpherence-menu-item-unread-count',
110
),
111
(int)$this->unreadCount);
112
}
113
114
return array(
115
$image,
116
$title,
117
$subtitle,
118
$unread_count,
119
);
120
}
121
122
}
123
124