summaryrefslogtreecommitdiff
path: root/public/app/models/Content_model.php
diff options
context:
space:
mode:
Diffstat (limited to 'public/app/models/Content_model.php')
-rw-r--r--public/app/models/Content_model.php30
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
## -------------------------------------------------------------------------