Folge dem Video um zu sehen, wie unsere Website als Web-App auf dem Startbildschirm installiert werden kann.
Anmerkung: Diese Funktion ist in einigen Browsern möglicherweise nicht verfügbar.
<?php
//Config-File einbinden, darin wird auch die DB-Connection hergestellt
include('connect.php');
?>
<html>
<head>
</head>
<body>
<form action="" method="post" name="form" id="form">
<p>Datum von :
<input name="theDate_start" type="text" id="sel_start" value="<?php echo $_POST[theDate_start]; ?>" size="10" onClick="displayCalendar(document.forms[0].theDate_start,'yyyy-mm-dd',this)">
<input type="submit" name="button2" id="button2" value="Wählen" />
</p>
</form>
<?php
if ($_POST[theDate_start]) {
$datum = $_POST[theDate_start];
$timestamp = strtotime($datum);
//Array mit allen Datums bestimmen
for($i = 0; $i <7; $i++){
$date[] = strtotime("+{$i} day", $timestamp);
}
$datumSqlString = mysql_escape_string($_POST[theDate_start]);
$sql =
"SELECT
id,
@d1 AS datum1,
MAX(IF(datum = @d1, FS, NULL)) AS FS1,
MAX(IF(datum = @d1, SS, NULL)) AS SS1,
MAX(IF(datum = @d1, NS, NULL)) AS NS1,
@d2 AS datum2,
MAX(IF(datum = @d2, FS, NULL)) AS FS2,
MAX(IF(datum = @d2, SS, NULL)) AS SS2,
MAX(IF(datum = @d2, NS, NULL)) AS NS2,
@d3 AS datum3,
MAX(IF(datum = @d3, FS, NULL)) AS FS3,
MAX(IF(datum = @d3, SS, NULL)) AS SS3,
MAX(IF(datum = @d3, NS, NULL)) AS NS3,
@d4 AS datum4,
MAX(IF(datum = @d4, FS, NULL)) AS FS4,
MAX(IF(datum = @d4, SS, NULL)) AS SS4,
MAX(IF(datum = @d4, NS, NULL)) AS NS4,
@d5 AS datum5,
MAX(IF(datum = @d5, FS, NULL)) AS FS5,
MAX(IF(datum = @d5, SS, NULL)) AS SS5,
MAX(IF(datum = @d5, NS, NULL)) AS NS5,
@d6 AS datum6,
MAX(IF(datum = @d6, FS, NULL)) AS FS6,
MAX(IF(datum = @d6, SS, NULL)) AS SS6,
MAX(IF(datum = @d6, NS, NULL)) AS NS6,
@d7 AS datum7,
MAX(IF(datum = @d7, FS, NULL)) AS FS7,
MAX(IF(datum = @d7, SS, NULL)) AS SS7,
MAX(IF(datum = @d7, NS, NULL)) AS NS7
FROM
( SELECT
@d1 := '{$datumSqlString}',
@d2 := DATE_ADD(@d1, INTERVAL 1 DAY),
@d3 := DATE_ADD(@d1, INTERVAL 2 DAY),
@d4 := DATE_ADD(@d1, INTERVAL 3 DAY),
@d5 := DATE_ADD(@d1, INTERVAL 4 DAY),
@d6 := DATE_ADD(@d1, INTERVAL 5 DAY),
@d7 := DATE_ADD(@d1, INTERVAL 6 DAY)
) AS vars,
(
SELECT
id,
datum,
schicht,
if( (schicht like '%1.%' or schicht='egal'),'X','') as FS ,
if( (schicht like '%2.%' or schicht='egal'),'X','') as SS,
if( (schicht like '%3.%' or schicht='egal'),'X','') as NS
FROM
eingabe
WHERE
datum BETWEEN @d1 AND @d7
) AS d
GROUP BY id";
$result = mysql_query($sql);
echo '<table>
<tr>
<th colspan="3" />';
//Schleife um alle Tage auszugeben
for($i = 0; $i <7; $i++){
echo '<th colspan="3">';
//Wochentag, ggf auf Deutsch wandeln -> googel: 'PHP Wochentag Deutsch'
echo strftime("%A", $date[$i]);
echo '<br />';
//Ausgabe des Datums
echo date('j.n.Y', $date[$i]);
echo'</th>';
}
echo '</tr><tr>
<th>ID:</th>
<th>Vorname:</th>
<th>Nachname:</th>';
//Schleife um für jeden Tag die Schichtnamen auszugeben
for($i = 0; $i<7; $i++){
echo '<th>FS:</th>
<th>SS:</th>
<th>NS:</th>';
}
echo '</tr>';
while($row = mysql_fetch_array($result)){
echo '<tr>';
echo "<td>{$row['id']}</td>";
echo "<td>{$row['vorname']}</td>";
echo "<td>{$row['nachname']}</td>";
//Schleife um für jeden Tag die Schichten auszugeben
for($i = 1; $i<=7; $i++){
echo "<td>{$row["FS{$i}"]}</td>";
echo "<td>{$row["SS{$i}"]}</td>";
echo "<td>{$row["NS{$i}"]}</td>";
}
echo '</tr>';
}
echo '</table>';
}
mysql_close();
?>
</body>
</html>
while($row = mysql_fetch_array($result)){
echo "<tbody>";
echo '<tr>';
echo "<td>{$row['id']}</td>";
echo "<td>{$row['nachname']}</td>";
echo "<td>{$row['vorname']}</td>";
//Schleife um für jeden Tag die Schichten auszugeben
for($i = 1; $i<=8; $i++){
if ($i % 2 == 0) {
$farbe = "#FFFFFF";
}
else {
$farbe = "#CCCCCC";
}
$datum = $_POST[theDate_start];
list ($jahr, $monat, $tag) = explode ("-", $datum);
$tstamp1 = mktime(date("H"),date("i"),date("s"),date($monat),date($tag)+1,date($jahr));
$tstamp2 = mktime(date("H"),date("i"),date("s"),date($monat),date(($tag)+2),date($jahr));
$tstamp3 = mktime(date("H"),date("i"),date("s"),date($monat),date($tag)+3,date($jahr));
$tstamp4 = mktime(date("H"),date("i"),date("s"),date($monat),date($tag)+4,date($jahr));
$tstamp5 = mktime(date("H"),date("i"),date("s"),date($monat),date($tag)+5,date($jahr));
$tstamp6 = mktime(date("H"),date("i"),date("s"),date($monat),date($tag)+6,date($jahr));
$tstamp7 = mktime(date("H"),date("i"),date("s"),date($monat),date($tag)+7,date($jahr));
$adddatum1 = date("Y-m-d",$tstamp1);
$adddatum2 = date("Y-m-d",$tstamp2);
$adddatum3 = date("Y-m-d",$tstamp3);
$adddatum4 = date("Y-m-d",$tstamp4);
$adddatum5 = date("Y-m-d",$tstamp5);
$adddatum6 = date("Y-m-d",$tstamp6);
$adddatum7 = date("Y-m-d",$tstamp7);
if ($_POST[theDate_start]) {
$datum = $_POST[theDate_start];
include ("../includes/_config.php");
$timestamp = strtotime($datum);
//Array mit allen Datums bestimmen
for($i = 0; $i <8; $i++){
$date[] = strtotime("+{$i} day", $timestamp);
}
$sql =
"SELECT
id,
vorname,
nachname,
@d1 AS datum1,
MAX(IF(datum = @d1, FS, NULL)) AS FS1,
MAX(IF(datum = @d1, SS, NULL)) AS SS1,
MAX(IF(datum = @d1, NS, NULL)) AS NS1,
@d2 AS datum2,
MAX(IF(datum = @d2, FS, NULL)) AS FS2,
MAX(IF(datum = @d2, SS, NULL)) AS SS2,
MAX(IF(datum = @d2, NS, NULL)) AS NS2,
@d3 AS datum3,
MAX(IF(datum = @d3, FS, NULL)) AS FS3,
MAX(IF(datum = @d3, SS, NULL)) AS SS3,
MAX(IF(datum = @d3, NS, NULL)) AS NS3,
@d4 AS datum4,
MAX(IF(datum = @d4, FS, NULL)) AS FS4,
MAX(IF(datum = @d4, SS, NULL)) AS SS4,
MAX(IF(datum = @d4, NS, NULL)) AS NS4,
@d5 AS datum5,
MAX(IF(datum = @d5, FS, NULL)) AS FS5,
MAX(IF(datum = @d5, SS, NULL)) AS SS5,
MAX(IF(datum = @d5, NS, NULL)) AS NS5,
@d6 AS datum6,
MAX(IF(datum = @d6, FS, NULL)) AS FS6,
MAX(IF(datum = @d6, SS, NULL)) AS SS6,
MAX(IF(datum = @d6, NS, NULL)) AS NS6,
@d7 AS datum7,
MAX(IF(datum = @d7, FS, NULL)) AS FS7,
MAX(IF(datum = @d7, SS, NULL)) AS SS7,
MAX(IF(datum = @d7, NS, NULL)) AS NS7,
@d7 AS datum8,
MAX(IF(datum = @d8, FS, NULL)) AS FS8,
MAX(IF(datum = @d8, SS, NULL)) AS SS8,
MAX(IF(datum = @d8, NS, NULL)) AS NS8
FROM
( SELECT
@d1 := '{$datumSqlString}',
@d2 := DATE_ADD(@d1, INTERVAL 1 DAY),
@d3 := DATE_ADD(@d1, INTERVAL 2 DAY),
@d4 := DATE_ADD(@d1, INTERVAL 3 DAY),
@d5 := DATE_ADD(@d1, INTERVAL 4 DAY),
@d6 := DATE_ADD(@d1, INTERVAL 5 DAY),
@d7 := DATE_ADD(@d1, INTERVAL 6 DAY),
@d8 := DATE_ADD(@d1, INTERVAL 7 DAY)
) AS vars,
(
SELECT
id,
vorname,
nachname,
datum,
schicht,
if( (schicht like '%1.%' or schicht='egal'),'X','') as FS ,
if( (schicht like '%2.%' or schicht='egal'),'X','') as SS,
if( (schicht like '%3.%' or schicht='egal'),'X','') as NS
FROM
eingabe
WHERE
datum BETWEEN @d1 AND @d8
) AS d
GROUP BY nachname";
$result = mysql_query($sql);
$adddatum1 = date("Y-m-d",$tstamp1);