Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F96116904
DrydockBlueprintViewController.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
Sun, Dec 22, 19:23
Size
2 KB
Mime Type
text/x-php
Expires
Tue, Dec 24, 19:23 (2 d)
Engine
blob
Format
Raw Data
Handle
23125915
Attached To
rPH Phabricator
DrydockBlueprintViewController.php
View Options
<?php
final
class
DrydockBlueprintViewController
extends
DrydockController
{
private
$id
;
public
function
willProcessRequest
(
array
$data
)
{
$this
->
id
=
$data
[
'id'
];
}
public
function
processRequest
()
{
$request
=
$this
->
getRequest
();
$user
=
$request
->
getUser
();
$blueprint
=
id
(
new
DrydockBlueprint
())->
load
(
$this
->
id
);
if
(!
$blueprint
)
{
return
new
Aphront404Response
();
}
$title
=
'Blueprint '
.
$blueprint
->
getID
().
' '
.
$blueprint
->
getClassName
();
$header
=
id
(
new
PHUIHeaderView
())
->
setHeader
(
$title
);
$actions
=
$this
->
buildActionListView
(
$blueprint
);
$properties
=
$this
->
buildPropertyListView
(
$blueprint
,
$actions
);
$blueprint_uri
=
'blueprint/'
.
$blueprint
->
getID
().
'/'
;
$blueprint_uri
=
$this
->
getApplicationURI
(
$blueprint_uri
);
$resources
=
id
(
new
DrydockResourceQuery
())
->
withBlueprintPHIDs
(
array
(
$blueprint
->
getPHID
()))
->
setViewer
(
$user
)
->
execute
();
$resource_list
=
$this
->
buildResourceListView
(
$resources
);
$resource_list
->
setNoDataString
(
pht
(
'This blueprint has no resources.'
));
$pager
=
new
AphrontPagerView
();
$pager
->
setURI
(
new
PhutilURI
(
$blueprint_uri
),
'offset'
);
$pager
->
setOffset
(
$request
->
getInt
(
'offset'
));
$crumbs
=
$this
->
buildApplicationCrumbs
();
$crumbs
->
setActionList
(
$actions
);
$crumbs
->
addTextCrumb
(
pht
(
'Blueprint %d'
,
$blueprint
->
getID
()));
$object_box
=
id
(
new
PHUIObjectBoxView
())
->
setHeader
(
$header
)
->
addPropertyList
(
$properties
);
return
$this
->
buildApplicationPage
(
array
(
$crumbs
,
$object_box
,
$resource_list
),
array
(
'device'
=>
true
,
'title'
=>
$title
,
));
}
private
function
buildActionListView
(
DrydockBlueprint
$blueprint
)
{
$view
=
id
(
new
PhabricatorActionListView
())
->
setUser
(
$this
->
getRequest
()->
getUser
())
->
setObjectURI
(
$this
->
getRequest
()->
getRequestURI
())
->
setObject
(
$blueprint
);
$uri
=
'/blueprint/edit/'
.
$blueprint
->
getID
().
'/'
;
$uri
=
$this
->
getApplicationURI
(
$uri
);
$view
->
addAction
(
id
(
new
PhabricatorActionView
())
->
setHref
(
$uri
)
->
setName
(
pht
(
'Edit Blueprint Policies'
))
->
setIcon
(
'edit'
)
->
setWorkflow
(
true
)
->
setDisabled
(
false
));
return
$view
;
}
private
function
buildPropertyListView
(
DrydockBlueprint
$blueprint
,
PhabricatorActionListView
$actions
)
{
$view
=
new
PHUIPropertyListView
();
$view
->
setActionList
(
$actions
);
$view
->
addProperty
(
pht
(
'Implementation'
),
$blueprint
->
getClassName
());
return
$view
;
}
}
Event Timeline
Log In to Comment