Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F97203202
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
Fri, Jan 3, 10:02
Size
1 KB
Mime Type
text/x-php
Expires
Sun, Jan 5, 10:02 (2 d)
Engine
blob
Format
Raw Data
Handle
23353544
Attached To
rPH Phabricator
DrydockBlueprintListController.php
View Options
<?php
final
class
DrydockBlueprintListController
extends
DrydockController
{
public
function
processRequest
()
{
$request
=
$this
->
getRequest
();
$user
=
$request
->
getUser
();
$title
=
pht
(
'Blueprints'
);
$blueprint_header
=
id
(
new
PHUIHeaderView
())
->
setHeader
(
$title
);
$blueprints
=
id
(
new
DrydockBlueprintQuery
())
->
setViewer
(
$user
)
->
execute
();
$blueprint_list
=
$this
->
buildBlueprintListView
(
$blueprints
);
$crumbs
=
$this
->
buildApplicationCrumbs
();
$crumbs
->
addTextCrumb
(
$title
,
$request
->
getRequestURI
());
$crumbs
->
addAction
(
id
(
new
PHUIListItemView
())
->
setName
(
pht
(
'New Blueprint'
))
->
setHref
(
$this
->
getApplicationURI
(
'blueprint/create/'
))
->
setIcon
(
'create'
));
$nav
=
$this
->
buildSideNav
(
'blueprint'
);
$nav
->
setCrumbs
(
$crumbs
);
$nav
->
appendChild
(
array
(
$blueprint_header
,
$blueprint_list
));
return
$this
->
buildApplicationPage
(
$nav
,
array
(
'title'
=>
$title
,
'device'
=>
true
,
));
}
protected
function
buildBlueprintListView
(
array
$blueprints
)
{
assert_instances_of
(
$blueprints
,
'DrydockBlueprint'
);
$user
=
$this
->
getRequest
()->
getUser
();
$view
=
new
PHUIObjectItemListView
();
foreach
(
$blueprints
as
$blueprint
)
{
$item
=
id
(
new
PHUIObjectItemView
())
->
setHeader
(
$blueprint
->
getClassName
())
->
setHref
(
$this
->
getApplicationURI
(
'/blueprint/'
.
$blueprint
->
getID
()))
->
setObjectName
(
pht
(
'Blueprint %d'
,
$blueprint
->
getID
()));
if
(
$blueprint
->
getImplementation
()->
isEnabled
())
{
$item
->
addAttribute
(
pht
(
'Enabled'
));
$item
->
setBarColor
(
'green'
);
}
else
{
$item
->
addAttribute
(
pht
(
'Disabled'
));
$item
->
setBarColor
(
'red'
);
}
$item
->
addAttribute
(
$blueprint
->
getImplementation
()->
getDescription
());
$view
->
addItem
(
$item
);
}
return
$view
;
}
}
Event Timeline
Log In to Comment