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