fix 500
This commit is contained in:
@@ -8,9 +8,11 @@ $worklistsData = file_get_contents($worklist_url);
|
||||
preg_match_all('/href="\/worklists\/(\d*)">(.*?)<\/a><\/td><td>.*?<\/td><td>(.*?)<\/td>/s', $worklistsData, $lists);
|
||||
|
||||
$worklists = [];
|
||||
|
||||
foreach($lists[1] as $key => $list) {
|
||||
|
||||
$dateArr = explode(' ', substr($lists[3][$key], 3, 11) . substr($lists[3][$key], 16));
|
||||
if (count($dateArr) < 3 || $dateArr[0] === "") continue;
|
||||
$dateArr[1] = $monthTrans[$dateArr[1]];
|
||||
$date = \DateTimeImmutable::createFromFormat('d M Y H:i', implode(' ', $dateArr));
|
||||
|
||||
@@ -61,6 +63,8 @@ if (isset($_GET['worklist']) || count($checkedLists) > 0) {
|
||||
$site = 'https://old.wina.be/worklists/' . $site;
|
||||
$data = file_get_contents($site);
|
||||
|
||||
$tempCount = [];
|
||||
|
||||
preg_match_all('/<div id="(data_shift.*?<table.*?>.*?<\/table>)/s', $data, $shiften);
|
||||
$shiften = $shiften[1];
|
||||
|
||||
@@ -79,13 +83,9 @@ if (isset($_GET['worklist']) || count($checkedLists) > 0) {
|
||||
preg_match_all('/data_shift.*?Invulling.*?<td.*?>(.*?)<\/td>/s', $shift, $blockNames);
|
||||
if (count($blockNames[1]) !== 0) {
|
||||
preg_match_all('/<span.*?>(.*?)<\/span>/s', $blockNames[1][0], $names);
|
||||
|
||||
|
||||
$tempCount = array_merge($tempCount, $names[1]);
|
||||
foreach ($names[1] as $name) {
|
||||
if (!array_key_exists($name, $nameCount)) {
|
||||
$nameCount[$name] = 1;
|
||||
} else {
|
||||
$nameCount[$name] += 1;
|
||||
}
|
||||
if (!array_key_exists($name, $nameHours)) {
|
||||
$nameHours[$name] = $diff;
|
||||
} else {
|
||||
@@ -95,6 +95,16 @@ if (isset($_GET['worklist']) || count($checkedLists) > 0) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$tempCount = array_unique($tempCount);
|
||||
|
||||
foreach ($tempCount as $name) {
|
||||
if (!array_key_exists($name, $nameCount)) {
|
||||
$nameCount[$name] = 1;
|
||||
} else {
|
||||
$nameCount[$name] += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,7 +170,7 @@ if ($totalShifted !== 0 & count($nameHours) !== 0)
|
||||
<tr>
|
||||
<th scope="col">Naam</th>
|
||||
<th scope="col">Uren</th>
|
||||
<th scope="col">Shiften</th>
|
||||
<th scope="col">Activiteiten</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -208,4 +218,3 @@ if ($totalShifted !== 0 & count($nameHours) !== 0)
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
Reference in New Issue
Block a user