| | <?php |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | namespace Eluceo\iCal\Property\Event; |
| |
|
| | use Eluceo\iCal\ParameterBag; |
| | use Eluceo\iCal\Property; |
| | use Eluceo\iCal\Property\ValueInterface; |
| | use Eluceo\iCal\Util\DateUtil; |
| |
|
| | |
| | |
| | |
| | |
| | |
| | class RecurrenceId extends Property |
| | { |
| | |
| | |
| | |
| | |
| | const RANGE_THISANDPRIOR = 'THISANDPRIOR'; |
| | const RANGE_THISANDFUTURE = 'THISANDFUTURE'; |
| |
|
| | |
| | |
| | |
| | |
| | |
| | protected $dateTime; |
| |
|
| | |
| | |
| | |
| | |
| | |
| | protected $range; |
| |
|
| | public function __construct(\DateTimeInterface $dateTime = null) |
| | { |
| | $this->name = 'RECURRENCE-ID'; |
| | $this->parameterBag = new ParameterBag(); |
| | if (isset($dateTime)) { |
| | $this->dateTime = $dateTime; |
| | } |
| | } |
| |
|
| | public function applyTimeSettings($noTime = false, $useTimezone = false, $useUtc = false, $timezoneString = '') |
| | { |
| | $params = DateUtil::getDefaultParams($this->dateTime, $noTime, $useTimezone, $timezoneString); |
| | foreach ($params as $name => $value) { |
| | $this->parameterBag->setParam($name, $value); |
| | } |
| |
|
| | if ($this->range) { |
| | $this->parameterBag->setParam('RANGE', $this->range); |
| | } |
| |
|
| | $this->setValue(DateUtil::getDateString($this->dateTime, $noTime, $useTimezone, $useUtc)); |
| | } |
| |
|
| | |
| | |
| | |
| | public function getDatetime() |
| | { |
| | return $this->dateTime; |
| | } |
| |
|
| | |
| | |
| | |
| | public function setDatetime(\DateTimeInterface $dateTime) |
| | { |
| | $this->dateTime = $dateTime; |
| |
|
| | return $this; |
| | } |
| |
|
| | |
| | |
| | |
| | public function getRange() |
| | { |
| | return $this->range; |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | public function setRange($range) |
| | { |
| | $this->range = $range; |
| |
|
| | return $this; |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | public function toLines() |
| | { |
| | if (!$this->value instanceof ValueInterface) { |
| | throw new \Exception('The value must implement the ValueInterface. Call RecurrenceId::applyTimeSettings() before adding RecurrenceId.'); |
| | } else { |
| | return parent::toLines(); |
| | } |
| | } |
| | } |
| |
|