Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F61313424
ManiphestTaskGraph.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, May 5, 21:26
Size
4 KB
Mime Type
text/x-php
Expires
Tue, May 7, 21:26 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
17494343
Attached To
rPH Phabricator
ManiphestTaskGraph.php
View Options
<?php
final
class
ManiphestTaskGraph
extends
PhabricatorObjectGraph
{
private
$seedMaps
=
array
();
private
$isStandalone
;
protected
function
getEdgeTypes
()
{
return
array
(
ManiphestTaskDependedOnByTaskEdgeType
::
EDGECONST
,
ManiphestTaskDependsOnTaskEdgeType
::
EDGECONST
,
);
}
protected
function
getParentEdgeType
()
{
return
ManiphestTaskDependsOnTaskEdgeType
::
EDGECONST
;
}
protected
function
newQuery
()
{
return
new
ManiphestTaskQuery
();
}
protected
function
isClosed
(
$object
)
{
return
$object
->
isClosed
();
}
public
function
setIsStandalone
(
$is_standalone
)
{
$this
->
isStandalone
=
$is_standalone
;
return
$this
;
}
public
function
getIsStandalone
()
{
return
$this
->
isStandalone
;
}
protected
function
newTableRow
(
$phid
,
$object
,
$trace
)
{
$viewer
=
$this
->
getViewer
();
Javelin
::
initBehavior
(
'phui-hovercards'
);
if
(
$object
)
{
$status
=
$object
->
getStatus
();
$priority
=
$object
->
getPriority
();
$status_icon
=
ManiphestTaskStatus
::
getStatusIcon
(
$status
);
$status_name
=
ManiphestTaskStatus
::
getTaskStatusName
(
$status
);
$priority_color
=
ManiphestTaskPriority
::
getTaskPriorityColor
(
$priority
);
if
(
$object
->
isClosed
())
{
$priority_color
=
'grey'
;
}
$status
=
array
(
id
(
new
PHUIIconView
())->
setIcon
(
$status_icon
,
$priority_color
),
' '
,
$status_name
,
);
$owner_phid
=
$object
->
getOwnerPHID
();
if
(
$owner_phid
)
{
$assigned
=
$viewer
->
renderHandle
(
$owner_phid
);
}
else
{
$assigned
=
phutil_tag
(
'em'
,
array
(),
pht
(
'None'
));
}
$link
=
javelin_tag
(
'a'
,
array
(
'href'
=>
$object
->
getURI
(),
'sigil'
=>
'hovercard'
,
'meta'
=>
array
(
'hoverPHID'
=>
$object
->
getPHID
(),
),
),
$object
->
getTitle
());
$link
=
array
(
phutil_tag
(
'span'
,
array
(
'class'
=>
'object-name'
,
),
$object
->
getMonogram
()),
' '
,
$link
,
);
}
else
{
$status
=
null
;
$assigned
=
null
;
$link
=
$viewer
->
renderHandle
(
$phid
);
}
if
(
$this
->
isParentTask
(
$phid
))
{
$marker
=
'fa-chevron-circle-up bluegrey'
;
$marker_tip
=
pht
(
'Direct Parent'
);
}
else
if
(
$this
->
isChildTask
(
$phid
))
{
$marker
=
'fa-chevron-circle-down bluegrey'
;
$marker_tip
=
pht
(
'Direct Subtask'
);
}
else
{
$marker
=
null
;
}
if
(
$marker
)
{
$marker
=
id
(
new
PHUIIconView
())
->
setIcon
(
$marker
)
->
addSigil
(
'has-tooltip'
)
->
setMetadata
(
array
(
'tip'
=>
$marker_tip
,
'align'
=>
'E'
,
));
}
return
array
(
$marker
,
$trace
,
$status
,
$assigned
,
$link
,
);
}
protected
function
newTable
(
AphrontTableView
$table
)
{
return
$table
->
setHeaders
(
array
(
null
,
null
,
pht
(
'Status'
),
pht
(
'Assigned'
),
pht
(
'Task'
),
))
->
setColumnClasses
(
array
(
'nudgeright'
,
'threads'
,
'graph-status'
,
null
,
'wide pri object-link'
,
))
->
setColumnVisibility
(
array
(
true
,
!
$this
->
getRenderOnlyAdjacentNodes
(),
))
->
setDeviceVisibility
(
array
(
true
,
// On mobile, we only show the actual graph drawing if we're on the
// standalone page, since it can take over the screen otherwise.
$this
->
getIsStandalone
(),
));
}
private
function
isParentTask
(
$task_phid
)
{
$map
=
$this
->
getSeedMap
(
ManiphestTaskDependedOnByTaskEdgeType
::
EDGECONST
);
return
isset
(
$map
[
$task_phid
]);
}
private
function
isChildTask
(
$task_phid
)
{
$map
=
$this
->
getSeedMap
(
ManiphestTaskDependsOnTaskEdgeType
::
EDGECONST
);
return
isset
(
$map
[
$task_phid
]);
}
private
function
getSeedMap
(
$type
)
{
if
(!
isset
(
$this
->
seedMaps
[
$type
]))
{
$maps
=
$this
->
getEdges
(
$type
);
$phids
=
idx
(
$maps
,
$this
->
getSeedPHID
(),
array
());
$phids
=
array_fuse
(
$phids
);
$this
->
seedMaps
[
$type
]
=
$phids
;
}
return
$this
->
seedMaps
[
$type
];
}
protected
function
newEllipsisRow
()
{
return
array
(
null
,
null
,
null
,
null
,
pht
(
"
\x
C2
\x
B7
\x
C2
\x
B7
\x
C2
\x
B7"
),
);
}
}
Event Timeline
Log In to Comment