Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/calendar/view/PhabricatorCalendarImportLogView.php
12256 views
1
<?php
2
3
final class PhabricatorCalendarImportLogView extends AphrontView {
4
5
private $logs = array();
6
private $showImportSources = false;
7
8
public function setLogs(array $logs) {
9
assert_instances_of($logs, 'PhabricatorCalendarImportLog');
10
$this->logs = $logs;
11
return $this;
12
}
13
14
public function getLogs() {
15
return $this->logs;
16
}
17
18
public function setShowImportSources($show_import_sources) {
19
$this->showImportSources = $show_import_sources;
20
return $this;
21
}
22
23
public function getShowImportSources() {
24
return $this->showImportSources;
25
}
26
27
public function render() {
28
return $this->newTable();
29
}
30
31
public function newTable() {
32
$viewer = $this->getViewer();
33
$logs = $this->getLogs();
34
35
$show_sources = $this->getShowImportSources();
36
37
$rows = array();
38
foreach ($logs as $log) {
39
$icon = $log->getDisplayIcon($viewer);
40
$color = $log->getDisplayColor($viewer);
41
$name = $log->getDisplayType($viewer);
42
$description = $log->getDisplayDescription($viewer);
43
44
$rows[] = array(
45
$log->getID(),
46
($show_sources
47
? $viewer->renderHandle($log->getImport()->getPHID())
48
: null),
49
id(new PHUIIconView())->setIcon($icon, $color),
50
$name,
51
phutil_escape_html_newlines($description),
52
phabricator_datetime($log->getDateCreated(), $viewer),
53
);
54
}
55
56
$table = id(new AphrontTableView($rows))
57
->setHeaders(
58
array(
59
pht('ID'),
60
pht('Source'),
61
null,
62
pht('Type'),
63
pht('Message'),
64
pht('Date'),
65
))
66
->setColumnVisibility(
67
array(
68
true,
69
$show_sources,
70
))
71
->setColumnClasses(
72
array(
73
'top',
74
'top',
75
'top',
76
'top pri',
77
'top wide',
78
'top',
79
));
80
81
return $table;
82
}
83
84
}
85
86