Compare commits
8 Commits
ef45413bee
...
max
Author | SHA1 | Date | |
---|---|---|---|
7810fff20b | |||
b104c8a6fc | |||
78ba32377b | |||
e4003ad37d | |||
7e034abf8c | |||
2b7811f044 | |||
![]() |
55c9fe1c51 | ||
976dc6a3ab |
@@ -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);
|
||||
}
|
||||
?>
|
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);
|
||||
}
|
||||
?>
|
21
Controller/istTeilController.php
Normal file
21
Controller/istTeilController.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
// Erstellt durch Stefan Groß
|
||||
namespace kinderverwaltung\Controller;
|
||||
|
||||
class istTeilController {
|
||||
private $db;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
$this-> db = new istTeilModel();
|
||||
|
||||
}
|
||||
|
||||
public function getBestellung(){
|
||||
$result = $this->db->getBestellung();
|
||||
|
||||
return json_encode($result);
|
||||
}
|
||||
}
|
||||
?>
|
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace kindergartenverwaltung\EnthaeltModel;
|
||||
namespace VPR_Schnittstelle\EnthaeltModel;
|
||||
|
||||
use kindergartenverwaltung\Library\Msg;
|
||||
use VPR_Schnittstelle\Library\Msg;
|
||||
|
||||
class EnthaeltModel extends Database{
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
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;
|
||||
}
|
||||
}
|
||||
?>
|
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;
|
||||
}
|
||||
}
|
||||
?>
|
45
Model/istTeilModel.php
Normal file
45
Model/istTeilModel.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace kinderverwaltung\Model;
|
||||
|
||||
use kinderverwaltung\Library\Msg;
|
||||
use ppb\Model\Database;
|
||||
|
||||
class IstTeilModel extends Database{
|
||||
|
||||
public function getBestellung(){
|
||||
$pdo = $this -> linkDB();
|
||||
|
||||
$sql = "SELECT bid FROM istTeil";
|
||||
|
||||
try {
|
||||
$stmt = $pdo->prepare($sql);
|
||||
}catch (\PDOException $e){
|
||||
//nur zum Testen:
|
||||
//new Msg(true,null,$e);
|
||||
//echo $e;
|
||||
return false;
|
||||
}
|
||||
return $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
|
||||
public function InsertIstTeil($data){
|
||||
$pdo = $this -> linkDB();
|
||||
|
||||
$sql = "INSERT INTO istTeil(bid, gid)";
|
||||
|
||||
|
||||
|
||||
try {
|
||||
$stmt = $pdo->prepare($sql);
|
||||
}catch (\PDOException $e){
|
||||
//nur zum Testen:
|
||||
//new Msg(true,null,$e);
|
||||
//echo $e;
|
||||
return false;
|
||||
}
|
||||
return $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
}
|
||||
}
|
||||
?>
|
Reference in New Issue
Block a user