3 final class PHUIObjectItemListView
extends AphrontTagView
{
13 private $allowEmptyList;
14 private $itemClass = 'phui-oi-standard';
15 private $tail = array();
17 public function setAllowEmptyList($allow_empty_list) {
18 $this->allowEmptyList
= $allow_empty_list;
22 public function getAllowEmptyList() {
23 return $this->allowEmptyList
;
26 public function setFlush($flush) {
27 $this->flush
= $flush;
31 public function setHeader($header) {
32 $this->header
= $header;
36 public function setPager($pager) {
37 $this->pager
= $pager;
41 public function setSimple($simple) {
42 $this->simple
= $simple;
46 public function setBig($big) {
51 public function setDrag($drag) {
53 $this->setItemClass('phui-oi-drag');
57 public function setNoDataString($no_data_string) {
58 $this->noDataString
= $no_data_string;
62 public function addItem(PHUIObjectItemView
$item) {
63 $this->items
[] = $item;
67 public function setItemClass($item_class) {
68 $this->itemClass
= $item_class;
72 protected function getTagName() {
76 public function newTailButton() {
77 $button = id(new PHUIButtonView())
79 ->setColor(PHUIButtonView
::GREY
)
80 ->setIcon('fa-chevron-down')
81 ->setText(pht('View All Results'));
83 $this->tail
[] = $button;
88 protected function getTagAttributes() {
90 $classes[] = 'phui-oi-list-view';
93 $classes[] = 'phui-oi-list-flush';
94 require_celerity_resource('phui-oi-flush-ui-css');
98 $classes[] = 'phui-oi-list-simple';
99 require_celerity_resource('phui-oi-simple-ui-css');
103 $classes[] = 'phui-oi-list-big';
104 require_celerity_resource('phui-oi-big-ui-css');
108 $classes[] = 'phui-oi-list-drag';
109 require_celerity_resource('phui-oi-drag-ui-css');
117 protected function getTagContent() {
118 $viewer = $this->getUser();
119 require_celerity_resource('phui-oi-list-view-css');
120 require_celerity_resource('phui-oi-color-css');
123 if ($this->header
!== null && strlen($this->header
)) {
124 $header = phutil_tag(
127 'class' => 'phui-oi-list-header',
134 foreach ($this->items
as $item) {
135 $item->setUser($viewer);
139 foreach ($this->items
as $item) {
140 $item->addClass($this->itemClass
);
143 $items = $this->items
;
144 } else if ($this->getAllowEmptyList()) {
147 $string = nonempty($this->noDataString
, pht('No data.'));
148 $string = id(new PHUIInfoView())
149 ->setSeverity(PHUIInfoView
::SEVERITY_NODATA
)
150 ->appendChild($string);
154 'class' => 'phui-oi-empty',
162 $pager = $this->pager
;
166 foreach ($this->tail
as $tail_item) {
167 $tail[] = phutil_tag(
170 'class' => 'phui-oi-tail',
180 $this->renderChildren(),