[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class AphrontProgressBarView extends AphrontBarView { 4 5 const WIDTH = 100; 6 7 private $value; 8 private $max = 100; 9 private $alt = ''; 10 11 public function getDefaultColor() { 12 return AphrontBarView::COLOR_AUTO_BADNESS; 13 } 14 15 public function setValue($value) { 16 $this->value = $value; 17 return $this; 18 } 19 20 public function setMax($max) { 21 $this->max = $max; 22 return $this; 23 } 24 25 public function setAlt($text) { 26 $this->alt = $text; 27 return $this; 28 } 29 30 protected function getRatio() { 31 return min($this->value, $this->max) / $this->max; 32 } 33 34 public function render() { 35 require_celerity_resource('aphront-bars'); 36 $ratio = $this->getRatio(); 37 $width = self::WIDTH * $ratio; 38 39 $color = $this->getColor(); 40 41 return phutil_tag_div( 42 "aphront-bar progress color-{$color}", 43 array( 44 phutil_tag( 45 'div', 46 array('title' => $this->alt), 47 phutil_tag( 48 'div', 49 array('style' => "width: {$width}px;"), 50 '')), 51 phutil_tag( 52 'span', 53 array(), 54 $this->getCaption()), 55 )); 56 } 57 58 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |