Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F96149402
PhortuneMerchantSearchEngine.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Dec 23, 04:00
Size
2 KB
Mime Type
text/x-php
Expires
Wed, Dec 25, 04:00 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23132641
Attached To
rPH Phabricator
PhortuneMerchantSearchEngine.php
View Options
<?php
final
class
PhortuneMerchantSearchEngine
extends
PhabricatorApplicationSearchEngine
{
public
function
getResultTypeDescription
()
{
return
pht
(
'Phortune Merchants'
);
}
public
function
getApplicationClassName
()
{
return
'PhabricatorPhortuneApplication'
;
}
public
function
buildSavedQueryFromRequest
(
AphrontRequest
$request
)
{
$saved
=
new
PhabricatorSavedQuery
();
return
$saved
;
}
public
function
buildQueryFromSavedQuery
(
PhabricatorSavedQuery
$saved
)
{
$query
=
id
(
new
PhortuneMerchantQuery
())
->
needProfileImage
(
true
);
return
$query
;
}
public
function
buildSearchForm
(
AphrontFormView
$form
,
PhabricatorSavedQuery
$saved_query
)
{}
protected
function
getURI
(
$path
)
{
return
'/phortune/merchant/'
.
$path
;
}
protected
function
getBuiltinQueryNames
()
{
$names
=
array
(
'all'
=>
pht
(
'All Merchants'
),
);
return
$names
;
}
public
function
buildSavedQueryFromBuiltin
(
$query_key
)
{
$query
=
$this
->
newSavedQuery
();
$query
->
setQueryKey
(
$query_key
);
switch
(
$query_key
)
{
case
'all'
:
return
$query
;
}
return
parent
::
buildSavedQueryFromBuiltin
(
$query_key
);
}
protected
function
getRequiredHandlePHIDsForResultList
(
array
$merchants
,
PhabricatorSavedQuery
$query
)
{
return
array
();
}
protected
function
renderResultList
(
array
$merchants
,
PhabricatorSavedQuery
$query
,
array
$handles
)
{
assert_instances_of
(
$merchants
,
'PhortuneMerchant'
);
$viewer
=
$this
->
requireViewer
();
$list
=
new
PHUIObjectItemListView
();
$list
->
setUser
(
$viewer
);
foreach
(
$merchants
as
$merchant
)
{
$item
=
id
(
new
PHUIObjectItemView
())
->
setSubhead
(
pht
(
'Merchant %d'
,
$merchant
->
getID
()))
->
setHeader
(
$merchant
->
getName
())
->
setHref
(
'/phortune/merchant/'
.
$merchant
->
getID
().
'/'
)
->
setObject
(
$merchant
)
->
setImageURI
(
$merchant
->
getProfileImageURI
());
$list
->
addItem
(
$item
);
}
$result
=
new
PhabricatorApplicationSearchResultView
();
$result
->
setObjectList
(
$list
);
$result
->
setNoDataString
(
pht
(
'No merchants found.'
));
return
$result
;
}
}
Event Timeline
Log In to Comment