2013-07-24 14:13:22 -07:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PHUIStatusItemView extends AphrontTagView {
|
|
|
|
|
|
|
|
private $icon;
|
|
|
|
private $iconLabel;
|
2014-05-16 18:59:02 -07:00
|
|
|
private $iconColor;
|
2013-07-24 14:13:22 -07:00
|
|
|
private $target;
|
|
|
|
private $note;
|
|
|
|
private $highlighted;
|
|
|
|
|
2014-05-16 18:59:02 -07:00
|
|
|
const ICON_ACCEPT = 'fa-check-circle';
|
|
|
|
const ICON_REJECT = 'fa-times-circle';
|
|
|
|
const ICON_LEFT = 'fa-chevron-circle-left';
|
|
|
|
const ICON_RIGHT = 'fa-chevron-circle-right';
|
|
|
|
const ICON_UP = 'fa-chevron-circle-up';
|
|
|
|
const ICON_DOWN = 'fa-chevron-circle-down';
|
|
|
|
const ICON_QUESTION = 'fa-question-circle';
|
|
|
|
const ICON_WARNING = 'fa-exclamation-circle';
|
|
|
|
const ICON_INFO = 'fa-info-circle';
|
|
|
|
const ICON_ADD = 'fa-plus-circle';
|
|
|
|
const ICON_MINUS = 'fa-minus-circle';
|
|
|
|
const ICON_OPEN = 'fa-circle-o';
|
|
|
|
const ICON_CLOCK = 'fa-clock-o';
|
2015-06-21 10:11:53 -07:00
|
|
|
const ICON_STAR = 'fa-star';
|
2014-05-16 18:59:02 -07:00
|
|
|
|
|
|
|
public function setIcon($icon, $color = null, $label = null) {
|
2013-07-24 14:13:22 -07:00
|
|
|
$this->icon = $icon;
|
|
|
|
$this->iconLabel = $label;
|
2014-05-16 18:59:02 -07:00
|
|
|
$this->iconColor = $color;
|
2013-07-24 14:13:22 -07:00
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setTarget($target) {
|
|
|
|
$this->target = $target;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setNote($note) {
|
|
|
|
$this->note = $note;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setHighlighted($highlighted) {
|
|
|
|
$this->highlighted = $highlighted;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function canAppendChild() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getTagName() {
|
|
|
|
return 'tr';
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getTagAttributes() {
|
|
|
|
$classes = array();
|
|
|
|
if ($this->highlighted) {
|
|
|
|
$classes[] = 'phui-status-item-highlighted';
|
|
|
|
}
|
|
|
|
|
|
|
|
return array(
|
|
|
|
'class' => $classes,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getTagContent() {
|
|
|
|
|
|
|
|
$icon = null;
|
|
|
|
if ($this->icon) {
|
|
|
|
$icon = id(new PHUIIconView())
|
2016-01-27 20:38:01 -08:00
|
|
|
->setIcon($this->icon.' '.$this->iconColor);
|
2013-07-24 14:13:22 -07:00
|
|
|
|
|
|
|
if ($this->iconLabel) {
|
|
|
|
Javelin::initBehavior('phabricator-tooltips');
|
|
|
|
$icon->addSigil('has-tooltip');
|
|
|
|
$icon->setMetadata(
|
|
|
|
array(
|
|
|
|
'tip' => $this->iconLabel,
|
2013-10-05 07:54:42 -07:00
|
|
|
'size' => 240,
|
2013-07-24 14:13:22 -07:00
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$target_cell = phutil_tag(
|
|
|
|
'td',
|
|
|
|
array(
|
|
|
|
'class' => 'phui-status-item-target',
|
|
|
|
),
|
2016-03-02 18:09:13 -08:00
|
|
|
array(
|
|
|
|
$icon,
|
|
|
|
$this->target,
|
|
|
|
));
|
2013-07-24 14:13:22 -07:00
|
|
|
|
|
|
|
$note_cell = phutil_tag(
|
|
|
|
'td',
|
|
|
|
array(
|
|
|
|
'class' => 'phui-status-item-note',
|
|
|
|
),
|
|
|
|
$this->note);
|
|
|
|
|
|
|
|
return array(
|
|
|
|
$target_cell,
|
|
|
|
$note_cell,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|