Compare commits
5 Commits
e190b5bb8d
...
max
| Author | SHA1 | Date | |
|---|---|---|---|
| 7810fff20b | |||
| b104c8a6fc | |||
| 78ba32377b | |||
| e4003ad37d | |||
| 7e034abf8c |
@@ -16,7 +16,6 @@ class BenutzerController{
|
|||||||
$this->db = new BenutzerModel();
|
$this->db = new BenutzerModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Updated einen Benutzer
|
|
||||||
public function updateBenutzer($elternId, $data){
|
public function updateBenutzer($elternId, $data){
|
||||||
|
|
||||||
$result = $this->db->updateBenutzer($benutzerId, $data);
|
$result = $this->db->updateBenutzer($benutzerId, $data);
|
||||||
@@ -25,7 +24,6 @@ class BenutzerController{
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fügt einen Benutzer in die Datenbank hinzu
|
|
||||||
public function insertBenutzer($data){
|
public function insertBenutzer($data){
|
||||||
$result = $this->db->insertBenutzer($data)
|
$result = $this->db->insertBenutzer($data)
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
//Programmiert von: Max Heer, Getestet von:
|
//Programmiert von: Max Heer, Getestet von:
|
||||||
|
|
||||||
namespace kindergartenverwaltung\Controller;
|
namespace VPR_Schnittstelle\Controller;
|
||||||
|
|
||||||
use kindergartenverwaltung\Libary\Msg;
|
use VPR_Schnittstelle\Libary\Msg;
|
||||||
use kindergartenverwaltung\Model\EnthaeltModel;
|
use VPR_Schnittstelle\Model\EnthaeltModel;
|
||||||
|
|
||||||
class EnthaeltController(){
|
class EnthaeltController(){
|
||||||
public function getInhaltsstoffe($gerichtId){
|
public function getInhaltsstoffe($gerichtId){
|
||||||
@@ -16,5 +16,10 @@
|
|||||||
$result=$this->db->insertEnthaelt($data);
|
$result=$this->db->insertEnthaelt($data);
|
||||||
return json_encode($result);
|
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);
|
||||||
|
}
|
||||||
|
?>
|
||||||
@@ -24,21 +24,18 @@ class KindController{
|
|||||||
return json_encode($result);
|
return json_encode($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Updated ein Kind
|
|
||||||
public function updateKind($kindId, $data){
|
public function updateKind($kindId, $data){
|
||||||
$result = $this->db->updateKind($kindId, $data);
|
$result = $this->db->updateKind($kindId, $data);
|
||||||
|
|
||||||
return json_encode($result);
|
return json_encode($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fügt ein Kind hinzu
|
|
||||||
public function addKind($data){
|
public function addKind($data){
|
||||||
$result = $this->db->addKind($data);
|
$result = $this->db->addKind($data);
|
||||||
|
|
||||||
return json_encode($data);
|
return json_encode($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Löscht ein Kind
|
|
||||||
public function deleteKind($kindId){
|
public function deleteKind($kindId){
|
||||||
$result = $this->db->deleteKind($kindId);
|
$result = $this->db->deleteKind($kindId);
|
||||||
|
|
||||||
|
|||||||
23
Controller/TagesplanController.php
Normal file
23
Controller/TagesplanController.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\TagesplanModel;
|
||||||
|
|
||||||
|
public function getTagesplan(){
|
||||||
|
$result=$this->db->getTagesplan();
|
||||||
|
return json_encode($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function insertTagesplan($data){
|
||||||
|
$result=$this->db->insertTagesplan($data);
|
||||||
|
return json_encode($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteTagesplan($id){
|
||||||
|
$result=$this->db->deleteTagesplan($id);
|
||||||
|
return json_encode($result);
|
||||||
|
}
|
||||||
|
?>
|
||||||
@@ -10,15 +10,6 @@ use kindergartenverwaltung\Model\BenutzerModel;
|
|||||||
|
|
||||||
class BenutzerModel extends Database{
|
class BenutzerModel extends Database{
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Updated einen Benutzer
|
|
||||||
*
|
|
||||||
* @param $elternId Die Id des Elternaccounts
|
|
||||||
* @param $data Die gegebenen Daten
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function updateBenutzer($elternId, $data){
|
public function updateBenutzer($elternId, $data){
|
||||||
$pdo = $this->linkDB();
|
$pdo = $this->linkDB();
|
||||||
|
|
||||||
@@ -49,13 +40,6 @@ class BenutzerModel extends Database{
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Fügt einen neuen Benutzer in der Datenbank hinzu
|
|
||||||
*
|
|
||||||
* @param $data Die gegebenen Daten
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function insertBenutzer($data){
|
public function insertBenutzer($data){
|
||||||
$pdo = $this->linkDB();
|
$pdo = $this->linkDB();
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace kindergartenverwaltung\EnthaeltModel;
|
namespace VPR_Schnittstelle\EnthaeltModel;
|
||||||
|
|
||||||
use kindergartenverwaltung\Library\Msg;
|
use VPR_Schnittstelle\Library\Msg;
|
||||||
|
|
||||||
class EnthaeltModel extends Database{
|
class EnthaeltModel extends Database{
|
||||||
|
|
||||||
@@ -48,5 +48,20 @@
|
|||||||
return false;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
63
Model/InhaltsstoffModel.php
Normal file
63
Model/InhaltsstoffModel.php
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
//Programmiert von: Max Heer, Getestet von:
|
||||||
|
|
||||||
|
namespace VPR_Schnittstelle\EnthaeltModel;
|
||||||
|
use VPR_Scnittstelle\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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@@ -38,7 +38,6 @@ public function getKind($parentId){
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* Updated die Daten eines Kindes
|
* Updated die Daten eines Kindes
|
||||||
*
|
*
|
||||||
* @param $kindId Id des Kindes
|
* @param $kindId Id des Kindes
|
||||||
@@ -77,9 +76,6 @@ 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
|
* @param $data Die Daten für das neue Kind
|
||||||
*/
|
*/
|
||||||
public function addKind($data){
|
public function addKind($data){
|
||||||
@@ -116,13 +112,7 @@ public function addKind($data){
|
|||||||
return $result;
|
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){
|
public function deleteKind($kindId){
|
||||||
$pdo = $this->linkDB();
|
$pdo = $this->linkDB();
|
||||||
|
|
||||||
|
|||||||
63
Model/TagesplanModel.php
Normal file
63
Model/TagesplanModel.php
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
//Programmiert von: Max Heer, Getestet von:
|
||||||
|
|
||||||
|
namespace VPR_Schnittstelle\EnthaeltModel;
|
||||||
|
use VPR_Schnittstelle\Library\Msg;
|
||||||
|
|
||||||
|
public function getTagesplan(){
|
||||||
|
$pdo=$this->linkDB();
|
||||||
|
$sql = "SELECT * FROM Tagesplan;";
|
||||||
|
try{
|
||||||
|
$stmt = $pdo->prepare($sql);
|
||||||
|
$stmt->execute();
|
||||||
|
}
|
||||||
|
catch(\PDOExeption $e){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$result = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function insertTagesplan($data){
|
||||||
|
$pdo=$this->linkDB();
|
||||||
|
$params = array();
|
||||||
|
$sql = "INSERT INTO Tagesplan (";
|
||||||
|
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 delteTagesplan($id){
|
||||||
|
$pdo=$this->linkDB();
|
||||||
|
$params = array();
|
||||||
|
$sql = "DELETE FROM Tagesplan WHERE id=:id;";
|
||||||
|
$params[":id"] = $id;
|
||||||
|
try{
|
||||||
|
$stmt = $pdo->prepare($sql);
|
||||||
|
$stmt->execute($params);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch(\PDOExeption $e){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
Reference in New Issue
Block a user