Path: blob/master/src/view/widget/bars/AphrontProgressBarView.php
12256 views
<?php12final class AphrontProgressBarView extends AphrontBarView {34const WIDTH = 100;56private $value;7private $max = 100;8private $alt = '';910protected function getDefaultColor() {11return parent::COLOR_AUTO_BADNESS;12}1314public function setValue($value) {15$this->value = $value;16return $this;17}1819public function setMax($max) {20$this->max = $max;21return $this;22}2324public function setAlt($text) {25$this->alt = $text;26return $this;27}2829protected function getRatio() {30return min($this->value, $this->max) / $this->max;31}3233public function render() {34require_celerity_resource('aphront-bars');35$ratio = $this->getRatio();36$width = self::WIDTH * $ratio;3738$color = $this->getColor();3940return phutil_tag_div(41"aphront-bar progress color-{$color}",42array(43phutil_tag(44'div',45array('title' => $this->alt),46phutil_tag(47'div',48array('style' => "width: {$width}px;"),49'')),50phutil_tag(51'span',52array(),53$this->getCaption()),54));55}5657}585960