first commit
This commit is contained in:
3
pages/default.page.php
Normal file
3
pages/default.page.php
Normal file
@ -0,0 +1,3 @@
|
||||
<?php
|
||||
$tpl['file'] = 'default.html';
|
||||
$tpl['data'] = '';
|
41
pages/doppelklinge.page.php
Normal file
41
pages/doppelklinge.page.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
$tpl['file'] = 'doppelklinge.html';
|
||||
$tpl['data'] = [];
|
||||
|
||||
$progress = !empty($_POST['progress']) ? $_POST['progress'] : '';
|
||||
|
||||
if(!empty($progress)) {
|
||||
$list = [];
|
||||
preg_match_all("/(?<task>.*): (?<act>.*) \/ (?<max>.*)/m", $progress, $tmp);
|
||||
|
||||
for($i = 0; $i < count($tmp[0]); $i++) {
|
||||
$list[$i] = (object)[
|
||||
'task' => trim($tmp['task'][$i]),
|
||||
'act' => (int)str_replace('.', '', $tmp['act'][$i]),
|
||||
'max' => (int)str_replace('.', '', $tmp['max'][$i])
|
||||
];
|
||||
$list[$i]->percent = round($list[$i]->act / $list[$i]->max * 100, 2);
|
||||
}
|
||||
|
||||
usort($list, function($a, $b) { return $b->percent <=> $a->percent; });
|
||||
|
||||
$act = $max = $avg = 0;
|
||||
for($i = 0; $i < 5; $i++) {
|
||||
$act += $list[$i]->act;
|
||||
$max += $list[$i]->max;
|
||||
$avg += $list[$i]->percent;
|
||||
}
|
||||
$percent = round($act / $max * 100, 2);
|
||||
|
||||
$tpl['data'] = [
|
||||
'progress' => $progress,
|
||||
'list' => $list,
|
||||
'percent' => $percent,
|
||||
'avg' => round($avg / 5, 2)
|
||||
];
|
||||
}
|
||||
else {
|
||||
$tpl['data'] = [
|
||||
'progress' => ''
|
||||
];
|
||||
}
|
60
pages/vermessung.page.php
Normal file
60
pages/vermessung.page.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
$tpl['file'] = 'vermessung.html';
|
||||
$tpl['data'] = [];
|
||||
$tpl['debug'] = false;
|
||||
|
||||
$protocol = !empty($_POST['protocol']) ? $_POST['protocol'] : '';
|
||||
|
||||
if(!empty($protocol)) {
|
||||
preg_match_all("/(?<datetime>.*)\t(?<amt>.*) führt mit (?<laeufer>.*) eine.*erwirtschaftet (?<gm>.*) Goldmünzen/m", $protocol, $res);
|
||||
|
||||
$dtact = date('m.Y');
|
||||
$vms = $newest = [];
|
||||
|
||||
for($i = 0; $i < count($res['datetime']); $i++) {
|
||||
$tmpdt = date('m.Y', strtotime($res['datetime'][$i]));
|
||||
|
||||
if(!array_key_exists($tmpdt, $vms)) {
|
||||
$vms[$tmpdt] = [
|
||||
'user' => [],
|
||||
'gm' => 0,
|
||||
'list' => [],
|
||||
'dtact' => $tmpdt
|
||||
];
|
||||
}
|
||||
|
||||
if(!array_key_exists($res['amt'][$i], $vms[$tmpdt]['user']))
|
||||
$vms[$tmpdt]['user'][$res['amt'][$i]] = 1;
|
||||
else
|
||||
$vms[$tmpdt]['user'][$res['amt'][$i]] += 1;
|
||||
|
||||
$laeufer = explode(', ', str_replace(' und ', ', ', trim($res['laeufer'][$i], ',')));
|
||||
foreach($laeufer as $tmp) {
|
||||
if(!array_key_exists($tmp, $vms[$tmpdt]['user']))
|
||||
$vms[$tmpdt]['user'][$tmp] = 1;
|
||||
else
|
||||
$vms[$tmpdt]['user'][$tmp] += 1;
|
||||
}
|
||||
arsort($vms[$tmpdt]['user']);
|
||||
|
||||
$vms[$tmpdt]['gm'] += (int)str_replace('.', '', $res['gm'][$i]);
|
||||
|
||||
$vms[$tmpdt]['list'][] = [
|
||||
'datum' => $res['datetime'][$i],
|
||||
'gold' => (int)str_replace('.', '', $res['gm'][$i]),
|
||||
'amt' => $res['amt'][$i],
|
||||
'laeufer' => $laeufer
|
||||
];
|
||||
}
|
||||
|
||||
$tpl['data'] = [
|
||||
'protocol' => $protocol,
|
||||
'vms' => $vms,
|
||||
'newest' => array_shift($vms)
|
||||
];
|
||||
}
|
||||
else {
|
||||
$tpl['data'] = [
|
||||
'protocol' => $protocol
|
||||
];
|
||||
}
|
Reference in New Issue
Block a user