Changeset View
Changeset View
Standalone View
Standalone View
src/applications/calendar/storage/PhabricatorCalendarEvent.php
Show All 11 Lines | final class PhabricatorCalendarEvent extends PhabricatorCalendarDAO | ||||
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 $mailKey; | protected $mailKey; | ||||
protected $viewPolicy; | protected $viewPolicy; | ||||
protected $editPolicy; | protected $editPolicy; | ||||
const DEFAULT_ICON = 'fa-calendar'; | |||||
private $invitees = self::ATTACHABLE; | private $invitees = self::ATTACHABLE; | ||||
private $appliedViewer; | private $appliedViewer; | ||||
public static function initializeNewCalendarEvent(PhabricatorUser $actor) { | public static function initializeNewCalendarEvent(PhabricatorUser $actor) { | ||||
$app = id(new PhabricatorApplicationQuery()) | $app = id(new PhabricatorApplicationQuery()) | ||||
->setViewer($actor) | ->setViewer($actor) | ||||
->withClasses(array('PhabricatorCalendarApplication')) | ->withClasses(array('PhabricatorCalendarApplication')) | ||||
->executeOne(); | ->executeOne(); | ||||
return id(new PhabricatorCalendarEvent()) | return id(new PhabricatorCalendarEvent()) | ||||
->setUserPHID($actor->getPHID()) | ->setUserPHID($actor->getPHID()) | ||||
->setIsCancelled(0) | ->setIsCancelled(0) | ||||
->setIsAllDay(0) | ->setIsAllDay(0) | ||||
->setIcon(self::DEFAULT_ICON) | |||||
->setViewPolicy($actor->getPHID()) | ->setViewPolicy($actor->getPHID()) | ||||
->setEditPolicy($actor->getPHID()) | ->setEditPolicy($actor->getPHID()) | ||||
->attachInvitees(array()) | ->attachInvitees(array()) | ||||
->applyViewerTimezone($actor); | ->applyViewerTimezone($actor); | ||||
} | } | ||||
public function applyViewerTimezone(PhabricatorUser $viewer) { | public function applyViewerTimezone(PhabricatorUser $viewer) { | ||||
if ($this->appliedViewer) { | if ($this->appliedViewer) { | ||||
▲ Show 20 Lines • Show All 115 Lines • ▼ Show 20 Lines | return array( | ||||
self::CONFIG_AUX_PHID => true, | self::CONFIG_AUX_PHID => true, | ||||
self::CONFIG_COLUMN_SCHEMA => array( | self::CONFIG_COLUMN_SCHEMA => array( | ||||
'name' => 'text', | 'name' => 'text', | ||||
'dateFrom' => 'epoch', | 'dateFrom' => 'epoch', | ||||
'dateTo' => 'epoch', | 'dateTo' => 'epoch', | ||||
'description' => 'text', | 'description' => 'text', | ||||
'isCancelled' => 'bool', | 'isCancelled' => 'bool', | ||||
'isAllDay' => 'bool', | 'isAllDay' => 'bool', | ||||
'icon' => 'text32', | |||||
'mailKey' => 'bytes20', | 'mailKey' => 'bytes20', | ||||
), | ), | ||||
self::CONFIG_KEY_SCHEMA => array( | self::CONFIG_KEY_SCHEMA => array( | ||||
'userPHID_dateFrom' => array( | 'userPHID_dateFrom' => array( | ||||
'columns' => array('userPHID', 'dateTo'), | 'columns' => array('userPHID', 'dateTo'), | ||||
), | ), | ||||
), | ), | ||||
) + parent::getConfiguration(); | ) + parent::getConfiguration(); | ||||
▲ Show 20 Lines • Show All 199 Lines • Show Last 20 Lines |