2012-08-02 23:07:21 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PhabricatorApplicationStatusView extends AphrontView {
|
|
|
|
|
|
|
|
private $count;
|
|
|
|
private $text;
|
|
|
|
private $type;
|
|
|
|
|
|
|
|
const TYPE_NEEDS_ATTENTION = 'needs';
|
|
|
|
const TYPE_INFO = 'info';
|
|
|
|
const TYPE_OKAY = 'okay';
|
|
|
|
const TYPE_WARNING = 'warning';
|
|
|
|
const TYPE_EMPTY = 'empty';
|
|
|
|
|
|
|
|
public function setType($type) {
|
|
|
|
$this->type = $type;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2013-02-21 19:42:19 +01:00
|
|
|
public function getType() {
|
|
|
|
return $this->type;
|
|
|
|
}
|
|
|
|
|
2012-08-02 23:07:21 +02:00
|
|
|
public function setText($text) {
|
|
|
|
$this->text = $text;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2013-02-21 19:42:19 +01:00
|
|
|
public function getText() {
|
|
|
|
return $this->text;
|
|
|
|
}
|
|
|
|
|
2012-08-02 23:07:21 +02:00
|
|
|
public function setCount($count) {
|
|
|
|
$this->count = $count;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getCount() {
|
|
|
|
return $this->count;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function render() {
|
2013-02-21 19:42:19 +01:00
|
|
|
$type = $this->type;
|
|
|
|
if (!$this->count) {
|
|
|
|
$type = self::TYPE_EMPTY;
|
|
|
|
}
|
|
|
|
|
2012-08-02 23:07:21 +02:00
|
|
|
$classes = array(
|
|
|
|
'phabricator-application-status',
|
2013-02-21 19:42:19 +01:00
|
|
|
'phabricator-application-status-type-'.$type,
|
2012-08-02 23:07:21 +02:00
|
|
|
);
|
|
|
|
|
2013-01-18 03:43:35 +01:00
|
|
|
return phutil_tag(
|
2012-08-02 23:07:21 +02:00
|
|
|
'span',
|
|
|
|
array(
|
|
|
|
'class' => implode(' ', $classes),
|
|
|
|
),
|
2013-01-18 03:43:35 +01:00
|
|
|
$this->text);
|
2012-08-02 23:07:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|