Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
7810fff20b | |||
b104c8a6fc | |||
78ba32377b | |||
e4003ad37d | |||
7e034abf8c | |||
2b7811f044 | |||
976dc6a3ab | |||
ef45413bee |
25
Controller/EnthaeltController.php
Normal file
25
Controller/EnthaeltController.php
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
//Programmiert von: Max Heer, Getestet von:
|
||||||
|
|
||||||
|
namespace VPR_Schnittstelle\Controller;
|
||||||
|
|
||||||
|
use VPR_Schnittstelle\Libary\Msg;
|
||||||
|
use VPR_Schnittstelle\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);
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
?>
|
67
Model/EnthaeltModel.php
Normal file
67
Model/EnthaeltModel.php
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
<?php
|
||||||
|
namespace VPR_Schnittstelle\EnthaeltModel;
|
||||||
|
|
||||||
|
use VPR_Schnittstelle\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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
Reference in New Issue
Block a user