diff --git a/shiftcounter.php b/shiftcounter.php
index 0d88780..937ffe7 100644
--- a/shiftcounter.php
+++ b/shiftcounter.php
@@ -1,16 +1,27 @@
(.*?)<\/a>/s', $worklistsData, $lists);
+
+$worklists = [];
+
+foreach($lists[1] as $key => $list) {
+ $worklists[$list] = $lists[2][$key];
+}
+natsort($worklists);
+
+$checkedLists = $_GET['worklist'];
+
$monthTrans = ['jan' => 'Jan', 'feb' => 'Feb', 'maa' => 'Mar', 'apr' => 'Apr', 'mei' => 'May', 'jul' => 'Jul', 'aug' => 'Aug', 'sep' => 'Sep',
'okt' => 'Oct', 'nov' => 'Nov', 'dec' => 'Dec'];
-$sites = ['https://www.wina.be/worklists/341', 'https://www.wina.be/worklists/336', 'https://www.wina.be/worklists/337'];
-
$all_names = [];
-$responsibles = ['William Vandermaesen', 'Samuel Nassen', 'Robin Broekmans'];
-$resp_icon = '';
$totalShifted = 0;
$total = 0;
-foreach ($sites as $site) {
+
+foreach ($checkedLists as $site) {
+ $site = 'https://www.wina.be/worklists/' . $site;
$data = file_get_contents($site);
preg_match_all('/
+
@@ -65,12 +77,25 @@ $avg = $totalShifted / count($all_names);
-
Wina 24 urenloop shift counter
-
shifted!
- Gemiddeld:
-
+ Wina shift counter
+
- = verantwoordelijke
+ 0) {
+ echo '' . floor($totalShifted) . ' uur en ' . ($totalShifted - floor($totalShifted)) * 60 . ' minuten geshift!
+ Gemiddeld: ' . floor($avg) . ' uur en ' . round(($avg - floor($avg)) * 60) . ' minuten
';
+
+ }
+?>
+
@@ -83,13 +108,7 @@ $avg = $totalShifted / count($all_names);
$val) {
- echo "$name" . (in_array($name, $responsibles) ? " $resp_icon" : '') . " | " . floor($val) . 'h ' . ($val - floor($val)) * 60 . 'min' . " |
";
- }
-
- foreach($responsibles as $resp) {
- if (!key_exists($resp, $all_names)) {
- echo "$resp $resp_icon | 0h 0min |
";
- }
+ echo "$name | " . floor($val) . 'h ' . ($val - floor($val)) * 60 . 'min' . " |
";
}
?>
@@ -109,10 +128,16 @@ $avg = $totalShifted / count($all_names);
+