Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/calendar/query/PhabricatorCalendarImportLogSearchEngine.php
12256 views
1
<?php
2
3
final class PhabricatorCalendarImportLogSearchEngine
4
extends PhabricatorApplicationSearchEngine {
5
6
public function getResultTypeDescription() {
7
return pht('Calendar Import Logs');
8
}
9
10
public function getApplicationClassName() {
11
return 'PhabricatorCalendarApplication';
12
}
13
14
public function canUseInPanelContext() {
15
return false;
16
}
17
18
public function newQuery() {
19
return new PhabricatorCalendarImportLogQuery();
20
}
21
22
protected function buildCustomSearchFields() {
23
return array(
24
id(new PhabricatorPHIDsSearchField())
25
->setLabel(pht('Import Sources'))
26
->setKey('importSourcePHIDs')
27
->setAliases(array('importSourcePHID')),
28
);
29
}
30
31
protected function buildQueryFromParameters(array $map) {
32
$query = $this->newQuery();
33
34
if ($map['importSourcePHIDs']) {
35
$query->withImportPHIDs($map['importSourcePHIDs']);
36
}
37
38
return $query;
39
}
40
41
protected function getURI($path) {
42
return '/calendar/import/log/'.$path;
43
}
44
45
protected function getBuiltinQueryNames() {
46
$names = array(
47
'all' => pht('All Logs'),
48
);
49
50
return $names;
51
}
52
53
public function buildSavedQueryFromBuiltin($query_key) {
54
$query = $this->newSavedQuery();
55
$query->setQueryKey($query_key);
56
57
switch ($query_key) {
58
case 'all':
59
return $query;
60
}
61
62
return parent::buildSavedQueryFromBuiltin($query_key);
63
}
64
65
protected function renderResultList(
66
array $logs,
67
PhabricatorSavedQuery $query,
68
array $handles) {
69
70
assert_instances_of($logs, 'PhabricatorCalendarImportLog');
71
$viewer = $this->requireViewer();
72
73
$view = id(new PhabricatorCalendarImportLogView())
74
->setShowImportSources(true)
75
->setViewer($viewer)
76
->setLogs($logs);
77
78
return id(new PhabricatorApplicationSearchResultView())
79
->setTable($view->newTable());
80
}
81
}
82
83