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