diff options
| author | George Halkiadakis <gchalkiadakis@sklavenitis.co.gr> | 2023-05-31 03:39:24 +0300 |
|---|---|---|
| committer | George Halkiadakis <gchalkiadakis@sklavenitis.co.gr> | 2023-05-31 03:39:24 +0300 |
| commit | d21f6ba14c8e15a5d0d44f82bea35c9e89eabbb9 (patch) | |
| tree | 74216f87c05181b0ac7a3c252d76a1160799dfc0 /public/app/models | |
| parent | 304613216a2dfa4701c50c08dcad1eddaf2919b9 (diff) | |
| download | gyraf1gov-d21f6ba14c8e15a5d0d44f82bea35c9e89eabbb9.tar.gz gyraf1gov-d21f6ba14c8e15a5d0d44f82bea35c9e89eabbb9.tar.bz2 gyraf1gov-d21f6ba14c8e15a5d0d44f82bea35c9e89eabbb9.zip | |
manage petitions; in progress
Diffstat (limited to 'public/app/models')
| -rw-r--r-- | public/app/models/Content_model.php | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/public/app/models/Content_model.php b/public/app/models/Content_model.php index ea19165..2a79159 100644 --- a/public/app/models/Content_model.php +++ b/public/app/models/Content_model.php @@ -53,17 +53,30 @@ class Content_model { /** user petitions * - * get all petitions of a user + * get all petitions of a user; * * @param int $uid: user id * @return array petition records */ public static function user_petitions($uid) { - return Registry::use('database')->runQuery( + $list = Registry::use('database')->runQuery( "SELECT * FROM petition WHERE user_id = :uid", [ ':uid' => $uid ] ); + + $results = []; // re-format results + foreach($list as $key => $rec) { + $results[] = [ + 'id' => $rec['id'], + 'type_id' => $rec['type_id'], + 'subject' => $rec['subject'], + 'signature' => $rec['signature'], + 'protocol' => $rec['protocol'] ?? '', + 'form_structure' => unserialize($rec['form_structure']) + ]; + } + return $results; } |
