2012-05-21 19:24:23 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class AphrontCalendarEventView extends AphrontView {
|
|
|
|
|
2012-05-21 20:59:12 +02:00
|
|
|
private $userPHID;
|
2012-05-21 19:24:23 +02:00
|
|
|
private $name;
|
|
|
|
private $epochStart;
|
|
|
|
private $epochEnd;
|
|
|
|
private $description;
|
2012-11-12 22:28:45 +01:00
|
|
|
private $eventID;
|
2014-02-24 19:04:23 +01:00
|
|
|
private $color;
|
2012-11-12 22:28:45 +01:00
|
|
|
|
|
|
|
public function setEventID($event_id) {
|
|
|
|
$this->eventID = $event_id;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
public function getEventID() {
|
|
|
|
return $this->eventID;
|
|
|
|
}
|
2012-05-21 19:24:23 +02:00
|
|
|
|
2012-05-21 20:59:12 +02:00
|
|
|
public function setUserPHID($user_phid) {
|
|
|
|
$this->userPHID = $user_phid;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getUserPHID() {
|
|
|
|
return $this->userPHID;
|
|
|
|
}
|
|
|
|
|
2012-05-21 19:24:23 +02:00
|
|
|
public function setName($name) {
|
|
|
|
$this->name = $name;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setEpochRange($start, $end) {
|
|
|
|
$this->epochStart = $start;
|
|
|
|
$this->epochEnd = $end;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getEpochStart() {
|
|
|
|
return $this->epochStart;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getEpochEnd() {
|
|
|
|
return $this->epochEnd;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getName() {
|
|
|
|
return $this->name;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setDescription($description) {
|
|
|
|
$this->description = $description;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getDescription() {
|
|
|
|
return $this->description;
|
|
|
|
}
|
|
|
|
|
2014-02-24 19:04:23 +01:00
|
|
|
public function setColor($color) {
|
|
|
|
$this->color = $color;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
public function getColor() {
|
|
|
|
if ($this->color) {
|
|
|
|
return $this->color;
|
|
|
|
} else {
|
|
|
|
return CalendarColors::COLOR_SKY;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-02-25 05:21:28 +01:00
|
|
|
public function getAllDay() {
|
|
|
|
$time = (60 * 60 * 22);
|
|
|
|
if (($this->getEpochEnd() - $this->getEpochStart()) >= $time) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getMultiDay() {
|
|
|
|
$nextday = strtotime('12:00 AM Tomorrow', $this->getEpochStart());
|
|
|
|
if ($this->getEpochEnd() > $nextday) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2012-05-21 19:24:23 +02:00
|
|
|
public function render() {
|
|
|
|
throw new Exception("Events are only rendered indirectly.");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|