Changeset View
Changeset View
Standalone View
Standalone View
src/applications/phortune/query/PhortuneChargeSearchEngine.php
Show First 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | final class PhortuneChargeSearchEngine | ||||
public function buildSearchForm( | public function buildSearchForm( | ||||
AphrontFormView $form, | AphrontFormView $form, | ||||
PhabricatorSavedQuery $saved_query) {} | PhabricatorSavedQuery $saved_query) {} | ||||
protected function getURI($path) { | protected function getURI($path) { | ||||
$account = $this->getAccount(); | $account = $this->getAccount(); | ||||
if ($account) { | if ($account) { | ||||
return '/phortune/'.$account->getID().'/charge/'; | return $account->getChargeListURI($path); | ||||
} else { | } else { | ||||
return '/phortune/charge/'.$path; | return '/phortune/charge/'.$path; | ||||
} | } | ||||
} | } | ||||
protected function getBuiltinQueryNames() { | protected function getBuiltinQueryNames() { | ||||
$names = array( | $names = array( | ||||
'all' => pht('All Charges'), | 'all' => pht('All Charges'), | ||||
Show All 10 Lines | public function buildSavedQueryFromBuiltin($query_key) { | ||||
switch ($query_key) { | switch ($query_key) { | ||||
case 'all': | case 'all': | ||||
return $query; | return $query; | ||||
} | } | ||||
return parent::buildSavedQueryFromBuiltin($query_key); | return parent::buildSavedQueryFromBuiltin($query_key); | ||||
} | } | ||||
protected function getRequiredHandlePHIDsForResultList( | |||||
array $charges, | |||||
PhabricatorSavedQuery $query) { | |||||
$phids = array(); | |||||
foreach ($charges as $charge) { | |||||
$phids[] = $charge->getProviderPHID(); | |||||
$phids[] = $charge->getCartPHID(); | |||||
$phids[] = $charge->getMerchantPHID(); | |||||
$phids[] = $charge->getPaymentMethodPHID(); | |||||
} | |||||
return $phids; | |||||
} | |||||
protected function renderResultList( | protected function renderResultList( | ||||
array $charges, | array $charges, | ||||
PhabricatorSavedQuery $query, | PhabricatorSavedQuery $query, | ||||
array $handles) { | array $handles) { | ||||
assert_instances_of($charges, 'PhortuneCharge'); | assert_instances_of($charges, 'PhortuneCharge'); | ||||
$viewer = $this->requireViewer(); | $viewer = $this->requireViewer(); | ||||
$table = id(new PhortuneChargeTableView()) | $table = id(new PhortuneChargeTableView()) | ||||
->setUser($viewer) | ->setUser($viewer) | ||||
->setCharges($charges) | ->setCharges($charges); | ||||
->setHandles($handles); | |||||
$result = new PhabricatorApplicationSearchResultView(); | $result = new PhabricatorApplicationSearchResultView(); | ||||
$result->setTable($table); | $result->setTable($table); | ||||
return $result; | return $result; | ||||
} | } | ||||
} | } |