]> gitweb.fluxo.info Git - drupal/muamba.git/commitdiff
Initial muamba page
authorSilvio Rhatto <rhatto@riseup.net>
Mon, 26 Sep 2011 19:58:06 +0000 (16:58 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Mon, 26 Sep 2011 19:58:06 +0000 (16:58 -0300)
muamba.business.inc
muamba.module
muamba.theme.inc

index d9ed4d8f9e66df47f855559582e32e2722f7e15f..a9da7281e03ec33956c952577206e1c4317d2b8a 100644 (file)
@@ -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;
 }
 
 /**
index 43857d9b72d92c87d5a2fe854399eb7572b92f90..deb1b2d4839e11f44fe9ab60bc6e667455fb4503 100644 (file)
@@ -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',
+    ),
   );
 }
 
index 056632f90acdf4bb00cab94b915de7ba1c756cb1..481941ff03463da6c2bc9a9e01c333314b525628 100644 (file)
@@ -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;
+}