/**
  * create element format parts
  *
  * @author Kjell-Inge Gustafsson, kigkonsult <*****@*****.**>
  * @since 2.0.6 - 2006-06-20
  * @uses iCalBase::_createFormat()
  * @uses calendarComponent::$timezonetype
  * @return string
  */
 function _createFormat()
 {
     parent::_createFormat();
     $objectname = null;
     switch ($this->format) {
         case 'xcal':
             return isset($this->timezonetype) ? strtolower($this->timezonetype) : strtolower($this->objName);
             break;
         default:
             return isset($this->timezonetype) ? strtoupper($this->timezonetype) : strtoupper($this->objName);
             break;
     }
 }
Example #2
0
 /**
  * Constructor
  *
  * Only job is to set all the variablesnames
  *
  * @param string $summary  Title for the event
  * @param string $description  Description
  * @param int $start  Start time for the event (timestamp)
  * @param int $created  Creation date for the event (timestamp)
  * @param int $last_mod  Last modification date for the event (timestamp)
  * @param int $status  Status of the event (0 = TENTATIVE, 1 = CONFIRMED, 2 = CANCELLED)
  * @param int $class  (0 = PRIVATE | 1 = PUBLIC | 2 = CONFIDENTIAL)
  * @param array $organizer  The organizer – use array('Name', '*****@*****.**')
  * @param array $attendees  key = attendee name, value = e-mail, second value = role of the attendee [0 = CHAIR | 1 = REQ | 2 = OPT | 3 =NON] (example: array('Michi' => 'flaimo@gmx.net,1'); )
  * @param array $categories  Array with Strings (example: array('Freetime','Party'))
  * @param int $frequency  frequency: 0 = once, secoundly – yearly = 1–7
  * @param mixed $rec_end  recurrency end: ('' = forever | integer = number of times | timestring = explicit date)
  * @param int $interval  Interval for frequency (every 2,3,4 weeks…)
  * @param string $days  Array with the number of the days the event accures (example: array(0,1,5) = Sunday, Monday, Friday
  * @param string $weekstart  Startday of the Week ( 0 = Sunday – 6 = Saturday)
  * @param string $exept_dates  exeption dates: Array with timestamps of dates that should not be includes in the recurring event
  * @param string $url  optional URL for that event
  * @param string $lang  Language of the strings used in the event (iso code)
  * @param string $uid  Optional UID for the Journal
  * @uses setSummary()
  * @uses iCalBase::setDescription()
  * @uses setStartDate()
  * @uses setCreated()
  * @uses iCalBase::setLastMod()
  * @uses iCalBase::setStatus()
  * @uses iCalBase::setClass()
  * @uses iCalBase::setOrganizer()
  * @uses iCalBase::setAttendees()
  * @uses iCalBase::setCategories()
  * @uses iCalBase::setURL()
  * @uses iCalBase::setLanguage()
  * @uses iCalBase::setFrequency()
  * @uses setRecEnd()
  * @uses iCalBase::setInterval()
  * @uses iCalBase::setDays()
  * @uses iCalBase::setWeekStart()
  * @uses iCalBase::setExeptDates()
  * @uses iCalBase::setSequence()
  * @uses setUID()
  */
 function __construct($summary, $description, $start, $created, $last_mod, $status, $class, $organizer, $attendees, $categories, $frequency, $rec_end, $interval, $days, $weekstart, $exept_dates, $url, $lang, $uid)
 {
     parent::__construct();
     parent::setSummary($summary);
     parent::setDescription($description);
     $this->setStartDate($start);
     $this->setCreated($created);
     parent::setLastMod($last_mod);
     parent::setStatus($status);
     parent::setClass($class);
     parent::setOrganizer($organizer);
     parent::setAttendees($attendees);
     parent::setCategories($categories);
     parent::setURL($url);
     parent::setLanguage($lang);
     parent::setFrequency($frequency);
     $this->setRecEnd($rec_end);
     parent::setInterval($interval);
     parent::setDays($days);
     parent::setWeekStart($weekstart);
     parent::setExeptDates($exept_dates);
     parent::setSequence(0);
     $this->setUID($uid);
 }
 /**
  * Constructor
  *
  * Only job is to set all the variablesnames
  *
  * @desc Constructor
  * @param int $action  0 = DISPLAY, 1 = EMAIL, (not supported: 2 = AUDIO, 3 = PROCEDURE)
  * @param int $trigger  Minutes the alarm goes off before the event/todo
  * @param string $summary  Title for the alarm
  * @param string $description  Description
  * @param (array) $attendees  key = attendee name, value = e-mail, second value = role of the attendee
  * [0 = CHAIR | 1 = REQ | 2 = OPT | 3 =NON] (example: array('Michi' => 'flaimo@gmx.net,1'); )
  * @param int $duration  Duration between the alarms in minutes
  * @param int $repeat  How often should the alarm be repeated
  * @param string $lang  Language of the strings used in the event (iso code)
  * @uses setAction()
  * @uses setTrigger()
  * @uses setSummary()
  * @uses iCalBase::setDescription()
  * @uses setAttendees()
  * @uses setDuration()
  * @uses setRepeat()
  * @uses iCalBase::setLanguage()
  */
 function iCalAlarm($action, $trigger, $summary, $description, $attendees, $duration, $repeat, $lang)
 {
     parent::iCalBase();
     $this->setAction($action);
     $this->setTrigger($trigger);
     parent::setSummary($summary);
     parent::setDescription($description);
     parent::setAttendees($attendees);
     $this->setDuration($duration);
     $this->setRepeat($repeat);
     parent::setLanguage($lang);
 }
 /**
  * Constructor
  *
  * Only job is to set all the variablesnames
  *
  * @desc Constructor
  * @param string $summary  Title for the event
  * @param string $description  Description
  * @param string $location  Location
  * @param int $start  Start time for the event (timestamp)
  * @param int $duration  Duration of the todo in minutes
  * @param int $end  Start time for the event (timestamp)
  * @param int $percent  The percent completion of the ToDo
  * @param int $prio  riority = 0–9
  * @param int $status  Status of the event (0 = TENTATIVE, 1 = CONFIRMED, 2 = CANCELLED)
  * @param int $class  (0 = PRIVATE | 1 = PUBLIC | 2 = CONFIDENTIAL)
  * @param array $organizer  The organizer – use array('Name', '*****@*****.**')
  * @param array $attendees  key = attendee name, value = e-mail, second value = role of the attendee [0 = CHAIR | 1 = REQ | 2 = OPT | 3 =NON] (example: array('Michi' => 'flaimo@gmx.net,1'); )
  * @param array $categories  Array with Strings (example: array('Freetime','Party'))
  * @param int $last_mod  Last modification of the to-to (timestamp)
  * @param array) $alarm  Array with all the alarm information, "''" for no alarm
  * @param int $frequency  frequency: 0 = once, secoundly – yearly = 1–7
  * @param mixed $rec_end  recurrency end: ('' = forever | integer = number of times | timestring = explicit date)
  * @param int $interval  Interval for frequency (every 2,3,4 weeks…)
  * @param string $days  Array with the number of the days the event accures (example: array(0,1,5) = Sunday, Monday, Friday
  * @param string $weekstart  Startday of the Week ( 0 = Sunday – 6 = Saturday)
  * @param string $exept_dates  exeption dates: Array with timestamps of dates that should not be includes in the recurring event
  * @param string $url  optional URL for that event
  * @param string $lang  Language of the strings used in the event (iso code)
  * @param string $uid  Optional UID for the ToDo
  * @uses iCalBase::setLanguage()
  * @uses iCalBase::setOrganizer()
  * @uses setStartDate()
  * @uses setDuration()
  * @uses setCompleted()
  * @uses iCalBase::setLastMod()
  * @uses setPercent()
  * @uses setLocation()
  * @uses iCalBase::setSequence()
  * @uses iCalBase::setCategories()
  * @uses iCalBase::setDescription()
  * @uses setSummary()
  * @uses iCalBase::setPriority()
  * @uses iCalBase::setClass()
  * @uses iCalBase::setAttendees()
  * @uses iCalBase::setStatus()
  * @uses iCalBase::setURL()
  * @uses iCalBase::setFrequency()
  * @uses setRecEnd()
  * @uses iCalBase::setInterval()
  * @uses iCalBase::setDays()
  * @uses iCalBase::setWeekStart()
  * @uses iCalBase::setExeptDates()
  * @uses setAlarm()
  * @uses setUID()
  * @since 1.020 - 2002-12-24
  */
 function iCalToDo($summary, $description, $location, $start, $duration, $end, $percent, $prio, $status, $class, $organizer, $attendees, $categories, $last_mod, $alarm, $frequency, $rec_end, $interval, $days, $weekstart, $exept_dates, $url, $lang, $uid)
 {
     parent::iCalBase();
     parent::setLanguage($lang);
     parent::setOrganizer($organizer);
     $this->setStartDate($start);
     $this->setDuration($duration);
     $this->setCompleted($end);
     parent::setLastMod($last_mod);
     $this->setPercent($percent);
     parent::setLocation($location);
     parent::setSequence(0);
     parent::setCategories($categories);
     parent::setDescription($description);
     parent::setSummary($summary);
     parent::setPriority($prio);
     parent::setClass($class);
     parent::setAttendees($attendees);
     parent::setStatus($status);
     parent::setURL($url);
     parent::setFrequency($frequency);
     $this->setRecEnd($rec_end);
     parent::setInterval($interval);
     parent::setDays($days);
     parent::setWeekStart($weekstart);
     parent::setExeptDates($exept_dates);
     $this->setAlarm($alarm);
     $this->setUID($uid);
 }
 /**
  * Constructor
  *
  * Only job is to set all the variablesnames
  *
  * @param int $action  0 = DISPLAY, 1 = EMAIL, (not supported: 2 = AUDIO, 3 = PROCEDURE)
  * @param int $trigger  Minutes the alarm goes off before the event/todo
  * @param string $summary  Title for the alarm
  * @param string $description  Description
  * @param array $attendees  key = attendee name, value = e-mail, second value = role of the attendee
  * [0 = CHAIR | 1 = REQ | 2 = OPT | 3 =NON] (example: array('Michi' => 'flaimo@gmx.net,1'); )
  * @param int $duration  Duration between the alarms in minutes
  * @param int $repeat  How often should the alarm be repeated
  * @param string $lang  Language of the strings used in the event (iso code)
  * @uses setAction()
  * @uses setTrigger()
  * @uses iCalBase::setSummary()
  * @uses iCalBase::setDescription()
  * @uses iCalBase::setAttendees()
  * @uses setDuration()
  * @uses setRepeat()
  * @uses iCalBase::setLanguage()
  */
 function __construct($action, $trigger, $summary, $description, $attendees, $duration, $repeat, $lang)
 {
     parent::__construct();
     $this->setVar('action', $action);
     $this->setVar('trigger', $trigger);
     parent::setSummary($summary);
     parent::setDescription($description);
     parent::setAttendees($attendees);
     $this->setVar('duration', $duration);
     $this->setVar('repeat', $repeat);
     parent::setLanguage($lang);
 }
Example #6
0
 /**
  * Constructor
  *
  * Only job is to set all the variablesnames
  *
  * @param array $organizer  The organizer - use array('Name', '*****@*****.**')
  * @param int $start  Start time for the event (timestamp; if you want an allday event the startdate has to start at 00:00:00)
  * @param int $end  Start time for the event (timestamp or write 'allday' for an allday event)
  * @param string $location  Location
  * @param int $transp  Transparancy (0 = OPAQUE | 1 = TRANSPARENT)
  * @param array $categories  Array with Strings (example: array('Freetime','Party'))
  * @param string $description  Description
  * @param string $summary  Title for the event
  * @param int $class  (0 = PRIVATE | 1 = PUBLIC | 2 = CONFIDENTIAL)
  * @param array $attendees  key = attendee name, value = e-mail, second value = role of the attendee [0 = CHAIR | 1 = REQ | 2 = OPT | 3 =NON] (example: array('Michi' => 'flaimo@gmx.net,1'); )
  * @param int $prio  riority = 0–9
  * @param int $frequency  frequency: 0 = once, secoundly – yearly = 1–7
  * @param mixed $rec_end  recurrency end: ('' = forever | integer = number of times | timestring = explicit date)
  * @param int $interval  Interval for frequency (every 2,3,4 weeks…)
  * @param string $days  Array with the number of the days the event accures (example: array(0,1,5) = Sunday, Monday, Friday
  * @param string $weekstart  Startday of the Week ( 0 = Sunday - 6 = Saturday)
  * @param string $exept_dates  exeption dates: Array with timestamps of dates that should not be includes in the recurring event
  * @param array $alarm  Array with all the alarm information, "''" for no alarm
  * @param int $status  Status of the event (0 = TENTATIVE, 1 = CONFIRMED, 2 = CANCELLED)
  * @param string $url  optional URL for that event
  * @param string $language  Language of the strings used in the event (iso code)
  * @param string $uid  Optional UID for the event
  * @uses iCalBase::setLanguage()
  * @uses iCalBase::setOrganizer()
  * @uses setStartDate()
  * @uses setEndDate()
  * @uses iCalBase::setLocation()
  * @uses setTransp()
  * @uses iCalBase::setSequence()
  * @uses iCalBase::setCategories()
  * @uses iCalBase::setDescription()
  * @uses iCalBase::setSummary()
  * @uses iCalBase::setPriority()
  * @uses iCalBase::setClass()
  * @uses setUID()
  * @uses iCalBase::setAttendees()
  * @uses iCalBase::setFrequency()
  * @uses setRecEnd()
  * @uses iCalBase::setInterval()
  * @uses iCalBase::setDays()
  * @uses iCalBase::setWeekStart()
  * @uses iCalBase::setExeptDates()
  * @uses iCalBase::setStatus()
  * @uses setAlarm()
  * @uses iCalBase::setURL()
  * @uses setUID()
  */
 function __construct($organizer, $start, $end, $location, $transp, $categories, $description, $summary, $class, $attendees, $prio, $frequency, $rec_end, $interval, $days, $weekstart, $exept_dates, $alarm, $status, $url, $language, $uid)
 {
     parent::__construct();
     parent::setLanguage($language);
     parent::setOrganizer($organizer);
     $this->setStartDate($start);
     $this->setEndDate($end);
     parent::setLocation($location);
     $this->setTransp($transp);
     parent::setSequence(0);
     parent::setCategories($categories);
     parent::setDescription($description);
     parent::setSummary($summary);
     parent::setPriority($prio);
     parent::setClass($class);
     parent::setAttendees($attendees);
     parent::setFrequency($frequency);
     $this->setRecEnd($rec_end);
     parent::setInterval($interval);
     parent::setDays($days);
     parent::setWeekStart($weekstart);
     parent::setExeptDates($exept_dates);
     parent::setStatus($status);
     $this->setAlarm($alarm);
     parent::setURL($url);
     $this->setUID($uid);
 }
 /**
  * Constructor
  *
  * Only job is to set all the variablesnames
  *
  * @desc Constructor
  * @param (int) $start  Start time for fb (timestamp)
  * @param (int) $end  Start time for fb (timestamp)
  * @param (int) $duration  Duration of the fb in minutes
  * @param (array) $organizer  The organizer - use array('Name', '*****@*****.**')
  * @param (array) $attendees  key = attendee name, value = e-mail, second value = role of the attendee [0 = CHAIR | 1 = REQ | 2 = OPT | 3 =NON] (example: array('Michi' => 'flaimo@gmx.net,1'); )
  * @param (array) $fb_times  key = timestamp (starting point), value = minutes, secound value = status (0 = FREE, 1 = BUSY, 2 = BUSY-UNAVAILABLE, 3 = BUSY-TENTATIVE)
  * @param (string) $url optional URL for that event
  * @param (string) $uid  Optional UID for the FreeBusy
  * @return (void)
  * @uses iCalBase::setOrganizer(), setStartDate(), setDuration(), setEndDate(), setUID(), iCalBase::setAttendees(), setFBTimes(), iCalBase::setURL()
  * @access private
  * @since 1.000 - 2002/10/10
  */
 function iCalFreeBusy($start, $end, $duration, $organizer, $attendees, $fb_times, $url, $uid)
 {
     parent::iCalBase();
     $this->fb_status = (array) array('FREE', 'BUSY', 'BUSY-UNAVAILABLE', 'BUSY-TENTATIVE');
     parent::setOrganizer($organizer);
     $this->setStartDate($start);
     $this->setDuration($duration);
     $this->setEndDate($end);
     parent::setAttendees($attendees);
     $this->setFBTimes($fb_times);
     parent::setURL($url);
     $this->setUID($uid);
 }
 /**
  * Set $alarm variable
  *
  * @param (array) $alarm
  * @see getAlarm()
  * @uses iCalToDo::$alarm
  * @uses iCalAlarm
  * @since 1.001 - 2002-10-10
  */
 private function setAlarm($alarm = '')
 {
     if (is_array($alarm)) {
         $this->alarm = (object) new iCalAlarm($alarm[0], $alarm[1], $alarm[2], $alarm[3], $alarm[4], $alarm[5], $alarm[6], parent::getLanguage());
     }
     // end if
 }
 /**
  * Set $freebusy_times variable
  *
  * @param array $times
  * @see getFBTimes()
  * @uses iCalFreeBusy::$freebusy_times
  * @uses getFBStatus()
  * @since 1.020 - 2002-12-24
  */
 private function setFBTimes($times = '')
 {
     if (is_array($times)) {
         foreach ($times as $timestamp => $data) {
             $values = (array) explode(',', $data);
             $minutes = (int) $values[0];
             $status = (string) $this->getFBStatus($values[1]);
             unset($values);
             $this->freebusy_times[parent::formatDate($timestamp)] = parent::formatDate($minutes) . ',' . $status;
         }
         // end foreach
     }
     // end if
 }
 /**
  * creates formatted output for calendar object instance
  *
  * @author Kjell-Inge Gustafsson, kigkonsult <*****@*****.**>
  * @since 2.21.07 - 2015-03-31
  * @uses vcalendar::$format
  * @uses vcalendar::$nl
  * @uses vcalendar::createVersion()
  * @uses vcalendar::createProdid()
  * @uses vcalendar::createCalscale()
  * @uses vcalendar::createMethod()
  * @uses vcalendar::createXprop()
  * @uses vcalendar::$components
  * @uses calendarComponent::setConfig()
  * @uses vcalendar::getConfig()
  * @uses calendarComponent::createComponent()
  * @uses vcalendar::$xcaldecl
  * @return string
  */
 function createCalendar()
 {
     parent::_createFormat();
     $calendarInit = $calendarxCaldecl = $calendarStart = $calendar = '';
     switch ($this->format) {
         case 'xcal':
             $calendarInit = '<?xml version="1.0" encoding="UTF-8"?>' . $this->nl . '<!DOCTYPE vcalendar PUBLIC "-//IETF//DTD XCAL/iCalendar XML//EN"' . $this->nl . '"http://www.ietf.org/internet-drafts/draft-ietf-calsch-many-xcal-01.txt"';
             $calendarStart = '>' . $this->nl . '<vcalendar';
             break;
         default:
             $calendarStart = 'BEGIN:VCALENDAR' . $this->nl;
             break;
     }
     $calendarStart .= $this->createVersion();
     $calendarStart .= $this->createProdid();
     $calendarStart .= $this->createCalscale();
     $calendarStart .= $this->createMethod();
     if ('xcal' == $this->format) {
         $calendarStart .= '>' . $this->nl;
     }
     $calendar .= $this->createXprop();
     foreach ($this->components as $component) {
         if (empty($component)) {
             continue;
         }
         $component->setConfig($this->getConfig(), FALSE, TRUE);
         $calendar .= $component->createComponent($this->xcaldecl);
     }
     if ('xcal' == $this->format && 0 < count($this->xcaldecl)) {
         // xCal only
         $calendarInit .= ' [';
         $old_xcaldecl = array();
         foreach ($this->xcaldecl as $declix => $declPart) {
             if (0 < count($old_xcaldecl) && isset($declPart['uri']) && isset($declPart['external']) && isset($old_xcaldecl['uri']) && isset($old_xcaldecl['external']) && in_array($declPart['uri'], $old_xcaldecl['uri']) && in_array($declPart['external'], $old_xcaldecl['external'])) {
                 continue;
             }
             // no duplicate uri and ext. references
             if (0 < count($old_xcaldecl) && !isset($declPart['uri']) && !isset($declPart['uri']) && isset($declPart['ref']) && isset($old_xcaldecl['ref']) && in_array($declPart['ref'], $old_xcaldecl['ref'])) {
                 continue;
             }
             // no duplicate element declarations
             $calendarxCaldecl .= $this->nl . '<!';
             foreach ($declPart as $declKey => $declValue) {
                 switch ($declKey) {
                     // index
                     case 'xmldecl':
                         // no 1
                         $calendarxCaldecl .= $declValue . ' ';
                         break;
                     case 'uri':
                         // no 2
                         $calendarxCaldecl .= $declValue . ' ';
                         $old_xcaldecl['uri'][] = $declValue;
                         break;
                     case 'ref':
                         // no 3
                         $calendarxCaldecl .= $declValue . ' ';
                         $old_xcaldecl['ref'][] = $declValue;
                         break;
                     case 'external':
                         // no 4
                         $calendarxCaldecl .= '"' . $declValue . '" ';
                         $old_xcaldecl['external'][] = $declValue;
                         break;
                     case 'type':
                         // no 5
                         $calendarxCaldecl .= $declValue . ' ';
                         break;
                     case 'type2':
                         // no 6
                         $calendarxCaldecl .= $declValue;
                         break;
                 }
             }
             $calendarxCaldecl .= '>';
         }
         $calendarxCaldecl .= $this->nl . ']';
     }
     // end if(( 'xcal'...
     switch ($this->format) {
         case 'xcal':
             $calendar .= '</vcalendar>' . $this->nl;
             break;
         default:
             $calendar .= 'END:VCALENDAR' . $this->nl;
             break;
     }
     return $calendarInit . $calendarxCaldecl . $calendarStart . $calendar;
 }
 /**
  * Set $uid variable
  *
  * @param int $uid
  * @see getUID()
  * @uses iCalJournal::$uid
  */
 private function setUID($uid = 0)
 {
     if (strlen(trim($uid)) > 0) {
         $this->uid = (string) $uid;
     } else {
         $rawid = (string) $this->startdate . 'plus' . parent::getSummary();
         $this->uid = (string) md5($rawid);
     }
     // end if
 }