2023-12-07 09:46:54 +01:00
|
|
|
<?php
|
|
|
|
//Programmierung: Sven Alteköster 100%
|
2024-01-13 15:51:38 +01:00
|
|
|
//Getestet durch: Sven Alteköster 100%
|
2023-12-07 09:46:54 +01:00
|
|
|
|
|
|
|
namespace ppb\Controller;
|
|
|
|
|
|
|
|
use ppb\Library\Msg;
|
2023-12-14 20:03:29 +01:00
|
|
|
use ppb\Model\BestellungModel;
|
2023-12-07 09:46:54 +01:00
|
|
|
|
2024-01-09 09:51:28 +01:00
|
|
|
class BestellungController
|
|
|
|
{
|
2023-12-07 09:46:54 +01:00
|
|
|
|
2024-01-09 09:51:28 +01:00
|
|
|
private $db;
|
2023-12-07 09:46:54 +01:00
|
|
|
|
2024-01-09 09:51:28 +01:00
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
$this->db = new BestellungModel();
|
|
|
|
}
|
2023-12-07 09:46:54 +01:00
|
|
|
|
2024-01-09 09:51:28 +01:00
|
|
|
public function getBestellung($id = false)
|
|
|
|
{
|
|
|
|
$result = $this->db->selectBestellung($id);
|
|
|
|
if ($id !== false) {
|
|
|
|
if ($result)
|
|
|
|
$result = $result[0];
|
|
|
|
else
|
|
|
|
$result = false;
|
2023-12-07 09:46:54 +01:00
|
|
|
}
|
2024-01-09 09:51:28 +01:00
|
|
|
|
|
|
|
return json_encode($result);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function writeBestellung($data)
|
|
|
|
{
|
|
|
|
$result = $this->db->insertBestellung($data);
|
|
|
|
return json_encode($result);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function updateBestellung($id, $data)
|
|
|
|
{
|
|
|
|
$result = $this->db->updateBestellung($id, $data);
|
|
|
|
return json_encode($result);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function deleteBestellung($id)
|
|
|
|
{
|
|
|
|
$result = $this->db->deleteBestellung($id);
|
|
|
|
return json_encode($result);
|
|
|
|
}
|
2023-12-07 09:46:54 +01:00
|
|
|
}
|