Compare commits
7 Commits
stefan
...
e190b5bb8d
| Author | SHA1 | Date | |
|---|---|---|---|
| e190b5bb8d | |||
| 16be7cf3dc | |||
| cab0d36555 | |||
| 62df0fcaf0 | |||
| 2b7811f044 | |||
| 976dc6a3ab | |||
| ef45413bee |
@@ -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)
|
||||
|
||||
|
||||
20
Controller/EnthaeltController.php
Normal file
20
Controller/EnthaeltController.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
//Programmiert von: Max Heer, Getestet von:
|
||||
|
||||
namespace kindergartenverwaltung\Controller;
|
||||
|
||||
use kindergartenverwaltung\Libary\Msg;
|
||||
use kindergartenverwaltung\Model\EnthaeltModel;
|
||||
|
||||
class EnthaeltController(){
|
||||
public function getInhaltsstoffe($gerichtId){
|
||||
$result=$this->db->getEnthaelt($gerichtId);
|
||||
return json_encode($result);
|
||||
}
|
||||
|
||||
public function insertEnthaelt($data){
|
||||
$result=$this->db->insertEnthaelt($data);
|
||||
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);
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
52
Model/EnthaeltModel.php
Normal file
52
Model/EnthaeltModel.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
namespace kindergartenverwaltung\EnthaeltModel;
|
||||
|
||||
use kindergartenverwaltung\Library\Msg;
|
||||
|
||||
class EnthaeltModel extends Database{
|
||||
|
||||
public function getEnthaelt($gerichtId){
|
||||
$pdo=$this->linkDB();
|
||||
$params = array();
|
||||
$sql = "SELECT * FROM Enthaelt WHERE gid = :gerichtId;";
|
||||
$params[":gerichtId"] = gerichtId;
|
||||
try{
|
||||
$stmt = $pdo->prepare($sql);
|
||||
$stmt->execute($params);
|
||||
}
|
||||
catch(\PDOExeption $e){
|
||||
return false;
|
||||
}
|
||||
$result = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function insertEnthaelt($data){
|
||||
$pdo=$this->linkDB();
|
||||
$params = array();
|
||||
$sql = "INSERT INTO Enthaelt (";
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -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