Compare commits

..

No commits in common. "b6ec972c19e3e3126414554b9172c0bb21a4de92" and "3f5bd9b1bc2a9dd583b21d5740634140a2ac6d5e" have entirely different histories.

4 changed files with 0 additions and 200 deletions

View File

@ -1,32 +0,0 @@
<?php
//Erstellt durch Stefan Groß - Samuel Wolff
namespace ppb\Controller;
use ppb\Model\FilterModel;
class FilterController
{
private $db;
public function __construct()
{
$this->db = new FilterModel();
}
public function writeFilter($data)
{
$results = $this->db->insertFilter($data);
return json_encode($results);
}
public function deleteFilter($id)
{
$results = $this->db->deleteFilter($id);
return json_encode($results);
}
}

View File

@ -1,42 +0,0 @@
<?php
//Erstellt durch Stefan Groß - Getestet von Samuel Wolff
namespace ppb\Controller;
use ppb\Model\GibtsAmModel;
class GibtsAmController
{
private $db;
public function __construct()
{
$this->db = new GibtsAmModel();
}
public function getGibtsAm()
{
$result = $this->db->selectGibtsAm();
return json_encode($result);
}
public function writeGibtsAm($data)
{
$result = $this->db->insertGibtsAm($data);
return json_encode($result);
}
public function deleteGibtsAm($id)
{
$result = $this->db->deleteGibtsAm($id);
return json_encode($result);
}
}
?>

View File

@ -1,52 +0,0 @@
<?php
namespace ppb\Model;
use ppb\Model\Database;
//Erstellt durch Stefan Groß - Samuel Wolff
class FilterModel extends Database
{
public function insertFilter($data)
{
$pdo = $this->linkDB();
$params = array();
$sql = "INSERT INTO Filter (kid, iid) VALUES (:kid, :iid)";
$params[":kid"] = $data["kid"];
$params[":iid"] = $data["iid"];
try {
$stmt = $pdo->prepare($sql);
$stmt->execute($params);
} catch (\PDOException $e) {
echo $sql;
return false;
}
return true;
}
public function deleteFilter($id)
{
$pdo = $this->linkDB();
$params = array();
$sql = "DELETE FROM Filter WHERE id = :id";
$params[":id"] = $id;
try {
$stmt = $pdo->prepare($sql);
$stmt->execute($params);
} catch (\PDOException $e) {
echo $sql;
return false;
}
return true;
}
}

View File

@ -1,74 +0,0 @@
<?php
namespace ppb\Model;
//Programmiert von Stefan Groß - Getestet von Samuel Wolff
class GibtsAmModel extends Database
{
public function selectGibtsAm()
{
$pdo = $this->linkDB();
$sql = "SELECT * FROM GibtsAm";
try {
$stmt = $pdo->prepare($sql);
$stmt->execute();
} catch (\PDOException $e) {
return false;
}
$results = $stmt->fetchAll(\PDO::FETCH_ASSOC);
foreach ($results as $key => $value) {
$results[$key]["id"] += 0;
$results[$key]["tid"] += 0;
$results[$key]["gid"] += 0;
}
return $results;
}
public function insertGibtsAm($data)
{
$pdo = $this->linkDB();
$params = array();
$sql = "INSERT INTO GibtsAm (tid, gid) VALUES (:tid, :gid)";
$params[":tid"] = $data["tid"];
$params[":gid"] = $data["gid"];
try {
$stmt = $pdo->prepare($sql);
$stmt->execute($params);
} catch (\PDOException $e) {
echo $sql;
return false;
}
return true;
}
public function deleteGibtsAm($id)
{
$pdo = $this->linkDB();
$params = array();
$sql = "DELETE FROM GibtsAm WHERE id = :id";
$params[":id"] = $id;
try {
$stmt = $pdo->prepare($sql);
$stmt->execute($params);
} catch (\PDOException $e) {
return false;
}
return true;
}
}
?>