2008-02-23 13:31:31 +00:00
|
|
|
<?php // BUILD: Remove line
|
2008-02-23 10:49:16 +00:00
|
|
|
|
2008-02-23 13:01:19 +00:00
|
|
|
/**
|
|
|
|
* The wrapper for the main vcalendar data. Used instead of ArrayObject
|
|
|
|
* so you can easily query for title and description.
|
|
|
|
* Exposes a iterator that will loop though all the data
|
|
|
|
*
|
|
|
|
* @package SG_iCalReader
|
|
|
|
* @author Morten Fangel (C) 2008
|
2008-02-24 11:05:01 +00:00
|
|
|
* @license http://creativecommons.org/licenses/by-sa/2.5/dk/deed.en_GB CC-BY-SA-DK
|
2008-02-23 13:01:19 +00:00
|
|
|
*/
|
2008-02-23 10:49:16 +00:00
|
|
|
class SG_iCal_VCalendar implements IteratorAggregate {
|
2010-10-29 03:17:55 +00:00
|
|
|
protected $data;
|
2010-10-31 15:59:40 +00:00
|
|
|
|
2008-02-23 13:01:19 +00:00
|
|
|
/**
|
|
|
|
* Creates a new SG_iCal_VCalendar.
|
|
|
|
*/
|
2008-02-23 10:49:16 +00:00
|
|
|
public function __construct($data) {
|
|
|
|
$this->data = $data;
|
|
|
|
}
|
2010-10-31 15:59:40 +00:00
|
|
|
|
2008-02-23 13:01:19 +00:00
|
|
|
/**
|
2010-10-31 15:59:40 +00:00
|
|
|
* Returns the title of the calendar. If no title is known, NULL
|
2008-02-23 13:01:19 +00:00
|
|
|
* will be returned
|
|
|
|
* @return string
|
|
|
|
*/
|
2008-02-23 10:49:16 +00:00
|
|
|
public function getTitle() {
|
|
|
|
if( isset($this->data['x-wr-calname']) ) {
|
|
|
|
return $this->data['x-wr-calname'];
|
|
|
|
} else {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
2010-10-31 15:59:40 +00:00
|
|
|
|
2008-02-23 13:01:19 +00:00
|
|
|
/**
|
|
|
|
* Returns the description of the calendar. If no description is
|
|
|
|
* known, NULL will be returned.
|
|
|
|
* @return string
|
|
|
|
*/
|
2008-02-23 10:49:16 +00:00
|
|
|
public function getDescription() {
|
|
|
|
if( isset($this->data['x-wr-caldesc']) ) {
|
|
|
|
return $this->data['x-wr-caldesc'];
|
|
|
|
} else {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
2010-10-31 15:59:40 +00:00
|
|
|
|
2008-02-23 13:01:19 +00:00
|
|
|
/**
|
|
|
|
* @see IteratorAggregate.getIterator()
|
|
|
|
*/
|
2008-02-23 10:49:16 +00:00
|
|
|
public function getIterator() {
|
|
|
|
return new ArrayIterator($this->data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|