Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/calendar/xaction/PhabricatorCalendarEventIconTransaction.php
12256 views
1
<?php
2
3
final class PhabricatorCalendarEventIconTransaction
4
extends PhabricatorCalendarEventTransactionType {
5
6
const TRANSACTIONTYPE = 'calendar.icon';
7
8
public function generateOldValue($object) {
9
return $object->getIcon();
10
}
11
12
public function applyInternalEffects($object, $value) {
13
$object->setIcon($value);
14
}
15
16
public function shouldHide() {
17
if ($this->isCreateTransaction()) {
18
return true;
19
}
20
21
return false;
22
}
23
24
public function getTitle() {
25
$old = $this->getIconLabel($this->getOldValue());
26
$new = $this->getIconLabel($this->getNewValue());
27
28
return pht(
29
'%s changed the event icon from %s to %s.',
30
$this->renderAuthor(),
31
$this->renderValue($old),
32
$this->renderValue($new));
33
}
34
35
public function getTitleForFeed() {
36
$old = $this->getIconLabel($this->getOldValue());
37
$new = $this->getIconLabel($this->getNewValue());
38
39
return pht(
40
'%s changed the icon for %s from %s to %s.',
41
$this->renderAuthor(),
42
$this->renderObject(),
43
$this->renderValue($old),
44
$this->renderValue($new));
45
}
46
47
private function getIconLabel($icon) {
48
$set = new PhabricatorCalendarIconSet();
49
return $set->getIconLabel($icon);
50
}
51
52
}
53
54