diff options
| author | George Halkiadakis <gchalkiadakis@sklavenitis.co.gr> | 2023-06-01 03:33:18 +0300 |
|---|---|---|
| committer | George Halkiadakis <gchalkiadakis@sklavenitis.co.gr> | 2023-06-01 03:33:18 +0300 |
| commit | 864fbb806621c8167c49f7449486fbc3bdaca1a6 (patch) | |
| tree | 1b5b5933dbb184b130c248d3281e709bd6286c5d /public/app/models/Content_model.php | |
| parent | 950798a91c0bed3f2d6e53182b0cff49f07eff0c (diff) | |
| download | gyraf1gov-864fbb806621c8167c49f7449486fbc3bdaca1a6.tar.gz gyraf1gov-864fbb806621c8167c49f7449486fbc3bdaca1a6.tar.bz2 gyraf1gov-864fbb806621c8167c49f7449486fbc3bdaca1a6.zip | |
user update; user petitions copy; fixed docker performance issues
Diffstat (limited to 'public/app/models/Content_model.php')
| -rw-r--r-- | public/app/models/Content_model.php | 30 |
1 files changed, 30 insertions, 0 deletions
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 ## ------------------------------------------------------------------------- |
