diff options
Diffstat (limited to 'Bachelor/Entwicklung webbasierter Anwendungen/Praktikum5_6/b-bestellzustand.php')
| -rw-r--r-- | Bachelor/Entwicklung webbasierter Anwendungen/Praktikum5_6/b-bestellzustand.php | 126 |
1 files changed, 126 insertions, 0 deletions
diff --git a/Bachelor/Entwicklung webbasierter Anwendungen/Praktikum5_6/b-bestellzustand.php b/Bachelor/Entwicklung webbasierter Anwendungen/Praktikum5_6/b-bestellzustand.php new file mode 100644 index 0000000..f1d7407 --- /dev/null +++ b/Bachelor/Entwicklung webbasierter Anwendungen/Praktikum5_6/b-bestellzustand.php @@ -0,0 +1,126 @@ +<?php
+ include ("classes.inc");
+ $Con=mysql_connect('localhost','ewa','ewa',3306)
+ or die('Could not connect: ' . mysql_error());
+ mysql_select_db('ewa') or die('Could not select database');
+ $query = "SELECT b.AuftragNr, b.SessionId, p.Bezeichnung, b.Lieferadresse, b.Zustand
+ FROM t_bestellung b
+ NATURAL JOIN t_pizza p
+ WHERE b.zustand = 'bestellt' OR b.zustand='imOfen' OR b.zustand='fertig'
+ ORDER BY Lieferadresse,Zeitpunkt
+ ";
+ $result = mysql_query($query) or die('Query failed: ' . mysql_error());
+
+ $Best=array();
+
+ $n=0;
+ while($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
+ $Best[$n] = new Bestellung(
+ $line[AuftragNr],
+ $line[SessionId],
+ $line[Lieferadresse],
+ $line[Bezeichnung],
+ $line[Zustand]
+ );
+ $n++;
+ }
+ //if (isset($_POST))
+ if (isset($_GET))
+ {
+ foreach ($_GET as $key => $val)
+ //echo "$key $val \n";
+ {
+ $auftrg_nr = substr($key,2);
+ //echo $auftrg_nr;
+ }
+
+ //if(is_array($Best))
+ {
+ //print_r($Best);
+ foreach ($Best as $aktBest) {
+ if ($aktBest->AuftNr == $auftrg_nr)
+ {
+ $pzAktZust = $aktBest->zustand;
+ $newZustand=$pzAktZust;
+ if ($pzAktZust == 'bestellt')
+ $newZustand = 'imOfen';
+ else if ($pzAktZust == 'imOfen')
+ $newZustand = 'fertig';
+ }
+ }
+ }
+
+ $update_str = "UPDATE t_bestellung b SET Zustand='$newZustand' WHERE b.AuftragNr = '$auftrg_nr'";
+ //echo $update_str;
+ $res = mysql_query($update_str) or die('Query failed: ' . mysql_error());
+ }
+?>
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+ "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+ <script type="text/javascript">
+ <!--
+ function submit_form() {
+ document.baecker.submit();
+ //parent.location.reload();
+ }
+ -->
+ </script>
+ <title>Pizzabäcker (bestellte Pizza)</title>
+ <link rel="stylesheet" type="text/css" href="formats.css">
+ <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+</head>
+
+<body>
+
+ <h1>Pizzabäcker (bestellte Pizza)</h1>
+ <?php
+ //echo "<form action=\"".$_SERVER['PHP_SELF']."\" method=\"POST\" name=\"baecker\">";
+ echo "<form action=\"".$_SERVER['PHP_SELF']."\" method=\"GET\" name=\"baecker\">";
+ //echo "<form action=\"http://www.fbi.h-da.de/cgi-bin/Echo.pl\" method=\"POST\" name=\"baecker\">";
+ ?>
+ <table>
+ <tr>
+ <td class="dummy">
+ </td>
+ </tr>
+ <tr>
+ <td class="dummy">
+ </td>
+ <td>im Ofen
+ </td>
+ <td>fertig
+ </td>
+ </tr>
+ <?php
+ if (is_array($Best))
+ {
+ foreach ($Best as $aktBest)
+ {
+ $nr=$aktBest->getauftnr();
+ echo"<tr>\n<td>";
+ $aktName =$aktBest->getpiz_name();
+ echo $aktName;
+ $aktZustand = $aktBest->zustand;
+ echo "</td>";
+ if ($aktZustand == 'imOfen') {
+ echo "<td><input type=\"radio\" name=\"nr$nr\" CHECKED DISABLED></td>\n";
+ echo "<td><input onclick=\"submit_form()\" type=\"radio\" name=\"nr$nr\"></td>\n";
+ }
+ else if ($aktZustand == 'bestellt') {
+ echo "<td><input onclick=\"submit_form()\" type=\"radio\" name=\"nr$nr\"></td>\n";
+ echo "<td><input type=\"radio\" name=\"nr$nr\" DISABLED></td>\n";
+ } else if ($aktZustand == 'fertig') {
+ echo "<td><input type=\"radio\" name=\"nr$nr\" DISABLED></td>\n";
+ echo "<td><input type=\"radio\" name=\"nr$nr\" CHECKED DISABLED></td>\n";
+ }
+ echo "</tr>\n";
+ }
+ }
+ ?>
+ </table>
+ </form>
+</body>
+</html>
\ No newline at end of file |
