forked from phacility/phabricator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPhluxListController.php
59 lines (44 loc) · 1.43 KB
/
PhluxListController.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
final class PhluxListController extends PhluxController {
public function handleRequest(AphrontRequest $request) {
$viewer = $this->getViewer();
$pager = new AphrontCursorPagerView();
$pager->readFromRequest($request);
$query = id(new PhluxVariableQuery())
->setViewer($viewer);
$vars = $query->executeWithCursorPager($pager);
$view = new PHUIObjectItemListView();
$view->setFlush(true);
foreach ($vars as $var) {
$key = $var->getVariableKey();
$item = new PHUIObjectItemView();
$item->setHeader($key);
$item->setHref($this->getApplicationURI('/view/'.$key.'/'));
$item->addIcon(
'none',
phabricator_datetime($var->getDateModified(), $viewer));
$view->addItem($item);
}
$crumbs = $this->buildApplicationCrumbs();
$box = id(new PHUIObjectBoxView())
->setHeaderText('Variables')
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->appendChild($view);
$title = pht('Variable List');
$header = id(new PHUIHeaderView())
->setHeader($title)
->setHeaderIcon('fa-copy');
$crumbs->addTextCrumb($title, $this->getApplicationURI());
$crumbs->setBorder(true);
$view = id(new PHUITwoColumnView())
->setHeader($header)
->setFooter(array(
$box,
$pager,
));
return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->appendChild($view);
}
}