Remove all "FileHasObject" edge reads and writes
[phabricator.git] / src / applications / calendar / query / PhabricatorCalendarImportSearchEngine.php
bloba5e44812ea35c2d6f066acec3409114173f53b19
1 <?php
3 final class PhabricatorCalendarImportSearchEngine
4 extends PhabricatorApplicationSearchEngine {
6 public function getResultTypeDescription() {
7 return pht('Calendar Imports');
10 public function getApplicationClassName() {
11 return 'PhabricatorCalendarApplication';
14 public function canUseInPanelContext() {
15 return false;
18 public function newQuery() {
19 return new PhabricatorCalendarImportQuery();
22 protected function buildCustomSearchFields() {
23 return array();
26 protected function buildQueryFromParameters(array $map) {
27 $query = $this->newQuery();
29 return $query;
32 protected function getURI($path) {
33 return '/calendar/import/'.$path;
36 protected function getBuiltinQueryNames() {
37 $names = array(
38 'all' => pht('All Imports'),
41 return $names;
44 public function buildSavedQueryFromBuiltin($query_key) {
45 $query = $this->newSavedQuery();
46 $query->setQueryKey($query_key);
48 switch ($query_key) {
49 case 'all':
50 return $query;
53 return parent::buildSavedQueryFromBuiltin($query_key);
56 protected function renderResultList(
57 array $imports,
58 PhabricatorSavedQuery $query,
59 array $handles) {
61 assert_instances_of($imports, 'PhabricatorCalendarImport');
62 $viewer = $this->requireViewer();
64 $list = new PHUIObjectItemListView();
65 foreach ($imports as $import) {
66 $item = id(new PHUIObjectItemView())
67 ->setViewer($viewer)
68 ->setObjectName(pht('Import %d', $import->getID()))
69 ->setHeader($import->getDisplayName())
70 ->setHref($import->getURI());
72 if ($import->getIsDisabled()) {
73 $item->setDisabled(true);
76 $list->addItem($item);
79 $result = new PhabricatorApplicationSearchResultView();
80 $result->setObjectList($list);
81 $result->setNoDataString(pht('No imports found.'));
83 return $result;