Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F549963
PhabricatorBadgesBadgeQualityTransaction.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
PhabricatorBadgesBadgeQualityTransaction.php
View Options
<?php
final
class
PhabricatorBadgesBadgeQualityTransaction
extends
PhabricatorBadgesBadgeTransactionType
{
const
TRANSACTIONTYPE
=
'badge.quality'
;
public
function
generateOldValue
(
$object
)
{
return
$object
->
getQuality
();
}
public
function
applyInternalEffects
(
$object
,
$value
)
{
$object
->
setQuality
(
$value
);
}
public
function
shouldHide
()
{
if
(
$this
->
isCreateTransaction
())
{
return
true
;
}
return
false
;
}
public
function
getTitle
()
{
$old
=
$this
->
getQualityLabel
(
$this
->
getOldValue
());
$new
=
$this
->
getQualityLabel
(
$this
->
getNewValue
());
return
pht
(
'%s updated the quality from %s to %s.'
,
$this
->
renderAuthor
(),
$old
,
$new
);
}
public
function
getTitleForFeed
()
{
$old
=
$this
->
getQualityLabel
(
$this
->
getOldValue
());
$new
=
$this
->
getQualityLabel
(
$this
->
getNewValue
());
return
pht
(
'%s updated the quality of %s from %s to %s.'
,
$this
->
renderAuthor
(),
$this
->
renderObject
(),
$old
,
$new
);
}
public
function
validateTransactions
(
$object
,
array
$xactions
)
{
$errors
=
array
();
if
(
$this
->
isEmptyTextTransaction
(
$object
->
getQuality
(),
$xactions
))
{
$errors
[]
=
$this
->
newRequiredError
(
pht
(
'Badge quality must be set.'
));
}
$map
=
PhabricatorBadgesQuality
::
getQualityMap
();
if
(!
$map
[
$object
->
getQuality
()])
{
$errors
[]
=
$this
->
newRequiredError
(
pht
(
'Badge quality is not valid.'
));
}
return
$errors
;
}
private
function
getQualityLabel
(
$quality
)
{
$map
=
PhabricatorBadgesQuality
::
getQualityMap
();
$name
=
$map
[
$quality
][
'name'
];
return
$this
->
renderValue
(
$name
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, May 12, 2:25 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
122233
Default Alt Text
PhabricatorBadgesBadgeQualityTransaction.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment