Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / src / view / phui / PHUIStatusItemView.php
blob6b375e1166afc73692a0c6d8348795101abb37d3
1 <?php
3 final class PHUIStatusItemView extends AphrontTagView {
5 private $icon;
6 private $iconLabel;
7 private $iconColor;
8 private $target;
9 private $note;
10 private $highlighted;
11 private $isExiled;
13 const ICON_ACCEPT = 'fa-check-circle';
14 const ICON_REJECT = 'fa-times-circle';
15 const ICON_LEFT = 'fa-chevron-circle-left';
16 const ICON_RIGHT = 'fa-chevron-circle-right';
17 const ICON_UP = 'fa-chevron-circle-up';
18 const ICON_DOWN = 'fa-chevron-circle-down';
19 const ICON_QUESTION = 'fa-question-circle';
20 const ICON_WARNING = 'fa-exclamation-circle';
21 const ICON_INFO = 'fa-info-circle';
22 const ICON_ADD = 'fa-plus-circle';
23 const ICON_MINUS = 'fa-minus-circle';
24 const ICON_OPEN = 'fa-circle-o';
25 const ICON_CLOCK = 'fa-clock-o';
26 const ICON_STAR = 'fa-star';
28 public function setIcon($icon, $color = null, $label = null) {
29 $this->icon = $icon;
30 $this->iconLabel = $label;
31 $this->iconColor = $color;
32 return $this;
35 public function setTarget($target) {
36 $this->target = $target;
37 return $this;
40 public function setNote($note) {
41 $this->note = $note;
42 return $this;
45 public function setHighlighted($highlighted) {
46 $this->highlighted = $highlighted;
47 return $this;
50 public function setIsExiled($is_exiled) {
51 $this->isExiled = $is_exiled;
52 return $this;
55 protected function canAppendChild() {
56 return false;
59 protected function getTagName() {
60 return 'tr';
63 protected function getTagAttributes() {
64 $classes = array();
65 if ($this->highlighted) {
66 $classes[] = 'phui-status-item-highlighted';
69 if ($this->isExiled) {
70 $classes[] = 'phui-status-item-exiled';
73 return array(
74 'class' => $classes,
78 protected function getTagContent() {
80 $icon = null;
81 if ($this->icon) {
82 $icon = id(new PHUIIconView())
83 ->setIcon($this->icon.' '.$this->iconColor);
85 if ($this->iconLabel) {
86 Javelin::initBehavior('phabricator-tooltips');
87 $icon->addSigil('has-tooltip');
88 $icon->setMetadata(
89 array(
90 'tip' => $this->iconLabel,
91 'size' => 240,
92 ));
96 $target_cell = phutil_tag(
97 'td',
98 array(
99 'class' => 'phui-status-item-target',
101 array(
102 $icon,
103 $this->target,
106 $note_cell = phutil_tag(
107 'td',
108 array(
109 'class' => 'phui-status-item-note',
111 $this->note);
113 return array(
114 $target_cell,
115 $note_cell,