Path: blob/master/src/applications/calendar/xaction/PhabricatorCalendarEventAllDayTransaction.php
12256 views
<?php12final class PhabricatorCalendarEventAllDayTransaction3extends PhabricatorCalendarEventTransactionType {45const TRANSACTIONTYPE = 'calendar.allday';67public function generateOldValue($object) {8return (int)$object->getIsAllDay();9}1011public function generateNewValue($object, $value) {12return (int)$value;13}1415public function applyInternalEffects($object, $value) {16$object->setIsAllDay($value);1718// Adjust the flags on any other dates the event has.19$keys = array(20'startDateTime',21'endDateTime',22'untilDateTime',23);2425foreach ($keys as $key) {26$dict = $object->getParameter($key);27if (!$dict) {28continue;29}3031$datetime = PhutilCalendarAbsoluteDateTime::newFromDictionary($dict);32$datetime->setIsAllDay($value);3334$object->setParameter($key, $datetime->toDictionary());35}36}3738public function getTitle() {39if ($this->getNewValue()) {40return pht(41'%s changed this to an all day event.',42$this->renderAuthor());43} else {44return pht(45'%s converted this from an all day event.',46$this->renderAuthor());47}48}4950public function getTitleForFeed() {51if ($this->getNewValue()) {52return pht(53'%s changed %s to an all day event.',54$this->renderAuthor(),55$this->renderObject());56} else {57return pht(58'%s converted %s from an all day event.',59$this->renderAuthor(),60$this->renderObject());61}62}6364}656667