diff --git a/Controller/BenutzerController.php b/Controller/BenutzerController.php index cb06bff..d87166f 100644 --- a/Controller/BenutzerController.php +++ b/Controller/BenutzerController.php @@ -56,6 +56,13 @@ class BenutzerController return json_encode($result); } + public function anmeldeVersuch() + { + $result = $this->db->anmeldeVersuch(); + + return json_encode($result); + } + } ?> \ No newline at end of file diff --git a/Controller/KindController.php b/Controller/KindController.php index fb744ac..73a195b 100644 --- a/Controller/KindController.php +++ b/Controller/KindController.php @@ -48,7 +48,7 @@ class KindController { $result = $this->db->deleteKind($kindId); - return $result; + return json_encode($result); } } diff --git a/Controller/TagesplanController.php b/Controller/TagesplanController.php index aed591d..a109ac0 100644 --- a/Controller/TagesplanController.php +++ b/Controller/TagesplanController.php @@ -33,5 +33,11 @@ class TagesplanController $result = $this->db->deleteTagesplan($id); return json_encode($result); } + + public function getGerichteOnTag() + { + $result = $this->db->getGerichteOnTag(); + return json_encode($result); + } } ?> \ No newline at end of file diff --git a/Model/BenutzerModel.php b/Model/BenutzerModel.php index 225c767..397505a 100644 --- a/Model/BenutzerModel.php +++ b/Model/BenutzerModel.php @@ -117,6 +117,7 @@ class BenutzerModel extends Database $stmt = $pdo->prepare($sql); $stmt->execute($params); } catch (\PDOException $e) { + echo "Faulty Sql? " . $sql; return false; } @@ -136,6 +137,7 @@ class BenutzerModel extends Database $stmt = $pdo->prepare($sql); $stmt->execute(); } catch (\PDOException $e) { + echo "Faulty Sql? " . $sql; return false; } @@ -144,6 +146,34 @@ class BenutzerModel extends Database return $result; } + + public function anmeldeVersuch() + { + + $pdo = $this->linkDB(); + + $params = array(); + + $params[":Benutzername"] = $_GET["Benutzername"]; + $params[":passwort"] = $_GET["passwort"]; + + $sql = "SELECT * FROM Benutzerkonto WHERE name = :Benutzername AND passwort = :passwort"; + + try { + $stmt = $pdo->prepare($sql); + $stmt->execute($params); + } catch (\PDOException $e) { + return false; + } + + $result = $stmt->fetchALL(\PDO::FETCH_ASSOC); + + if (count($result) > 0) + return true; + else + return false; + + } } ?> \ No newline at end of file diff --git a/Model/TagesplanModel.php b/Model/TagesplanModel.php index 797c47d..84db2ad 100644 --- a/Model/TagesplanModel.php +++ b/Model/TagesplanModel.php @@ -65,5 +65,28 @@ class TagesplanModel extends Database return false; } } + + public function getGerichteOnTag() + { + + $pdo = $this->linkDB(); + + $datum = $_GET["datum"]; + + $sql = "SELECT Gericht.id, Gericht.name, Gericht.preis, Gericht.beschreibung FROM Gericht LEFT JOIN GibtsAm ON Gericht.id = GibtsAm.gid LEFT JOIN Tagesplan ON GibtsAm.tid = Tagesplan.id WHERE Tagesplan.datum = '$datum'"; + + try { + $stmt = $pdo->prepare($sql); + $stmt->execute(); + } catch (\PDOException $e) { + echo $sql . " This do be faulty"; + return false; + } + + $result = $stmt->fetchAll(\PDO::FETCH_ASSOC); + + return $result; + + } } ?> \ No newline at end of file