Compare commits
4 Commits
max
...
e190b5bb8d
| Author | SHA1 | Date | |
|---|---|---|---|
| e190b5bb8d | |||
| 16be7cf3dc | |||
| cab0d36555 | |||
| 62df0fcaf0 |
@@ -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)
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
//Programmiert von: Max Heer, Getestet von:
|
||||
|
||||
namespace VPR_Schnittstelle\Controller;
|
||||
namespace kindergartenverwaltung\Controller;
|
||||
|
||||
use VPR_Schnittstelle\Libary\Msg;
|
||||
use VPR_Schnittstelle\Model\EnthaeltModel;
|
||||
use kindergartenverwaltung\Libary\Msg;
|
||||
use kindergartenverwaltung\Model\EnthaeltModel;
|
||||
|
||||
class EnthaeltController(){
|
||||
public function getInhaltsstoffe($gerichtId){
|
||||
@@ -16,10 +16,5 @@
|
||||
$result=$this->db->insertEnthaelt($data);
|
||||
return json_encode($result);
|
||||
}
|
||||
|
||||
public function deleteEnthaelt($id){
|
||||
$result=$this->db->deleteEnthaelt($id);
|
||||
return json_encode($result);
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,23 +0,0 @@
|
||||
<?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,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);
|
||||
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
<?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,6 +10,15 @@ use kindergartenverwaltung\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();
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace VPR_Schnittstelle\EnthaeltModel;
|
||||
namespace kindergartenverwaltung\EnthaeltModel;
|
||||
|
||||
use VPR_Schnittstelle\Library\Msg;
|
||||
use kindergartenverwaltung\Library\Msg;
|
||||
|
||||
class EnthaeltModel extends Database{
|
||||
|
||||
@@ -48,20 +48,5 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,63 +0,0 @@
|
||||
<?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,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();
|
||||
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
<?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