log system for any action?

Hi,

I would like save to log file any action of any user: new event , edit , deleting. I can code php, but i need some help where in scheduler code i must do it.

Example:
added event 51: system date and hour, “data event (text, time…)”
modified event 51: …
deleted event 53…

etc.

I need it because our calendar is public to certain users (group of friends) and sometimes they are deleting/editing by error. With a log system i can restore events.

thx

Are you using connector or custom code on server side?

In case of connector it will be as simple as

function mylogcode($action){ $type = $action->get_status(); $start_date = $action->get_value("start_date"); somelog(...); }; $conn->event->attach("beforeProcessing", mylogcode); $conn->render_...

I’m using plugin code (on wp). Can i use your code ?

Hi,
you have to open file dhtmlxSchedulerConfigurator.php and modify it like here:

	...
	public function getEventsRec($usertype, $scheduler_id) {
		...
		$this->scheduler = new schedulerConnector($this->connection);
		$this->scheduler->event->attach("beforeProcessing", Array($this, "mylogcode"));
		...


	protected function replaceHostInURL($url) {
		$url_parsed = parse_url($url);
		$host = $_SERVER['SERVER_NAME'];
		$url = preg_replace("/".preg_quote($url_parsed['host'])."/", $host, $url, 1);
		return $url;
	}

	public function mylogcode($action) {
		$type = $action->get_status();
		$start_date = $action->get_value("start_date");
		somelog(...);
	}

}

?>