Zeitbereich implementiert + bugfixes
This commit is contained in:
parent
30aa75aa01
commit
7aa61727ad
|
|
@ -111,6 +111,7 @@ if (isset($_POST['AliasHelferID'])) {
|
|||
$AliasHelferID = $_SESSION["AliasHelferID"];
|
||||
} else {
|
||||
HelferAuswahlButton($db_link, $AliasHelferID);
|
||||
echo "<p>Erst Helfer auswählen</p>";
|
||||
exit;
|
||||
}
|
||||
HelferAuswahlButton($db_link, $AliasHelferID);
|
||||
|
|
@ -118,7 +119,7 @@ HelferAuswahlButton($db_link, $AliasHelferID);
|
|||
$_SESSION["AliasHelferID"] = $AliasHelferID;
|
||||
$AdminID = $_SESSION["AdminID"];
|
||||
|
||||
$db_erg = Helferdaten($db_link, $HelferID);
|
||||
$db_erg = Helferdaten($db_link, $AliasHelferID);
|
||||
while ($zeile = mysqli_fetch_array($db_erg, MYSQLI_ASSOC)) {
|
||||
$HelferName = $zeile['Name'];
|
||||
}
|
||||
|
|
@ -192,8 +193,9 @@ if (isset($_POST['minusschicht'])) {
|
|||
$db_erg = SchichtenSummeEinesHelfers($db_link, $AliasHelferID);
|
||||
$zeile = mysqli_fetch_array($db_erg, MYSQLI_ASSOC);
|
||||
|
||||
//"Dienstplan von"
|
||||
echo '<table class="commontable"><tr class="header"><th onclick="window.location.href=\'AdminMeineSchichten.php\'">';
|
||||
echo " Dienstplan von $HelferName (Zusammenfassung)<br>";
|
||||
echo '<img src="Bilder/PfeilRechts2.png" style="width:30px;height:30px;align:middle;">' . "Dienstplan von $HelferName: ";
|
||||
echo $zeile['Anzahl'];
|
||||
echo " Schichten insgesamt ";
|
||||
echo $zeile['Dauer'] / 3600;
|
||||
|
|
@ -232,94 +234,24 @@ if ($addschicht == '0') {
|
|||
//echo "InfoAlleSchichtID ".$InfoAlleSchichtID;
|
||||
|
||||
if ($addschicht != '0') {
|
||||
//$db_erg = AlleSchichten($db_link,$dienstsort);
|
||||
//$db_erg = AlleSchichtenImZeitbereich($db_link,"2023-05-18 00:00:00","2023-05-19 00:00:00");
|
||||
if ($ZeitBereich == 1) { // Alle
|
||||
$db_erg = AlleSchichtenImZeitbereich($db_link, "2000-05-18 00:00:00", "2200-05-19 00:00:00", -1);
|
||||
}
|
||||
if ($ZeitBereich == 2) { // Davor
|
||||
$db_erg = AlleSchichtenImZeitbereich($db_link, "2000-05-18 00:00:00", "2023-05-18 00:00:00", -1);
|
||||
}
|
||||
if ($ZeitBereich == 3) { // Do
|
||||
$db_erg = AlleSchichtenImZeitbereich($db_link, "2023-05-18 00:00:00", "2023-05-19 00:00:00", -1);
|
||||
}
|
||||
if ($ZeitBereich == 4) { // Fr
|
||||
$db_erg = AlleSchichtenImZeitbereich($db_link, "2023-05-19 00:00:00", "2023-05-20 00:00:00", -1);
|
||||
}
|
||||
if ($ZeitBereich == 5) { // Sa
|
||||
$db_erg = AlleSchichtenImZeitbereich($db_link, "2023-05-20 00:00:00", "2023-05-21 00:00:00", -1);
|
||||
}
|
||||
if ($ZeitBereich == 6) { // So
|
||||
$db_erg = AlleSchichtenImZeitbereich($db_link, "2023-05-21 00:00:00", "2023-05-22 00:00:00", -1);
|
||||
}
|
||||
if ($ZeitBereich == 7) { // Danach
|
||||
$db_erg = AlleSchichtenImZeitbereich($db_link, "2023-05-22 00:00:00", "2223-05-22 00:00:00", -1);
|
||||
}
|
||||
echo '<table class="commontable">';
|
||||
require('_zeitbereich.php');
|
||||
$Bereich = AusgabeZeitbereichZeile($start_date,$ZeitBereich,$TageNamenDeutsch);
|
||||
$MeinVon = $Bereich['MeinVon'];
|
||||
$MeinBis = $Bereich['MeinBis'];
|
||||
$db_erg = AlleSchichtenImZeitbereich($db_link, $MeinVon , $MeinBis, -1);
|
||||
|
||||
// fuer Anzahlanzeige in Ueberschrift
|
||||
$iAlleSchichtenCount = AlleSchichtenCount($db_link);
|
||||
$iBelegteSchichtenCount = AlleBelegteSchichtenCount($db_link);
|
||||
|
||||
echo '</table>';
|
||||
|
||||
//echo "<p><button name='addschicht' value='0'><b>↩</b></button></p>";
|
||||
echo '<table class="commontable">';
|
||||
echo "<thead>";
|
||||
echo "<tr>";
|
||||
echo "</tr><th colspan='7'>" . "Alle Schichten der Con (" . $iBelegteSchichtenCount . "/" . $iAlleSchichtenCount . ")</th></tr>";
|
||||
|
||||
/*
|
||||
if ($dienstsort=='1')
|
||||
{
|
||||
echo "<th>". "Dienst" . "</th>";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<th>". "Von" . "</th>";
|
||||
}
|
||||
*/
|
||||
if ($ZeitBereich == 1) {
|
||||
echo "<th style='width:100px; background-color:#0000FF' onclick='window.location.href=\"AlleSchichten.php?ZeitBereich=1\"'>" . "Alle" . "</th>";
|
||||
} else {
|
||||
echo "<th style='width:100px' onclick='window.location.href=\"AlleSchichten.php?ZeitBereich=1\"'>" . "Alle" . "</th>";
|
||||
}
|
||||
if ($ZeitBereich == 2) {
|
||||
echo "<th style='width:100px; background-color:#0000FF' onclick='window.location.href=\"AlleSchichten.php?ZeitBereich=2\"'>" . "Davor" . "</th>";
|
||||
} else {
|
||||
echo "<th style='width:100px' onclick='window.location.href=\"AlleSchichten.php?ZeitBereich=2\"'>" . "Davor" . "</th>";
|
||||
}
|
||||
if ($ZeitBereich == 3) {
|
||||
echo "<th style='width:50px; background-color:#0000FF' onclick='window.location.href=\"AlleSchichten.php?ZeitBereich=3\"'>" . "Do" . "</th>";
|
||||
} else {
|
||||
echo "<th style='width:50px' onclick='window.location.href=\"AlleSchichten.php?ZeitBereich=3\"'>" . "Do" . "</th>";
|
||||
}
|
||||
if ($ZeitBereich == 4) {
|
||||
echo "<th style='width:50px; background-color:#0000FF' onclick='window.location.href=\"AlleSchichten.php?ZeitBereich=4\"'>" . "Fr" . "</th>";
|
||||
} else {
|
||||
echo "<th style='width:50px' onclick='window.location.href=\"AlleSchichten.php?ZeitBereich=4\"'>" . "Fr" . "</th>";
|
||||
}
|
||||
if ($ZeitBereich == 5) {
|
||||
echo "<th style='width:50px; background-color:#0000FF' onclick='window.location.href=\"AlleSchichten.php?ZeitBereich=5\"'>" . "Sa" . "</th>";
|
||||
} else {
|
||||
echo "<th style='width:50px' onclick='window.location.href=\"AlleSchichten.php?ZeitBereich=5\"'>" . "Sa" . "</th>";
|
||||
}
|
||||
if ($ZeitBereich == 6) {
|
||||
echo "<th style='width:50px; background-color:#0000FF' onclick='window.location.href=\"AlleSchichten.php?ZeitBereich=6\"'>" . "So" . "</th>";
|
||||
} else {
|
||||
echo "<th style='width:50px' onclick='window.location.href=\"AlleSchichten.php?ZeitBereich=6\"'>" . "So" . "</th>";
|
||||
}
|
||||
if ($ZeitBereich == 7) {
|
||||
echo "<th style='width:100px; background-color:#0000FF' onclick='window.location.href=\"AlleSchichten.php?ZeitBereich=7\"'>" . "Danach" . "</th>";
|
||||
} else {
|
||||
echo "<th style='width:100px' onclick='window.location.href=\"AlleSchichten.php?ZeitBereich=7\"'>" . "Danach" . "</th>";
|
||||
}
|
||||
//echo "<th style='width:100px' onclick='window.location.href=\"AlleSchichten.php?ZeitBereich=2\"'>". "Davor" . "</th>";
|
||||
//echo "<th style='width:50px'>". "Do" . "</th>";
|
||||
//echo "<th style='width:50px'>". "Fr" . "</th>";
|
||||
//echo "<th style='width:50px'>". "Sa" . "</th>";
|
||||
//echo "<th style='width:50px'>". "So" . "</th>";
|
||||
//echo "<th style='width:100px'>". "Danach" . "</th>";
|
||||
echo "<tr class='header'>";
|
||||
echo "<th colspan='7'>Alle Schichten der Con (" . $iBelegteSchichtenCount . "/" . $iAlleSchichtenCount . ")</th></tr>";
|
||||
|
||||
echo "</tr>";
|
||||
echo "</thead>";
|
||||
|
||||
$OldTag = "";
|
||||
$OldWas = "";
|
||||
|
|
@ -344,7 +276,8 @@ if ($addschicht != '0') {
|
|||
$Was = $zeile['Was'];
|
||||
|
||||
if ($Was != $OldWas) {
|
||||
echo "<tr class='header'><th colspan='7' style='width:100%'>";
|
||||
// + in <span> becomes - when rows are opened
|
||||
echo "<tr class='header'><th colspan='7' style='width:100%'><span>+</span> ";
|
||||
echo $Was;
|
||||
echo "</th>";
|
||||
/*
|
||||
|
|
@ -377,7 +310,7 @@ if ($addschicht != '0') {
|
|||
$regtext = 'Meine!';
|
||||
} else {
|
||||
// dummy-style, um SchichtID unsichtbar im Tag anzuzeigen
|
||||
$rowstyle = 'style="dummy:' . $zeile['SchichtID'] . '"';
|
||||
$rowstyle = 'dbinfo="SchichtID:' . $zeile['SchichtID'] . ';helferlvl:' . $HelferLevel . '" ';
|
||||
$regtext = '';
|
||||
}
|
||||
if ($_SESSION["SchichtIdAktiv"] == $zeile['SchichtID']) {
|
||||
|
|
@ -398,7 +331,6 @@ if ($addschicht != '0') {
|
|||
// buttons sind in der selben Zelle
|
||||
echo "<td width='30px'>" . "<button width='20px' name='plusschicht' value='" . $zeile['SchichtID'] . "'>+</button>" . "";
|
||||
echo " <button width='120px' name='minusschicht' value='" . $zeile['SchichtID'] . "'>–</button> $regtext" . "</td>";
|
||||
//echo "<td>$regtext</td>";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
echo "</table>";
|
||||
|
|
|
|||
|
|
@ -196,32 +196,17 @@ if ($addschicht == '0') {
|
|||
|
||||
|
||||
if ($addschicht != '0') {
|
||||
//$db_erg = AlleSchichten($db_link,$dienstsort);
|
||||
//$db_erg = AlleSchichtenImZeitbereich($db_link,"2023-05-18 00:00:00","2023-05-19 00:00:00",$HelferLevel);
|
||||
if ($ZeitBereich == 1) { // Alle
|
||||
$db_erg = AlleSchichtenImZeitbereich($db_link, "2000-05-18 00:00:00", "2200-05-19 00:00:00", $HelferLevel);
|
||||
}
|
||||
if ($ZeitBereich == 2) { // Davor
|
||||
$db_erg = AlleSchichtenImZeitbereich($db_link, "2000-05-18 00:00:00", "2023-05-18 00:00:00", $HelferLevel);
|
||||
}
|
||||
if ($ZeitBereich == 3) { // Do
|
||||
$db_erg = AlleSchichtenImZeitbereich($db_link, "2023-05-18 00:00:00", "2023-05-19 00:00:00", $HelferLevel);
|
||||
}
|
||||
if ($ZeitBereich == 4) { // Fr
|
||||
$db_erg = AlleSchichtenImZeitbereich($db_link, "2023-05-19 00:00:00", "2023-05-20 00:00:00", $HelferLevel);
|
||||
}
|
||||
if ($ZeitBereich == 5) { // Sa
|
||||
$db_erg = AlleSchichtenImZeitbereich($db_link, "2023-05-20 00:00:00", "2023-05-21 00:00:00", $HelferLevel);
|
||||
}
|
||||
if ($ZeitBereich == 6) { // So
|
||||
$db_erg = AlleSchichtenImZeitbereich($db_link, "2023-05-21 00:00:00", "2023-05-22 00:00:00", $HelferLevel);
|
||||
}
|
||||
if ($ZeitBereich == 7) { // Danach
|
||||
$db_erg = AlleSchichtenImZeitbereich($db_link, "2023-05-22 00:00:00", "2223-05-22 00:00:00", $HelferLevel);
|
||||
}
|
||||
echo '<table class="commontable">';
|
||||
require('_zeitbereich.php');
|
||||
$Bereich = AusgabeZeitbereichZeile($start_date,$ZeitBereich,$TageNamenDeutsch);
|
||||
$MeinVon = $Bereich['MeinVon'];
|
||||
$MeinBis = $Bereich['MeinBis'];
|
||||
$db_erg = AlleSchichtenImZeitbereich($db_link, $MeinVon , $MeinBis, -1);
|
||||
|
||||
// fuer Anzahlanzeige in Ueberschrift
|
||||
$iAlleSchichtenCount = AlleSchichtenCount($db_link);
|
||||
$iBelegteSchichtenCount = AlleBelegteSchichtenCount($db_link);
|
||||
echo '</table>';
|
||||
echo "<button type='button' onclick='expand_all_table_rows();'>Alles Ausklappen</button>";
|
||||
|
||||
// "Alle Schichten der Con"
|
||||
|
|
@ -229,44 +214,7 @@ if ($addschicht != '0') {
|
|||
echo "<tr class='header'>";
|
||||
echo "<th colspan='7'>Alle Schichten der Con (" . $iBelegteSchichtenCount . "/" . $iAlleSchichtenCount . ")</th></tr>";
|
||||
|
||||
echo "<tr class='header'>"; // Zeitbereich tr
|
||||
if ($ZeitBereich == 1) {
|
||||
echo "<th style='width:100px; background-color:#0000FF' onclick='window.location.href=\"AlleSchichten.php?ZeitBereich=1\"'>" . "Alle" . "</th>";
|
||||
} else {
|
||||
echo "<th style='width:100px' onclick='window.location.href=\"AlleSchichten.php?ZeitBereich=1\"'>" . "Alle" . "</th>";
|
||||
}
|
||||
if ($ZeitBereich == 2) {
|
||||
echo "<th style='width:100px; background-color:#0000FF' onclick='window.location.href=\"AlleSchichten.php?ZeitBereich=2\"'>" . "Davor" . "</th>";
|
||||
} else {
|
||||
echo "<th style='width:100px' onclick='window.location.href=\"AlleSchichten.php?ZeitBereich=2\"'>" . "Davor" . "</th>";
|
||||
}
|
||||
if ($ZeitBereich == 3) {
|
||||
echo "<th style='width:50px; background-color:#0000FF' onclick='window.location.href=\"AlleSchichten.php?ZeitBereich=3\"'>" . "Do" . "</th>";
|
||||
} else {
|
||||
echo "<th style='width:50px' onclick='window.location.href=\"AlleSchichten.php?ZeitBereich=3\"'>" . "Do" . "</th>";
|
||||
}
|
||||
if ($ZeitBereich == 4) {
|
||||
echo "<th style='width:50px; background-color:#0000FF' onclick='window.location.href=\"AlleSchichten.php?ZeitBereich=4\"'>" . "Fr" . "</th>";
|
||||
} else {
|
||||
echo "<th style='width:50px' onclick='window.location.href=\"AlleSchichten.php?ZeitBereich=4\"'>" . "Fr" . "</th>";
|
||||
}
|
||||
if ($ZeitBereich == 5) {
|
||||
echo "<th style='width:50px; background-color:#0000FF' onclick='window.location.href=\"AlleSchichten.php?ZeitBereich=5\"'>" . "Sa" . "</th>";
|
||||
} else {
|
||||
echo "<th style='width:50px' onclick='window.location.href=\"AlleSchichten.php?ZeitBereich=5\"'>" . "Sa" . "</th>";
|
||||
}
|
||||
if ($ZeitBereich == 6) {
|
||||
echo "<th style='width:50px; background-color:#0000FF' onclick='window.location.href=\"AlleSchichten.php?ZeitBereich=6\"'>" . "So" . "</th>";
|
||||
} else {
|
||||
echo "<th style='width:50px' onclick='window.location.href=\"AlleSchichten.php?ZeitBereich=6\"'>" . "So" . "</th>";
|
||||
}
|
||||
if ($ZeitBereich == 7) {
|
||||
echo "<th style='width:100px; background-color:#0000FF' onclick='window.location.href=\"AlleSchichten.php?ZeitBereich=7\"'>" . "Danach" . "</th>";
|
||||
} else {
|
||||
echo "<th style='width:100px' onclick='window.location.href=\"AlleSchichten.php?ZeitBereich=7\"'>" . "Danach" . "</th>";
|
||||
}
|
||||
|
||||
echo "</tr>"; //Zeitbereich tr
|
||||
echo "</tr>";
|
||||
|
||||
$OldTag = "";
|
||||
$OldWas = "";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
// Login und Admin Status testen. Wenn kein Admin-Status, Weiterleiten auf index.php und beenden
|
||||
SESSION_START();
|
||||
require_once 'konfiguration.php';
|
||||
require 'SQL.php';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
<?php
|
||||
// Login und Admin Status testen. Wenn kein Admin-Status, Weiterleiten auf index.php und beenden
|
||||
SESSION_START();
|
||||
require_once 'konfiguration.php';
|
||||
require 'SQL.php';
|
||||
|
|
|
|||
|
|
@ -162,11 +162,6 @@ if (isset($_POST['minusschicht'])) {
|
|||
|
||||
/// Schichten Auswahl
|
||||
////////////////////////////////////////////////////////
|
||||
if ($addschicht == '0') {
|
||||
echo "<p><b>Schichten Hinzufügen geordnet nach</b>";
|
||||
echo "<button name='addschicht' value='1'>Tage</button>";
|
||||
echo "<button name='addschicht' value='2'>Dienste</button></p>";
|
||||
}
|
||||
|
||||
|
||||
// fuer Anzahlanzeige in Ueberschrift
|
||||
|
|
@ -179,60 +174,12 @@ $iBelegteSchichtenCount = AlleBelegteSchichtenCount($db_link);
|
|||
echo "<th colspan='7'>" . "Alle Schichten der Con (";
|
||||
echo $iBelegteSchichtenCount . "/" . $iAlleSchichtenCount . ")</th></tr>";
|
||||
|
||||
echo "\n<tr class='header'>\n"; // Zeitbereich tr
|
||||
|
||||
// Zeitbereich: -1 davor, 0 kein Limit, 1-N Tag N der Con, 1000: nach der Con
|
||||
$ZeitBereichWerte = ZEITBEREICHWERTE;
|
||||
$ZeitBereichFelder = count($ZeitBereichWerte);
|
||||
$ZeitBereichFeldBreite = round(100 / $ZeitBereichFelder); // % width for style
|
||||
require('_zeitbereich.php');
|
||||
|
||||
$format = 'Y-m-d';
|
||||
|
||||
// iterate over all days plus "before" and "after"
|
||||
// Wenn TAG_DAUER=4, dann sind die Werte 1-4 die Tage der Con
|
||||
// ZeitBereichWerte = [-1, 0, 1, 2, 3, 4, 1000]
|
||||
// -1: davor, 0: alle, 1-4: Tag 1-4, 1000: danach
|
||||
foreach ($ZeitBereichWerte as &$EinZeitBereich) {
|
||||
if ($EinZeitBereich > 0 && $EinZeitBereich <= TAGE_DAUER) {
|
||||
$PlusTage = $EinZeitBereich - 1;
|
||||
//TODO: only if locale DE
|
||||
$day = $start_date->add(new DateInterval("P{$PlusTage}D"));
|
||||
$Wochentag = $TageNamenDeutsch[date_format($day, 'w')];
|
||||
|
||||
$Text = "$Wochentag (Tag{$EinZeitBereich})";
|
||||
$Von = date_format($day, $format) . " 00:00:00";
|
||||
$Bis = date_format($day, $format) . " 23:59:59";
|
||||
} elseif ($EinZeitBereich == -1) {
|
||||
$Text = 'Davor';
|
||||
$Von = "2000-01-01 00:00:00";
|
||||
$Bis = date_format($start_date, $format) . " 00:00:00";
|
||||
} elseif ($EinZeitBereich == 0) {
|
||||
$Text = 'Alle' ;
|
||||
$Von = "2000-01-01 00:00:00";
|
||||
$Bis = "3000-01-01 00:00:00";
|
||||
} elseif ($EinZeitBereich == 1000) {
|
||||
$Text = 'Danach';
|
||||
$tage_dauer = TAGE_DAUER;
|
||||
$day = $start_date->add(new DateInterval("P{$tage_dauer}D"));
|
||||
$Von = date_format($day, $format) . " 00:00:00";
|
||||
$Bis = "3000-01-01 00:00:00";
|
||||
}
|
||||
// highlight the selected time range
|
||||
if ($EinZeitBereich == $ZeitBereich) {
|
||||
$color = 'background-color:#0000FF; ' ;
|
||||
$MeinVon = $Von;
|
||||
$MeinBis = $Bis;
|
||||
} else {
|
||||
$color = '';
|
||||
}
|
||||
//$Text="$Text <br>$MeinVon $MeinBis"; // debug time strings
|
||||
|
||||
// write the field for each day
|
||||
echo "<th style='width:{$ZeitBereichFeldBreite}%; $color' ";
|
||||
echo "onclick='window.location.href=\"TeilnehmerSchichtenAusdruck.php?ZeitBereich={$EinZeitBereich}\";'>";
|
||||
echo "$Text" . "</th>\n";
|
||||
}
|
||||
echo "</tr>"; //Zeitbereich tr
|
||||
$Bereich = AusgabeZeitbereichZeile($start_date,$ZeitBereich,$TageNamenDeutsch);
|
||||
$MeinVon = $Bereich['MeinVon'];
|
||||
$MeinBis = $Bereich['MeinBis'];
|
||||
|
||||
$db_erg = AlleSchichtenImZeitbereich($db_link, $MeinVon, $MeinBis, $HelferLevel);
|
||||
//echo "<tr><th class=header> AlleSchichtenImZeitbereich(db_link,$Von,$Bis,$HelferLevel);</th></tr>"; // debug
|
||||
|
|
@ -255,7 +202,6 @@ echo "</table>\n";
|
|||
// if the shift is already taken, the name is printed in, else the field is empty to write in.
|
||||
// we iterate over all tasks (Was) and then over Ist and Soll for each task,
|
||||
// filling one field for each Ist or Soll and filling in the name in Ist and leave it empty if it is Soll.
|
||||
echo "<br>next table<br>\n";
|
||||
echo "<table class='commontable'>\n";
|
||||
// $db_erg ist aus AlleSchichtenImZeitbereich
|
||||
// und gibt zurueck Was, Ab, Bis, Ist, Tag, Soll - Ist und Soll sind die HelferStunden
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ function AusgabeZeitbereichZeile ($start_date,$ZeitBereich,$TageNamenDeutsch)
|
|||
$ZeitBereichFeldBreite = round(100 / $ZeitBereichFelder); // % width for style
|
||||
|
||||
$format = 'Y-m-d';
|
||||
|
||||
echo "\n<tr class='header'>\n"; // Zeitbereich tr
|
||||
// iterate over all days plus "before" and "after"
|
||||
// Wenn TAG_DAUER=4, dann sind die Werte 1-4 die Tage der Con
|
||||
// ZeitBereichWerte = [-1, 0, 1, 2, 3, 4, 1000]
|
||||
|
|
|
|||
Loading…
Reference in New Issue