2013-03-30 09:51:35 -07:00
|
|
|
<?php
|
|
|
|
|
2013-09-06 14:06:12 -07:00
|
|
|
final class PHUIWorkpanelView extends AphrontView {
|
2013-03-30 09:51:35 -07:00
|
|
|
|
|
|
|
private $cards = array();
|
|
|
|
private $header;
|
2014-01-11 18:16:26 -08:00
|
|
|
private $editURI;
|
2013-03-30 09:51:35 -07:00
|
|
|
private $footerAction;
|
|
|
|
|
2013-09-09 14:14:34 -07:00
|
|
|
public function setCards(PHUIObjectItemListView $cards) {
|
2013-03-30 09:51:35 -07:00
|
|
|
$this->cards[] = $cards;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setHeader($header) {
|
|
|
|
$this->header = $header;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2014-01-11 18:16:26 -08:00
|
|
|
public function setEditURI($edit_uri) {
|
|
|
|
$this->editURI = $edit_uri;
|
2013-03-30 09:51:35 -07:00
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2013-06-05 08:41:43 -07:00
|
|
|
public function setFooterAction(PHUIListItemView $footer_action) {
|
2013-03-30 09:51:35 -07:00
|
|
|
$this->footerAction = $footer_action;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function render() {
|
2013-09-06 14:06:12 -07:00
|
|
|
require_celerity_resource('phui-workpanel-view-css');
|
2013-03-30 09:51:35 -07:00
|
|
|
|
|
|
|
$footer = '';
|
|
|
|
if ($this->footerAction) {
|
2013-03-30 14:46:02 -07:00
|
|
|
$footer_tag = $this->footerAction;
|
|
|
|
$footer = phutil_tag(
|
2013-06-05 08:41:43 -07:00
|
|
|
'ul',
|
2013-03-30 09:51:35 -07:00
|
|
|
array(
|
2013-09-06 14:06:12 -07:00
|
|
|
'class' => 'phui-workpanel-footer-action mst ps'
|
2013-03-30 09:51:35 -07:00
|
|
|
),
|
2013-03-30 14:46:02 -07:00
|
|
|
$footer_tag);
|
2013-03-30 09:51:35 -07:00
|
|
|
}
|
|
|
|
|
2014-01-08 16:20:31 -08:00
|
|
|
$header_edit = id(new PHUIIconView())
|
|
|
|
->setSpriteSheet(PHUIIconView::SPRITE_ACTIONS)
|
|
|
|
->setSpriteIcon('settings-grey')
|
2014-01-11 18:16:26 -08:00
|
|
|
->setHref($this->editURI);
|
2014-01-08 16:20:31 -08:00
|
|
|
|
2013-04-05 07:40:27 -07:00
|
|
|
$header = id(new PhabricatorActionHeaderView())
|
|
|
|
->setHeaderTitle($this->header)
|
2014-01-08 16:20:31 -08:00
|
|
|
->setHeaderColor(PhabricatorActionHeaderView::HEADER_GREY)
|
|
|
|
->addAction($header_edit);
|
2013-03-30 09:51:35 -07:00
|
|
|
|
|
|
|
$body = phutil_tag(
|
|
|
|
'div',
|
|
|
|
array(
|
2013-09-06 14:06:12 -07:00
|
|
|
'class' => 'phui-workpanel-body'
|
2013-03-30 09:51:35 -07:00
|
|
|
),
|
|
|
|
$this->cards);
|
|
|
|
|
|
|
|
$view = phutil_tag(
|
|
|
|
'div',
|
|
|
|
array(
|
2013-09-06 14:06:12 -07:00
|
|
|
'class' => 'phui-workpanel-view-inner',
|
2013-03-30 09:51:35 -07:00
|
|
|
),
|
|
|
|
array(
|
|
|
|
$header,
|
|
|
|
$body,
|
|
|
|
$footer,
|
|
|
|
));
|
|
|
|
|
|
|
|
return phutil_tag(
|
|
|
|
'div',
|
|
|
|
array(
|
2013-09-06 14:06:12 -07:00
|
|
|
'class' => 'phui-workpanel-view'
|
2013-03-30 09:51:35 -07:00
|
|
|
),
|
|
|
|
$view);
|
|
|
|
}
|
|
|
|
}
|