--- a/admin/timeline.php +++ b/admin/timeline.php @@ -1,1 +1,149 @@ +(child:Agency) WITH n, count(child) AS children WHERE children = 0 AND n:Agency RETURN n, children; +// no children + +// MATCH (n) WHERE has(n.start_date) and n.start_date < 18870000 RETURN n +// time slice +if (isset($_REQUEST['json'])) { + + /* echo '{ + "timeline": + { + "headline":"The Main Timeline Headline Goes here", + "type":"default", + "text":"

Intro body text goes here, some HTML is ok

", + "asset": { + "media":"http://yourdomain_or_socialmedialink_goes_here.jpg", + "credit":"Credit Name Goes Here", + "caption":"Caption text goes here" + }, + "date": [ + { + "startDate":"2011,12,10", + "endDate":"2011,12,11", + "headline":"Headline Goes Here", + "text":"

Body text goes here, some HTML is OK

", + "tag":"This is Optional", + "classname":"optionaluniqueclassnamecanbeaddedhere", + "asset": { + "media":"http://twitter.com/ArjunaSoriano/status/164181156147900416", + "thumbnail":"optional-32x32px.jpg", + "credit":"Credit Name Goes Here", + "caption":"Caption text goes here" + } + } + ], + "era": [ + { + "startDate":"2011,12,10", + "endDate":"2011,12,11", + "headline":"Headline Goes Here", + "text":"

Body text goes here, some HTML is OK

", + "tag":"This is Optional" + } + + ] + } +}'; */ + + // https://github.com/jadell/neo4jphp + spl_autoload_register(function ($className) { + $libPath = '../lib/neo4jphp/lib/'; + $classFile = str_replace('\\',DIRECTORY_SEPARATOR,$className).'.php'; + $classPath = $libPath.$classFile; + if (file_exists($classPath)) { + require($classPath); + } + }); + + +// Connecting to the default port 7474 on localhost + $client = new Everyman\Neo4j\Client(); +//$client = new Everyman\Neo4j\Client('192.168.1.127'); +//print_r($client->getServerInfo()); + + + + + //https://github.com/jadell/neo4jphp/wiki/Cypher-and-gremlin-queries + $queryString = "MATCH (n) where has(n.agency_no) RETURN n LIMIT 1000"; + $query = new Everyman\Neo4j\Cypher\Query($client, $queryString); + $dates = Array(); + $result = $query->getResultSet(); + foreach ($result as $row) { + //$dates[] = Array("startDate" =>"2011,12,10", "endDate"=>"2011,12,11", "headline"=>"Headline Goes Here", "text"=>"

Body text goes here, some HTML is OK

"); + $name = $row['x']->getProperty('name'); + $startDate = $row['x']->getProperty('start_date'); + $startDate = substr_replace($startDate, ",", 6, 0); + $startDate = substr_replace($startDate, ",", 4, 0); + $endDate = $row['x']->getProperty('end_date'); + if ($endDate == " ") $endDate = "20140101"; + $endDate = substr_replace($endDate, ",", 6, 0); + $endDate = substr_replace($endDate, ",", 4, 0); + + $dates[] = Array("startDate" =>$startDate, "endDate"=>$endDate, "headline"=>$name, "text"=>"

Body text goes here, some HTML is OK

"); + + } + + + + $timeline = Array( "headline"=>"The Main Timeline Headline Goes here", + "type"=>"default", + "text"=>"

Intro body text goes here, some HTML is ok

","date"=>$dates); + echo json_encode(Array("timeline" => $timeline)); + die(); +} +?> + + + + + Revolutionary User Interfaces + + + + + + + + + + + +
+ + + + + +