aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2011-09-26 16:58:06 -0300
committerSilvio Rhatto <rhatto@riseup.net>2011-09-26 16:58:06 -0300
commitdfb96366348a72498b45e3c324fddde100296f43 (patch)
treea3b9a5a58ffdf29c354168844b8001283515df2b
parent22b2b4c6217577cb35c1913c3c2c560979e64236 (diff)
downloadmuamba-dfb96366348a72498b45e3c324fddde100296f43.tar.gz
muamba-dfb96366348a72498b45e3c324fddde100296f43.tar.bz2
Initial muamba page
-rw-r--r--muamba.business.inc8
-rw-r--r--muamba.module4
-rw-r--r--muamba.theme.inc19
3 files changed, 27 insertions, 4 deletions
diff --git a/muamba.business.inc b/muamba.business.inc
index d9ed4d8..a9da728 100644
--- a/muamba.business.inc
+++ b/muamba.business.inc
@@ -110,7 +110,7 @@ function muamba_get_transactions($uid, $type = 'sent', $status = MUAMBA_REQUESTE
->fields('m', array('mid', 'uid', 'owner', 'thread_id'));
}
- return $query->execute();
+ return $query->execute()->fetchAll();
}
/**
@@ -122,10 +122,10 @@ function muamba() {
$sent = muamba_get_transactions($user->uid);
$received = muamba_get_transactions($user->uid, 'received');
- dpm($sent);
- dpm($received);
+ $output = theme('muamba_transactions', array('transactions' => $sent));
+ $output .= theme('muamba_transactions', array('transactions' => $received));
- return t('Muamba management page');
+ return $output;
}
/**
diff --git a/muamba.module b/muamba.module
index 43857d9..deb1b2d 100644
--- a/muamba.module
+++ b/muamba.module
@@ -119,6 +119,10 @@ function muamba_theme($existing, $type, $theme, $path) {
'muamba_powered' => array(
'template' => 'muamba-powered',
),
+ 'muamba_transactions' => array(
+ 'variables' => array('transactions' => NULL),
+ 'file' => 'muamba.theme.inc',
+ ),
);
}
diff --git a/muamba.theme.inc b/muamba.theme.inc
index 056632f..481941f 100644
--- a/muamba.theme.inc
+++ b/muamba.theme.inc
@@ -4,3 +4,22 @@
* @file
* Misc theme functions.
*/
+
+function theme_muamba_transactions($variables) {
+ $transactions = $variables['transactions'];
+ $output = '<div class="muamba-transactions">';
+ $output .= '<h2>'. t('Transactions') .'</h2>';
+
+ $rows = array();
+ foreach ($transactions as $entry) {
+ // Sanitize the data before handing it off to the theme layer.
+ $rows[] = array_map('check_plain', (array) $entry);
+ }
+
+ // Make a table for them.
+ $header = array(t('Id'), t('uid'), t('Owner'), t('Thread'));
+ $output .= theme('table', array('header' => $header, 'rows' => $rows));
+ $output .= '</div>';
+
+ return $output;
+}