00001 <?php
00013 class SVCalendar {
00014 protected $events = array();
00015 protected $timezone = 'Eastern';
00016 protected $method = 'PUBLISH';
00017 protected $name = 'Test Calendar';
00018
00026 public function setName($name) {
00027 $this->name = $name;
00028 }
00029
00035 public function addEvent($e) {
00036 array_push($this->events, $e);
00037 }
00038
00047 public function render() {
00048 $data = $this->renderEvents();
00049 $return = <<<END
00050 BEGIN:VCALENDAR
00051 CALSCALE:GREGORIAN
00052 X-WR-TIMEZONE;VALUE=TEXT:US/$this->timezone
00053 METHOD:$this->method
00054 PRODID:-
00055 X-WR-CALNAME;VALUE=TEXT:$this->name
00056 VERSION:2.0
00057 $data
00058 END:VCALENDAR
00059 END;
00060 return $return;
00061 }
00062
00072 public function renderEvents() {
00073 $data = '';
00074 foreach($this->events as $e) {
00075 $data .= $e->render();
00076 }
00077 return $data;
00078 }
00079 }
00080 ?>