Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F106762667
DrydockBlueprintListController.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, Mar 31, 06:22
Size
1 KB
Mime Type
text/x-php
Expires
Wed, Apr 2, 06:22 (2 d)
Engine
blob
Format
Raw Data
Handle
25268957
Attached To
rPH Phabricator
DrydockBlueprintListController.php
View Options
<?php
final
class
DrydockBlueprintListController
extends
DrydockBlueprintController
implements
PhabricatorApplicationSearchResultsControllerInterface
{
private
$queryKey
;
public
function
shouldAllowPublic
()
{
return
true
;
}
public
function
willProcessRequest
(
array
$data
)
{
$this
->
queryKey
=
idx
(
$data
,
'queryKey'
);
}
public
function
processRequest
()
{
$request
=
$this
->
getRequest
();
$controller
=
id
(
new
PhabricatorApplicationSearchController
(
$request
))
->
setQueryKey
(
$this
->
queryKey
)
->
setSearchEngine
(
new
DrydockBlueprintSearchEngine
())
->
setNavigation
(
$this
->
buildSideNavView
());
return
$this
->
delegateToController
(
$controller
);
}
public
function
renderResultsList
(
array
$blueprints
,
PhabricatorSavedQuery
$query
)
{
assert_instances_of
(
$blueprints
,
'DrydockBlueprint'
);
$viewer
=
$this
->
getRequest
()->
getUser
();
$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
);
}
return
$view
;
}
public
function
buildApplicationCrumbs
()
{
$can_create
=
$this
->
hasApplicationCapability
(
DrydockCapabilityCreateBlueprints
::
CAPABILITY
);
$crumbs
=
parent
::
buildApplicationCrumbs
();
$crumbs
->
addAction
(
id
(
new
PHUIListItemView
())
->
setName
(
pht
(
'New Blueprint'
))
->
setHref
(
$this
->
getApplicationURI
(
'/blueprint/create/'
))
->
setDisabled
(!
$can_create
)
->
setWorkflow
(!
$can_create
)
->
setIcon
(
'create'
));
return
$crumbs
;
}
}
Event Timeline
Log In to Comment