Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F551850
ManiphestTaskPriorityHeraldAction.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
ManiphestTaskPriorityHeraldAction.php
View Options
<?php
final
class
ManiphestTaskPriorityHeraldAction
extends
HeraldAction
{
const
ACTIONCONST
=
'maniphest.priority'
;
const
DO_PRIORITY
=
'do.priority'
;
public
function
supportsObject
(
$object
)
{
return
(
$object
instanceof
ManiphestTask
);
}
public
function
getActionGroupKey
()
{
return
HeraldApplicationActionGroup
::
ACTIONGROUPKEY
;
}
public
function
getHeraldActionName
()
{
return
pht
(
'Change priority to'
);
}
public
function
supportsRuleType
(
$rule_type
)
{
return
(
$rule_type
!=
HeraldRuleTypeConfig
::
RULE_TYPE_PERSONAL
);
}
public
function
applyEffect
(
$object
,
HeraldEffect
$effect
)
{
$priority
=
head
(
$effect
->
getTarget
());
if
(!
$priority
)
{
$this
->
logEffect
(
self
::
DO_STANDARD_EMPTY
);
return
;
}
$adapter
=
$this
->
getAdapter
();
$object
=
$adapter
->
getObject
();
$current
=
$object
->
getPriority
();
if
(
$current
==
$priority
)
{
$this
->
logEffect
(
self
::
DO_STANDARD_NO_EFFECT
,
$priority
);
return
;
}
$keyword_map
=
ManiphestTaskPriority
::
getTaskPriorityKeywordsMap
();
$keyword
=
head
(
idx
(
$keyword_map
,
$priority
));
$xaction
=
$adapter
->
newTransaction
()
->
setTransactionType
(
ManiphestTaskPriorityTransaction
::
TRANSACTIONTYPE
)
->
setNewValue
(
$keyword
);
$adapter
->
queueTransaction
(
$xaction
);
$this
->
logEffect
(
self
::
DO_PRIORITY
,
$keyword
);
}
public
function
getHeraldActionStandardType
()
{
return
self
::
STANDARD_PHID_LIST
;
}
public
function
renderActionDescription
(
$value
)
{
$priority
=
head
(
$value
);
$name
=
ManiphestTaskPriority
::
getTaskPriorityName
(
$priority
);
return
pht
(
'Change priority to: %s.'
,
$name
);
}
protected
function
getDatasource
()
{
return
id
(
new
ManiphestTaskPriorityDatasource
())
->
setLimit
(
1
);
}
protected
function
getDatasourceValueMap
()
{
return
ManiphestTaskPriority
::
getTaskPriorityMap
();
}
protected
function
getActionEffectMap
()
{
return
array
(
self
::
DO_PRIORITY
=>
array
(
'icon'
=>
'fa-pencil'
,
'color'
=>
'green'
,
'name'
=>
pht
(
'Changed Task Priority'
),
),
);
}
protected
function
renderActionEffectDescription
(
$type
,
$data
)
{
switch
(
$type
)
{
case
self
::
DO_PRIORITY
:
return
pht
(
'Changed task priority to "%s".'
,
ManiphestTaskPriority
::
getTaskPriorityName
(
$data
));
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, May 12, 3:56 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
97484
Default Alt Text
ManiphestTaskPriorityHeraldAction.php (2 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment