Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F99171311
PhabricatorCalendarExportModeTransaction.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
Tue, Jan 21, 23:21
Size
1 KB
Mime Type
text/x-php
Expires
Thu, Jan 23, 23:21 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23728698
Attached To
rPH Phabricator
PhabricatorCalendarExportModeTransaction.php
View Options
<?php
final
class
PhabricatorCalendarExportModeTransaction
extends
PhabricatorCalendarExportTransactionType
{
const
TRANSACTIONTYPE
=
'calendar.export.mode'
;
public
function
generateOldValue
(
$object
)
{
return
$object
->
getPolicyMode
();
}
public
function
applyInternalEffects
(
$object
,
$value
)
{
$object
->
setPolicyMode
(
$value
);
}
public
function
getTitle
()
{
$old_value
=
$this
->
getOldValue
();
$new_value
=
$this
->
getNewValue
();
$old_name
=
PhabricatorCalendarExport
::
getPolicyModeName
(
$old_value
);
$new_name
=
PhabricatorCalendarExport
::
getPolicyModeName
(
$new_value
);
return
pht
(
'%s changed the policy mode for this export from %s to %s.'
,
$this
->
renderAuthor
(),
$this
->
renderValue
(
$old_name
),
$this
->
renderValue
(
$new_name
));
}
public
function
validateTransactions
(
$object
,
array
$xactions
)
{
$errors
=
array
();
$valid
=
PhabricatorCalendarExport
::
getPolicyModes
();
$valid
=
array_fuse
(
$valid
);
foreach
(
$xactions
as
$xaction
)
{
$value
=
$xaction
->
getNewValue
();
if
(
isset
(
$valid
[
$value
]))
{
continue
;
}
$errors
[]
=
$this
->
newInvalidError
(
pht
(
'Mode "%s" is not a valid policy mode. Valid modes are: %s.'
,
$value
,
implode
(
', '
,
$valid
)),
$xaction
);
}
return
$errors
;
}
}
Event Timeline
Log In to Comment