Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F115997600
PhabricatorCalendarEventFrequencyTransaction.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
Wed, Jun 4, 08:38
Size
2 KB
Mime Type
text/x-php
Expires
Fri, Jun 6, 08:38 (2 d)
Engine
blob
Format
Raw Data
Handle
26551597
Attached To
rPH Phabricator
PhabricatorCalendarEventFrequencyTransaction.php
View Options
<?php
final
class
PhabricatorCalendarEventFrequencyTransaction
extends
PhabricatorCalendarEventTransactionType
{
const
TRANSACTIONTYPE
=
'calendar.frequency'
;
public
function
generateOldValue
(
$object
)
{
return
$object
->
getFrequencyUnit
();
}
public
function
applyInternalEffects
(
$object
,
$value
)
{
$object
->
setRecurrenceFrequency
(
array
(
'rule'
=>
$value
,
));
}
public
function
getTitle
()
{
$frequency
=
$this
->
getFrequencyUnit
(
$this
->
getNewValue
());
switch
(
$frequency
)
{
case
PhabricatorCalendarEvent
::
FREQUENCY_DAILY
:
return
pht
(
'%s set this event to repeat daily.'
,
$this
->
renderAuthor
());
case
PhabricatorCalendarEvent
::
FREQUENCY_WEEKLY
:
return
pht
(
'%s set this event to repeat weekly.'
,
$this
->
renderAuthor
());
case
PhabricatorCalendarEvent
::
FREQUENCY_MONTHLY
:
return
pht
(
'%s set this event to repeat monthly.'
,
$this
->
renderAuthor
());
case
PhabricatorCalendarEvent
::
FREQUENCY_YEARLY
:
return
pht
(
'%s set this event to repeat yearly.'
,
$this
->
renderAuthor
());
}
}
public
function
getTitleForFeed
()
{
$frequency
=
$this
->
getFrequencyUnit
(
$this
->
getNewValue
());
switch
(
$frequency
)
{
case
PhabricatorCalendarEvent
::
FREQUENCY_DAILY
:
return
pht
(
'%s set %s to repeat daily.'
,
$this
->
renderAuthor
(),
$this
->
renderObject
());
case
PhabricatorCalendarEvent
::
FREQUENCY_WEEKLY
:
return
pht
(
'%s set %s to repeat weekly.'
,
$this
->
renderAuthor
(),
$this
->
renderObject
());
case
PhabricatorCalendarEvent
::
FREQUENCY_MONTHLY
:
return
pht
(
'%s set %s to repeat monthly.'
,
$this
->
renderAuthor
(),
$this
->
renderObject
());
case
PhabricatorCalendarEvent
::
FREQUENCY_YEARLY
:
return
pht
(
'%s set %s to repeat yearly.'
,
$this
->
renderAuthor
(),
$this
->
renderObject
());
}
}
private
function
getFrequencyUnit
(
$value
)
{
if
(
is_array
(
$value
))
{
$value
=
idx
(
$value
,
'rule'
);
}
else
{
return
$value
;
}
}
}
Event Timeline
Log In to Comment