2013-03-30 17:51:35 +01:00
|
|
|
<?php
|
|
|
|
|
2014-01-13 21:23:39 +01:00
|
|
|
final class PHUIWorkboardView extends AphrontTagView {
|
2013-03-30 17:51:35 +01:00
|
|
|
|
|
|
|
private $panels = array();
|
2013-04-02 20:23:24 +02:00
|
|
|
private $fluidLayout = false;
|
2013-11-06 03:55:42 +01:00
|
|
|
private $fluidishLayout = false;
|
2013-03-31 21:28:50 +02:00
|
|
|
private $actions = array();
|
2013-03-30 17:51:35 +01:00
|
|
|
|
2013-09-06 23:06:12 +02:00
|
|
|
public function addPanel(PHUIWorkpanelView $panel) {
|
2013-03-30 17:51:35 +01:00
|
|
|
$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-11-06 03:55:42 +01:00
|
|
|
public function setFluidishLayout($layout) {
|
|
|
|
$this->fluidishLayout = $layout;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2013-04-20 02:44:20 +02:00
|
|
|
public function addAction(PHUIIconView $action) {
|
2013-03-31 21:28:50 +02:00
|
|
|
$this->actions[] = $action;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2014-01-13 21:23:39 +01:00
|
|
|
public function getTagAttributes() {
|
|
|
|
return array(
|
|
|
|
'class' => 'phui-workboard-view',
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getTagContent() {
|
2013-09-06 23:06:12 +02:00
|
|
|
require_celerity_resource('phui-workboard-view-css');
|
2013-03-30 17:51:35 +01:00
|
|
|
|
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(
|
2013-09-06 23:06:12 +02:00
|
|
|
'class' => 'phui-workboard-action-item'
|
2013-03-31 21:28:50 +02:00
|
|
|
),
|
|
|
|
$action);
|
|
|
|
}
|
|
|
|
$action_list = phutil_tag(
|
|
|
|
'ul',
|
|
|
|
array(
|
2013-09-06 23:06:12 +02:00
|
|
|
'class' => 'phui-workboard-action-list'
|
2013-03-31 21:28:50 +02:00
|
|
|
),
|
|
|
|
$items);
|
|
|
|
}
|
|
|
|
|
2013-04-02 20:23:24 +02:00
|
|
|
$view = new AphrontMultiColumnView();
|
|
|
|
$view->setGutter(AphrontMultiColumnView::GUTTER_MEDIUM);
|
2013-11-06 03:55:42 +01:00
|
|
|
if ($this->fluidLayout) {
|
|
|
|
$view->setFluidLayout($this->fluidLayout);
|
|
|
|
}
|
|
|
|
if ($this->fluidishLayout) {
|
|
|
|
$view->setFluidishLayout($this->fluidishLayout);
|
|
|
|
}
|
2013-04-02 20:23:24 +02:00
|
|
|
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-09-06 23:06:12 +02:00
|
|
|
'class' => 'phui-workboard-view-shadow'
|
2013-03-30 17:51:35 +01:00
|
|
|
),
|
|
|
|
$view);
|
2013-03-31 21:28:50 +02:00
|
|
|
|
2014-01-13 21:23:39 +01:00
|
|
|
return array(
|
|
|
|
$action_list,
|
|
|
|
$board,
|
|
|
|
);
|
2013-03-30 17:51:35 +01:00
|
|
|
}
|
|
|
|
}
|