Initial commit: new project structure and scripts

This commit is contained in:
MosLaptop\Not.Reda
2025-08-29 11:14:49 +02:00
parent 69dd02eb91
commit 75c6cc2a74
14 changed files with 180 additions and 225 deletions

37
Model/TaskModel.php Normal file
View File

@@ -0,0 +1,37 @@
<?php
namespace ppb\Model;
use ppb\Library\Msg;
class TaskModel extends Database {
public function insertTask($data) {
$pdo = $this->linkDB();
try {
$sql = "INSERT INTO task (id, userId, projectId, title, expense, dueDate, priorityId, done )
VALUES (:id,:userId,:projectId, :title, :expense, :dueDate, :priorityId, :done)";
$sth = $pdo->prepare($sql);
$sth-> execute([
':id' => $this->createUUID(),
':userId' => '4f141df7-3c0a-11e8-b046-2c4d544f8fe0',
':projectId' => $data['projectId'],
':title' => $data['title'],
':expense' => str_replace("," , "." ,$data['expense']),
':dueDate' => date("Y-m-d", strtotime($data['dueDate'])),
':priorityId' => $data['priorityId'],
':done' => 0
]);
$pdo = null;
new Msg(false, "Task erfolgreich eingefügt.");
} catch (\PDOException $e) {
new Msg(true, 'Fehler beim Einfügen des Tasks', $e);
}
}
}