2023-12-20 09:12:15 +01:00
|
|
|
<?php
|
|
|
|
|
2024-01-14 18:30:05 +01:00
|
|
|
//Programmiert von: Max Heer, Getestet von: Samuel Wolff
|
2023-12-20 09:12:15 +01:00
|
|
|
|
2024-01-14 18:30:05 +01:00
|
|
|
namespace ppb\Model;
|
2023-12-20 09:12:15 +01:00
|
|
|
|
2024-01-14 18:30:05 +01:00
|
|
|
use ppb\Library\Msg;
|
|
|
|
|
|
|
|
class TagesplanModel extends Database
|
|
|
|
{
|
|
|
|
|
|
|
|
public function getTagesplan()
|
|
|
|
{
|
|
|
|
$pdo = $this->linkDB();
|
2023-12-20 09:12:15 +01:00
|
|
|
$sql = "SELECT * FROM Tagesplan";
|
2024-01-14 18:30:05 +01:00
|
|
|
try {
|
2023-12-20 09:12:15 +01:00
|
|
|
$stmt = $pdo->prepare($sql);
|
|
|
|
$stmt->execute();
|
2024-01-14 18:30:05 +01:00
|
|
|
} catch (\PDOException $e) {
|
2023-12-20 09:12:15 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
$result = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
|
2024-01-14 18:30:05 +01:00
|
|
|
public function insertTagesplan($data)
|
|
|
|
{
|
|
|
|
$pdo = $this->linkDB();
|
2023-12-20 09:12:15 +01:00
|
|
|
$params = array();
|
|
|
|
$sql = "INSERT INTO Tagesplan (";
|
2024-01-14 18:30:05 +01:00
|
|
|
foreach ($data as $index => $value) {
|
|
|
|
$sql .= "" . $index . ",";
|
2023-12-20 09:12:15 +01:00
|
|
|
}
|
2024-01-14 18:30:05 +01:00
|
|
|
$sql = substr($sql, 0, strlen($sql) - 1) . ") VALUES (";
|
2023-12-20 09:12:15 +01:00
|
|
|
|
2024-01-14 18:30:05 +01:00
|
|
|
foreach ($data as $index => $value) {
|
|
|
|
$sql .= ":" . $index . ",";
|
|
|
|
$params[":" . $index] = $value;
|
2023-12-20 09:12:15 +01:00
|
|
|
}
|
|
|
|
|
2024-01-14 18:30:05 +01:00
|
|
|
$sql = substr($sql, 0, strlen($sql) - 1) . ");";
|
2023-12-20 09:12:15 +01:00
|
|
|
|
2024-01-14 18:30:05 +01:00
|
|
|
try {
|
2023-12-20 09:12:15 +01:00
|
|
|
$stmt = $pdo->prepare($sql);
|
|
|
|
$stmt->execute($params);
|
|
|
|
return true;
|
2024-01-14 18:30:05 +01:00
|
|
|
} catch (\PDOException $e) {
|
|
|
|
echo $sql;
|
2023-12-20 09:12:15 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-14 18:30:05 +01:00
|
|
|
public function deleteTagesplan($id)
|
|
|
|
{
|
|
|
|
$pdo = $this->linkDB();
|
2023-12-20 09:12:15 +01:00
|
|
|
$params = array();
|
|
|
|
$sql = "DELETE FROM Tagesplan WHERE id=:id";
|
|
|
|
$params[":id"] = $id;
|
2024-01-14 18:30:05 +01:00
|
|
|
try {
|
2023-12-20 09:12:15 +01:00
|
|
|
$stmt = $pdo->prepare($sql);
|
|
|
|
$stmt->execute($params);
|
|
|
|
return true;
|
2024-01-14 18:30:05 +01:00
|
|
|
} catch (\PDOException $e) {
|
2023-12-20 09:12:15 +01:00
|
|
|
return false;
|
|
|
|
}
|
2024-01-18 10:02:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getGerichteOnTag()
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-12-20 09:12:15 +01:00
|
|
|
}
|
2024-01-14 18:30:05 +01:00
|
|
|
}
|
2023-12-20 09:12:15 +01:00
|
|
|
?>
|