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() {
18 public function newQuery() {
19 return new PhabricatorCalendarImportQuery();
22 protected function buildCustomSearchFields() {
26 protected function buildQueryFromParameters(array $map) {
27 $query = $this->newQuery();
32 protected function getURI($path) {
33 return '/calendar/import/'.$path;
36 protected function getBuiltinQueryNames() {
38 'all' => pht('All Imports'),
44 public function buildSavedQueryFromBuiltin($query_key) {
45 $query = $this->newSavedQuery();
46 $query->setQueryKey($query_key);
53 return parent
::buildSavedQueryFromBuiltin($query_key);
56 protected function renderResultList(
58 PhabricatorSavedQuery
$query,
61 assert_instances_of($imports, 'PhabricatorCalendarImport');
62 $viewer = $this->requireViewer();
64 $list = new PHUIObjectItemListView();
65 foreach ($imports as $import) {
66 $item = id(new PHUIObjectItemView())
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.'));