aboutsummaryrefslogtreecommitdiff
path: root/muamba.theme.inc
blob: 771c80b82195f465538626d2f56e9003bcf94066 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php

/**
 * @file
 * Misc theme functions.
 */

function theme_muamba_transactions($variables) {
  $rows         = array();
  $type         = $variables['type'];
  $transactions = $variables['transactions'];

  $output       = '<div class="muamba-transactions">';

  if ($type == 'sent') {
    $title = t('Items I requested from people');
  }
  else {
    $title = t('My items that people requested');
  }

  $output      .= '<h2>'. $title .'</h2>';

  if (empty($transactions)) {
    $output .= t('There are no transactions.');
    $output .= '</div>';
    return $output;
  }

  foreach($transactions as $transaction) {
    $rows[] = array(
      'asset'   => $transaction['node']->title,
      'user'    => $transaction['user']->name,
      'status'  => muamba_statuses($transaction['status']),
      'actions' => 'accept', // TODO
    );
  }

  // Make a table for them.
  $header = array(t('Asset'), t('User'), t('Status'), t('Actions'));
  $output .= theme('table', array('header' => $header, 'rows' => $rows));  
  $output .= '</div>';

  return $output;
}