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
All checks were successful
Build and push / Pulling repo on server (push) Successful in 3s
This commit is contained in:
commit
03a3c03433
@ -36,11 +36,13 @@ echo "[i] Found $last_page pages\n";
|
||||
//create an array with all pages
|
||||
$pages = range(1,65);
|
||||
|
||||
foreach($pages as $page)
|
||||
{
|
||||
echo "[i] Crawling page $page\n";
|
||||
scanPage($page);
|
||||
}
|
||||
// foreach($pages as $page)
|
||||
// {
|
||||
// echo "[i] Crawling page $page\n";
|
||||
// scanPage($page);
|
||||
// }
|
||||
|
||||
scanPage(1,false);
|
||||
|
||||
function scanPage($key,$usecache=true)
|
||||
{
|
||||
|
BIN
crawler/data.db
BIN
crawler/data.db
Binary file not shown.
@ -17,9 +17,53 @@ class Demo extends Page{
|
||||
|
||||
function test()
|
||||
{
|
||||
$u = new User();
|
||||
$u->load('Chris','firstname');
|
||||
var_dump($u->data);
|
||||
$graph1 = partial('graph.html.php', [
|
||||
'id' => 'graph1',
|
||||
'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()
|
||||
|
@ -58,7 +58,6 @@ class Smart extends Page {
|
||||
|
||||
$this->set('results_dogs', $results);
|
||||
$this->set('dogs', $dogs);
|
||||
$this->set('query', $query);
|
||||
$this->set('template', 'search.html.php');
|
||||
|
||||
}
|
||||
|
@ -8,46 +8,46 @@
|
||||
|
||||
<?php foreach ($dogs as $dog) :
|
||||
|
||||
$dogid=preg_replace("/[^A-Za-z0-9]/", '', $dog);
|
||||
$results = $results_dogs[$dog];
|
||||
$sdata = [];
|
||||
?>
|
||||
|
||||
<h1 id="<?= $dog; ?>"><?= $dog; ?></h1>
|
||||
<h1 id="<?= $dogid; ?>"><?= $dog; ?></h1>
|
||||
|
||||
<button onClick="getElementById('table_<?= $dog ?>').style.display='table'">Tabelle anzeigen</button>
|
||||
<div class="table-responsive">
|
||||
<table id="table_<?= $dog ?>" class="table" style="display:none">
|
||||
<tr>
|
||||
<th>Event</th>
|
||||
<th>Datum</th>
|
||||
<th>Lauf</th>
|
||||
<th>Startnummer</th>
|
||||
<th>Teilnehmer</th>
|
||||
<th>Hund</th>
|
||||
<th>Verein</th>
|
||||
<th>F</th>
|
||||
<th>VW</th>
|
||||
<th>ZF</th>
|
||||
<th>Zeit</th>
|
||||
<th>GF</th>
|
||||
<th>m/sek</th>
|
||||
<th>Bew.</th>
|
||||
<th>Punkte</th>
|
||||
<th>Rang</th>
|
||||
<th>Aktion</th>
|
||||
</tr>
|
||||
<?php foreach ($results as $res) :
|
||||
// graph data preparation
|
||||
if ($res['bew'] != 'DIS' && $res['punkte'] != 'DIS')
|
||||
{
|
||||
$sdata['dates'][] = date("d.m.Y", strtotime($res['date']));
|
||||
$sdata['speed'][] = $res['msek'] ?: 0;
|
||||
$sdata['errors'][] = $res['f'] ?: 0;
|
||||
$sdata['refusals'][] = $res['vw'] ?: 0;
|
||||
$sdata['time'][] = $res['zeit'] ?: 0;
|
||||
$sdata['points'][] = $res['punkte'];
|
||||
$sdata['ranking'][] = $res['rang'];
|
||||
}
|
||||
<table id="table_<?= $dog ?>" class="table" style="display:none">
|
||||
<tr>
|
||||
<th>event</th>
|
||||
<th>Wann wars</th>
|
||||
<th>run</th>
|
||||
<th>rang</th>
|
||||
<th>stnr</th>
|
||||
<th>teilnehmer</th>
|
||||
<th>hund</th>
|
||||
<th>verein</th>
|
||||
<th>f</th>
|
||||
<th>vw</th>
|
||||
<th>zf</th>
|
||||
<th>zeit</th>
|
||||
<th>gf</th>
|
||||
<th>msek</th>
|
||||
<th>bew</th>
|
||||
<th>punkte</th>
|
||||
</tr>
|
||||
<?php foreach ($results as $res) :
|
||||
// graph data preparation
|
||||
|
||||
if ($res['bew'] != 'DIS' && $res['punkte'] != 'DIS')
|
||||
{
|
||||
$sdata['dates'][] = date("d.m.Y", strtotime($res['date']));
|
||||
$sdata['speed'][] = $res['msek'] ?: 0;
|
||||
$sdata['errors'][] = $res['f'] ?: 0;
|
||||
$sdata['refusals'][] = $res['vw'] ?: 0;
|
||||
$sdata['time'][] = $res['zeit'] ?: 0;
|
||||
$sdata['points'][] = $res['punkte'];
|
||||
$sdata['ranking'][] = $res['rang'];
|
||||
}
|
||||
|
||||
?>
|
||||
<tr>
|
||||
@ -69,93 +69,64 @@
|
||||
<td><?= $res['rang'] ?></td>
|
||||
<td><a href="#" class="btn btn-primary" title="Importieren"><i class="fas fa-file-import"></i></a></td>
|
||||
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
|
||||
|
||||
<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) : ?>
|
||||
<div class="col">
|
||||
<?= partial('graph.html.php', [
|
||||
'id' => 'graph1'.$dogid,
|
||||
'title' => 'Fehler und Verweigerungen',
|
||||
'xaxis' => $sdata['dates'],
|
||||
'seriesdata' => [
|
||||
['name' => 'Fehler', 'type' => 'line', 'stack' => 'Total', 'data' => $sdata['errors']],
|
||||
['name' => 'Verweigerungen', 'type' => 'line', 'stack' => 'Total', 'data' => $sdata['refusals']],
|
||||
],
|
||||
]);
|
||||
?>
|
||||
</div>
|
||||
|
||||
<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 if (count($results) > 0) : ?>
|
||||
<div class="col">
|
||||
<div id="graph<?= $dog ?>" data-bs-theme="light" class="card bg-light text-black" style="min-height: 400px;"></div>
|
||||
|
||||
<script type="text/javascript">
|
||||
// Initialize the echarts instance based on the prepared dom
|
||||
var myChart = echarts.init(document.getElementById('graph<?= $dog ?>'));
|
||||
|
||||
// Specify the configuration items and data for the chart
|
||||
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>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<hr>
|
||||
|
73
web/templates/partials/graph.html.php
Normal file
73
web/templates/partials/graph.html.php
Normal 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>
|
Reference in New Issue
Block a user