forked from phacility/phabricator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConpherenceMenuItemView.php
122 lines (108 loc) · 2.42 KB
/
ConpherenceMenuItemView.php
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<?php
final class ConpherenceMenuItemView extends AphrontTagView {
private $title;
private $subtitle;
private $imageURI;
private $href;
private $epoch;
private $unreadCount;
public function setUnreadCount($unread_count) {
$this->unreadCount = $unread_count;
return $this;
}
public function getUnreadCount() {
return $this->unreadCount;
}
public function setEpoch($epoch) {
$this->epoch = $epoch;
return $this;
}
public function getEpoch() {
return $this->epoch;
}
public function setHref($href) {
$this->href = $href;
return $this;
}
public function getHref() {
return $this->href;
}
public function setImageURI($image_uri) {
$this->imageURI = $image_uri;
return $this;
}
public function getImageURI() {
return $this->imageURI;
}
public function setSubtitle($subtitle) {
$this->subtitle = $subtitle;
return $this;
}
public function getSubtitle() {
return $this->subtitle;
}
public function setTitle($title) {
$this->title = $title;
return $this;
}
public function getTitle() {
return $this->title;
}
protected function getTagName() {
return 'a';
}
protected function getTagAttributes() {
$classes = array();
$classes[] = 'conpherence-menu-item-view';
$classes[] = 'phui-list-item-href';
return array(
'class' => implode(' ', $classes),
'href' => $this->href,
);
}
protected function getTagContent() {
$image = null;
if ($this->imageURI) {
$image = phutil_tag(
'span',
array(
'class' => 'conpherence-menu-item-image',
'style' => 'background-image: url('.$this->imageURI.');',
),
'');
}
$title = null;
if ($this->title) {
$title = phutil_tag(
'span',
array(
'class' => 'conpherence-menu-item-title',
),
$this->title);
}
$subtitle = null;
if ($this->subtitle) {
$subtitle = phutil_tag(
'span',
array(
'class' => 'conpherence-menu-item-subtitle',
),
$this->subtitle);
}
$unread_count = null;
if ($this->unreadCount) {
$unread_count = phutil_tag(
'span',
array(
'class' => 'conpherence-menu-item-unread-count',
),
(int)$this->unreadCount);
}
return array(
$image,
$title,
$subtitle,
$unread_count,
);
}
}