Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F98603974
PhabricatorPackagesPackageSearchEngine.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
Tue, Jan 14, 19:08
Size
1 KB
Mime Type
text/x-php
Expires
Thu, Jan 16, 19:08 (2 d)
Engine
blob
Format
Raw Data
Handle
23604720
Attached To
rPH Phabricator
PhabricatorPackagesPackageSearchEngine.php
View Options
<?php
final
class
PhabricatorPackagesPackageSearchEngine
extends
PhabricatorApplicationSearchEngine
{
public
function
getResultTypeDescription
()
{
return
pht
(
'Packages'
);
}
public
function
getApplicationClassName
()
{
return
'PhabricatorPackagesApplication'
;
}
public
function
newQuery
()
{
return
id
(
new
PhabricatorPackagesPackageQuery
());
}
protected
function
buildQueryFromParameters
(
array
$map
)
{
$query
=
$this
->
newQuery
();
return
$query
;
}
protected
function
buildCustomSearchFields
()
{
return
array
();
}
protected
function
getURI
(
$path
)
{
return
'/packages/package/'
.
$path
;
}
protected
function
getBuiltinQueryNames
()
{
$names
=
array
(
'all'
=>
pht
(
'All Packages'
),
);
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
renderResultList
(
array
$packages
,
PhabricatorSavedQuery
$query
,
array
$handles
)
{
assert_instances_of
(
$packages
,
'PhabricatorPackagesPackage'
);
$viewer
=
$this
->
requireViewer
();
$list
=
id
(
new
PHUIObjectItemListView
())
->
setViewer
(
$viewer
);
foreach
(
$packages
as
$package
)
{
$item
=
id
(
new
PHUIObjectItemView
())
->
setObjectName
(
$package
->
getFullKey
())
->
setHeader
(
$package
->
getName
())
->
setHref
(
$package
->
getURI
());
$list
->
addItem
(
$item
);
}
return
id
(
new
PhabricatorApplicationSearchResultView
())
->
setObjectList
(
$list
)
->
setNoDataString
(
pht
(
'No packages found.'
));
}
}
Event Timeline
Log In to Comment