Location: A review of cardiac cellular electrophysiology models @ 797bc599b7ec / dojo-presentation / js / dojo / dojox / analytics / logger / dojoxAnalytics.php

Author:
David Nickerson <david.nickerson@gmail.com>
Date:
2021-09-15 23:15:11+12:00
Desc:
update jupyter notebook with FK model results
Permanent Source URI:
https://models.cellml.org/workspace/a1/rawfile/797bc599b7ec66eef984e817d4ce138aabd116a6/dojo-presentation/js/dojo/dojox/analytics/logger/dojoxAnalytics.php

<?php
	require_once("./JSON.php");

	$filename = "./logs/analytics.log";
	$json = new Services_JSON;

	$id = $_REQUEST["id"];
	$items = $json->decode($_REQUEST["data"]);

	if (!$handle = fopen($filename, 'a+')) {
		print '{error: "server error"}';
		exit;
	}

	foreach($items as $i=>$item){
		$item->_analyticsId = $id;
		$item->_analyticsTimeStamp = time();
		$log = $json->encode($item) . "\n";
		fwrite($handle, $log);
	}
	
	fclose($handle);

	$response = "{'eventsRecieved': '" . sizeof($items) . "', 'id': '" . $id . "'}";
	if ($_REQUEST["callback"]){
		print $_REQUEST["callback"] . "(" . $response . ");";
	}else{
		print $response;
	}
	
?>