Path: blob/master/src/view/phui/PHUISegmentBarView.php
12249 views
<?php12final class PHUISegmentBarView extends AphrontTagView {34private $label;5private $segments = array();67public function setLabel($label) {8$this->label = $label;9return $this;10}1112public function newSegment() {13$segment = new PHUISegmentBarSegmentView();14$this->segments[] = $segment;15return $segment;16}1718protected function canAppendChild() {19return false;20}2122protected function getTagAttributes() {23return array(24'class' => 'phui-segment-bar-view',25);26}2728protected function getTagContent() {29require_celerity_resource('phui-segment-bar-view-css');3031$label = $this->label;32if (strlen($label)) {33$label = phutil_tag(34'div',35array(36'class' => 'phui-segment-bar-label',37),38$label);39}4041$segments = $this->segments;4243$position = 0;44foreach ($segments as $segment) {45$segment->setPosition($position);46$position += $segment->getWidth();47}4849$segments = array_reverse($segments);5051$segments = phutil_tag(52'div',53array(54'class' => 'phui-segment-bar-segments',55),56$segments);5758return array(59$label,60$segments,61);62}6364}656667