aboutsummaryrefslogtreecommitdiff
path: root/muamba-widget.tpl.php
blob: 6923de8db5879c62a2eff9b27b2b29dc02b9bf9f (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
<?php

/**
 * @file
 * Template for displaying the muamba widget.
 */

// User and path
$path = drupal_get_path('module', 'muamba');
global $user;

// Add javascript and CSS files
drupal_add_js($path  .'/muamba.js');
drupal_add_css($path .'/muamba.css');

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

if (empty($transaction)) {
  $output .= theme('muamba_widget_icon', array('status' => MUAMBA_REQUESTED, 'id' => $nid));
}
elseif ($transaction['uid'] == $user->uid) {
  foreach (muamba_actions_available('sent', $transaction['status']) as $action) {
    $output .= theme('muamba_widget_icon', array('status' => $action, 'id' => $transaction['mid']));
  }
}
elseif ($transaction['owner'] == $user->uid) {
  foreach (muamba_actions_available('received', $transcation['status']) as $action) {
    $output .= theme('muamba_widget_icon', array('status' => $action, 'id' => $transaction['mid']));
  }
}
else {
  $icon = theme('image',
    array(
      'path'  => $path .'/images/unavailable.png',
      'alt'   => t('Item unavailable'),
      'title' => t('Item unavailable'),
    )
  );
}

$output .= '</div>';

print $output;