implementovane pridavanie priloh typu "comment",

dynamicka uprava komentarov dvojklikom
This commit is contained in:
2025-05-14 00:36:56 +02:00
parent e870a62b89
commit 82e14b8fa4
5 changed files with 226 additions and 21 deletions

View File

@ -217,4 +217,45 @@ function reportGetAllGrouped($status = null) {
return $groups;
}
/**
* Attachments
*/
function attachmentAdd($report_id, $attachment_type, $attachment_content) {
global $db;
$stm = $db->insert('attachments', [
'report_id' => $report_id,
'attachment_type' => $attachment_type,
'attachment_content' => $attachment_content,
'created_dt' => date('Y-m-d H:i:s')
]);
return ($stm->rowCount() > 0);
}
function attachmentUpdate($attachment_id, $attachment_content) {
global $db;
if (strlen(trim($attachment_content)) <= 0) return attachmentDelete($attachment_id);
$stm = $db->update('attachments', [
'attachment_content' => $attachment_content
], [
'attachment_id' => $attachment_id
]);
return ($stm->rowCount() > 0);
}
function attachmentDelete($attachment_id) {
global $db;
$stm = $db->delete('attachments', [
'attachment_id' => $attachment_id
]);
return ($stm->rowCount() > 0);
}
function attachmentGetAll($report_id) {
global $db;
return $db->select('attachments', '*', [
'ORDER' => ['created_dt' => 'ASC'],
'report_id' => $report_id
]);
}
?>