Server side integration

Data loading

Scheduler can load data as in XML or iCal format

XML

     //scheduler.load(url,callback);
     scheduler.load("data.php");
<data>
	<event id="2">
		<start_date>2009-05-24 00:00:00</start_date>
		<end_date>2009-06-08 00:00:00</end_date>
		<text><![CDATA[French Open]]></text>
		<details><![CDATA[Philippe-Chatrier Court Paris, FRA]]></details>
	</event>
	<event id="3">
		<start_date>2009-06-10 00:00:00</start_date>
		<end_date>2009-06-13 00:00:00</end_date>
		<text><![CDATA[Aegon Championship]]></text>
		<details><![CDATA[The Queens Club London, ENG]]></details>
	</event>
</data>

Mandatory values:

  • start_date - format defined by scheduler.config.xml_date
  • end_date
  • text

Any other optional elements can present , they will be mapped to related event properties.

iCal

Only events with fixed start and end date supported.

     //scheduler.load(url,"ical",callback);
     scheduler.load("data.php","ical");
BEGIN:VCALENDAR
PRODID:-//Last.fm Limited Event Feeds//NONSGML//EN
VERSION:2.0
X-WR-CALNAME:Last.fm Events
X-WR-CALDESC:Event listing - supplied by http://www.Last.fm
 
BEGIN:VEVENT
UID:LFMEVENT-1043574
URL;VALUE=URI:http://www.last.fm/event/1043574
DTSTAMP:20090507T190000
DTSTART:20090507T190000
DTEND;VALUE=DATE:20090507
SUMMARY:Cross.B.Band
DESCRIPTION:Cross.B.Band 
END:VEVENT
 
BEGIN:VEVENT
UID:LFMEVENT-965499
URL;VALUE=URI:http://www.last.fm/event/965499
DTSTAMP:20090507T200000
DTSTART:20090507T200000
DTEND;VALUE=DATE:20090507
DESCRIPTION:some content here
END:VEVENT
 
END:VCALENDAR

DTSTART, DTEND - used as start and end of event DESCRIPTION - used as text of event all attriubutes of event from iCal structure mapped to the properties of event with the same name

Connector

Scheduller includes dataProcessor and can use it to sync. with server ( if you want to implement custom server side logic you can check dataProcessor article )

		scheduler.init('scheduler_here',null,"month");
		scheduler.load("events.php?uid="+scheduler.uid());
 
		var dp = new dataProcessor("events.php");
		dp.init(scheduler);
	include ('dhtmlxConnector/codebase/scheduler_connector.php');
 
	$res=mysql_connect("localhost","root","");
	mysql_select_db("sampleDB");
 
	$calendar = new SchedulerConnector($res);
	$calendar->render_table("events","id","event_start,event_end,event_text","type");

The third parameter must have 3 mandatory fields:

  • event field mapped to start date;
  • event field mapped to end date;
  • event field mapped to event text.

For more details about connector usage - you can check Connectors documentation