2012-10-01 23:06:00 +02:00
|
|
|
<?php
|
|
|
|
|
2013-08-07 19:58:09 +02:00
|
|
|
final class PHUIPinboardView extends AphrontView {
|
2012-10-01 23:06:00 +02:00
|
|
|
|
|
|
|
private $items = array();
|
2012-12-13 19:59:29 +01:00
|
|
|
private $noDataString;
|
|
|
|
|
|
|
|
public function setNoDataString($no_data_string) {
|
|
|
|
$this->noDataString = $no_data_string;
|
|
|
|
return $this;
|
|
|
|
}
|
2012-10-01 23:06:00 +02:00
|
|
|
|
2013-08-07 19:58:09 +02:00
|
|
|
public function addItem(PHUIPinboardItemView $item) {
|
2012-10-01 23:06:00 +02:00
|
|
|
$this->items[] = $item;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function render() {
|
2013-08-07 19:58:09 +02:00
|
|
|
require_celerity_resource('phui-pinboard-view-css');
|
2012-10-01 23:06:00 +02:00
|
|
|
|
2012-12-13 19:59:29 +01:00
|
|
|
if (!$this->items) {
|
|
|
|
$string = nonempty($this->noDataString, pht('No data.'));
|
2015-03-01 23:45:56 +01:00
|
|
|
return id(new PHUIInfoView())
|
|
|
|
->setSeverity(PHUIInfoView::SEVERITY_NODATA)
|
2013-02-07 01:53:49 +01:00
|
|
|
->appendChild($string)
|
2012-12-13 19:59:29 +01:00
|
|
|
->render();
|
|
|
|
}
|
|
|
|
|
2013-01-29 03:44:54 +01:00
|
|
|
return phutil_tag(
|
2012-10-01 23:06:00 +02:00
|
|
|
'div',
|
|
|
|
array(
|
2013-08-07 19:58:09 +02:00
|
|
|
'class' => 'phui-pinboard-view',
|
2012-10-01 23:06:00 +02:00
|
|
|
),
|
2013-03-09 22:52:41 +01:00
|
|
|
$this->items);
|
2012-10-01 23:06:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|