From dfb96366348a72498b45e3c324fddde100296f43 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Mon, 26 Sep 2011 16:58:06 -0300 Subject: Initial muamba page --- muamba.business.inc | 8 ++++---- muamba.module | 4 ++++ muamba.theme.inc | 19 +++++++++++++++++++ 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 = '
'; + $output .= '

'. t('Transactions') .'

'; + + $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 .= '
'; + + return $output; +} -- cgit v1.2.3