Changeset View
Changeset View
Standalone View
Standalone View
src/applications/calendar/storage/PhabricatorCalendarEvent.php
<?php | <?php | ||||
final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO | final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO | ||||
implements PhabricatorPolicyInterface, | implements PhabricatorPolicyInterface, | ||||
PhabricatorProjectInterface, | PhabricatorProjectInterface, | ||||
PhabricatorMarkupInterface, | PhabricatorMarkupInterface, | ||||
PhabricatorApplicationTransactionInterface, | PhabricatorApplicationTransactionInterface, | ||||
PhabricatorSubscribableInterface, | PhabricatorSubscribableInterface, | ||||
PhabricatorTokenReceiverInterface, | PhabricatorTokenReceiverInterface, | ||||
PhabricatorDestructibleInterface, | PhabricatorDestructibleInterface, | ||||
PhabricatorMentionableInterface, | PhabricatorMentionableInterface, | ||||
PhabricatorFlaggableInterface { | PhabricatorFlaggableInterface, | ||||
PhabricatorSpacesInterface { | |||||
protected $name; | protected $name; | ||||
protected $userPHID; | protected $userPHID; | ||||
protected $dateFrom; | protected $dateFrom; | ||||
protected $dateTo; | protected $dateTo; | ||||
protected $description; | protected $description; | ||||
protected $isCancelled; | protected $isCancelled; | ||||
protected $isAllDay; | protected $isAllDay; | ||||
protected $icon; | protected $icon; | ||||
protected $mailKey; | protected $mailKey; | ||||
protected $isRecurring = 0; | protected $isRecurring = 0; | ||||
protected $recurrenceFrequency = array(); | protected $recurrenceFrequency = array(); | ||||
protected $recurrenceEndDate; | protected $recurrenceEndDate; | ||||
private $isGhostEvent = false; | private $isGhostEvent = false; | ||||
protected $instanceOfEventPHID; | protected $instanceOfEventPHID; | ||||
protected $sequenceIndex; | protected $sequenceIndex; | ||||
protected $viewPolicy; | protected $viewPolicy; | ||||
protected $editPolicy; | protected $editPolicy; | ||||
protected $spacePHID; | |||||
const DEFAULT_ICON = 'fa-calendar'; | const DEFAULT_ICON = 'fa-calendar'; | ||||
private $parentEvent = self::ATTACHABLE; | private $parentEvent = self::ATTACHABLE; | ||||
private $invitees = self::ATTACHABLE; | private $invitees = self::ATTACHABLE; | ||||
private $appliedViewer; | private $appliedViewer; | ||||
// Frequency Constants | // Frequency Constants | ||||
const FREQUENCY_DAILY = 'daily'; | const FREQUENCY_DAILY = 'daily'; | ||||
Show All 23 Lines | public static function initializeNewCalendarEvent( | ||||
return id(new PhabricatorCalendarEvent()) | return id(new PhabricatorCalendarEvent()) | ||||
->setUserPHID($actor->getPHID()) | ->setUserPHID($actor->getPHID()) | ||||
->setIsCancelled(0) | ->setIsCancelled(0) | ||||
->setIsAllDay(0) | ->setIsAllDay(0) | ||||
->setIsRecurring($is_recurring) | ->setIsRecurring($is_recurring) | ||||
->setIcon(self::DEFAULT_ICON) | ->setIcon(self::DEFAULT_ICON) | ||||
->setViewPolicy($view_policy) | ->setViewPolicy($view_policy) | ||||
->setEditPolicy($actor->getPHID()) | ->setEditPolicy($actor->getPHID()) | ||||
->setSpacePHID($actor->getDefaultSpacePHID()) | |||||
->attachInvitees(array()) | ->attachInvitees(array()) | ||||
->applyViewerTimezone($actor); | ->applyViewerTimezone($actor); | ||||
} | } | ||||
public function applyViewerTimezone(PhabricatorUser $viewer) { | public function applyViewerTimezone(PhabricatorUser $viewer) { | ||||
if ($this->appliedViewer) { | if ($this->appliedViewer) { | ||||
throw new Exception(pht('Viewer timezone is already applied!')); | throw new Exception(pht('Viewer timezone is already applied!')); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 464 Lines • ▼ Show 20 Lines | /* -( PhabricatorDestructibleInterface )----------------------------------- */ | ||||
public function destroyObjectPermanently( | public function destroyObjectPermanently( | ||||
PhabricatorDestructionEngine $engine) { | PhabricatorDestructionEngine $engine) { | ||||
$this->openTransaction(); | $this->openTransaction(); | ||||
$this->delete(); | $this->delete(); | ||||
$this->saveTransaction(); | $this->saveTransaction(); | ||||
} | } | ||||
/* -( PhabricatorSpacesInterface )----------------------------------------- */ | |||||
public function getSpacePHID() { | |||||
return $this->spacePHID; | |||||
} | |||||
} | } |