2013-03-30 17:51:35 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PhabricatorWorkboardView extends AphrontView {
|
|
|
|
|
|
|
|
private $panels = array();
|
2013-04-02 20:23:24 +02:00
|
|
|
private $fluidLayout = false;
|
2013-03-31 21:28:50 +02:00
|
|
|
private $actions = array();
|
2013-03-30 17:51:35 +01:00
|
|
|
|
|
|
|
public function addPanel(PhabricatorWorkpanelView $panel) {
|
|
|
|
$this->panels[] = $panel;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2013-04-02 20:23:24 +02:00
|
|
|
public function setFluidLayout($layout) {
|
|
|
|
$this->fluidLayout = $layout;
|
2013-03-30 17:51:35 +01:00
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2013-04-05 16:40:27 +02:00
|
|
|
public function addAction(PhabricatorActionIconView $action) {
|
2013-03-31 21:28:50 +02:00
|
|
|
$this->actions[] = $action;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2013-03-30 17:51:35 +01:00
|
|
|
public function render() {
|
|
|
|
require_celerity_resource('phabricator-workboard-view-css');
|
|
|
|
|
2013-03-31 21:28:50 +02:00
|
|
|
$action_list = null;
|
|
|
|
if (!empty($this->actions)) {
|
|
|
|
$items = array();
|
|
|
|
foreach ($this->actions as $action) {
|
|
|
|
$items[] = phutil_tag(
|
|
|
|
'li',
|
|
|
|
array(
|
|
|
|
'class' => 'phabricator-workboard-action-item'
|
|
|
|
),
|
|
|
|
$action);
|
|
|
|
}
|
|
|
|
$action_list = phutil_tag(
|
|
|
|
'ul',
|
|
|
|
array(
|
|
|
|
'class' => 'phabricator-workboard-action-list'
|
|
|
|
),
|
|
|
|
$items);
|
|
|
|
}
|
|
|
|
|
2013-04-02 20:23:24 +02:00
|
|
|
$view = new AphrontMultiColumnView();
|
|
|
|
$view->setGutter(AphrontMultiColumnView::GUTTER_MEDIUM);
|
|
|
|
$view->setFluidLayout($this->fluidLayout);
|
|
|
|
foreach ($this->panels as $panel) {
|
|
|
|
$view->addColumn($panel);
|
2013-03-30 17:51:35 +01:00
|
|
|
}
|
|
|
|
|
2013-03-31 21:28:50 +02:00
|
|
|
$board = phutil_tag(
|
2013-03-30 17:51:35 +01:00
|
|
|
'div',
|
|
|
|
array(
|
2013-04-02 20:23:24 +02:00
|
|
|
'class' => 'phabricator-workboard-view-shadow'
|
2013-03-30 17:51:35 +01:00
|
|
|
),
|
|
|
|
$view);
|
2013-03-31 21:28:50 +02:00
|
|
|
|
|
|
|
return phutil_tag(
|
|
|
|
'div',
|
|
|
|
array(
|
|
|
|
'class' => 'phabricator-workboard-view'
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
$action_list,
|
|
|
|
$board
|
|
|
|
));
|
2013-03-30 17:51:35 +01:00
|
|
|
}
|
|
|
|
}
|