2015-02-08 02:06:28 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PHUIActionPanelView extends AphrontTagView {
|
|
|
|
|
|
|
|
private $href;
|
|
|
|
private $fontIcon;
|
|
|
|
private $header;
|
|
|
|
private $subHeader;
|
2015-02-09 16:27:54 +01:00
|
|
|
private $bigText;
|
2015-02-08 02:06:28 +01:00
|
|
|
private $state;
|
|
|
|
private $status;
|
|
|
|
|
2015-09-16 18:22:31 +02:00
|
|
|
const COLOR_RED = 'phui-action-panel-red';
|
|
|
|
const COLOR_ORANGE = 'phui-action-panel-orange';
|
|
|
|
const COLOR_YELLOW = 'phui-action-panel-yellow';
|
|
|
|
const COLOR_GREEN = 'phui-action-panel-green';
|
|
|
|
const COLOR_BLUE = 'phui-action-panel-blue';
|
|
|
|
const COLOR_INDIGO = 'phui-action-panel-indigo';
|
|
|
|
const COLOR_VIOLET = 'phui-action-panel-violet';
|
|
|
|
const COLOR_PINK = 'phui-action-panel-pink';
|
2015-02-08 02:06:28 +01:00
|
|
|
|
|
|
|
public function setHref($href) {
|
|
|
|
$this->href = $href;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setFontIcon($image) {
|
|
|
|
$this->fontIcon = $image;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2015-02-09 16:27:54 +01:00
|
|
|
public function setBigText($text) {
|
|
|
|
$this->bigText = $text;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2015-02-08 02:06:28 +01:00
|
|
|
public function setHeader($header) {
|
|
|
|
$this->header = $header;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setSubHeader($sub) {
|
|
|
|
$this->subHeader = $sub;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setState($state) {
|
|
|
|
$this->state = $state;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setStatus($text) {
|
|
|
|
$this->status = $text;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2015-09-16 03:32:01 +02:00
|
|
|
protected function getTagName() {
|
|
|
|
return 'div';
|
2015-02-08 02:06:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
protected function getTagAttributes() {
|
|
|
|
require_celerity_resource('phui-action-panel-css');
|
|
|
|
|
|
|
|
$classes = array();
|
|
|
|
$classes[] = 'phui-action-panel';
|
2015-09-16 03:32:01 +02:00
|
|
|
if ($this->state) {
|
2015-02-08 02:06:28 +01:00
|
|
|
$classes[] = $this->state;
|
2015-09-16 03:32:01 +02:00
|
|
|
}
|
|
|
|
if ($this->bigText) {
|
|
|
|
$classes[] = 'phui-action-panel-bigtext';
|
2015-02-08 02:06:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return array(
|
|
|
|
'class' => implode(' ', $classes),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getTagContent() {
|
|
|
|
|
|
|
|
$icon = null;
|
2015-09-16 03:32:01 +02:00
|
|
|
if ($this->fontIcon) {
|
|
|
|
$fonticon = id(new PHUIIconView())
|
|
|
|
->setIconFont($this->fontIcon);
|
2015-02-08 02:06:28 +01:00
|
|
|
$icon = phutil_tag(
|
2015-09-16 03:32:01 +02:00
|
|
|
'span',
|
2015-02-08 02:06:28 +01:00
|
|
|
array(
|
|
|
|
'class' => 'phui-action-panel-icon',
|
|
|
|
),
|
|
|
|
$fonticon);
|
|
|
|
}
|
|
|
|
|
|
|
|
$header = null;
|
|
|
|
if ($this->header) {
|
|
|
|
$header = phutil_tag(
|
2015-09-17 17:22:23 +02:00
|
|
|
'span',
|
2015-02-08 02:06:28 +01:00
|
|
|
array(
|
|
|
|
'class' => 'phui-action-panel-header',
|
|
|
|
),
|
2015-09-17 17:22:23 +02:00
|
|
|
$this->header);
|
2015-02-08 02:06:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$subheader = null;
|
|
|
|
if ($this->subHeader) {
|
|
|
|
$subheader = phutil_tag(
|
2015-09-16 03:32:01 +02:00
|
|
|
'span',
|
2015-02-08 02:06:28 +01:00
|
|
|
array(
|
|
|
|
'class' => 'phui-action-panel-subheader',
|
|
|
|
),
|
|
|
|
$this->subHeader);
|
|
|
|
}
|
|
|
|
|
2015-09-16 03:32:01 +02:00
|
|
|
$row = phutil_tag(
|
|
|
|
'span',
|
|
|
|
array(
|
|
|
|
'class' => 'phui-action-panel-row',
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
$icon,
|
|
|
|
$subheader,
|
|
|
|
));
|
|
|
|
|
|
|
|
$table = phutil_tag(
|
|
|
|
'span',
|
|
|
|
array(
|
|
|
|
'class' => 'phui-action-panel-table',
|
|
|
|
),
|
|
|
|
$row);
|
|
|
|
|
2015-09-17 17:22:23 +02:00
|
|
|
return phutil_tag(
|
2015-09-16 03:32:01 +02:00
|
|
|
'a',
|
|
|
|
array(
|
|
|
|
'href' => $this->href,
|
|
|
|
'class' => 'phui-action-panel-hitarea',
|
|
|
|
),
|
2015-09-17 17:22:23 +02:00
|
|
|
array($header, $table));
|
2015-02-08 02:06:28 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|