Merge branch 'master' of https://gitea.haschek.at/Crispi/dogstats
All checks were successful
Build and push / Pulling repo on server (push) Successful in 3s

This commit is contained in:
piapassecker 2023-12-11 19:57:06 +01:00
commit 03a3c03433
6 changed files with 217 additions and 128 deletions

View File

@ -36,11 +36,13 @@ echo "[i] Found $last_page pages\n";
//create an array with all pages //create an array with all pages
$pages = range(1,65); $pages = range(1,65);
foreach($pages as $page) // foreach($pages as $page)
{ // {
echo "[i] Crawling page $page\n"; // echo "[i] Crawling page $page\n";
scanPage($page); // scanPage($page);
} // }
scanPage(1,false);
function scanPage($key,$usecache=true) function scanPage($key,$usecache=true)
{ {

Binary file not shown.

View File

@ -17,9 +17,53 @@ class Demo extends Page{
function test() function test()
{ {
$u = new User(); $graph1 = partial('graph.html.php', [
$u->load('Chris','firstname'); 'id' => 'graph1',
var_dump($u->data); 'title' => 'Graph 1',
'legend' => ['Geschwindigkeit', 'Fehler', 'Verweigerungen', 'Zeit', 'Geschwindigkeit', 'Punkte', 'Platz'],
'xaxis' => ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'],
'seriesdata' => [
['name' => 'Geschwindigkeit', 'type'=>'line','stack'=>'Total', 'data' => [120, 132, 101, 134, 90, 230, 210]],
['name' => 'Fehler', 'type'=>'line','stack'=>'Total', 'data' => [220, 182, 191, 234, 290, 330, 310]],
['name' => 'Verweigerungen', 'type'=>'line','stack'=>'Total', 'data' => [150, 232, 201, 154, 190, 330, 410]],
['name' => 'Zeit', 'type'=>'line','stack'=>'Total', 'data' => [320, 332, 301, 334, 390, 330, 320]],
['name' => 'Punkte', 'type'=>'line','stack'=>'Total', 'data' => [820, 932, 901, 934, 1290, 1330, 1320]],
['name' => 'Platz', 'type'=>'line','stack'=>'Total', 'data' => [820, 932, 901, 934, 1290, 1330, 1320]]
],
]);
$graph2 = partial('graph.html.php', [
'id' => 'graph2',
'title' => 'Punkte',
'xaxis' => ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'],
'seriesdata' => [
['name' => 'Punkte', 'type'=>'line','stack'=>'Total', 'data' => [820, 932, 901, 934, 1290, 1330, 1320]],
],
]);
$graph3 = partial('graph.html.php', [
'id' => 'graph3',
'title' => 'Graph 3',
'legend' => ['Punkte'],
'xaxis' => ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'],
'seriesdata' => [
['name' => 'Punkte', 'type'=>'line','stack'=>'Total', 'data' => [820, 932, 901, 934, 1290, 1330, 1320]],
],
]);
return '<div class="container text-center">
<div class="row">
<div class="col">
'.$graph1.'
</div>
<div class="col">
'.$graph2.'
</div>
<div class="col">
'.$graph3.'
</div>
</div>
</div>';
} }
function index() function index()

View File

@ -58,7 +58,6 @@ class Smart extends Page {
$this->set('results_dogs', $results); $this->set('results_dogs', $results);
$this->set('dogs', $dogs); $this->set('dogs', $dogs);
$this->set('query', $query);
$this->set('template', 'search.html.php'); $this->set('template', 'search.html.php');
} }

View File

@ -8,36 +8,36 @@
<?php foreach ($dogs as $dog) : <?php foreach ($dogs as $dog) :
$dogid=preg_replace("/[^A-Za-z0-9]/", '', $dog);
$results = $results_dogs[$dog]; $results = $results_dogs[$dog];
$sdata = []; $sdata = [];
?> ?>
<h1 id="<?= $dog; ?>"><?= $dog; ?></h1> <h1 id="<?= $dogid; ?>"><?= $dog; ?></h1>
<button onClick="getElementById('table_<?= $dog ?>').style.display='table'">Tabelle anzeigen</button> <button onClick="getElementById('table_<?= $dog ?>').style.display='table'">Tabelle anzeigen</button>
<div class="table-responsive">
<table id="table_<?= $dog ?>" class="table" style="display:none"> <table id="table_<?= $dog ?>" class="table" style="display:none">
<tr> <tr>
<th>Event</th> <th>event</th>
<th>Datum</th> <th>Wann wars</th>
<th>Lauf</th> <th>run</th>
<th>Startnummer</th> <th>rang</th>
<th>Teilnehmer</th> <th>stnr</th>
<th>Hund</th> <th>teilnehmer</th>
<th>Verein</th> <th>hund</th>
<th>F</th> <th>verein</th>
<th>VW</th> <th>f</th>
<th>ZF</th> <th>vw</th>
<th>Zeit</th> <th>zf</th>
<th>GF</th> <th>zeit</th>
<th>m/sek</th> <th>gf</th>
<th>Bew.</th> <th>msek</th>
<th>Punkte</th> <th>bew</th>
<th>Rang</th> <th>punkte</th>
<th>Aktion</th>
</tr> </tr>
<?php foreach ($results as $res) : <?php foreach ($results as $res) :
// graph data preparation // graph data preparation
if ($res['bew'] != 'DIS' && $res['punkte'] != 'DIS') if ($res['bew'] != 'DIS' && $res['punkte'] != 'DIS')
{ {
$sdata['dates'][] = date("d.m.Y", strtotime($res['date'])); $sdata['dates'][] = date("d.m.Y", strtotime($res['date']));
@ -72,90 +72,61 @@
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
</table> </table>
</div>
<h4>Statistik</h4>
<div class="card" style="width: 25rem;">
<ul class="list-group list-group-flush">
<li class="list-group-item"><i class="fas fa-rabbit-fast"></i> Durchschnittsgeschwinigkeit: <span class="badge bg-primary" style="float:right;"><?= $averagespeed ?> m/s</span></li>
<li class="list-group-item"><i class="fas fa-exclamation-triangle"></i> Fehler pro Lauf: <span class="badge bg-primary" style="float:right;"><?= $averageerrors ?></span></li>
<li class="list-group-item"><i class="fas fa-do-not-enter"></i> Verweigerungen pro Lauf: <span class="badge bg-primary" style="float:right;"><?= $averagerefusals ?></span></li>
<li class="list-group-item"><i class="fas fa-trophy-alt"></i> Durchschnittliche Platzierung: <span class="badge bg-primary" style="float:right;"><?= $averageranking ?></span></li>
</ul>
</div>
<br/>
<div class="row">
<?php if (count($results) > 0) : ?> <?php if (count($results) > 0) : ?>
<div class="col"> <div class="col">
<div id="graph<?= $dog ?>" data-bs-theme="light" class="card bg-light text-black" style="min-height: 400px;"></div> <?= partial('graph.html.php', [
'id' => 'graph1'.$dogid,
<script type="text/javascript"> 'title' => 'Fehler und Verweigerungen',
// Initialize the echarts instance based on the prepared dom 'xaxis' => $sdata['dates'],
var myChart = echarts.init(document.getElementById('graph<?= $dog ?>')); 'seriesdata' => [
['name' => 'Fehler', 'type' => 'line', 'stack' => 'Total', 'data' => $sdata['errors']],
// Specify the configuration items and data for the chart ['name' => 'Verweigerungen', 'type' => 'line', 'stack' => 'Total', 'data' => $sdata['refusals']],
var option = { ],
title: { ]);
text: 'Stacked Line' ?>
},
tooltip: {
trigger: 'axis'
},
legend: {
data: ['Geschwindigkeit', 'Fehler', 'Verweigerungen', 'Zeit', 'Geschwindigkeit', 'Punkte', 'Platz']
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
toolbox: {
feature: {
saveAsImage: {}
}
},
xAxis: {
type: 'category',
boundaryGap: false,
data: <?= json_encode($sdata['dates']); ?>
},
yAxis: {
type: 'value'
},
series: [{
name: 'Geschwindigkeit',
type: 'line',
stack: 'Total',
data: <?= json_encode($sdata['speed']); ?>
},
{
name: 'Fehler',
type: 'line',
stack: 'Total',
data: <?= json_encode($sdata['errors']); ?>
},
{
name: 'Verweigerungen',
type: 'line',
stack: 'Total',
data: <?= json_encode($sdata['refusals']); ?>
},
{
name: 'Zeit',
type: 'line',
stack: 'Total',
data: <?= json_encode($sdata['time']); ?>
},
{
name: 'Punkte',
type: 'line',
stack: 'Total',
data: <?= json_encode($sdata['points']); ?>
},
{
name: 'Platz',
type: 'line',
stack: 'Total',
data: <?= json_encode($sdata['ranking']); ?>
}
]
};
// Display the chart using the configuration items and data just specified.
myChart.setOption(option);
</script>
</div> </div>
<?php endif; ?>
<div class="col">
<?= partial('graph.html.php', [
'id' => 'graph2'.$dogid,
'title' => 'Geschwindigkeit',
'xaxis' => $sdata['dates'],
'seriesdata' => [
['name' => 'Geschwindigkeit', 'type' => 'line', 'stack' => 'Total', 'data' => $sdata['speed']],
],
]);
?>
</div>
<div class="col">
<?= partial('graph.html.php', [
'id' => 'graph3'.$dogid,
'title' => 'Platzierung',
'xaxis' => $sdata['dates'],
'seriesdata' => [
['name' => 'Platzierung', 'type' => 'line', 'stack' => 'Total', 'data' => $sdata['ranking']],
],
]);
?>
</div>
</div>
<?php endif; ?>
<hr> <hr>

View File

@ -0,0 +1,73 @@
<?php
/*
usage:
partial('graph.html.php', [
'id' => 'graph1',
'title' => 'Graph 1',
'gclass' => '', // classes for the graph div
'legend' => ['Geschwindigkeit', 'Fehler', 'Verweigerungen', 'Zeit', 'Geschwindigkeit', 'Punkte', 'Platz'],
'xaxis' => ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'],
'seriesdata' => [
['name' => 'Geschwindigkeit', 'type'=>'line','stack'=>'Total', 'data' => [120, 132, 101, 134, 90, 230, 210]],
['name' => 'Fehler', 'type'=>'line','stack'=>'Total', 'data' => [220, 182, 191, 234, 290, 330, 310]],
['name' => 'Verweigerungen', 'type'=>'line','stack'=>'Total', 'data' => [150, 232, 201, 154, 190, 330, 410]],
['name' => 'Zeit', 'type'=>'line','stack'=>'Total', 'data' => [320, 332, 301, 334, 390, 330, 320]],
['name' => 'Punkte', 'type'=>'line','stack'=>'Total', 'data' => [820, 932, 901, 934, 1290, 1330, 1320]],
['name' => 'Platz', 'type'=>'line','stack'=>'Total', 'data' => [820, 932, 901, 934, 1290, 1330, 1320]]
],
])
*/
?>
<div id="graph<?= $id ?>" data-bs-theme="light" class="card bg-light text-black <?= $gclass ?>" style="min-height: 200px;"></div>
<script type="text/javascript">
// Initialize the echarts instance based on the prepared dom
var myChart<?= $id ?> = echarts.init(document.getElementById('graph<?= $id ?>'));
// Specify the configuration items and data for the chart
var option = {
title: {
text: '<?= $title ?>'
},
tooltip: {
trigger: 'axis'
},
<?php if(isset($legend)): ?>
legend: {
data: <?= json_encode($legend); ?>
},
<?php endif; ?>
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
toolbox: {
feature: {
saveAsImage: {}
}
},
xAxis: {
type: 'category',
boundaryGap: false,
data: <?= json_encode($xaxis); ?>
},
yAxis: {
type: 'value'
},
series: <?= json_encode($seriesdata, JSON_PRETTY_PRINT); ?>
};
// Display the chart using the configuration items and data just specified.
myChart<?= $id ?>.setOption(option);
window.addEventListener('resize', function(event) {
if(myChart<?= $id ?> != null && myChart<?= $id ?> != undefined){
myChart<?= $id ?>.resize();
}
}, true);
</script>