now stores state in JSON file, added utility to create JSON file
This commit is contained in:
@@ -1,70 +0,0 @@
|
||||
<?php
|
||||
|
||||
include '../includes/file.php';
|
||||
|
||||
function r($item){
|
||||
if($item === 'skip'){
|
||||
return "'skip'";
|
||||
} else {
|
||||
return $item;
|
||||
}
|
||||
}
|
||||
|
||||
$hsg_array_s = load_var('../lists.sav');
|
||||
$hsg_array = Array();
|
||||
if($hsg_array_s != null){
|
||||
header("Content-Type: text/plain");
|
||||
header("Content-Disposition: attachment; filename=hsg.php");
|
||||
|
||||
$keys = array_keys($hsg_array_s);
|
||||
for($i=0; $i<sizeof($keys); $i++){
|
||||
$hsg_array[$i] = $hsg_array_s[$keys[$i]];
|
||||
for($c=0; $c<sizeof($hsg_array[$i]['comments']); $c++){
|
||||
if($hsg_array[$i]['comments'][$c] === ''){
|
||||
$hsg_array[$i]['comments'][$c] = "Zu dieser These hat die Liste {\$hsg_array[$i]['name']} keine Begründung angegeben.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo '<?php
|
||||
|
||||
function get_hsg_array(){
|
||||
';
|
||||
for($i=0; $i<sizeof($hsg_array); $i++){
|
||||
echo " \$hsg_array[$i]['name'] = '{$hsg_array[$i]['name']}';
|
||||
\$hsg_array[$i]['name_x'] = '{$hsg_array[$i]['name_x']}';
|
||||
";
|
||||
if(isset($hsg_array[$i]['answers'])){
|
||||
echo " \$hsg_array[$i]['answers'] = Array(";
|
||||
echo r($hsg_array[$i]['answers'][0]);
|
||||
for($a=1;$a<sizeof($hsg_array[$i]['answers']);$a++){
|
||||
echo ','.r($hsg_array[$i]['answers'][$a]);
|
||||
}
|
||||
echo ");
|
||||
";
|
||||
}
|
||||
if(isset($hsg_array[$i]['comments'])){
|
||||
echo "\$hsg_array[$i]['comments'] = Array(
|
||||
";
|
||||
echo " \"{$hsg_array[$i]['comments'][0]}\"";
|
||||
for($c=1; $c<sizeof($hsg_array[$i]['comments']);$c++){
|
||||
echo ",
|
||||
|
||||
\"{$hsg_array[$i]['comments'][$c]}\"";
|
||||
}
|
||||
echo ");
|
||||
";
|
||||
}
|
||||
echo "
|
||||
|
||||
";
|
||||
}
|
||||
|
||||
echo " return \$hsg_array;
|
||||
|
||||
}
|
||||
|
||||
?>";
|
||||
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user