Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F116057259
DrydockBlueprintSearchEngine.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
Wed, Jun 4, 16:33
Size
1 KB
Mime Type
text/x-php
Expires
Fri, Jun 6, 16:33 (2 d)
Engine
blob
Format
Raw Data
Handle
26515766
Attached To
rPH Phabricator
DrydockBlueprintSearchEngine.php
View Options
<?php
final
class
DrydockBlueprintSearchEngine
extends
PhabricatorApplicationSearchEngine
{
public
function
getResultTypeDescription
()
{
return
pht
(
'Drydock Blueprints'
);
}
public
function
getApplicationClassName
()
{
return
'PhabricatorDrydockApplication'
;
}
public
function
newQuery
()
{
return
id
(
new
DrydockBlueprintQuery
());
}
protected
function
buildQueryFromParameters
(
array
$map
)
{
$query
=
$this
->
newQuery
();
return
$query
;
}
protected
function
buildCustomSearchFields
()
{
return
array
();
}
protected
function
getURI
(
$path
)
{
return
'/drydock/blueprint/'
.
$path
;
}
protected
function
getBuiltinQueryNames
()
{
return
array
(
'all'
=>
pht
(
'All Blueprints'
),
);
}
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
$blueprints
,
PhabricatorSavedQuery
$query
,
array
$handles
)
{
assert_instances_of
(
$blueprints
,
'DrydockBlueprint'
);
$viewer
=
$this
->
requireViewer
();
$view
=
new
PHUIObjectItemListView
();
foreach
(
$blueprints
as
$blueprint
)
{
$item
=
id
(
new
PHUIObjectItemView
())
->
setHeader
(
$blueprint
->
getBlueprintName
())
->
setHref
(
$this
->
getApplicationURI
(
'/blueprint/'
.
$blueprint
->
getID
()))
->
setObjectName
(
pht
(
'Blueprint %d'
,
$blueprint
->
getID
()));
if
(!
$blueprint
->
getImplementation
()->
isEnabled
())
{
$item
->
setDisabled
(
true
);
}
$item
->
addAttribute
(
$blueprint
->
getImplementation
()->
getBlueprintName
());
$view
->
addItem
(
$item
);
}
$result
=
new
PhabricatorApplicationSearchResultView
();
$result
->
setObjectList
(
$view
);
$result
->
setNoDataString
(
pht
(
'No blueprints found.'
));
return
$result
;
}
}
Event Timeline
Log In to Comment