This commit is contained in:
48
sources/getAufgabenTable.php
Normal file
48
sources/getAufgabenTable.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
require('../config.php');
|
||||
|
||||
require('../CrewbrainApi.php');
|
||||
require('../vendor/autoload.php');
|
||||
$CrewBrain = new CrewBrain();
|
||||
|
||||
|
||||
$result = $Epi->requestEpiApi('/v1/packingnote/open?isco=False&cl=' . Epirent_Mandant);
|
||||
$result = $CrewBrain->requestCrewBrainApi('api/tasklist/5');
|
||||
$data_output = json_decode($result)->payload;
|
||||
|
||||
|
||||
foreach ($data_output as $packingjob) {
|
||||
|
||||
$date = new DateTime($packingjob->date_end);
|
||||
$date->setTime(0, 0, 0);
|
||||
$today = new DateTime();
|
||||
$today->setTime(0, 0, 0);
|
||||
if ($date == $today) {
|
||||
|
||||
echo "<tr class='text-dark bg-warning'>";
|
||||
} else if ($date < $today) {
|
||||
echo "<tr class=' bg-danger'>";
|
||||
} else {
|
||||
echo "<tr>";
|
||||
}
|
||||
echo "<td>" . $packingjob->primary_key . "</td>";
|
||||
echo "<td>" . $packingjob->contact->name . "</td>";
|
||||
echo "<td>" . $packingjob->event . "</td>";
|
||||
echo "<td>" . date_format(new \DateTime($packingjob->date_start), 'd.m.Y') . " " . getTimeFromSeconds($packingjob->time_start) . "</td>";
|
||||
echo "<td>" . date_format(new \DateTime($packingjob->date_end), 'd.m.Y') . " " . getTimeFromSeconds($packingjob->time_end) . "</td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
|
||||
function getTimeFromSeconds(string $timestring) {
|
||||
|
||||
$hours = floor($timestring / 3600);
|
||||
$mins = floor($timestring / 60 % 60);
|
||||
$secs = floor($timestring % 60);
|
||||
|
||||
$timeFormat = sprintf('%02d:%02d', $hours, $mins);
|
||||
|
||||
return $timeFormat;
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user