2013-03-30 17:51:35 +01:00
|
|
|
<?php
|
|
|
|
|
2014-01-13 21:23:39 +01:00
|
|
|
final class PHUIWorkpanelView extends AphrontTagView {
|
2013-03-30 17:51:35 +01:00
|
|
|
|
|
|
|
private $cards = array();
|
|
|
|
private $header;
|
2014-01-12 03:16:26 +01:00
|
|
|
private $editURI;
|
2014-03-06 03:40:28 +01:00
|
|
|
private $headerAction;
|
2013-03-30 17:51:35 +01:00
|
|
|
private $footerAction;
|
2014-01-13 06:40:02 +01:00
|
|
|
private $headerColor = PhabricatorActionHeaderView::HEADER_GREY;
|
2013-03-30 17:51:35 +01:00
|
|
|
|
2014-03-06 03:40:28 +01:00
|
|
|
public function setHeaderAction(PHUIIconView $header_action) {
|
|
|
|
$this->headerAction = $header_action;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2013-09-09 23:14:34 +02:00
|
|
|
public function setCards(PHUIObjectItemListView $cards) {
|
2013-03-30 17:51:35 +01:00
|
|
|
$this->cards[] = $cards;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setHeader($header) {
|
|
|
|
$this->header = $header;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2014-01-12 03:16:26 +01:00
|
|
|
public function setEditURI($edit_uri) {
|
|
|
|
$this->editURI = $edit_uri;
|
2013-03-30 17:51:35 +01:00
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2013-06-05 17:41:43 +02:00
|
|
|
public function setFooterAction(PHUIListItemView $footer_action) {
|
2013-03-30 17:51:35 +01:00
|
|
|
$this->footerAction = $footer_action;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2014-01-13 06:40:02 +01:00
|
|
|
public function setHeaderColor($header_color) {
|
|
|
|
$this->headerColor = $header_color;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2014-01-13 21:23:39 +01:00
|
|
|
public function getTagAttributes() {
|
|
|
|
return array(
|
|
|
|
'class' => 'phui-workpanel-view',
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getTagContent() {
|
2013-09-06 23:06:12 +02:00
|
|
|
require_celerity_resource('phui-workpanel-view-css');
|
2013-03-30 17:51:35 +01:00
|
|
|
|
|
|
|
$footer = '';
|
|
|
|
if ($this->footerAction) {
|
2013-03-30 22:46:02 +01:00
|
|
|
$footer_tag = $this->footerAction;
|
|
|
|
$footer = phutil_tag(
|
2013-06-05 17:41:43 +02:00
|
|
|
'ul',
|
2013-03-30 17:51:35 +01:00
|
|
|
array(
|
2013-09-06 23:06:12 +02:00
|
|
|
'class' => 'phui-workpanel-footer-action mst ps'
|
2013-03-30 17:51:35 +01:00
|
|
|
),
|
2013-03-30 22:46:02 +01:00
|
|
|
$footer_tag);
|
2013-03-30 17:51:35 +01:00
|
|
|
}
|
|
|
|
|
2014-02-27 18:39:59 +01:00
|
|
|
$header_edit = null;
|
|
|
|
if ($this->editURI) {
|
|
|
|
$header_edit = id(new PHUIIconView())
|
|
|
|
->setSpriteSheet(PHUIIconView::SPRITE_ACTIONS)
|
|
|
|
->setSpriteIcon('settings-grey')
|
|
|
|
->setHref($this->editURI);
|
|
|
|
}
|
2013-04-05 16:40:27 +02:00
|
|
|
$header = id(new PhabricatorActionHeaderView())
|
|
|
|
->setHeaderTitle($this->header)
|
2014-02-27 18:39:59 +01:00
|
|
|
->setHeaderColor($this->headerColor);
|
|
|
|
if ($header_edit) {
|
|
|
|
$header->addAction($header_edit);
|
|
|
|
}
|
2014-03-06 03:40:28 +01:00
|
|
|
if ($this->headerAction) {
|
|
|
|
$header->addAction($this->headerAction);
|
|
|
|
}
|
2013-03-30 17:51:35 +01:00
|
|
|
|
|
|
|
$body = phutil_tag(
|
|
|
|
'div',
|
|
|
|
array(
|
2013-09-06 23:06:12 +02:00
|
|
|
'class' => 'phui-workpanel-body'
|
2013-03-30 17:51:35 +01:00
|
|
|
),
|
|
|
|
$this->cards);
|
|
|
|
|
|
|
|
$view = phutil_tag(
|
|
|
|
'div',
|
|
|
|
array(
|
2013-09-06 23:06:12 +02:00
|
|
|
'class' => 'phui-workpanel-view-inner',
|
2013-03-30 17:51:35 +01:00
|
|
|
),
|
|
|
|
array(
|
|
|
|
$header,
|
|
|
|
$body,
|
|
|
|
$footer,
|
|
|
|
));
|
|
|
|
|
2014-01-13 21:23:39 +01:00
|
|
|
return $view;
|
2013-03-30 17:51:35 +01:00
|
|
|
}
|
|
|
|
}
|