Add a basic "harbormaster.step.edit" API method
[phabricator/blender.git] / src / view / phui / PHUIWorkpanelView.php
blob911d38c2e336c24767494cafe1647e28494d7373
1 <?php
3 final class PHUIWorkpanelView extends AphrontTagView {
5 private $cards = array();
6 private $header;
7 private $subheader = null;
8 private $footerAction;
9 private $headerActions = array();
10 private $headerTag;
11 private $headerIcon;
12 private $href;
14 public function setHeaderIcon($icon) {
15 $this->headerIcon = $icon;
16 return $this;
19 public function getHeaderIcon() {
20 return $this->headerIcon;
23 public function setCards(PHUIObjectItemListView $cards) {
24 $this->cards[] = $cards;
25 return $this;
28 public function setHeader($header) {
29 $this->header = $header;
30 return $this;
33 public function setSubheader($subheader) {
34 $this->subheader = $subheader;
35 return $this;
38 public function setFooterAction(PHUIListItemView $footer_action) {
39 $this->footerAction = $footer_action;
40 return $this;
43 public function addHeaderAction(PHUIIconView $action) {
44 $this->headerActions[] = $action;
45 return $this;
48 public function setHeaderTag(PHUITagView $tag) {
49 $this->headerTag = $tag;
50 return $this;
53 public function setHref($href) {
54 $this->href = $href;
55 return $this;
58 public function getHref() {
59 return $this->href;
62 protected function getTagAttributes() {
63 return array(
64 'class' => 'phui-workpanel-view',
68 protected function getTagContent() {
69 require_celerity_resource('phui-workpanel-view-css');
71 $footer = '';
72 if ($this->footerAction) {
73 $footer_tag = $this->footerAction;
74 $footer = phutil_tag(
75 'ul',
76 array(
77 'class' => 'phui-workpanel-footer-action mst ps',
79 $footer_tag);
82 $header = id(new PHUIHeaderView())
83 ->setHeader($this->header)
84 ->setSubheader($this->subheader);
86 foreach ($this->headerActions as $action) {
87 $header->addActionItem($action);
90 if ($this->headerTag) {
91 $header->addActionItem($this->headerTag);
94 if ($this->headerIcon) {
95 $header->setHeaderIcon($this->headerIcon);
98 $href = $this->getHref();
99 if ($href !== null) {
100 $header->setHref($href);
103 $body = phutil_tag(
104 'div',
105 array(
106 'class' => 'phui-workpanel-body-content',
108 $this->cards);
110 $body = phutil_tag_div('phui-workpanel-body', $body);
112 $view = id(new PHUIBoxView())
113 ->setColor(PHUIBoxView::GREY)
114 ->addClass('phui-workpanel-view-inner')
115 ->appendChild(
116 array(
117 $header,
118 $body,
119 $footer,
122 return $view;