Index: export.php =================================================================== --- export.php (revision 973) +++ export.php (working copy) @@ -23,5 +23,6 @@ { case "csv": require_once("export_csv.inc.php"); break; case "xml": require_once("export_xml.inc.php"); break; + case "json" : require_once("export_json.inc.php"); break; } ?> Index: export_json.inc.php =================================================================== --- export_json.inc.php (nonexistent) +++ export_json.inc.php (working copy) @@ -0,0 +1,64 @@ + +*/ + + header('Content-Type: application/json; charset=utf-8'); + + + for($i = 0; $i < $reader->getTestIDCount(); $i++) + { + // Add an element for each revision + $stmt = $reader->getTestRunInfoStatement($i); + + if(is_string($stmt)) + die($stmt); + + $row = $stmt->fetch(PDO::FETCH_ASSOC); + echo ''; + + // Now get the all test results for this revision + $stmt = $reader->getSingleResultInfoStatement($i); + + if(is_string($stmt)) + die($stmt); + + while($row = $stmt->fetch(PDO::FETCH_ASSOC)) + { + /*echo ''; */ + $response = array( + 'id' => $row['id'], + 'module' => $row['module'], + 'test' => $row['test'], + 'status' => $row['status'], + 'count' => $row['count'], + 'failures' => $row['failures'], + 'skipped' => $row['skipped'], + 'todo' => $row['todo'], + 'time' => $row['time'] + + ); + $data = ( + 'status' => 'Success', + 'data' = $response + ); + json_encode($data); + } + + echo '}'; + } + + echo ''; +?>