[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class PHUIWorkpanelView extends AphrontTagView { 4 5 private $cards = array(); 6 private $header; 7 private $subheader = null; 8 private $footerAction; 9 private $headerColor = PHUIActionHeaderView::HEADER_GREY; 10 private $headerActions = array(); 11 private $headerTag; 12 private $headerIcon; 13 14 public function setHeaderIcon(PHUIIconView $header_icon) { 15 $this->headerIcon = $header_icon; 16 return $this; 17 } 18 19 public function getHeaderIcon() { 20 return $this->headerIcon; 21 } 22 23 public function setCards(PHUIObjectItemListView $cards) { 24 $this->cards[] = $cards; 25 return $this; 26 } 27 28 public function setHeader($header) { 29 $this->header = $header; 30 return $this; 31 } 32 33 public function setSubheader($subheader) { 34 $this->subheader = $subheader; 35 return $this; 36 } 37 38 public function setFooterAction(PHUIListItemView $footer_action) { 39 $this->footerAction = $footer_action; 40 return $this; 41 } 42 43 public function setHeaderColor($header_color) { 44 $this->headerColor = $header_color; 45 return $this; 46 } 47 48 public function addHeaderAction(PHUIIconView $action) { 49 $this->headerActions[] = $action; 50 return $this; 51 } 52 53 public function setHeaderTag(PHUITagView $tag) { 54 $this->headerTag = $tag; 55 return $this; 56 } 57 58 public function getTagAttributes() { 59 return array( 60 'class' => 'phui-workpanel-view', 61 ); 62 } 63 64 public function getTagContent() { 65 require_celerity_resource('phui-workpanel-view-css'); 66 67 $classes = array(); 68 $classes[] = 'phui-workpanel-view-inner'; 69 $footer = ''; 70 if ($this->footerAction) { 71 $footer_tag = $this->footerAction; 72 $footer = phutil_tag( 73 'ul', 74 array( 75 'class' => 'phui-workpanel-footer-action mst ps', 76 ), 77 $footer_tag); 78 } 79 80 $header = id(new PHUIActionHeaderView()) 81 ->setHeaderTitle($this->header) 82 ->setHeaderSubtitle($this->subheader) 83 ->setHeaderColor($this->headerColor); 84 85 if ($this->headerIcon) { 86 $header->setHeaderIcon($this->headerIcon); 87 } 88 89 if ($this->headerTag) { 90 $header->setTag($this->headerTag); 91 } 92 93 foreach ($this->headerActions as $action) { 94 $header->addAction($action); 95 } 96 97 $classes[] = 'phui-workpanel-'.$this->headerColor; 98 99 $body = phutil_tag( 100 'div', 101 array( 102 'class' => 'phui-workpanel-body', 103 ), 104 $this->cards); 105 106 $view = phutil_tag( 107 'div', 108 array( 109 'class' => implode(' ', $classes), 110 ), 111 array( 112 $header, 113 $body, 114 $footer, 115 )); 116 117 return $view; 118 } 119 }
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 |