implementovane pridavanie priloh typu "comment",
dynamicka uprava komentarov dvojklikom
This commit is contained in:
@ -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
|
||||
]);
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user