[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class PHUIPinboardItemView extends AphrontView { 4 5 private $imageURI; 6 private $uri; 7 private $header; 8 private $iconBlock = array(); 9 private $disabled; 10 11 private $imageWidth; 12 private $imageHeight; 13 14 public function setHeader($header) { 15 $this->header = $header; 16 return $this; 17 } 18 19 public function setURI($uri) { 20 $this->uri = $uri; 21 return $this; 22 } 23 24 public function setImageURI($image_uri) { 25 $this->imageURI = $image_uri; 26 return $this; 27 } 28 29 public function setImageSize($x, $y) { 30 $this->imageWidth = $x; 31 $this->imageHeight = $y; 32 return $this; 33 } 34 35 public function addIconCount($icon, $count) { 36 $this->iconBlock[] = array($icon, $count); 37 return $this; 38 } 39 40 public function setDisabled($disabled) { 41 $this->disabled = $disabled; 42 return $this; 43 } 44 45 public function render() { 46 require_celerity_resource('phui-pinboard-view-css'); 47 $header = null; 48 if ($this->header) { 49 if ($this->disabled) { 50 $header_color = 'gradient-lightgrey-header'; 51 } else { 52 $header_color = 'gradient-lightblue-header'; 53 } 54 $header = phutil_tag( 55 'div', 56 array( 57 'class' => 'phui-pinboard-item-header '. 58 'sprite-gradient '.$header_color, 59 ), 60 phutil_tag('a', array('href' => $this->uri), $this->header)); 61 } 62 63 $image = null; 64 if ($this->imageWidth) { 65 $image = phutil_tag( 66 'a', 67 array( 68 'href' => $this->uri, 69 'class' => 'phui-pinboard-item-image-link', 70 ), 71 phutil_tag( 72 'img', 73 array( 74 'src' => $this->imageURI, 75 'width' => $this->imageWidth, 76 'height' => $this->imageHeight, 77 ))); 78 } 79 80 $icons = array(); 81 if ($this->iconBlock) { 82 $icon_list = array(); 83 foreach ($this->iconBlock as $block) { 84 $icon = id(new PHUIIconView()) 85 ->setIconFont($block[0].' lightgreytext') 86 ->addClass('phui-pinboard-icon'); 87 88 $count = phutil_tag('span', array(), $block[1]); 89 $icon_list[] = phutil_tag( 90 'span', 91 array( 92 'class' => 'phui-pinboard-item-count', 93 ), 94 array($icon, $count)); 95 } 96 $icons = phutil_tag( 97 'div', 98 array( 99 'class' => 'phui-pinboard-icons', 100 ), 101 $icon_list); 102 } 103 104 $content = $this->renderChildren(); 105 if ($content) { 106 $content = phutil_tag( 107 'div', 108 array( 109 'class' => 'phui-pinboard-item-content', 110 ), 111 $content); 112 } 113 114 $classes = array(); 115 $classes[] = 'phui-pinboard-item-view'; 116 if ($this->disabled) { 117 $classes[] = 'phui-pinboard-item-disabled'; 118 } 119 120 return phutil_tag( 121 'div', 122 array( 123 'class' => implode(' ', $classes), 124 ), 125 array( 126 $header, 127 $image, 128 $content, 129 $icons, 130 )); 131 } 132 133 }
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 |