Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/calendar/xaction/PhabricatorCalendarEventUntilDateTransaction.php
12256 views
1
<?php
2
3
final class PhabricatorCalendarEventUntilDateTransaction
4
extends PhabricatorCalendarEventDateTransaction {
5
6
const TRANSACTIONTYPE = 'calendar.recurrenceenddate';
7
8
public function generateOldValue($object) {
9
$editor = $this->getEditor();
10
11
$until = $object->newUntilDateTime();
12
if (!$until) {
13
return null;
14
}
15
16
return $until
17
->newAbsoluteDateTime()
18
->setIsAllDay($editor->getOldIsAllDay())
19
->toDictionary();
20
}
21
22
public function applyInternalEffects($object, $value) {
23
$actor = $this->getActor();
24
$editor = $this->getEditor();
25
26
if ($value) {
27
$datetime = PhutilCalendarAbsoluteDateTime::newFromDictionary($value);
28
$datetime->setIsAllDay($editor->getNewIsAllDay());
29
$object->setUntilDateTime($datetime);
30
} else {
31
$object->setUntilDateTime(null);
32
}
33
}
34
35
public function getTitle() {
36
if ($this->getNewValue()) {
37
return pht(
38
'%s changed this event to repeat until %s.',
39
$this->renderAuthor(),
40
$this->renderNewDate());
41
} else {
42
return pht(
43
'%s changed this event to repeat forever.',
44
$this->renderAuthor());
45
}
46
}
47
48
public function getTitleForFeed() {
49
if ($this->getNewValue()) {
50
return pht(
51
'%s changed %s to repeat until %s.',
52
$this->renderAuthor(),
53
$this->renderObject(),
54
$this->renderNewDate());
55
} else {
56
return pht(
57
'%s changed %s to repeat forever.',
58
$this->renderAuthor(),
59
$this->renderObject());
60
}
61
}
62
63
protected function getInvalidDateMessage() {
64
return pht('Repeat until date is invalid.');
65
}
66
67
}
68
69