|
Quotes |
" ... I want to tell you that your thyme product is functional and valuable beyond
words. I cannot imagine why any portal would be without it. It is the cornerstone of our new project ..."
" ... Thanks for such a complete project, its making my job much easier. ..."
" ... I have now deployed 4 different calendars and our users love them ... "
" ... Easy to install and use and a great look/design. ..."
" ... This has to be the easiest to use program I think I've had to deal with at all this year. ..."
|
|
| View previous topic :: View next topic |
| Author |
Message |
esoft_ian
Joined: 12 Sep 2005 Posts: 5160
|
Posted: Mon Aug 04, 2008 6:11 pm Post subject: Adding events using Thyme's API |
|
|
The following code will add a simple event.
| Code: |
<?php
require_once("/full/path/to/thyme/include/classes/class.calendar.php");
require_once(_CAL_BASE_PATH_ ."include/classes/class.event.php");
# Used to set calendar
$cal = new calendar();
$cal->set("calendar","Default Calendar"); # title of calendar to add event to
# Create new, blank event
$event = new _cal_event();
# Set calendar for event
$event->calendar = $cal->calendar;
# Set title
$event->title = "My New Event";
# Set start time M/D/YYYY HH:MM
$event->starttime = _ex_strtotime("8/4/2008 14:00");
# Set duration HH:MM:SS
$event->duration = "1:0:0";
# Save event
$event->save();
|
This creates a new event in the calendar called Default Calendar called "My New Event" that starts at 2pm and ends at 3pm on August 4th, 2008.
Here are some common event properties that may also be set:
allday - Set to 1 if the event lasts all day
org_name - Organizer's name
org_email - Organizer's e-mail
url - URL of event
notes - notes or description of the event.
flag - Set to 1 to flag the event
location - Location name
addr_st - Street address line
addr_ci - City / State / Zip line
phone - Phone number |
|
| Back to top |
|
 |
esoft_ian
Joined: 12 Sep 2005 Posts: 5160
|
Posted: Thu Aug 07, 2008 4:10 pm Post subject: |
|
|
Note that this:
| Code: |
# Set start time M/D/YYYY HH:MM
$event->starttime = _ex_strtotime("8/4/2008 14:00");
|
could also be in YYYY-MM-DD format:
| Code: |
# Set start time YYYY-MM-DD HH:MM
$event->starttime = _ex_strtotime("2008-8-4 14:00");
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|