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