Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2894499
SemiStructuredObjectTypeController.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
2 KB
Referenced Files
None
Subscribers
None
SemiStructuredObjectTypeController.php
View Options
<?php
abstract
class
SemiStructuredObjectTypeController
extends
SemiStructuredBaseController
{
private
$objectType
;
public
function
setObjectType
(
SemiStructuredObjectType
$object_type
)
{
$this
->
objectType
=
$object_type
;
return
$this
;
}
public
function
getObjectType
(
)
{
return
$this
->
objectType
;
}
// TODO ???
public
function
buildApplicationMenu
(
)
{
return
$this
->
buildSideNavView
(
)
->
getMenu
(
)
;
}
protected
function
buildHeaderView
(
)
{
$viewer
=
$this
->
getViewer
(
)
;
$object_type
=
$this
->
getObjectType
(
)
;
if
(
$object_type
->
isArchived
(
)
)
{
$status_icon
=
'fa-ban'
;
$status_color
=
'dark'
;
}
else
{
$status_icon
=
'fa-check'
;
$status_color
=
'bluegrey'
;
}
$status_name
=
idx
(
SemiStructuredObjectType
::
getStatusNameMap
(
)
,
$object_type
->
getStatus
(
)
)
;
return
id
(
new
PHUIHeaderView
(
)
)
->
setHeader
(
$object_type
->
getName
(
)
)
->
setUser
(
$viewer
)
->
setPolicyObject
(
$object_type
)
->
setStatus
(
$status_icon
,
$status_color
,
$status_name
)
->
setHeaderIcon
(
'fa-trophy'
)
;
}
protected
function
buildApplicationCrumbs
(
)
{
$object_type
=
$this
->
getObjectType
(
)
;
$uri
=
$object_type
->
getURI
(
)
;
$crumbs
=
parent
::
buildApplicationCrumbs
(
)
;
$crumbs
->
addTextCrumb
(
$object_type
->
getName
(
)
,
$uri
)
;
$crumbs
->
setBorder
(
true
)
;
return
$crumbs
;
}
protected
function
buildSideNavView
(
$filter
=
null
)
{
$viewer
=
$this
->
getViewer
(
)
;
$object_type
=
$this
->
getObjectType
(
)
;
$id
=
$object_type
->
getID
(
)
;
$can_edit
=
PhabricatorPolicyFilter
::
hasCapability
(
$viewer
,
$object_type
,
PhabricatorPolicyCapability
::
CAN_EDIT
)
;
$nav
=
id
(
new
AphrontSideNavFilterView
(
)
)
->
setBaseURI
(
new
PhutilURI
(
$this
->
getApplicationURI
(
)
)
)
;
$nav
->
addLabel
(
pht
(
'Object Type'
)
)
;
$nav
->
addFilter
(
'view'
,
pht
(
'View Object Type'
)
,
$object_type
->
getURI
(
)
,
'fa-trophy'
)
;
$nav
->
addFilter
(
'instances'
,
pht
(
'View Instances'
)
,
$this
->
getApplicationURI
(
"/type/{$id}/items/"
)
,
'fa-group'
)
;
$nav
->
selectFilter
(
$filter
)
;
return
$nav
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Jan 19, 19:59 (1 w, 5 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1128228
Default Alt Text
SemiStructuredObjectTypeController.php (2 KB)
Attached To
Mode
R6 Semi Structured
Attached
Detach File
Event Timeline
Log In to Comment