[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/view/phui/ -> PHUIStatusItemView.php (source)

   1  <?php
   2  
   3  final class PHUIStatusItemView extends AphrontTagView {
   4  
   5    private $icon;
   6    private $iconLabel;
   7    private $iconColor;
   8    private $target;
   9    private $note;
  10    private $highlighted;
  11  
  12    const ICON_ACCEPT = 'fa-check-circle';
  13    const ICON_REJECT = 'fa-times-circle';
  14    const ICON_LEFT = 'fa-chevron-circle-left';
  15    const ICON_RIGHT = 'fa-chevron-circle-right';
  16    const ICON_UP = 'fa-chevron-circle-up';
  17    const ICON_DOWN = 'fa-chevron-circle-down';
  18    const ICON_QUESTION = 'fa-question-circle';
  19    const ICON_WARNING = 'fa-exclamation-circle';
  20    const ICON_INFO = 'fa-info-circle';
  21    const ICON_ADD = 'fa-plus-circle';
  22    const ICON_MINUS = 'fa-minus-circle';
  23    const ICON_OPEN = 'fa-circle-o';
  24    const ICON_CLOCK = 'fa-clock-o';
  25  
  26    /* render_textarea */
  27    public function setIcon($icon, $color = null, $label = null) {
  28      $this->icon = $icon;
  29      $this->iconLabel = $label;
  30      $this->iconColor = $color;
  31      return $this;
  32    }
  33  
  34    public function setTarget($target) {
  35      $this->target = $target;
  36      return $this;
  37    }
  38  
  39    public function setNote($note) {
  40      $this->note = $note;
  41      return $this;
  42    }
  43  
  44    public function setHighlighted($highlighted) {
  45      $this->highlighted = $highlighted;
  46      return $this;
  47    }
  48  
  49    protected function canAppendChild() {
  50      return false;
  51    }
  52  
  53    protected function getTagName() {
  54      return 'tr';
  55    }
  56  
  57    protected function getTagAttributes() {
  58      $classes = array();
  59      if ($this->highlighted) {
  60        $classes[] = 'phui-status-item-highlighted';
  61      }
  62  
  63      return array(
  64        'class' => $classes,
  65      );
  66    }
  67  
  68    protected function getTagContent() {
  69  
  70      $icon = null;
  71      if ($this->icon) {
  72        $icon = id(new PHUIIconView())
  73          ->setIconFont($this->icon.' '.$this->iconColor);
  74  
  75        if ($this->iconLabel) {
  76          Javelin::initBehavior('phabricator-tooltips');
  77          $icon->addSigil('has-tooltip');
  78          $icon->setMetadata(
  79            array(
  80              'tip' => $this->iconLabel,
  81              'size' => 240,
  82            ));
  83        }
  84      }
  85  
  86      $icon_cell = phutil_tag(
  87        'td',
  88        array(),
  89        $icon);
  90  
  91      $target_cell = phutil_tag(
  92        'td',
  93        array(
  94          'class' => 'phui-status-item-target',
  95        ),
  96        $this->target);
  97  
  98      $note_cell = phutil_tag(
  99        'td',
 100        array(
 101          'class' => 'phui-status-item-note',
 102        ),
 103        $this->note);
 104  
 105      return array(
 106        $icon_cell,
 107        $target_cell,
 108        $note_cell,
 109      );
 110    }
 111  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1