From 864fbb806621c8167c49f7449486fbc3bdaca1a6 Mon Sep 17 00:00:00 2001 From: George Halkiadakis Date: Thu, 1 Jun 2023 03:33:18 +0300 Subject: user update; user petitions copy; fixed docker performance issues --- public/app/models/Content_model.php | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'public/app/models/Content_model.php') diff --git a/public/app/models/Content_model.php b/public/app/models/Content_model.php index 2a79159..1f145a0 100644 --- a/public/app/models/Content_model.php +++ b/public/app/models/Content_model.php @@ -73,6 +73,7 @@ class Content_model { 'subject' => $rec['subject'], 'signature' => $rec['signature'], 'protocol' => $rec['protocol'] ?? '', + 'creation_date' => date("Y-m-d", strtotime($rec['creation_date'])), 'form_structure' => unserialize($rec['form_structure']) ]; } @@ -96,6 +97,35 @@ class Content_model { } + public static function get_petition($filters) + { + $where = []; + $binds = []; + foreach($filters as $key => $val) { + $where[] = $key ." = :". $key; + $binds[':'.$key] = $val; + } + + $rec = Registry::use('database')->query( + "SELECT * FROM petition WHERE ". implode(" AND ", $where), + $filters + )->getFirst(); + + if ($rec === false) return false; + else { + return [ + 'id' => $rec['id'], + 'type' => (($rec['type_id'] == 1) ? 'application' : 'penalty'), + 'subject' => $rec['subject'], + 'signature' => $rec['signature'], + 'protocol' => $rec['protocol'] ?? false, + 'creation_date' => date("Y-m-d", strtotime($rec['creation_date'])), + 'form_structure' => unserialize($rec['form_structure']) + ]; + } + } + + ## F I L E S ## ------------------------------------------------------------------------- -- cgit v1.2.3