restructured, more doc
This commit is contained in:
70
admin/export-hsg.php
Normal file
70
admin/export-hsg.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?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;
|
||||
|
||||
}
|
||||
|
||||
?>";
|
||||
|
||||
}
|
||||
?>
|
||||
136
admin/stats.php
Normal file
136
admin/stats.php
Normal file
@@ -0,0 +1,136 @@
|
||||
<?php
|
||||
include '../includes/file.php';
|
||||
|
||||
$visits = get_visits('', '../data/visits.sav');
|
||||
|
||||
$nocount = $visits['nocount'];
|
||||
$answers = $visits['ans'];
|
||||
|
||||
unset($visits['nocount']);
|
||||
unset($visits['ans']);
|
||||
|
||||
$max_visitors = 0;
|
||||
foreach($visits as $value){
|
||||
if(sizeof($value) > $max_visitors){
|
||||
$max_visitors = sizeof($value);
|
||||
}
|
||||
}
|
||||
|
||||
$max_visits = 0;
|
||||
foreach($visits as $value){
|
||||
$count = 0;
|
||||
foreach($value as $key => $v){
|
||||
$count += $v;
|
||||
}
|
||||
if($count > $max_visits){
|
||||
$max_visits = $count;
|
||||
}
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Mahlowat - Statistik</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
||||
<meta content="">
|
||||
<link href="../css/bootstrap.min.css" rel="stylesheet" media="screen">
|
||||
<link href="../css/bootstrap-responsive.min.css" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../css/style.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="container top-buffer">
|
||||
|
||||
<div class="well">
|
||||
<h1>Besucher</h1>
|
||||
<p>Von wie vielen IP-Adressen wurde der Mahlowat aufgerufen?</p>
|
||||
|
||||
<table class="table table-bordered table-hover">
|
||||
<tr><th style="width: 200px;">Datum</th><th style="width:100px">Besucher</th><th style="width:640px;"> </th></tr>
|
||||
<?php
|
||||
foreach($visits as $day => $value){
|
||||
$dayvisitors = sizeof($value);
|
||||
|
||||
if($max_visitors != 0){
|
||||
$day_percentage = intval( 100 * $dayvisitors / $max_visitors);
|
||||
} else {
|
||||
$day_percentage = 0;
|
||||
}
|
||||
|
||||
$dayvisitors == $max_visitors ? $class = "success" : $class = "";
|
||||
|
||||
echo "<tr class='$class'>
|
||||
<td><b>$day</b></td><td>$dayvisitors</td>
|
||||
<td><div class='progress'>
|
||||
<div class='progress-bar' role='progressbar' aria-valuenow='$dayvisitors' aria-valuemin='0' aria-valuemax='$max_visitors' style='width: $day_percentage%;'>
|
||||
$dayvisitors
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>";
|
||||
}
|
||||
?>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="well">
|
||||
<h1>Durchläufe</h1>
|
||||
<p>Wie oft wurde eine Auswertung vorgenommen? (Letzte Frage oder Gewichtungsseite)</p>
|
||||
|
||||
<table class="table table-bordered table-hover">
|
||||
<tr><th style="width: 200px;">Datum</th><th style="width:100px">Durchläufe</th><th style="width:640px;"> </th></tr>
|
||||
<?php
|
||||
foreach($visits as $day => $value){
|
||||
$dayvisits = 0;
|
||||
foreach($value as $key => $v){
|
||||
$dayvisits += $v;
|
||||
}
|
||||
|
||||
if($max_visits != 0){
|
||||
$day_percentage2 = intval( 100 * $dayvisits / $max_visits);
|
||||
} else {
|
||||
$day_percentage2 = 0;
|
||||
}
|
||||
|
||||
$dayvisits == $max_visits ? $class = "success" : $class = "";
|
||||
|
||||
echo "<tr class='$class'>
|
||||
<td><b>$day</b></td><td>$dayvisits</td>
|
||||
<td><div class='progress'>
|
||||
<div class='progress-bar' role='progressbar' aria-valuenow='$dayvisits' aria-valuemin='0' aria-valuemax='$max_visits' style='width: $day_percentage2%;'>
|
||||
$dayvisits
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>";
|
||||
}
|
||||
?>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="well">
|
||||
<h1>Nicht gezählte Aufrufe</h1>
|
||||
<p><span class="label label-primary"><?php echo $nocount;?></span> Aufrufe wurden nicht gespeichert.</p>
|
||||
</div>
|
||||
|
||||
<div class="well">
|
||||
<h1>Antworten</h1>
|
||||
<p>
|
||||
<?php
|
||||
foreach($answers as $key => $value){
|
||||
foreach($value as $k => $ans){
|
||||
echo "$ans<br>\n";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user