1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-16 20:02:40 +01:00
phorge-phorge/src/applications/drydock/view/DrydockLogListView.php
epriestley 38f5894b58 Move Drydock object list rendering to SearchEngine
Summary: Ref T4986. Allows the Drydock search engines to render as panels.

Test Plan: Viewed affected interfaces in Drydock. Created panels from each engine.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T4986

Differential Revision: https://secure.phabricator.com/D9103
2014-05-13 12:14:33 -07:00

69 lines
1.3 KiB
PHP

<?php
final class DrydockLogListView extends AphrontView {
private $logs;
public function setLogs(array $logs) {
assert_instances_of($logs, 'DrydockLog');
$this->logs = $logs;
return $this;
}
public function render() {
$logs = $this->logs;
$viewer = $this->getUser();
$view = new PHUIObjectItemListView();
$rows = array();
foreach ($logs as $log) {
$resource_uri = '/drydock/resource/'.$log->getResourceID().'/';
$lease_uri = '/drydock/lease/'.$log->getLeaseID().'/';
$rows[] = array(
phutil_tag(
'a',
array(
'href' => $resource_uri,
),
$log->getResourceID()),
phutil_tag(
'a',
array(
'href' => $lease_uri,
),
$log->getLeaseID()),
$log->getMessage(),
phabricator_date($log->getEpoch(), $viewer),
);
}
$table = new AphrontTableView($rows);
$table->setDeviceReadyTable(true);
$table->setHeaders(
array(
'Resource',
'Lease',
'Message',
'Date',
));
$table->setShortHeaders(
array(
'R',
'L',
'Message',
'',
));
$table->setColumnClasses(
array(
'',
'',
'wide',
'',
));
return $table;
}
}