recurring events not writing to db

I am loading from scheduler.load(“php/events_tree_db.php”) but when I try and create recurring events, it fails to write to the event_rec table. It only writes to the events_tt table with the following:

event_id event_name start_date end_date details section_id section2_id 2 test 2011-06-01 10:00:00 9999-02-01 00:00:00 20 0

Then obviously every recurring event shows up everyday for the whole day.

I have the following in my events_tree_db.php file

$scheduler->render_table("events_tt","event_id","start_date,end_date,event_name,details,section_id,section2_id"); $scheduler->render_table("events_rec","event_id","start_date,end_date,text,rec_type,event_pid,event_length");

Have I overlooked something? Thanks!

Post params look like this:
1307143951475_!nativeedit… inserted
1307143951475_end_date 9999-02-01 00:00
1307143951475_event_lengt… 3600
1307143951475_id 1307143951475
1307143951475_rec_pattern month_1_1_1_
1307143951475_rec_type month_1_1_1_#no
1307143951475_section_id 20
1307143951475_start_date 2011-06-01 10:00
1307143951475_text test
ids 1307143951475

Hello,

Note that recurring events expect additional handling on the server side, check out Recurring events page in our documentation.
Or simple past additional handlers from the scheduler\samples\03_extensions\php\events_rec.php file.

Best regards,
Ilya

thanks for the reply but I’m still having trouble. Can you be more specific where these queries need to be? Seems like it will only update one table. It writes to either events_tt or events_rec. But events_rec depends on events_tt for the related event_id.

Hello,

What’s ‘events_tt’?

events_rec.php file has following contents:

[code]<?php
include (’…/…/…/codebase/connector/scheduler_connector.php’);
include (’…/…/common/config.php’);

$res=mysql_connect($server, $user, $pass);
mysql_select_db($db_name);

function delete_related($action){
	global $scheduler;
	
	$status = $action->get_status();
	$type =$action->get_value("rec_type");
	$pid =$action->get_value("event_pid");
	//when serie changed or deleted we need to remove all linked events
	if (($status == "deleted" || $status == "updated") && $type!=""){
		$scheduler->sql->query("DELETE FROM events_rec WHERE event_pid='".$scheduler->sql->escape($action->get_id())."'");
	}
	if ($status == "deleted" && $pid !=0){
		$scheduler->sql->query("UPDATE events_rec SET rec_type='none' WHERE event_id='".$scheduler->sql->escape($action->get_id())."'");
		$action->success();
	}
	
}
function insert_related($action){
	$status = $action->get_status();
	$type =$action->get_value("rec_type");
	
	if ($status == "inserted" && $type=="none")
		$action->set_status("deleted");
}

$scheduler = new schedulerConnector($res);
//$scheduler->enable_log("log.txt",true);
$scheduler->event->attach("beforeProcessing","delete_related");
$scheduler->event->attach("afterProcessing","insert_related");
$scheduler->render_table("events_rec","event_id","start_date,end_date,text,rec_type,event_pid,event_length");

?>[/code]
What you need to do is add event handlers in your events.php file:

	function delete_related($action){
		global $scheduler;
		
		$status = $action->get_status();
		$type =$action->get_value("rec_type");
		$pid =$action->get_value("event_pid");
		//when serie changed or deleted we need to remove all linked events
		if (($status == "deleted" || $status == "updated") && $type!=""){
			$scheduler->sql->query("DELETE FROM events_rec WHERE event_pid='".$scheduler->sql->escape($action->get_id())."'");
		}
		if ($status == "deleted" && $pid !=0){
			$scheduler->sql->query("UPDATE events_rec SET rec_type='none' WHERE event_id='".$scheduler->sql->escape($action->get_id())."'");
			$action->success();
		}
		
	}
	function insert_related($action){
		$status = $action->get_status();
		$type =$action->get_value("rec_type");
		
		if ($status == "inserted" && $type=="none")
			$action->set_status("deleted");
	}

...
	$scheduler->event->attach("beforeProcessing","delete_related");
	$scheduler->event->attach("afterProcessing","insert_related");

Best regards,
Ilya

events_tt is the table for events tree which is a timeline view. Since I was having issues writing to both tables, I tried adding on columns to this table for the recurring events. Following the documentation from http://docs.dhtmlx.com/doku.php?id=dhtmlxscheduler:recurring_events Looks like the needed columns are:
ec_type - varchar[64]
event_length - long int
event_pid - int

My server side code is now :

[code]$res=mysql_connect($server, $user, $pass);
mysql_select_db($db_name);

function delete_related($action){
	global $scheduler;
	
	$status = $action->get_status();
	$type =$action->get_value("rec_type");
	$pid =$action->get_value("event_pid");
	//when serie changed or deleted we need to remove all linked events
	if (($status == "deleted" || $status == "updated") && $type!=""){
		$scheduler->sql->query("DELETE FROM events_rec WHERE event_pid='".$scheduler->sql->escape($action->get_id())."'");
	}
	if ($status == "deleted" && $pid !=0){
		$scheduler->sql->query("UPDATE events_rec SET rec_type='none' WHERE event_id='".$scheduler->sql->escape($action->get_id())."'");
		$action->success();
	}
	
}
function insert_related($action){
	$status = $action->get_status();
	$type =$action->get_value("rec_type");
	
	if ($status == "inserted" && $type=="none")
		$action->set_status("deleted");
}

$scheduler = new schedulerConnector($res);
//$scheduler->enable_log("log.txt",true);


//
$scheduler->event->attach("beforeProcessing","delete_related");
$scheduler->event->attach("afterProcessing","insert_related");
$scheduler->render_table("events_tt","event_id","start_date,end_date,event_name,details,section_id,section2_id,rec_type,event_pid,event_length");

[/code]
It now write to the db fine but every time I try and edit a recurring event I get the error “ev is undefined”

Hello,

I tried following: opened tree timeline sample, added recurring events functionality support and tried to edit events — everything seemed to work ok.
Can you please describe in detail steps to reproduce this issue?

Thank you and best regards,
Ilya