Compare commits
14 Commits
sven
...
23df80f0db
Author | SHA1 | Date | |
---|---|---|---|
23df80f0db | |||
78ba32377b | |||
5765d49e01 | |||
c28a3eb452 | |||
9f7060d202 | |||
e4003ad37d | |||
a915732afd | |||
05dcaf2555 | |||
e190b5bb8d | |||
16be7cf3dc | |||
cab0d36555 | |||
62df0fcaf0 | |||
6e52a22691 | |||
7e034abf8c |
@@ -3,10 +3,10 @@
|
||||
// Programmiert durch Samuel Wolff
|
||||
// Getestet durch: Nicht getestet
|
||||
|
||||
namespace kindergartenverwaltung\Controller;
|
||||
namespace ppb\Controller;
|
||||
|
||||
use kindergartenverwaltung\Library\Msg;
|
||||
use kindergartenverwaltung\Model\BenutzerModel;
|
||||
use ppb\Library\Msg;
|
||||
use ppb\Model\BenutzerModel;
|
||||
|
||||
class BenutzerController{
|
||||
|
||||
@@ -16,6 +16,7 @@ class BenutzerController{
|
||||
$this->db = new BenutzerModel();
|
||||
}
|
||||
|
||||
// Updated einen Benutzer
|
||||
public function updateBenutzer($elternId, $data){
|
||||
|
||||
$result = $this->db->updateBenutzer($benutzerId, $data);
|
||||
@@ -24,6 +25,7 @@ class BenutzerController{
|
||||
|
||||
}
|
||||
|
||||
// Fügt einen Benutzer in die Datenbank hinzu
|
||||
public function insertBenutzer($data){
|
||||
$result = $this->db->insertBenutzer($data)
|
||||
|
||||
|
@@ -5,7 +5,7 @@
|
||||
namespace ppb\Controller;
|
||||
|
||||
use ppb\Library\Msg;
|
||||
use ppb\Model\GerichtModel;
|
||||
use ppb\Model\BestellungModel;
|
||||
|
||||
class BestellungController {
|
||||
|
||||
|
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
//Programmiert von: Max Heer, Getestet von:
|
||||
|
||||
namespace kindergartenverwaltung\Controller;
|
||||
namespace VPR_Schnittstelle\Controller;
|
||||
|
||||
use kindergartenverwaltung\Libary\Msg;
|
||||
use kindergartenverwaltung\Model\EnthaeltModel;
|
||||
use VPR_Schnittstelle\Libary\Msg;
|
||||
use VPR_Schnittstelle\Model\EnthaeltModel;
|
||||
|
||||
class EnthaeltController(){
|
||||
public function getInhaltsstoffe($gerichtId){
|
||||
@@ -16,5 +16,10 @@
|
||||
$result=$this->db->insertEnthaelt($data);
|
||||
return json_encode($result);
|
||||
}
|
||||
|
||||
public function deleteEnthaelt($id){
|
||||
$result=$this->db->deleteEnthaelt($id);
|
||||
return json_encode($result);
|
||||
}
|
||||
}
|
||||
?>
|
23
Controller/InhaltsstoffController.php
Normal file
23
Controller/InhaltsstoffController.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
//Programmiert von: Max Heer, Getestet von:
|
||||
|
||||
namespace VPR_Schnittstelle\Controller;
|
||||
|
||||
use VPR_Schnittstelle\Libary\Msg;
|
||||
use VPR_Schnittstelle\Model\InhaltsstoffModel;
|
||||
|
||||
public function getInhaltsstoff(){
|
||||
$result=$this->db->getInhaltsstoff();
|
||||
return json_encode($result);
|
||||
}
|
||||
|
||||
public function insertInhaltsstoff($data){
|
||||
$result=$this->db->insertInhaltsstoff($data);
|
||||
return json_encode($result);
|
||||
}
|
||||
|
||||
public function deleteInhaltsstoff($id){
|
||||
$result=$this->db->deleteInhaltsstoff($id);
|
||||
return json_encode($result);
|
||||
}
|
||||
?>
|
@@ -3,10 +3,10 @@
|
||||
// Programmiert durch Samuel Wolff
|
||||
// Getestet durch: Nicht getestet
|
||||
|
||||
namespace kindergartenverwaltung\Controller;
|
||||
namespace ppb\Controller;
|
||||
|
||||
use kindergartenverwaltung\Library\Msg;
|
||||
use kindergartenverwaltung\Model\KindModel;
|
||||
use ppb\Library\Msg;
|
||||
use ppb\Model\KindModel;
|
||||
|
||||
class KindController{
|
||||
|
||||
@@ -24,18 +24,21 @@ class KindController{
|
||||
return json_encode($result);
|
||||
}
|
||||
|
||||
// Updated ein Kind
|
||||
public function updateKind($kindId, $data){
|
||||
$result = $this->db->updateKind($kindId, $data);
|
||||
|
||||
return json_encode($result);
|
||||
}
|
||||
|
||||
// Fügt ein Kind hinzu
|
||||
public function addKind($data){
|
||||
$result = $this->db->addKind($data);
|
||||
|
||||
return json_encode($data);
|
||||
}
|
||||
|
||||
// Löscht ein Kind
|
||||
public function deleteKind($kindId){
|
||||
$result = $this->db->deleteKind($kindId);
|
||||
|
||||
|
@@ -3,13 +3,22 @@
|
||||
// Programmiert durch Samuel Wolff
|
||||
// Getestet durch: Nicht getestet
|
||||
|
||||
namespace kindergartenverwaltung\Controller;
|
||||
namespace ppb\Controller;
|
||||
|
||||
use kindergartenverwaltung\Library\Msg;
|
||||
use kindergartenverwaltung\Model\BenutzerModel;
|
||||
use ppb\Library\Msg;
|
||||
use ppb\Model\BenutzerModel;
|
||||
|
||||
class BenutzerModel extends Database{
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Updated einen Benutzer
|
||||
*
|
||||
* @param $elternId Die Id des Elternaccounts
|
||||
* @param $data Die gegebenen Daten
|
||||
*
|
||||
*/
|
||||
public function updateBenutzer($elternId, $data){
|
||||
$pdo = $this->linkDB();
|
||||
|
||||
@@ -40,6 +49,13 @@ class BenutzerModel extends Database{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Fügt einen neuen Benutzer in der Datenbank hinzu
|
||||
*
|
||||
* @param $data Die gegebenen Daten
|
||||
*
|
||||
*/
|
||||
public function insertBenutzer($data){
|
||||
$pdo = $this->linkDB();
|
||||
|
||||
|
@@ -62,7 +62,7 @@ class BestellungModel extends Database {
|
||||
*/
|
||||
public function updateBestellung($id, $data){
|
||||
$pdo = $this->linkDB();
|
||||
$sql = "UPDATE Bestellung SET "
|
||||
$sql = "UPDATE Bestellung SET ";
|
||||
//Fügt alle Parameter und einen Platzhalter in den SQL Befehl ein
|
||||
foreach (array_keys($data) as $key){
|
||||
$sql .= $key . " = :" . $key. ",";
|
||||
|
@@ -9,7 +9,7 @@ abstract class Database {
|
||||
/**
|
||||
* Zugangsdaten für die Datenbank
|
||||
*/
|
||||
private $dbName = "pbs2h22aal_av"; //Datenbankname
|
||||
private $dbName = "pbs2h22aal_SubwaySurfers"; //Datenbankname
|
||||
private $linkName = "mysql.pb.bib.de"; //Datenbank-Server
|
||||
//Administration: https://mysql.pb.bib.de/phpMyAdmin/
|
||||
private $user = "pbs2h22aal"; //Benutzername
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace kindergartenverwaltung\EnthaeltModel;
|
||||
namespace VPR_Schnittstelle\EnthaeltModel;
|
||||
|
||||
use kindergartenverwaltung\Library\Msg;
|
||||
|
||||
@@ -48,5 +48,20 @@
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteEnthaelt($id){
|
||||
$pdo=$this->linkDB();
|
||||
$params = array();
|
||||
$sql = "DELETE FROM Enthaelt WHERE id=:id";
|
||||
$params[":id"] = $id;
|
||||
try{
|
||||
$stmt = $pdo->prepare($sql);
|
||||
$stmt->execute($params);
|
||||
return true;
|
||||
}
|
||||
catch(\PDOExeption $e){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
@@ -62,7 +62,7 @@ class GerichtModel extends Database {
|
||||
*/
|
||||
public function updateGericht($id, $data){
|
||||
$pdo = $this->linkDB();
|
||||
$sql = "UPDATE Gericht SET "
|
||||
$sql = "UPDATE Gericht SET ";
|
||||
//Fügt alle Parameter und einen Platzhalter in den SQL Befehl ein
|
||||
foreach (array_keys($data) as $key){
|
||||
$sql .= $key . " = :" . $key. ",";
|
||||
|
60
Model/InhaltsstoffModel.php
Normal file
60
Model/InhaltsstoffModel.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
namespace VPR_Schnittstelle\EnthaeltModel;
|
||||
use kindergartenverwaltung\Library\Msg;
|
||||
|
||||
public function getInhaltsstoff(){
|
||||
$pdo=$this->linkDB();
|
||||
$sql = "SELECT * FROM Inhaltsstoff";
|
||||
try{
|
||||
$stmt = $pdo->prepare($sql);
|
||||
$stmt->execute();
|
||||
}
|
||||
catch(\PDOExeption $e){
|
||||
return false;
|
||||
}
|
||||
$result = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function insertInhaltsstoff($data){
|
||||
$pdo=$this->linkDB();
|
||||
$params = array();
|
||||
$sql = "INSERT INTO Inhaltsstoff ";
|
||||
foreach($data as $index=>$value){
|
||||
$sql .= "".$index.",";
|
||||
}
|
||||
$sql = substr($sql,0,strlen($sql)-1).") VALUES (";
|
||||
|
||||
foreach($data as $index=>$value){
|
||||
$sql .= "':".$index."',";
|
||||
$params[":".$index] = $value;
|
||||
}
|
||||
|
||||
$sql = substr($sql,0,strlen($sql)-1).");";
|
||||
|
||||
try{
|
||||
$stmt = $pdo->prepare($sql);
|
||||
$stmt->execute($params);
|
||||
return true;
|
||||
}
|
||||
catch(\PDOExeption $e){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteInhaltsstoff($id){
|
||||
$pdo=$this->linkDB();
|
||||
$params = array();
|
||||
$sql = "DELETE FROM Inhalsstoff WHERE id=:id";
|
||||
$params[":id"] = $id;
|
||||
try{
|
||||
$stmt = $pdo->prepare($sql);
|
||||
$stmt->execute($params);
|
||||
return true;
|
||||
}
|
||||
catch(\PDOExeption $e){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
?>
|
@@ -3,9 +3,9 @@
|
||||
// Programmiert durch Samuel Wolff
|
||||
// Getestet durch: Nicht getestet
|
||||
|
||||
namespace kindergartenverwaltung\Model;
|
||||
namespace ppb\Model;
|
||||
|
||||
use kindergartenverwaltung\Library\Msg;
|
||||
use ppb\Library\Msg;
|
||||
|
||||
|
||||
class KindModel extends Database{
|
||||
@@ -19,14 +19,14 @@ public function getKind($parentId){
|
||||
|
||||
// Das mitgeben einer Id erlaubt es die Kinder eines bestimmten Benutzerkontos anzeigen zu lassen,
|
||||
// während das leerlassen alle Kinder ausgibt.
|
||||
id($parentId !== false){
|
||||
$sql. = " WHERE bid=:id;";
|
||||
if($parentId !== false){
|
||||
$sql .= " WHERE bid=:id;";
|
||||
$params[":id"] = $parentId;
|
||||
}
|
||||
|
||||
try{
|
||||
$stmt = $pdo->prepare($sql);
|
||||
$stmt->excute($params);
|
||||
$stmt->execute($params);
|
||||
}
|
||||
catch(\PDOException $e){
|
||||
return false;
|
||||
@@ -38,6 +38,7 @@ public function getKind($parentId){
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Updated die Daten eines Kindes
|
||||
*
|
||||
* @param $kindId Id des Kindes
|
||||
@@ -76,6 +77,9 @@ public function updateKind($kindId, $data){
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Fügt ein Kind mit gegebenen Daten in die Datenbank hinzu
|
||||
*
|
||||
* @param $data Die Daten für das neue Kind
|
||||
*/
|
||||
public function addKind($data){
|
||||
@@ -112,7 +116,13 @@ public function addKind($data){
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Löscht ein Kind mit einer gegebenen Id aus der Datenbank
|
||||
*
|
||||
* @param $kindId Die Id des zu löschenden Kindes
|
||||
*
|
||||
*/
|
||||
public function deleteKind($kindId){
|
||||
$pdo = $this->linkDB();
|
||||
|
||||
|
Reference in New Issue
Block a user