2023-12-06 08:33:25 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
// Programmiert durch Samuel Wolff
|
2024-01-14 18:30:05 +01:00
|
|
|
// Getestet durch: Samuel Wolff
|
2023-12-06 08:33:25 +01:00
|
|
|
|
2023-12-14 16:59:16 +01:00
|
|
|
namespace ppb\Controller;
|
2023-12-06 08:33:25 +01:00
|
|
|
|
2023-12-14 16:59:16 +01:00
|
|
|
use ppb\Library\Msg;
|
|
|
|
use ppb\Model\BenutzerModel;
|
2023-12-06 08:33:25 +01:00
|
|
|
|
2023-12-18 08:16:21 +01:00
|
|
|
class BenutzerController
|
|
|
|
{
|
2023-12-06 08:33:25 +01:00
|
|
|
|
|
|
|
private $db;
|
|
|
|
|
2023-12-18 08:16:21 +01:00
|
|
|
public function __construct()
|
|
|
|
{
|
2023-12-06 08:33:25 +01:00
|
|
|
$this->db = new BenutzerModel();
|
|
|
|
}
|
|
|
|
|
2024-01-18 10:47:56 +01:00
|
|
|
public function getBenutzer($name) {
|
|
|
|
$result = $this->db->selectBenutzer($name);
|
2024-01-18 10:00:42 +01:00
|
|
|
if ($id !== false) {
|
|
|
|
if ($result)
|
|
|
|
$result = $result[0];
|
|
|
|
else
|
|
|
|
$result = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return json_encode($result);
|
|
|
|
}
|
|
|
|
|
2023-12-11 15:35:38 +01:00
|
|
|
// Updated einen Benutzer
|
2023-12-18 08:16:21 +01:00
|
|
|
public function updateBenutzer($elternId, $data)
|
|
|
|
{
|
2023-12-06 08:33:25 +01:00
|
|
|
|
2023-12-18 08:16:21 +01:00
|
|
|
$result = $this->db->updateBenutzer($elternId, $data);
|
2023-12-06 08:33:25 +01:00
|
|
|
|
|
|
|
return json_encode($result);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2023-12-11 15:35:38 +01:00
|
|
|
// Fügt einen Benutzer in die Datenbank hinzu
|
2024-01-08 11:14:17 +01:00
|
|
|
public function writeBenutzer($data)
|
2023-12-18 08:16:21 +01:00
|
|
|
{
|
|
|
|
$result = $this->db->insertBenutzer($data);
|
2023-12-06 08:33:25 +01:00
|
|
|
|
|
|
|
return json_encode($data);
|
|
|
|
}
|
|
|
|
|
2024-01-15 09:39:19 +01:00
|
|
|
|
|
|
|
public function nextId()
|
|
|
|
{
|
|
|
|
$result = $this->db->nextId();
|
|
|
|
|
|
|
|
return json_encode($result);
|
|
|
|
}
|
|
|
|
|
2023-12-06 08:33:25 +01:00
|
|
|
}
|
|
|
|
|
2023-12-18 08:16:21 +01:00
|
|
|
?>
|