diff --git a/composer.json b/composer.json index 5cac0114..b1a42a95 100644 --- a/composer.json +++ b/composer.json @@ -34,6 +34,7 @@ "roave/security-advisories": "dev-master", "gregwar/captcha": "^1.1", "phpmailer/phpmailer": "^5.2", - "codeigniter/framework": "3.1.6" + "codeigniter/framework": "3.1.6", + "jsvrcek/ics": "^0.5.1" } } diff --git a/composer.lock b/composer.lock index 47d5f10a..285804a1 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "8c888cb85f0aee3ee5b357c38a3182e4", + "content-hash": "cc53442fb0e3041fbf3d22ed9f5bcca5", "packages": [ { "name": "codeigniter/framework", @@ -87,6 +87,54 @@ ], "time": "2015-09-11T15:23:20+00:00" }, + { + "name": "jsvrcek/ics", + "version": "0.5.1", + "source": { + "type": "git", + "url": "https://github.com/jasvrcek/ICS.git", + "reference": "c93b8dba37b35dd0b65d7b76c7d5b8bc38ecc74c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/jasvrcek/ICS/zipball/c93b8dba37b35dd0b65d7b76c7d5b8bc38ecc74c", + "reference": "c93b8dba37b35dd0b65d7b76c7d5b8bc38ecc74c", + "shasum": "" + }, + "require": { + "php": "^5.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8 || ^5.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Jsvrcek\\ICS\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Justin Svrcek", + "homepage": "https://github.com/jasvrcek" + } + ], + "description": "abstraction layer for creating multi-byte safe RFC 5545 compliant .ics files", + "homepage": "https://github.com/jasvrcek/ICS", + "keywords": [ + ".ics", + "RFC 5545", + "calendar", + "export", + "ical", + "multi-byte safe" + ], + "time": "2017-02-01T20:10:20+00:00" + }, { "name": "phpmailer/phpmailer", "version": "v5.2.23", diff --git a/src/vendor/composer/autoload_psr4.php b/src/vendor/composer/autoload_psr4.php index d5735917..0af8a7e4 100644 --- a/src/vendor/composer/autoload_psr4.php +++ b/src/vendor/composer/autoload_psr4.php @@ -9,6 +9,7 @@ return array( 'phpDocumentor\\Reflection\\' => array($vendorDir . '/phpdocumentor/reflection-common/src', $vendorDir . '/phpdocumentor/type-resolver/src', $vendorDir . '/phpdocumentor/reflection-docblock/src'), 'Webmozart\\Assert\\' => array($vendorDir . '/webmozart/assert/src'), 'Symfony\\Component\\Yaml\\' => array($vendorDir . '/symfony/yaml'), + 'Jsvrcek\\ICS\\' => array($vendorDir . '/jsvrcek/ics/src'), 'Gregwar\\Captcha\\' => array($vendorDir . '/gregwar/captcha'), 'Doctrine\\Instantiator\\' => array($vendorDir . '/doctrine/instantiator/src/Doctrine/Instantiator'), 'DeepCopy\\' => array($vendorDir . '/myclabs/deep-copy/src/DeepCopy'), diff --git a/src/vendor/composer/autoload_static.php b/src/vendor/composer/autoload_static.php index b7dc26f0..0521912e 100644 --- a/src/vendor/composer/autoload_static.php +++ b/src/vendor/composer/autoload_static.php @@ -19,6 +19,10 @@ class ComposerStaticInit745c9af234090db98769aa0b5014bcf4 array ( 'Symfony\\Component\\Yaml\\' => 23, ), + 'J' => + array ( + 'Jsvrcek\\ICS\\' => 12, + ), 'G' => array ( 'Gregwar\\Captcha\\' => 16, @@ -45,6 +49,10 @@ class ComposerStaticInit745c9af234090db98769aa0b5014bcf4 array ( 0 => __DIR__ . '/..' . '/symfony/yaml', ), + 'Jsvrcek\\ICS\\' => + array ( + 0 => __DIR__ . '/..' . '/jsvrcek/ics/src', + ), 'Gregwar\\Captcha\\' => array ( 0 => __DIR__ . '/..' . '/gregwar/captcha', diff --git a/src/vendor/composer/installed.json b/src/vendor/composer/installed.json index 6405f618..aa733d1e 100644 --- a/src/vendor/composer/installed.json +++ b/src/vendor/composer/installed.json @@ -1,39 +1,4 @@ [ - { - "name": "codeigniter/framework", - "version": "3.1.5", - "version_normalized": "3.1.5.0", - "source": { - "type": "git", - "url": "https://github.com/bcit-ci/CodeIgniter.git", - "reference": "6c7a4266410070d30f8f6bcdf9c9e67f3d6478e3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/bcit-ci/CodeIgniter/zipball/6c7a4266410070d30f8f6bcdf9c9e67f3d6478e3", - "reference": "6c7a4266410070d30f8f6bcdf9c9e67f3d6478e3", - "shasum": "" - }, - "require": { - "php": ">=5.3.7" - }, - "require-dev": { - "mikey179/vfsstream": "1.1.*", - "phpunit/phpunit": "4.* || 5.*" - }, - "suggest": { - "paragonie/random_compat": "Provides better randomness in PHP 5.x" - }, - "time": "2017-06-19T08:33:58+00:00", - "type": "project", - "installation-source": "dist", - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "The CodeIgniter framework", - "homepage": "https://codeigniter.com" - }, { "name": "gregwar/captcha", "version": "v1.1.1", @@ -1649,5 +1614,90 @@ "testing", "xunit" ] + }, + { + "name": "codeigniter/framework", + "version": "3.1.6", + "version_normalized": "3.1.6.0", + "source": { + "type": "git", + "url": "https://github.com/bcit-ci/CodeIgniter.git", + "reference": "7e4f63cd4b792e7dc2dc4b8b0183a6072a3f9462" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/bcit-ci/CodeIgniter/zipball/7e4f63cd4b792e7dc2dc4b8b0183a6072a3f9462", + "reference": "7e4f63cd4b792e7dc2dc4b8b0183a6072a3f9462", + "shasum": "" + }, + "require": { + "php": ">=5.3.7" + }, + "require-dev": { + "mikey179/vfsstream": "1.1.*", + "phpunit/phpunit": "4.* || 5.*" + }, + "suggest": { + "paragonie/random_compat": "Provides better randomness in PHP 5.x" + }, + "time": "2017-09-25T16:43:58+00:00", + "type": "project", + "installation-source": "dist", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "The CodeIgniter framework", + "homepage": "https://codeigniter.com" + }, + { + "name": "jsvrcek/ics", + "version": "0.5.1", + "version_normalized": "0.5.1.0", + "source": { + "type": "git", + "url": "https://github.com/jasvrcek/ICS.git", + "reference": "c93b8dba37b35dd0b65d7b76c7d5b8bc38ecc74c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/jasvrcek/ICS/zipball/c93b8dba37b35dd0b65d7b76c7d5b8bc38ecc74c", + "reference": "c93b8dba37b35dd0b65d7b76c7d5b8bc38ecc74c", + "shasum": "" + }, + "require": { + "php": "^5.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8 || ^5.5" + }, + "time": "2017-02-01T20:10:20+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Jsvrcek\\ICS\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Justin Svrcek", + "homepage": "https://github.com/jasvrcek" + } + ], + "description": "abstraction layer for creating multi-byte safe RFC 5545 compliant .ics files", + "homepage": "https://github.com/jasvrcek/ICS", + "keywords": [ + ".ics", + "RFC 5545", + "calendar", + "export", + "ical", + "multi-byte safe" + ] } ] diff --git a/src/vendor/jsvrcek/ics/src/CalendarExport.php b/src/vendor/jsvrcek/ics/src/CalendarExport.php new file mode 100644 index 00000000..5c9dde60 --- /dev/null +++ b/src/vendor/jsvrcek/ics/src/CalendarExport.php @@ -0,0 +1,295 @@ +stream = $stream; + $this->formatter = $formatter; + } + + /** + * @return CalendarStream + */ + public function getStreamObject() + { + return $this->stream; + } + + /** + * @return string + */ + public function getStream() + { + $this->stream->reset(); + + /* @var $cal Calendar */ + foreach ($this->getCalendars() as $cal) + { + //start calendar + $this->stream->addItem('BEGIN:VCALENDAR') + ->addItem('VERSION:'.$cal->getVersion()) + ->addItem('PRODID:'.$cal->getProdId()) + ->addItem('CALSCALE:'.$cal->getCalendarScale()) + ->addItem('METHOD:'.$cal->getMethod()); + + //custom headers + foreach ($cal->getCustomHeaders() as $key => $value) + { + $this->stream->addItem($key.':'.$value); + } + + //timezone + $this->stream->addItem('BEGIN:VTIMEZONE'); + + $tz = $cal->getTimezone(); + $transitions = $tz->getTransitions(strtotime('1970-01-01'), strtotime('1970-12-31')); + + $daylightSavings = array( + 'exists' => false, + 'start' => '', + 'offsetTo' => '', + 'offsetFrom' => '' + ); + + $standard = array( + 'start' => '', + 'offsetTo' => '', + 'offsetFrom' => '' + ); + + foreach ($transitions as $transition) + { + $varName = ($transition['isdst']) ? 'daylightSavings' : 'standard'; + + ${$varName}['exists'] = true; + ${$varName}['start'] = $this->formatter->getFormattedDateTime(new \DateTime($transition['time'])); + + ${$varName}['offsetTo'] = $this->formatter->getFormattedTimeOffset($transition['offset']); + + //get previous offset + $previousTimezoneObservance = $transition['ts'] - 100; + $tzDate = new \DateTime('now', $tz); + $tzDate->setTimestamp($previousTimezoneObservance); + $offset = $tzDate->getOffset(); + + ${$varName}['offsetFrom'] = $this->formatter->getFormattedTimeOffset($offset); + } + + $this->stream->addItem('TZID:'.$tz->getName()); + + $this->stream->addItem('BEGIN:STANDARD') + ->addItem('DTSTART:'.$standard['start']) + ->addItem('TZOFFSETTO:'.$standard['offsetTo']) + ->addItem('TZOFFSETFROM:'.$standard['offsetFrom']); + + if ($daylightSavings['exists']) + { + $this->stream->addItem('RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU'); + } + $this->stream->addItem('END:STANDARD'); + + if ($daylightSavings['exists']) + { + $this->stream->addItem('BEGIN:DAYLIGHT') + ->addItem('DTSTART:'.$daylightSavings['start']) + ->addItem('TZOFFSETTO:'.$daylightSavings['offsetTo']) + ->addItem('TZOFFSETFROM:'.$daylightSavings['offsetFrom']) + ->addItem('RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU') + ->addItem('END:DAYLIGHT'); + } + + $this->stream->addItem('END:VTIMEZONE'); + + //add events + /* @var $event CalendarEvent */ + foreach ($cal->getEvents() as $event) + { + $dtStart = $event->isAllDay() ? + $this->formatter->getFormattedDate($event->getStart()) : + $this->formatter->getFormattedDateTime($event->getStart()); + + $dtEnd = $event->isAllDay() ? + $this->formatter->getFormattedDate($event->getEnd()) : + $this->formatter->getFormattedDateTime($event->getEnd()); + + $this->stream->addItem('BEGIN:VEVENT') + ->addItem('UID:'.$event->getUid()) + ->addItem('DTSTART:'. $dtStart) + ->addItem('DTEND:'. $dtEnd); + + if ($event->getRecurrenceRule() instanceof RecurrenceRule) + $this->stream->addItem($event->getRecurrenceRule()->__toString()); + + foreach ($event->getExceptionDates() as $date) + { + $this->stream->addItem('EXDATE:'.$this->formatter->getFormattedDateTime($date)); + } + + if ($event->getSequence()) + $this->stream->addItem('SEQUENCE:'.$event->getSequence()); + + $this->stream->addItem('STATUS:'.$event->getStatus()) + ->addItem('SUMMARY:'.$event->getSummary()) + ->addItem('DESCRIPTION:'.$event->getDescription()); + + if ($event->getClass()) + $this->stream->addItem('CLASS:'.$event->getClass()); + + /* @var $location Location */ + foreach ($event->getLocations() as $location) + { + $this->stream + ->addItem('LOCATION'.$location->getUri().$location->getLanguage().':'.$location->getName()); + } + + if ($event->getPriority() > 0 && $event->getPriority() <= 9) + $this->stream->addItem('PRIORITY:'.$event->getPriority()); + + if ($event->getGeo()) + $this->stream->addItem('GEO:'.$event->getGeo()->getLatitude().';'.$event->getGeo()->getLongitude()); + + if ($event->getUrl()) + $this->stream->addItem('URL:'.$event->getUrl()); + + + if ($event->getTimestamp()) + { + $this->stream->addItem('DTSTAMP:'.$this->formatter->getFormattedUTCDateTime($event->getTimestamp())); + } + else + { + $this->stream->addItem('DTSTAMP:'.$this->formatter->getFormattedUTCDateTime(new \DateTime())); + } + + if ($event->getCreated()) + $this->stream->addItem('CREATED:'.$this->formatter->getFormattedUTCDateTime($event->getCreated())); + + if ($event->getLastModified()) + $this->stream->addItem('LAST-MODIFIED:'.$this->formatter->getFormattedUTCDateTime($event->getLastModified())); + + foreach ($event->getAttendees() as $attendee) + { + $this->stream->addItem($attendee->__toString()); + } + + if ($event->getOrganizer()) + $this->stream->addItem($event->getOrganizer()->__toString()); + + /** @var CalendarAlarm $alarm */ + foreach ($event->getAlarms() as $alarm) + { + //basic requirements for all types of alarm + $this->stream->addItem('BEGIN:VALARM') + ->addItem('TRIGGER;VALUE=DATE-TIME:'.$this->formatter->getFormattedUTCDateTime($alarm->getTrigger())) + ->addItem('ACTION:'.$alarm->getAction()); + + //only handle repeats if both repeat and duration are set + if ($alarm->getRepeat() && $alarm->getDuration()) { + $this->stream->addItem('REPEAT:'.$alarm->getRepeat()) + ->addItem('DURATION:'.$this->formatter->getFormattedDateInterval($alarm->getDuration())); + } + + //action specific logic + switch ($alarm->getAction()) + { + case 'AUDIO': + $attachments = $alarm->getAttachments(); + $this->stream->addItem('ATTACH;'.$attachments[0]); + break; + case 'DISPLAY': + $this->stream->addItem('DESCRIPTION:'.$alarm->getDescription()); + break; + case 'EMAIL': + $this->stream->addItem('SUMMARY:'.$alarm->getSummary()) + ->addItem('DESCRIPTION:'.$alarm->getDescription()); + + foreach ($alarm->getAttendees() as $attendee) + { + $this->stream->addItem($attendee->__toString()); + } + foreach ($alarm->getAttachments() as $attachment) + { + $this->stream->addItem('ATTACH;'.$attachment); + } + break; + default: + throw new \Exception("Unknown ALARM action: '{$alarm->getAction()}'"); + break; + } + + $this->stream->addItem('END:VALARM'); + } + + $this->stream->addItem('END:VEVENT'); + } + + //end calendar + $this->stream->addItem('END:VCALENDAR'); + } + + return $this->stream->getStream(); + } + + + /** + * @return array + */ + public function getCalendars() + { + return $this->calendars; + } + + /** + * @param array $calendars + * @return CalendarExport + */ + public function setCalendars(array $calendars) + { + $this->calendars = $calendars; + return $this; + } + + /** + * @param Calendar $cal + * @return CalendarExport + */ + public function addCalendar(Calendar $cal) + { + $this->calendars[] = $cal; + return $this; + } +} diff --git a/src/vendor/jsvrcek/ics/src/CalendarStream.php b/src/vendor/jsvrcek/ics/src/CalendarStream.php new file mode 100644 index 00000000..b03ceb6a --- /dev/null +++ b/src/vendor/jsvrcek/ics/src/CalendarStream.php @@ -0,0 +1,98 @@ +doImmediateOutput = $doImmediateOutput; + } + + /** + * resets stream to blank string + */ + public function reset() + { + $this->stream = ''; + } + + /** + * @return string + */ + public function getStream() + { + return $this->stream; + } + + /** + * splits item into new lines if necessary + * @param string $item + * @return CalendarStream + */ + public function addItem($item) + { + //get number of bytes + $length = strlen($item); + + $block = ''; + + if ($length > 75) + { + $start = 0; + + while ($start < $length) + { + $block .= mb_strcut($item, $start, self::LINE_LENGTH, 'UTF-8'); + $start = $start + self::LINE_LENGTH; + + //add space if not last line + if ($start < $length) $block .= Constants::CRLF.' '; + } + } + else + { + $block = $item; + } + + $this->stream .= $block.Constants::CRLF; + + if ($this->doImmediateOutput) + { + echo $this; + $this->reset(); + } + + return $this; + } + + /** + * @return string + */ + public function __toString() + { + return $this->getStream(); + } +} \ No newline at end of file diff --git a/src/vendor/jsvrcek/ics/src/Constants.php b/src/vendor/jsvrcek/ics/src/Constants.php new file mode 100644 index 00000000..48a101d1 --- /dev/null +++ b/src/vendor/jsvrcek/ics/src/Constants.php @@ -0,0 +1,7 @@ +timezone = new \DateTimeZone('America/New_York'); + $this->events = new Provider(); + $this->todos = new Provider(); + $this->freeBusy = new Provider(); + } + + /** + * For use if you want CalendarExport::getStream to get events in batches from a database during + * the output of the ics feed, instead of adding all events to the Calendar object before outputting + * the ics feed. + * - CalendarExport::getStream iterates through the Calendar::$events internal data array. The $eventsProvider + * closure will be called every time this data array reaches its end during iteration, and the closure should + * return the next batch of events + * - A $startKey argument with the current key of the data array will be passed to the $eventsProvider closure + * - The $eventsProvider must return an array of CalendarEvent objects + * + * Example: Calendar::setEventsProvider(function($startKey){ + * //get database rows starting with $startKey + * //return an array of CalendarEvent objects + * }) + * + * @param \Closure $eventsProvider + * @return \Jsvrcek\ICS\Model\Calendar + */ + public function setEventsProvider(\Closure $eventsProvider) + { + $this->events = new Provider($eventsProvider); + return $this; + } + + /** + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * @param string $version + * @return \Jsvrcek\ICS\Model\Calendar + */ + public function setVersion($version) + { + $this->version = $version; + return $this; + } + + /** + * @return string + */ + public function getProdId() + { + return $this->prodId; + } + + /** + * @param string $prodId + * @return \Jsvrcek\ICS\Model\Calendar + */ + public function setProdId($prodId) + { + $this->prodId = $prodId; + return $this; + } + + /** + * @return string + */ + public function getCalendarScale() + { + return $this->calendarScale; + } + + /** + * @param string $calendarScale + * @return \Jsvrcek\ICS\Model\Calendar + */ + public function setCalendarScale($calendarScale) + { + $this->calendarScale = $calendarScale; + return $this; + } + + /** + * @return string + */ + public function getMethod() + { + return $this->method; + } + + /** + * @param string $method + * @return \Jsvrcek\ICS\Model\Calendar + */ + public function setMethod($method) + { + $this->method = $method; + return $this; + } + + /** + * @return array + */ + public function getCustomHeaders() + { + return $this->customHeaders; + } + + /** + * use to add custom headers as array key-value pairs
+ * Example: $customHeaders = array('X-WR-TIMEZONE' => 'America/New_York') + * + * @param array $customHeaders + * @return \Jsvrcek\ICS\Model\Calendar + */ + public function setCustomHeaders(array $customHeaders) + { + $this->customHeaders = $customHeaders; + return $this; + } + + /** + * @param string $key + * @param string $value + * @return \Jsvrcek\ICS\Model\Calendar + */ + public function addCustomHeader($key, $value) + { + $this->customHeaders[$key] = $value; + return $this; + } + + /** + * @return \DateTimeZone + */ + public function getTimezone() + { + return $this->timezone; + } + + /** + * @param \DateTimeZone $timezone + * @return \Jsvrcek\ICS\Model\Calendar + */ + public function setTimezone(\DateTimeZone $timezone) + { + $this->timezone = $timezone; + return $this; + } + + /** + * @return Provider + */ + public function getEvents() + { + return $this->events; + } + + /** + * @param CalendarEvent $event + * @return \Jsvrcek\ICS\Model\Calendar + */ + public function addEvent(CalendarEvent $event) + { + $this->events->add($event); + return $this; + } + + /** + * @return array $todos returs array of CalendarTodo objects + */ + public function getTodos() + { + return $this->todos; + } + + /** + * @param CalendarTodo $todo + * @return \Jsvrcek\ICS\Model\Calendar + */ + public function addTodo(CalendarTodo $todo) + { + $this->todos[] = $todo; + return $this; + } + + /** + * @param array $todos + * @return \Jsvrcek\ICS\Model\Calendar + */ + public function setTodos(array $todos) + { + $this->todos = $todos; + return $this; + } + + /** + * @return array $freeBusy returs array of CalendarFreeBusy objects + */ + public function getFreeBusy() + { + return $this->freeBusy; + } + + /** + * @param CalendarFreeBusy $todo + * @return \Jsvrcek\ICS\Model\Calendar + */ + public function addFreeBusy(CalendarFreeBusy $todo) + { + $this->freeBusy[] = $todo; + return $this; + } + + /** + * @param array $freeBusy + * @return \Jsvrcek\ICS\Model\Calendar + */ + public function setFreeBusy(array $freeBusy) + { + $this->freeBusy = $freeBusy; + return $this; + } +} diff --git a/src/vendor/jsvrcek/ics/src/Model/CalendarAlarm.php b/src/vendor/jsvrcek/ics/src/Model/CalendarAlarm.php new file mode 100644 index 00000000..1497d5b3 --- /dev/null +++ b/src/vendor/jsvrcek/ics/src/Model/CalendarAlarm.php @@ -0,0 +1,246 @@ +action; + } + + /** + * @param string $action + * @return \Jsvrcek\ICS\Model\CalendarAlarm + */ + public function setAction($action) + { + $action = strtoupper($action); + $this->action = $action; + return $this; + } + + /** + * @return \DateTime + */ + public function getTrigger() + { + return $this->trigger; + } + + /** + * @param \DateTime $trigger + * @return \Jsvrcek\ICS\Model\CalendarAlarm + */ + public function setTrigger($trigger) + { + $this->trigger = $trigger; + return $this; + } + + /** + * @return array + */ + public function getAttachments() + { + return $this->attachments; + } + + /** + * @param array $attachments + * @return \Jsvrcek\ICS\Model\CalendarAlarm + */ + public function setAttachments($attachments) + { + $this->attachments = $attachments; + return $this; + } + + /** + * @param string $attachment + * @return \Jsvrcek\ICS\Model\CalendarAlarm + */ + public function addAttachment($attachment) + { + $this->attachments[] = $attachment; + return $this; + } + + /** + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * @param string $description + * @return \Jsvrcek\ICS\Model\CalendarAlarm + */ + public function setDescription($description) + { + $this->description = $description; + return $this; + } + + /** + * @return string + */ + public function getSummary() + { + return $this->summary; + } + + /** + * @param string $summary + * @return \Jsvrcek\ICS\Model\CalendarAlarm + */ + public function setSummary($summary) + { + $this->summary = $summary; + return $this; + } + + /** + * @return array $attendees array of Attendee objects + */ + public function getAttendees() + { + return $this->attendees; + } + + /** + * @param array $attendees array of Attendee objects + * @return \Jsvrcek\ICS\Model\CalendarAlarm + */ + public function setAttendees(array $attendees) + { + $this->attendees = $attendees; + return $this; + } + + /** + * @param Attendee $attendee + * @return \Jsvrcek\ICS\Model\CalendarAlarm + */ + public function addAttendee(Attendee $attendee) + { + $this->attendees[] = $attendee; + return $this; + } + + /** + * @return int + */ + public function getRepeat() + { + return $this->repeat; + } + + /** + * @param int $repeat + * @return \Jsvrcek\ICS\Model\CalendarAlarm + */ + public function setRepeat($repeat) + { + $this->repeat = $repeat; + return $this; + } + + /** + * @return \DateInterval + */ + public function getDuration() + { + return $this->duration; + } + + /** + * @param \DateInterval $duration + * @return \Jsvrcek\ICS\Model\CalendarAlarm + */ + public function setDuration($duration) + { + $this->duration = $duration; + return $this; + } +} diff --git a/src/vendor/jsvrcek/ics/src/Model/CalendarEvent.php b/src/vendor/jsvrcek/ics/src/Model/CalendarEvent.php new file mode 100644 index 00000000..89022d1e --- /dev/null +++ b/src/vendor/jsvrcek/ics/src/Model/CalendarEvent.php @@ -0,0 +1,620 @@ +allDay; + } + + /** + * @param boolean $allDay + * @return \Jsvrcek\ICS\Model\CalendarEvent + */ + public function setAllDay($allDay) + { + $this->allDay = $allDay; + return $this; + } + + /** + * @return string + */ + public function getUid() + { + return $this->uid; + } + + /** + * @param string $uid + * @return \Jsvrcek\ICS\Model\CalendarEvent + */ + public function setUid($uid) + { + $this->uid = $uid; + return $this; + } + + /** + * @return \DateTime + */ + public function getStart() + { + return $this->start; + } + + /** + * also sets end time to 30 minutes after start as default
+ * - end time can be overridden with setEnd() + * + * @param \DateTime $start + * @return \Jsvrcek\ICS\Model\CalendarEvent + */ + public function setStart(\DateTime $start) + { + $this->start = $start; + $end = clone $start; + $this->setEnd($end->add(\DateInterval::createFromDateString('30 minutes'))); + return $this; + } + + /** + * @return \DateTime + */ + public function getEnd() + { + return $this->end; + } + + /** + * @param \DateTime $end + * @return \Jsvrcek\ICS\Model\CalendarEvent + */ + public function setEnd(\DateTime $end) + { + //check End is greater than Start + if ($this->getStart() instanceof \DateTime) + { + if ($this->getStart() > $end) + throw new CalendarEventException('End DateTime must be greater than Start DateTime'); + } + else + { + throw new CalendarEventException('You must set the Start time before setting the End Time of a CalendarEvent'); + } + + $this->end = $end; + return $this; + } + + /** + * @return \Jsvrcek\ICS\Model\Recurrence\RecurrenceRule + */ + public function getRecurrenceRule() + { + return $this->recurrenceRule; + } + + /** + * @param RecurrenceRule $recurrenceRule + * @return \Jsvrcek\ICS\Model\CalendarEvent + */ + public function setRecurrenceRule(RecurrenceRule $recurrenceRule) + { + $this->recurrenceRule = $recurrenceRule; + return $this; + } + + /** + * array of DateTime instances + * @param array $dates + */ + public function setExceptionDates(array $dates) + { + $this->exceptionDates = $dates; + return $this; + } + + /** + * @return array + */ + public function getExceptionDates() + { + return $this->exceptionDates; + } + + /** + * @param \DateTime $date + * @return \Jsvrcek\ICS\Model\CalendarEvent + */ + public function addExceptionDate(\DateTime $date) + { + $this->exceptionDates[] = $date; + return $this; + } + + /** + * @return the string + */ + public function getSummary() + { + return $this->summary; + } + + /** + * @param string $summary + * @return \Jsvrcek\ICS\Model\CalendarEvent + */ + public function setSummary($summary) + { + $this->summary = $summary; + return $this; + } + + /** + * @return the string + */ + public function getDescription() + { + return $this->description; + } + + /** + * @param string $description + * @return \Jsvrcek\ICS\Model\CalendarEvent + */ + public function setDescription($description) + { + $this->description = $description; + return $this; + } + + /** + * @return array $alarms returs array of CalendarAlarm objects + */ + public function getAlarms() + { + return $this->alarms; + } + + /** + * @param CalendarAlarm $alarm + * @return \Jsvrcek\ICS\Model\CalendarEvent + */ + public function addAlarm(CalendarAlarm $alarm) + { + $this->alarms[] = $alarm; + return $this; + } + + /** + * @param array $alarms + * @return \Jsvrcek\ICS\Model\CalendarEvent + */ + public function setAlarms(array $alarms) + { + $this->alarms = $alarms; + return $this; + } + + /** + * + * @return string + */ + public function getClass() + { + return $this->class; + } + + /** + * + * @param string $class + * @return \Jsvrcek\ICS\Model\CalendarEvent + */ + public function setClass($class) + { + $this->class = $class; + return $this; + } + + /** + * + * @return \DateTime + */ + public function getCreated() + { + return $this->created; + } + + /** + * + * @param \DateTime $created + * @return \Jsvrcek\ICS\Model\CalendarEvent + */ + public function setCreated(\DateTime $created) + { + $this->created = $created; + return $this; + } + + /** + * + * @return Geo|null + */ + public function getGeo() + { + return $this->geo; + } + + /** + * + * @param Geo $geo + * @return \Jsvrcek\ICS\Model\CalendarEvent + */ + public function setGeo(Geo $geo) + { + $this->geo = $geo; + return $this; + } + + /** + * + * @return \DateTime + */ + public function getLastModified() + { + return $this->lastModified; + } + + /** + * + * @param \DateTime $lastModified + * @return \Jsvrcek\ICS\Model\CalendarEvent + */ + public function setLastModified(\DateTime $lastModified) + { + $this->lastModified = $lastModified; + return $this; + } + + /** + * + * @return array $locations array of Location objects + */ + public function getLocations() + { + return $this->locations; + } + + /** + * + * @param array $locations array of Location objects + * @return \Jsvrcek\ICS\Model\CalendarEvent + */ + public function setLocations(array $locations) + { + $this->locations = $locations; + return $this; + } + + /** + * + * @param Location $location + * @return \Jsvrcek\ICS\Model\CalendarEvent + */ + public function addLocation(Location $location) + { + $this->locations[] = $location; + return $this; + } + + /** + * + * @return Organizer + */ + public function getOrganizer() + { + return $this->organizer; + } + + /** + * + * @param Organizer $organizer + * @return \Jsvrcek\ICS\Model\CalendarEvent + */ + public function setOrganizer(Organizer $organizer) + { + $this->organizer = $organizer; + return $this; + } + + /** + * + * @return string + */ + public function getPriority() + { + return $this->priority; + } + + /** + * + * @param string $priority + * @return \Jsvrcek\ICS\Model\CalendarEvent + */ + public function setPriority($priority) + { + $this->priority = $priority; + return $this; + } + + /** + * + * @return \DateTime + */ + public function getTimestamp() + { + return $this->timestamp; + } + + /** + * + * @param \DateTime $timestamp + * @return \Jsvrcek\ICS\Model\CalendarEvent + */ + public function setTimestamp(\DateTime $timestamp) + { + $this->timestamp = $timestamp; + return $this; + } + + /** + * + * @return string + */ + public function getStatus() + { + return $this->status; + } + + /** + * + * @param string $status + * @return \Jsvrcek\ICS\Model\CalendarEvent + */ + public function setStatus($status) + { + $this->status = $status; + return $this; + } + + /** + * + * @return string + */ + public function getRecuringId() + { + return $this->recuringId; + } + + /** + * + * @param string $recuringId + * @return \Jsvrcek\ICS\Model\CalendarEvent + */ + public function setRecuringId($recuringId) + { + $this->recuringId = $recuringId; + return $this; + } + + /** + * @return integer + */ + public function getSequence() + { + return $this->sequence; + } + + /** + * @param integer $sequence + * @return \Jsvrcek\ICS\Model\CalendarEvent + */ + public function setSequence($sequence) + { + $this->sequence = $sequence; + return $this; + } + + /** + * + * @return array $attendees array of Attendee objects + */ + public function getAttendees() + { + return $this->attendees; + } + + /** + * + * @param array $attendees array of Attendee objects + * @return \Jsvrcek\ICS\Model\CalendarEvent + */ + public function setAttendees(array $attendees) + { + $this->attendees = $attendees; + return $this; + } + + /** + * @param Attendee $attendee + * @return \Jsvrcek\ICS\Model\CalendarEvent + */ + public function addAttendee(Attendee $attendee) + { + $this->attendees[] = $attendee; + return $this; + } + + /** + * @param string $url + * @return \Jsvrcek\ICS\Model\CalendarEvent + */ + public function setUrl($url) + { + $this->url = $url; + return $this; + } + + /** + * @return string + */ + public function getUrl() + { + return $this->url; + } +} diff --git a/src/vendor/jsvrcek/ics/src/Model/CalendarFreeBusy.php b/src/vendor/jsvrcek/ics/src/Model/CalendarFreeBusy.php new file mode 100644 index 00000000..24c0b07d --- /dev/null +++ b/src/vendor/jsvrcek/ics/src/Model/CalendarFreeBusy.php @@ -0,0 +1,8 @@ +latitude; + } + + /** + * @param float $latitude + * @return \Jsvrcek\ICS\Model\Description\Geo + */ + public function setLatitude($latitude) + { + $this->latitude = $latitude; + return $this; + } + + /** + * @return number + */ + public function getLongitude() + { + return $this->longitude; + } + + /** + * @param float $longitude + * @return \Jsvrcek\ICS\Model\Description\Geo + */ + public function setLongitude($longitude) + { + $this->longitude = $longitude; + return $this; + } + +} diff --git a/src/vendor/jsvrcek/ics/src/Model/Description/Location.php b/src/vendor/jsvrcek/ics/src/Model/Description/Location.php new file mode 100644 index 00000000..4f9a4fe6 --- /dev/null +++ b/src/vendor/jsvrcek/ics/src/Model/Description/Location.php @@ -0,0 +1,77 @@ +name; + } + + /** + * @param string $name + * @return \Jsvrcek\ICS\Model\Description\Location + */ + public function setName($name) + { + $this->name = $name; + return $this; + } + + /** + * @return string + */ + public function getUri() + { + return $this->uri; + } + + /** + * @param string $uri uri to vCard or other uri + * @return \Jsvrcek\ICS\Model\Description\Location + */ + public function setUri($uri) + { + $this->uri = ';ALTREP="' . $uri . '"'; + return $this; + } + + /** + * @return string + */ + public function getLanguage() + { + return $this->language; + } + + /** + * @param string $language RFC 1766 language identifier + * @return \Jsvrcek\ICS\Model\Description\Location + */ + public function setLanguage($language) + { + $this->language = ';LANGUAGE='.$language; + return $this; + } +} diff --git a/src/vendor/jsvrcek/ics/src/Model/Recurrence/DataType/Frequency.php b/src/vendor/jsvrcek/ics/src/Model/Recurrence/DataType/Frequency.php new file mode 100644 index 00000000..f41997e6 --- /dev/null +++ b/src/vendor/jsvrcek/ics/src/Model/Recurrence/DataType/Frequency.php @@ -0,0 +1,90 @@ + 'SECONDLY', + self::MINUTELY => 'MINUTELY', + self::HOURLY => 'HOURLY', + self::DAILY => 'DAILY', + self::WEEKLY => 'WEEKLY', + self::MONTHLY => 'MONTHLY', + self::YEARLY => 'YEARLY' + ); + + /** + * @param integer $frequency Frequency::SECONDLY, Frequency::MINUTELY, + * Frequency::HOURLY, Frequency::DAILY, Frequency::WEEKLY, + * Frequency::MONTHLY, Frequency::YEARLY + */ + public function __construct($frequency) + { + $this->validateFrequency($frequency); + + $this->freq = $frequency; + } + + /** + * @return number + */ + public function getFreq() + { + return $this->freq; + } + + /** + * @param integer $freq + * @return \Jsvrcek\ICS\Model\Recurrence\DataType\Frequency + */ + public function setFreq($freq) + { + $this->validateFrequency($freq); + + $this->freq = $freq; + return $this; + } + + /** + * @param integer $frequency + * @throws CalendarRecurrenceException + */ + private function validateFrequency($frequency) + { + if (!is_int($frequency) || $frequency < 1 || $frequency > 7) + { + throw new CalendarRecurrenceException('You must pass a Frequency constant to the contructor.'); + } + } + + /** + * @return string + */ + public function __toString() + { + return self::KEY.'='.self::$values[$this->freq]; + } +} \ No newline at end of file diff --git a/src/vendor/jsvrcek/ics/src/Model/Recurrence/DataType/Weekday.php b/src/vendor/jsvrcek/ics/src/Model/Recurrence/DataType/Weekday.php new file mode 100644 index 00000000..f50aaec2 --- /dev/null +++ b/src/vendor/jsvrcek/ics/src/Model/Recurrence/DataType/Weekday.php @@ -0,0 +1,92 @@ + 'SU', + self::MONDAY => 'MO', + self::TUESDAY => 'TU', + self::WEDNESDAY => 'WE', + self::THURSDAY => 'TH', + self::FRIDAY => 'FR', + self::SATURDAY => 'SA' + ); + + /** + * @param integer $weekday Weekday::SUNDAY, Weekday::MONDAY, + * Weekday::TUESDAY, Weekday::WEDNESDAY, Weekday::THURSDAY, + * Weekday::FRIDAY, Weekday::SATURDAY + */ + public function __construct($weekday) + { + $this->validateWeekday($weekday); + + $this->weekday = $weekday; + } + + /** + * @return number + */ + public function getWeekday() + { + return $this->weekday; + } + + /** + * @param integer $weekday + * @return \Jsvrcek\ICS\Model\Recurrence\DataType\Weekday + */ + public function setWeekday($weekday) + { + $this->validateWeekday($weekday); + + $this->weekday = $weekday; + return $this; + } + + /** + * @param integer $weekday + * @throws CalendarRecurrenceException + */ + private function validateWeekday($weekday) + { + if (!is_int($weekday) || $weekday < 1 || $weekday > 7) + { + throw new CalendarRecurrenceException('You must pass a Weekday constant to the contructor.'); + } + } + + /** + * @return string + */ + public function __toString() + { + return $this->values[$this->weekday]; + } +} \ No newline at end of file diff --git a/src/vendor/jsvrcek/ics/src/Model/Recurrence/DataType/WeekdayNum.php b/src/vendor/jsvrcek/ics/src/Model/Recurrence/DataType/WeekdayNum.php new file mode 100644 index 00000000..b018103a --- /dev/null +++ b/src/vendor/jsvrcek/ics/src/Model/Recurrence/DataType/WeekdayNum.php @@ -0,0 +1,78 @@ +validateWeekdayNum($weekdaynum); + $this->validateCountFromStartOrEnd($countFromStartOrEnd); + + $this->weekdaynum = $weekdaynum; + $this->countFromStartOrEnd = $countFromStartOrEnd; + } + + /* (non-PHPdoc) + * @see Jsvrcek\ICS\Model\Recurrence\DataType.Weekday::__toString() + */ + public function __toString() + { + return $this->countFromStartOrEnd.$this->weekdaynum.parent::__toString(); + } + + /** + * @param mixed $countFromStartOrEnd + * @throws CalendarRecurrenceException + */ + private function validateCountFromStartOrEnd($countFromStartOrEnd) + { + if ($countFromStartOrEnd !== self::COUNT_FROM_START && $countFromStartOrEnd !== self::COUNT_FROM_END) + { + throw new CalendarRecurrenceException('You must use WeekdayNum::COUNT_FROM_START or WeekdayNum::COUNT_FROM_END'); + } + } + + /** + * @param integer $weekdaynum + * @throws CalendarRecurrenceException + */ + private function validateWeekdayNum($weekdaynum) + { + if (!is_int($weekdaynum) || $weekdaynum < 1 || $weekdaynum > 53) + { + throw new CalendarRecurrenceException('$weekdaynum must be an integer between 1 and 53'); + } + } +} \ No newline at end of file diff --git a/src/vendor/jsvrcek/ics/src/Model/Recurrence/RecurrenceRule.php b/src/vendor/jsvrcek/ics/src/Model/Recurrence/RecurrenceRule.php new file mode 100644 index 00000000..e95b00f2 --- /dev/null +++ b/src/vendor/jsvrcek/ics/src/Model/Recurrence/RecurrenceRule.php @@ -0,0 +1,536 @@ +formatter = $formatter; + } + + /** + * @return \Jsvrcek\ICS\Model\Recurrence\Frequency + */ + public function getFrequency() + { + return $this->frequency; + } + + /** + * @param Frequency $frequency + * @return \Jsvrcek\ICS\Model\Recurrence\RecurrenceRule + */ + public function setFrequency(Frequency $frequency) + { + $this->frequency = $frequency; + return $this; + } + + /** + * + * @return \DateTime + */ + public function getUntil() + { + return $this->until; + } + + /** + * + * @param \DateTime $until = null + * @return \Jsvrcek\ICS\Model\Recurrence\RecurrenceRule + */ + public function setUntil(\DateTime $until = null) + { + $this->until = $until; + return $this; + } + + /** + * + * @return integer + */ + public function getCount() + { + return $this->count; + } + + + /** + * @param integer $count + * @return \Jsvrcek\ICS\Model\Recurrence\RecurrenceRule + */ + public function setCount($count) + { + $this->validateInteger($count); + + $this->count = $count; + return $this; + } + + /** + * + * @return integer + */ + public function getInterval() + { + return $this->interval; + } + + /** + * @param integer $interval + * @return \Jsvrcek\ICS\Model\Recurrence\RecurrenceRule + */ + public function setInterval($interval) + { + $this->validateInteger($interval); + + $this->interval = $interval; + return $this; + } + + /** + * @return array + */ + public function getBySecondList() + { + return $this->bySecondList; + } + + /** + * @param array $bySecondList + * @return \Jsvrcek\ICS\Model\Recurrence\RecurrenceRule + */ + public function setBySecondList(array $bySecondList) + { + $this->bySecondList = $bySecondList; + return $this; + } + + /** + * @param integer $integer 0-60 + * @return \Jsvrcek\ICS\Model\Recurrence\RecurrenceRule + */ + public function addBySecond($integer) + { + $this->validateInteger($integer); + + $this->bySecondList[] = $integer; + return $this; + } + + /** + * + * @return array + */ + public function getByMinuteList() + { + return $this->byMinuteList; + } + + /** + * @param array $byMinuteList + * @return \Jsvrcek\ICS\Model\Recurrence\RecurrenceRule + */ + public function setByMinuteList(array $byMinuteList) + { + $this->byMinuteList = $byMinuteList; + return $this; + } + + /** + * @param integer $integer 0-59 + * @return \Jsvrcek\ICS\Model\Recurrence\RecurrenceRule + */ + public function addByMinute($integer) + { + $this->validateInteger($integer); + + $this->byMinuteList[] = $integer; + return $this; + } + + /** + * + * @return array + */ + public function getByHourList() + { + return $this->byHourList; + } + + /** + * @param array $byHourList + * @return \Jsvrcek\ICS\Model\Recurrence\RecurrenceRule + */ + public function setByHourList(array $byHourList) + { + $this->byHourList = $byHourList; + return $this; + } + + /** + * @param integer $integer 0-23 + * @return \Jsvrcek\ICS\Model\Recurrence\RecurrenceRule + */ + public function addByHour($integer) + { + $this->validateInteger($integer); + + $this->byHourList[] = $integer; + return $this; + } + + /** + * + * @return array + */ + public function getByDayList() + { + return $this->byDayList; + } + + /** + * @param array $byDayList + * @return \Jsvrcek\ICS\Model\Recurrence\RecurrenceRule + */ + public function setByDayList(array $byDayList) + { + $this->byDayList = $byDayList; + return $this; + } + + /** + * @param WeekdayNum $weekdaynum + * @return \Jsvrcek\ICS\Model\Recurrence\RecurrenceRule + */ + public function addByDay(WeekdayNum $weekdaynum) + { + $this->byDayList[] = $weekdaynum; + return $this; + } + + /** + * + * @return array + */ + public function getByMonthDayList() + { + return $this->byMonthDayList; + } + + /** + * @param array $byMonthDayList + * @return \Jsvrcek\ICS\Model\Recurrence\RecurrenceRule + */ + public function setByMonthDayList(array $byMonthDayList) + { + $this->byMonthDayList = $byMonthDayList; + return $this; + } + + /** + * @param integer $integer + * @return \Jsvrcek\ICS\Model\Recurrence\RecurrenceRule + */ + public function addByMonthDay($integer) + { + $this->validateInteger($integer); + + $this->byMonthDayList[] = $bySecond; + return $this; + } + + /** + * + * @return array + */ + public function getByYearDayList() + { + return $this->byYearDayList; + } + + /** + * @param array $byYearDayList + * @return \Jsvrcek\ICS\Model\Recurrence\RecurrenceRule + */ + public function setByYearDayList(array $byYearDayList) + { + $this->byYearDayList = $byYearDayList; + return $this; + } + + /** + * + * @return array + */ + public function getByWeekNumberList() + { + return $this->byWeekNumberList; + } + + /** + * @param array $byWeekNumberList + * @return \Jsvrcek\ICS\Model\Recurrence\RecurrenceRule + */ + public function setByWeekNumberList(array $byWeekNumberList) + { + $this->byWeekNumberList = $byWeekNumberList; + return $this; + } + + /** + * + * @return array + */ + public function getByMonthList() + { + return $this->byMonthList; + } + + /** + * @param array $byMonthList + * @return \Jsvrcek\ICS\Model\Recurrence\RecurrenceRule + */ + public function setByMonthList(array $byMonthList) + { + $this->byMonthList = $byMonthList; + return $this; + } + + /** + * + * @return array + */ + public function getBySetPosYearDayList() + { + return $this->bySetPosYearDayList; + } + + /** + * @param array $bySetPosYearDayList + * @return \Jsvrcek\ICS\Model\Recurrence\RecurrenceRule + */ + public function setBySetPosYearDayList(array $bySetPosYearDayList) + { + $this->bySetPosYearDayList = $bySetPosYearDayList; + return $this; + } + + /** + * + * @return Weekday + */ + public function getWeekStart() + { + return $this->weekStart; + } + + /** + * @param Weekday $weekStart + * @return \Jsvrcek\ICS\Model\Recurrence\RecurrenceRule + */ + public function setWeekStart(Weekday $weekStart) + { + $this->weekStart = $weekStart; + return $this; + } + + /** + * parses an RRULE string, hydrates self with values + * + * @param string $rRuleString + * @return \Jsvrcek\ICS\Model\Recurrence\RecurrenceRule + */ + public function parse($rRuleString) + { + //remove RRULE: + $string = str_replace(self::KEY, null, $rRuleString); + + $attributes = explode(';', $string); + + foreach ($attributes as $attribute) + { + list($key, $value) = explode('=', $attribute); + + switch ($key) + { + case Frequency::KEY: + if ($valueStringKey = array_search($value, Frequency::$values)) + { + $this->setFrequency(new Frequency($valueStringKey)); + } + else + { + throw new CalendarRecurrenceException('Unsupported FREQ value in Recurrence Rule (RRULE) string: '.$value); + } + break; + + case 'INTERVAL': + $this->setInterval((int)$value); + break; + + case 'UNTIL': + $untilDate = new \DateTime(str_replace('Z', '', $value), new \DateTimeZone('UTC')); + $this->setUntil($untilDate); + break; + + default: + throw new CalendarRecurrenceException('Unsupported attribute in Recurrence Rule (RRULE) string: '.$key); + } + } + + return $this; + } + + /** + * @return string + */ + public function __toString() + { + $items = array($this->getFrequency()->__toString()); + + if ($this->interval) + $items[] = 'INTERVAL='.$this->interval; + + if ($this->until) + $items[] = 'UNTIL='.$this->formatter->getFormattedUTCDateTime($this->until); + + if ($this->count) + $items[] = 'COUNT='.$this->count; + + if ($this->byDayList) + $items[] = 'BYDAY='.implode(',', $this->byDayList); + + return self::KEY.implode(';', $items); + } + + /** + * @param integer $integer + * @throws CalendarRecurrenceException + */ + private function validateInteger($integer) + { + if (!is_int($integer)) + { + throw new CalendarRecurrenceException('Value must be an integer'); + } + } +} \ No newline at end of file diff --git a/src/vendor/jsvrcek/ics/src/Model/Relationship/Attendee.php b/src/vendor/jsvrcek/ics/src/Model/Relationship/Attendee.php new file mode 100644 index 00000000..cb5cd0d8 --- /dev/null +++ b/src/vendor/jsvrcek/ics/src/Model/Relationship/Attendee.php @@ -0,0 +1,438 @@ +formatter = $formatter; + } + + /** + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * RFC 5545 cal-address http://tools.ietf.org/html/rfc5545#section-3.3.3 + * @param string $uri + * @return \Jsvrcek\ICS\Model\Relationship\Attendee + */ + public function setValue($uri) + { + $this->value = $this->formatter->getFormattedUri($uri); + return $this; + } + + /** + * @return string + */ + public function getCalendarUserType() + { + return $this->calendarUserType; + } + + /** + * RFC 5545 cutypeparam http://tools.ietf.org/html/rfc5545#section-3.2.3 + * + * @param string $calendarUserType + * "INDIVIDUAL" ; An individual
+ * "GROUP" ; A group of individuals
+ * "RESOURCE" ; A physical resource
+ * "ROOM" ; A room resource
+ * "UNKNOWN" ; Otherwise not known
+ * x-name ; Experimental type
+ * iana-token) ; Other IANA-registered type + * @return \Jsvrcek\ICS\Model\Relationship\Attendee + */ + public function setCalendarUserType($calendarUserType) + { + $this->calendarUserType = $calendarUserType; + return $this; + } + + /** + * @return array + */ + public function getCalendarMembers() + { + return $this->calendarMembers; + } + + /** + * RFC 5545 memberparam http://tools.ietf.org/html/rfc5545#section-3.2.11 + * @param array $calendarMemberUris array of uri values for calendar users ex. array('sue@example.com', 'joe@example.com') + * @return \Jsvrcek\ICS\Model\Relationship\Attendee + */ + public function setCalendarMembers($calendarMemberUris) + { + foreach ($calendarMemberUris as &$uri) + { + $uri = $this->formatter->getFormattedUri($uri); + } + + $this->calendarMembers = $calendarMemberUris; + return $this; + } + + /** + * RFC 5545 memberparam http://tools.ietf.org/html/rfc5545#section-3.2.11 + * @param string $uri + * @return \Jsvrcek\ICS\Model\Relationship\Attendee + */ + public function addCalendarMember($uri) + { + $this->calendarMembers[] = $this->formatter->getFormattedUri($uri); + return $this; + } + + /** + * @return string + */ + public function getRole() + { + return $this->role; + } + + /** + * RFC 5545 roleparam http://tools.ietf.org/html/rfc5545#section-3.2.16 + * @param string $role + * "CHAIR" ; Indicates chair of the calendar entity
+ * "REQ-PARTICIPANT" ; Indicates a participant whose participation is required
+ * "OPT-PARTICIPANT" ; Indicates a participant whose participation is optional
+ * "NON-PARTICIPANT" ; Indicates a participant who is copied for information purposes only
+ * x-name ; Experimental role + * iana-token ; Other IANA role + * @return \Jsvrcek\ICS\Model\Relationship\Attendee + */ + public function setRole($role) + { + $this->role = $role; + return $this; + } + + /** + * @return string + */ + public function getParticipationStatus() + { + return $this->participationStatus; + } + + /** + * RFC 5545 partstatparam http://tools.ietf.org/html/rfc5545#section-3.2.12 + * @param string $participationStatus + * Example values for an Event:
+ * "NEEDS-ACTION" ; Event needs action
+ * "ACCEPTED" ; Event accepted
+ * "DECLINED" ; Event declined
+ * "TENTATIVE" ; Event tentatively accepted
+ * "DELEGATED" ; Event delegated + * + * @return \Jsvrcek\ICS\Model\Relationship\Attendee + */ + public function setParticipationStatus($participationStatus) + { + $this->participationStatus = $participationStatus; + return $this; + } + + /** + * @return string + */ + public function getRsvp() + { + return $this->rsvp; + } + + /** + * RFC 5545 rsvpparam http://tools.ietf.org/html/rfc5545#section-3.2.17 + * @param string $rsvp "TRUE" or "FALSE" + * @return \Jsvrcek\ICS\Model\Relationship\Attendee + */ + public function setRsvp($rsvp) + { + $this->rsvp = $rsvp; + return $this; + } + + /** + * @return array + */ + public function getDelegatedTo() + { + return $this->delegatedTo; + } + + /** + * RFC 5545 deltoparam http://tools.ietf.org/html/rfc5545#section-3.2.5 + * @param array $delegatedToUris array of uri values for calendar users ex. array('sue@example.com', 'joe@example.com') + * @return \Jsvrcek\ICS\Model\Relationship\Attendee + */ + public function setDelegatedTo(array $delegatedToUris) + { + foreach ($delegatedToUris as &$uri) + { + $uri = $this->formatter->getFormattedUri($uri); + } + + $this->delegatedTo = $delegatedToUris; + return $this; + } + + /** + * @param string $uri uri value for calendar users ex. 'mary@example.com' + * @return \Jsvrcek\ICS\Model\Relationship\Attendee + */ + public function addDelegatedTo($uri) + { + $this->delegatedTo[] = $this->formatter->getFormattedUri($uri); + return $this; + } + + /** + * @return array + */ + public function getDelegatedFrom() + { + return $this->delegatedFrom; + } + + /** + * RFC 5545 delfromparam http://tools.ietf.org/html/rfc5545#section-3.2.4 + * @param array $delegatedFromUris array of uri values for calendar users ex. array('sue@example.com', 'joe@example.com') + * @return \Jsvrcek\ICS\Model\Relationship\Attendee + */ + public function setDelegatedFrom(array $delegatedFromUris) + { + foreach ($delegatedFromUris as &$uri) + { + $uri = $this->formatter->getFormattedUri($uri); + } + + $this->delegatedFrom = $delegatedFromUris; + return $this; + } + + /** + * @param string $uri uri value for calendar users ex. 'mary@example.com' + * @return \Jsvrcek\ICS\Model\Relationship\Attendee + */ + public function addDelegatedFrom($uri) + { + $this->delegatedFrom[] = $this->formatter->getFormattedUri($uri); + return $this; + } + + /** + * @return string + */ + public function getSentBy() + { + return $this->sentBy; + } + + /** + * RFC 5545 sentbyparam http://tools.ietf.org/html/rfc5545#section-3.2.18 + * @param string $sentBy email address + * @return \Jsvrcek\ICS\Model\Relationship\Attendee + */ + public function setSentBy($sentBy) + { + $this->sentBy = $sentBy; + return $this; + } + + /** + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * @param string $name + * @return \Jsvrcek\ICS\Model\Relationship\Attendee + */ + public function setName($name) + { + $this->name = $name; + return $this; + } + + /** + * @return string + */ + public function getDirectory() + { + return $this->directory; + } + + /** + * RFC 5545 dirparam http://tools.ietf.org/html/rfc5545#section-3.2.6 + * @param string $directory uri directory entry associated with the calendar user + * @return \Jsvrcek\ICS\Model\Relationship\Attendee + */ + public function setDirectory($uri) + { + $this->directory = $uri; + return $this; + } + + /** + * @return string + */ + public function getLanguage() + { + return $this->language; + } + + /** + * @param string $language RFC 1766 language identifier + * @return \Jsvrcek\ICS\Model\Relationship\Attendee + */ + public function setLanguage($language) + { + $this->language = $language; + return $this; + } + + /** + * @return string + */ + public function __toString() + { + $string = 'ATTENDEE'; + + if ($this->calendarUserType) + $string .= ';CUTYPE='.$this->calendarUserType; + + if (count($this->calendarMembers)) + { + $string .= ';MEMBER="'.implode('","', $this->calendarMembers).'"'; + } + + if ($this->role) + $string .= ';ROLE='.$this->role; + + if ($this->participationStatus) + $string .= ';PARTSTAT='.$this->participationStatus; + + if ($this->rsvp) + $string .= ';RSVP='.$this->rsvp; + + if (count($this->delegatedTo)) + { + $string .= ';DELEGATED-TO="'.implode('","', $this->delegatedTo).'"'; + } + + if (count($this->delegatedFrom)) + { + $string .= ';DELEGATED-FROM="'.implode('","', $this->delegatedFrom).'"'; + } + + if ($this->sentBy) + $string .= ';SENT-BY="'.$this->sentBy.'"'; + + if ($this->name) + $string .= ';CN='.$this->name; + + if ($this->directory) + $string .= ';DIR="'.$this->directory.'"'; + + if ($this->language) + $string .= ';LANGUAGE='.$this->language; + + $string .= ':'.$this->value; + + return $string; + } +} diff --git a/src/vendor/jsvrcek/ics/src/Model/Relationship/Organizer.php b/src/vendor/jsvrcek/ics/src/Model/Relationship/Organizer.php new file mode 100644 index 00000000..fec1a882 --- /dev/null +++ b/src/vendor/jsvrcek/ics/src/Model/Relationship/Organizer.php @@ -0,0 +1,166 @@ +formatter = $formatter; + } + + /** + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * RFC 5545 cal-address http://tools.ietf.org/html/rfc5545#section-3.3.3 + * @param string $uri + * @return \Jsvrcek\ICS\Model\Relationship\Organizer + */ + public function setValue($uri) + { + $this->value = $this->formatter->getFormattedUri($uri); + return $this; + } + + /** + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * @param string $name + * @return \Jsvrcek\ICS\Model\Relationship\Organizer + */ + public function setName($name) + { + $this->name = $name; + return $this; + } + + /** + * @return string + */ + public function getDirectory() + { + return $this->directory; + } + + /** + * RFC 5545 dirparam http://tools.ietf.org/html/rfc5545#section-3.2.6 + * @param string $directory uri directory entry associated with the calendar user + * @return \Jsvrcek\ICS\Model\Relationship\Organizer + */ + public function setDirectory($uri) + { + $this->directory = $uri; + return $this; + } + + /** + * @return string + */ + public function getSentBy() + { + return $this->sentBy; + } + + /** + * RFC 5545 sentbyparam http://tools.ietf.org/html/rfc5545#section-3.2.18 + * @param string $sentBy email address + * @return \Jsvrcek\ICS\Model\Relationship\Organizer + */ + public function setSentBy($sentBy) + { + $this->sentBy = $sentBy; + return $this; + } + + /** + * @return string + */ + public function getLanguage() + { + return $this->language; + } + + /** + * @param string $language RFC 1766 language identifier + * @return \Jsvrcek\ICS\Model\Relationship\Organizer + */ + public function setLanguage($language) + { + $this->language = $language; + return $this; + } + + public function __toString() + { + $string = 'ORGANIZER'; + + if ($this->sentBy) + $string .= ';SENT-BY="'.$this->sentBy.'"'; + + if ($this->name) + $string .= ';CN='.$this->name; + + if ($this->directory) + $string .= ';DIR="'.$this->directory.'"'; + + if ($this->language) + $string .= ';LANGUAGE='.$this->language; + + $string .= ':'.$this->value; + + return $string; + } +} \ No newline at end of file diff --git a/src/vendor/jsvrcek/ics/src/Utility/Formatter.php b/src/vendor/jsvrcek/ics/src/Utility/Formatter.php new file mode 100644 index 00000000..973ba076 --- /dev/null +++ b/src/vendor/jsvrcek/ics/src/Utility/Formatter.php @@ -0,0 +1,86 @@ +format(self::DATE_TIME); + } + + /** + * @param int $offset + * @return string + */ + public function getFormattedTimeOffset($offset) + { + $prefix = ($offset < 0) ? '-' : '+'; + + return $prefix.gmdate('Hi', abs($offset)); + } + + /** + * @param \DateTime $dateTime + * @return string + */ + public function getFormattedUTCDateTime(\DateTime $dateTime) + { + return $dateTime->setTimezone(new \DateTimeZone('UTC')) + ->format(self::DATE_TIME_UTC); + } + + /** + * @param \DateTime $dateTime + * @return string + */ + public function getFormattedDate(\DateTime $dateTime) + { + return $dateTime->format(self::DATE); + } + + /** + * converts email addresses into mailto: uri + * @param string $uri + * @return string + */ + public function getFormattedUri($uri) + { + if (strpos($uri, '@') && stripos($uri, 'mailto:') === false) + $uri = 'mailto:'.$uri; + + return $uri; + } + + /** + * converts DateInterval object to string that can be used for a VALARM DURATION + * @param \DateInterval $interval + * @return string + */ + public function getFormattedDateInterval(\DateInterval $interval) + { + $format = "P"; + + if ($interval->y) { $format .= '%yY'; } + if ($interval->m) { $format .= '%mM'; } + if ($interval->d) { $format .= '%dD'; } + + if ($interval->h || $interval->i || $interval->s) { + $format .= "T"; + } + + if ($interval->h) { $format .= '%hH'; } + if ($interval->i) { $format .= '%iM'; } + if ($interval->s) { $format .= '%sS'; } + + return $interval->format($format); + } +} \ No newline at end of file diff --git a/src/vendor/jsvrcek/ics/src/Utility/Provider.php b/src/vendor/jsvrcek/ics/src/Utility/Provider.php new file mode 100644 index 00000000..8447809b --- /dev/null +++ b/src/vendor/jsvrcek/ics/src/Utility/Provider.php @@ -0,0 +1,110 @@ +provider = $provider; + } + + /** + * for manually adding items, rather than using a provider closure to add items in batches during iteration + * Cannot be used in conjunction with a provider closure! + * + * @param mixed $item + */ + public function add($item) + { + $this->manuallyAddedData[] = $item; + } + + /* (non-PHPdoc) + * @see Iterator::current() + */ + public function current() + { + return current($this->data); + } + + /* (non-PHPdoc) + * @see Iterator::key() + */ + public function key() + { + return $this->key; + } + + /* (non-PHPdoc) + * @see Iterator::next() + */ + public function next() + { + array_shift($this->data); + $this->key++; + } + + /* (non-PHPdoc) + * @see Iterator::rewind() + */ + public function rewind() + { + $this->data = array(); + $this->key = 0; + } + + /** + * get next batch from provider if data array is at the end + * + * (non-PHPdoc) + * @see Iterator::valid() + */ + public function valid() + { + if (count($this->data) < 1) + { + if ($this->provider instanceof \Closure) + { + $this->data = $this->provider->__invoke($this->key); + } + else + { + $this->data = $this->manuallyAddedData; + $this->manuallyAddedData = array(); + } + } + + return count($this->data) > 0; + } +} \ No newline at end of file