Using dhtmlxConnector to retrieve events for the Scheduler

Hello,

I am looking for the best way to populate the scheduler with events from my database.

My database is quite complex utilising about 4 separate tables within the database. Is there anyway I can do joins using dhtmlxConnector?

If not, how can I write my own logic to best interface with the scheduler. I need full CRUD capability. Is dhtmxConnector even the best way to do this?

Also my times and dates are stored as separate columns. How can I combine the two in my serverside call?

$scheduler>render_table("bookings","id","datestart.timestart,dateend.timeend,title");

Thanks,

Tim

Is there anyway I can do joins using dhtmlxConnector?
Yep
docs.dhtmlx.com/doku.php?id=dhtm … operations

Also my times and dates are stored as separate columns. How can I combine the two in my serverside call?

You can use beforeRender event of connector , to re-format values before output

Assuming that you will need a lot of customization - you can just use a fully custom code instead
Your server side code just need to output xml in the specific format
docs.dhtmlx.com/doku.php?id=dhtm … ta_loading

Hello,

Could you please post some example code of how I can merge 4 fields from my db (dStart, dEnd, tStart, tEnd) into the required start and end times for the scheduler.

I have had no luck with this.

thanks,

tim

Something like next can be used

[code]
$scheduler->event->attach(“beforeRender”, function($action){
$ds = $action->get_value(“datestart”);
$ts = $action->get_value(“timestart”);
$de = $action->get_value(“dateend”);
$te = $action->get_value(“timeend”);

$action->set_value("datestart", $ds+" "+$ts);
$action->set_value("dateend", $de+" "+$te);

})
$scheduler->render_table(“bookings”,“id”,“datestart.dateend,title”,“timestart,timeend”);[/code]

That results in

I also had to fix a few things in your code

[code] $scheduler->event->attach(“beforeRender”, function($action){
$ds = $action->get_value(“datestart”);
$ts = $action->get_value(“timestart”);
$de = $action->get_value(“dateend”);
$te = $action->get_value(“timeend”);

$action->set_value("datestart", $ds." ".$ts);
$action->set_value("dateend", $de." ".$te);
});
$scheduler->render_table("bookings","id","datestart,dateend,title");[/code]

Sorry for inconvenience, try to use

[code]function my_render_code($action){
$ds = $action->get_value(“datestart”);
$ts = $action->get_value(“timestart”);
$de = $action->get_value(“dateend”);
$te = $action->get_value(“timeend”);

$action->set_value("datestart", $ds." ".$ts);
$action->set_value("dateend", $de." ".$te);

}
$scheduler->event->attach(“beforeRender”, “my_render_code”);
$scheduler->render_table(“bookings”,“id”,“datestart,dateend,title”);[/code]

( Previously provided code is a strange mix of js and php syntax, which will not work correctly )

Hello.

Thanks for this. Unfortunately this is still not working. It is outputing the dates as normal and seems to be ignoring the beforeRender event completely.

Is it still correct to call

$scheduler->render_table("bookings", "id", "datestart, dateend, title");

Thanks
Tim

Never mind,

The log showed me where I was going wrong.

Thanks,