Home · Links · Contact Us
Home arrow Forums
Home
Features
FAQ
Screen Shots
Modules
Demos
Documentation
Forums
Contact Us
Download
Purchase
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. ..."


  FAQFAQ    SearchSearch  RegisterRegister   Log inLog in 
Adding events using Thyme's API

 
Post new topic   Reply to topic     Forum Index -> Hacking Thyme
View previous topic :: View next topic  
Author Message
esoft_ian



Joined: 12 Sep 2005
Posts: 5160

PostPosted: Mon Aug 04, 2008 6:11 pm    Post subject: Adding events using Thyme's API Reply with quote

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
View user's profile Send private message Visit poster's website
esoft_ian



Joined: 12 Sep 2005
Posts: 5160

PostPosted: Thu Aug 07, 2008 4:10 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Hacking Thyme All times are GMT
Page 1 of 1

 
Jump to:  
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
© 2005 eXtrovert software unless otherwise noted. All rights reserved.
Portions © 2004 Ben Brown. All rights reserved.
Trademarks are property of their respective owners.