PHP Classes

File: ical_class_docs.rtf

Recommend this page to a friend!
  Classes of Floyd Resler   ical   ical_class_docs.rtf   Download  
File: ical_class_docs.rtf
Role: Documentation
Content type: text/plain
Description: Documentation
Class: ical
Create a calendar file of events in ICAL format
Author: By
Last change:
Date: 12 years ago
Size: 10,741 bytes
 

Contents

Class file image Download
{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf320 {\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\fmodern\fcharset0 Courier-Bold;} {\colortbl;\red255\green255\blue255;} \margl1440\margr1440\vieww10800\viewh8400\viewkind0 \deftab720 \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab720\pardirnatural\qc \f0\b\fs56 \cf0 \expnd0\expndtw0\kerning0 class.ical.php\ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab720\pardirnatural\qc \b0\fs24 \cf0 \expnd0\expndtw0\kerning0 \'a92012 by Floyd Resler\ \ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab720\pardirnatural \cf0 \expnd0\expndtw0\kerning0 The ical class allows you to easily create ics output that can be used in calendaring programs such as iCal.\ \ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab720\pardirnatural \b\fs36 \cf0 \expnd0\expndtw0\kerning0 Basic Usage\ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab720\pardirnatural \b0\fs24 \cf0 \expnd0\expndtw0\kerning0 include \'93class.ical.php\'94;\ \ $ical=new ical(\'93Floyd\'92s Birthday Party 3/14/2012 7pm 11pm\'94)\ $ics=$ical->createEvent();\ \ The above example will create an ics output that looks like this:\ BEGIN:VCALENDAR\ CALSCALE:GREGORIAN\ VERSION:2.0\ X-WR-CALNAME:Floyd's Birthday Party \ BEGIN:VTIMEZONE\ TZID:America/New_York\ BEGIN:DAYLIGHT\ TZOFFSETFROM:-0500\ RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU\ DTSTART:20070311T030000\ TZNAME:EDT\ TZOFFSETTO:-0400\ END:DAYLIGHT\ BEGIN:STANDARD\ TZOFFSETFROM:-0400\ RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU\ DTSTART:20071104T020000\ TZNAME:EST\ TZOFFSETTO:-0500\ END:STANDARD\ END:VTIMEZONE\ BEGIN:VEVENT\ SUMMARY: Floyd's Birthday Party \ CREATED:20120201T163357T\ UID:4f29afc51f543\ DTSTART;TZID=America/New_York:20120314T190000\ DTEND;TZID=America/New_York:20120314T230000\ END:VEVENT\ END:VCALENDAR\ \ As you can see you can pass to the class a fairly readable string that it will attempt to convert to an event. However, you may use the various methods to set the event information. However you wish to do it you must always at least pass the event title.\ \ The class attempts to get the daylight savings time information based on the timezone of the server the script is running on. You can change this by using one of the methods mentioned in the Methods section below.\ \ The class automatically sets the daylight savings time start and end dates for the United States. This can also be changed using methods.\ \ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab720\pardirnatural \b\fs36 \cf0 \expnd0\expndtw0\kerning0 Methods\ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab720\pardirnatural \b0\fs24 \cf0 \expnd0\expndtw0\kerning0 The methods for the class are presented in the order they appear in the class.\ \ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab720\pardirnatural \f1\b \cf0 \expnd0\expndtw0\kerning0 setEventStartTime($time)\ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab720\pardirnatural \f0\b0 \cf0 \expnd0\expndtw0\kerning0 This will set the start time of the event. For example:\ $ical->setEventStartTime(\'9302/15/2012 5pm\'94)\ \ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab720\pardirnatural \f1\b \cf0 \expnd0\expndtw0\kerning0 setEventEndTime($time)\ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab720\pardirnatural \f0\b0 \cf0 \expnd0\expndtw0\kerning0 Same as setEventStartTime except it sets the end time of the event\ \ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab720\pardirnatural \f1\b \cf0 \expnd0\expndtw0\kerning0 setEventStartDate($date)\ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab720\pardirnatural \f0\b0 \cf0 \expnd0\expndtw0\kerning0 If your event is an all-day event, use this method to set the date of the event.\ \ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab720\pardirnatural \f1\b \cf0 \expnd0\expndtw0\kerning0 setEventEndDate($date)\ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab720\pardirnatural \f0\b0 \cf0 \expnd0\expndtw0\kerning0 If your event is an all-day event and has an end date, use this method.\ \ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab720\pardirnatural \f1\b \cf0 \expnd0\expndtw0\kerning0 setEventTitle($title)\ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab720\pardirnatural \f0\b0 \cf0 \expnd0\expndtw0\kerning0 Sets the title of the event.\ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab720\pardirnatural \f1\b \cf0 \expnd0\expndtw0\kerning0 \ setTimeZone($timezone)\ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab720\pardirnatural \f0\b0 \cf0 \expnd0\expndtw0\kerning0 Sets the timezone of the event. This is set automatically based on the timezone of the server. If you set the timezone it must be in the standard PHP format such as America/New_York.\ \ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab720\pardirnatural \f1\b \cf0 \expnd0\expndtw0\kerning0 setGMTOffset($offset)\ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab720\pardirnatural \f0\b0 \cf0 \expnd0\expndtw0\kerning0 Sets the GMT offset in hours for the event. For example:\ $ical->setGMTOffset(-5)\ \ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab720\pardirnatural \f1\b \cf0 \expnd0\expndtw0\kerning0 setDaylightStart($start)\ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab720\pardirnatural \f0\b0 \cf0 \expnd0\expndtw0\kerning0 Sets the date and time that daylight savings time begins. For example:\ $ical->setDaylightStart("2007-03-11 02:00:00");\ \ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab720\pardirnatural \f1\b \cf0 \expnd0\expndtw0\kerning0 setDaylightEnd($end)\ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab720\pardirnatural \f0\b0 \cf0 \expnd0\expndtw0\kerning0 Sets the date and time that daylight savings time ends. For example:\ $ical->setDaylightEnd("2007-11-04 02:00:00");\ \ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab720\pardirnatural \f1\b \cf0 \expnd0\expndtw0\kerning0 setFrequency($frequency,$interval=1,$options=a \f0\b0 \expnd0\expndtw0\kerning0 rray())\ Sets the frequency of the event.\ $frequency is DAILY, WEEKLY, MONTHLY, or YEARLY. You can use the class constants for this.\ $interval is at what interval the event should repeat.\ $option is an array of key/value pairs that can customize the event. You will need to know the standard ics commands for this. A good way to learn them is to create a custom repeating event in iCal (or some other application), export the event and look at the file contents.\ \ Example:\ $icon->setFrequency(ical::MONHTLY,1,array(\'93UNTIL\'94=>\'9420121030\'94,\'94BYDAY\'94=>\'941TU\'94));\ \ The above example would set a repeating event that would repeat on the first Tuesday of every month until October 30th.\ \ \f1\b \expnd0\expndtw0\kerning0 setLocation($location)\ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab720\pardirnatural \f0\b0 \cf0 \expnd0\expndtw0\kerning0 Sets the location of the event.\ \ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab720\pardirnatural \f1\b \cf0 \expnd0\expndtw0\kerning0 setURL($url)\ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab720\pardirnatural \f0\b0 \cf0 \expnd0\expndtw0\kerning0 Sets the URL of the event.\ \ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab720\pardirnatural \f1\b \cf0 \expnd0\expndtw0\kerning0 setNotes($notes)\ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab720\pardirnatural \f0\b0 \cf0 \expnd0\expndtw0\kerning0 Sets the notes of the event.\ \ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab720\pardirnatural \f1\b \cf0 \expnd0\expndtw0\kerning0 addAttendee($email,$name="",$rsvp=true)\ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab720\pardirnatural \f0\b0 \cf0 \expnd0\expndtw0\kerning0 Adds an attendee to the event. If $rsvp is set then the attendee will be allowed to RSVP via email to the organizer. Please note that the class does not actually send an email to the attendees. Also, if you add attendees then you must set the event organizer.\ \ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab720\pardirnatural \f1\b \cf0 \expnd0\expndtw0\kerning0 setOrganizer($name,$email)\ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab720\pardirnatural \f0\b0 \cf0 \expnd0\expndtw0\kerning0 Sets the event organizer.\ \ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab720\pardirnatural \f1\b \cf0 \expnd0\expndtw0\kerning0 createEvent()\ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab720\pardirnatural \f0\b0 \cf0 \expnd0\expndtw0\kerning0 This will create the event and return a string in the proper ics output.\ \ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab720\pardirnatural \b\fs36 \cf0 \expnd0\expndtw0\kerning0 Licensing\ \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardeftab720\pardirnatural \b0\fs24 \cf0 \expnd0\expndtw0\kerning0 You are free to use this class however you wish. However, if you modify it I would like to see the modifications.\ \ For questions or comments, send an email to floyd.resler@maccrafters.com.}