2013-03-11 03:20:01 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class AphrontTwoColumnView extends AphrontView {
|
|
|
|
|
|
|
|
private $mainColumn;
|
|
|
|
private $sideColumn;
|
2013-04-12 00:05:50 +02:00
|
|
|
private $centered = false;
|
2013-03-11 03:20:01 +01:00
|
|
|
private $padding = true;
|
|
|
|
|
|
|
|
public function setMainColumn($main) {
|
|
|
|
$this->mainColumn = $main;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setSideColumn($side) {
|
|
|
|
$this->sideColumn = $side;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2013-04-12 00:05:50 +02:00
|
|
|
public function setCentered($centered) {
|
|
|
|
$this->centered = $centered;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2013-03-11 03:20:01 +01:00
|
|
|
public function setNoPadding($padding) {
|
|
|
|
$this->padding = $padding;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function render() {
|
|
|
|
require_celerity_resource('aphront-two-column-view-css');
|
|
|
|
|
|
|
|
$main = phutil_tag(
|
|
|
|
'div',
|
|
|
|
array(
|
|
|
|
'class' => 'aphront-main-column'
|
|
|
|
),
|
|
|
|
$this->mainColumn);
|
|
|
|
|
|
|
|
$side = phutil_tag(
|
|
|
|
'div',
|
|
|
|
array(
|
|
|
|
'class' => 'aphront-side-column'
|
|
|
|
),
|
|
|
|
$this->sideColumn);
|
|
|
|
|
|
|
|
$classes = array('aphront-two-column');
|
2013-04-12 00:05:50 +02:00
|
|
|
if ($this->centered) {
|
|
|
|
$classes = array('aphront-two-column-centered');
|
|
|
|
}
|
|
|
|
|
2013-03-11 03:20:01 +01:00
|
|
|
if ($this->padding) {
|
|
|
|
$classes[] = 'aphront-two-column-padded';
|
|
|
|
}
|
|
|
|
|
|
|
|
return phutil_tag(
|
|
|
|
'div',
|
|
|
|
array(
|
|
|
|
'class' => implode(' ', $classes)
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
$main,
|
|
|
|
$side,
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|