I have the following code:
[code]function updateEvent($item)
{
print "inside updateEvent = " . $item->get_id() . “\n”;
$nvp_event = new NVPEvent($item->get_id());
$item->set_value(“summary”,$nvp_event->summary());
}
$res=mysql_connect($server, $user, $pass);
mysql_select_db($db_name);
$scheduler = new schedulerConnector($res);
$scheduler->enable_log("log.txt",true);
$scheduler->event->attach("beforeRender",updateEvent);
$scheduler->render_table("events","id","start,end,title, "summary");
[/code]
And I am having two problems:
- I have added “summary” as an extra field, it doesn’t exist in the DB, I want to calculate it and add it to the item before it is rendered. But what appears to happen is that it gets added to the SQL statement and then fails.
- If I remove the extra field “summary” from the render table statement, I get a warning in my log file that says “Use of undefined constant updateEvent - assumed ‘updateEvent’” and the method never gets called (at least I don’t see the print statement and no summary property is present in the XML generated.
What am I doing wrong?