Styling is up to you.
As far as I understood your explanation this is near to your ideas.
Code:
<html>
<head>
<title>HWA Bram Stoker Award Recommendations</title>
<script language="JavaScript" type="text/JavaScript">
// THE FOLLOWING IS LIMESURVEY CODE
function get_session_key(USERNAME $username, PASSWORD $password)
</script>
</head>
<body>
<!-- START OF CONTENT -->
<table border=1><tr bgcolor="#bbbbbb"><td colspan=8><br><center><h1>HWA Bram Stoker Award® Member Recommendations for Works Published in 2018</h1></td></tr>
<?php
require_once 'jsonrpcphp/JsonRPCClient.php';
define( 'LS_BASEURL', 'https://www.myServer.de/survey'); // adjust this one to your actual LimeSurvey URL
define( 'LS_USER', 'user' );
define( 'LS_PASSWORD', 'password' );
// the survey to process
$survey_id=977824;
// instantiate a new client
$myJSONRPCClient = new \org\jsonrpcphp\JsonRPCClient( LS_BASEURL.'/index.php/admin/remotecontrol' );
// receive session key
$sessionKey= $myJSONRPCClient->get_session_key( LS_USER, LS_PASSWORD );
if(is_array($sessionKey))
{
header("Content-type: application/json");
echo json_encode($sessionKey);
echo '<br />This is another test with sesssion key.<br />';
die();
}
else if($sessionKey) // Is a valid session
{
/* Get the responses */
$rawResponses = $myJSONRPCClient->export_responses( $sessionKey, $survey_id,
'json', // Document type : pdf,csv,xls,doc,json
null, // Language code : null : default from survey
'complete', // Stautus complete|incomplete|all
'code', // Heading : code|full|abbreviated : question text, default code
'short', // answer : short|long , default : long
null,
null
);
$category= array ("","Novel","First Novel","Graphic Novel","Young adult novel","Long Fiction","Short Fiction","Screenplay","Anthology","Fiction Collection");
$columns = array("title", "author", "publisher", "venue", "month");
if(is_array($rawResponses))
{
print_r($rawResponses);
}
else {
$decodedString = base64_decode($rawResponses); // The decodedString variable turns the data into an array and contains the entire array of data for the survey in English
$responseArr = json_decode($decodedString, True); // Creates the json-decoded array of data for use in PHP.
for ($i=1;$i<9;$i++) {
echo '<tr bgcolor="#bbbbbb"><td colspan="8" style="font-size:14pt;font-weight:bold;text-align:center">'.$category[$i].'</td></tr>';
foreach($responseArr['responses'] as $rownumber => $row) {
foreach($row as $column => $item) {
if ($item["category"]=="A".$i) {
echo '<tr bgcolor="#bbbbbb">';
foreach($columns as $col) {
echo '<td style="border: 1px solid #CCC; padding: 2px 7px;">' . $item[$col] . '</td>';
}
}
echo '</tr>';
}
}
}
echo '</table>';
}
}
// Release the session key
$myJSONRPCClient->release_session_key( $sSessionKey );
?>
</table>
<!-- END OF CONTENT -->
</body>
</html>
1. You should have the same structure in the codes of the categories (Why did you change after "A9"?)
Therefore the script only works up to category "A9"; as you see I check for "A".$i in the loop.
2. The same in "month". Why the change? Here I used the short name of the month as code