diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2011-10-06 22:41:35 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2011-10-06 22:41:35 -0300 |
commit | fe5d67700ceb54bdc951dbd1f5f98e9dcae89855 (patch) | |
tree | 9ec00b088f2cb2b65ea62950d87754094f0d7e73 /muamba-widget.tpl.php | |
parent | fc44d53e2538655f2859cfe1b7566b6db44cdcfb (diff) | |
download | muamba-fe5d67700ceb54bdc951dbd1f5f98e9dcae89855.tar.gz muamba-fe5d67700ceb54bdc951dbd1f5f98e9dcae89855.tar.bz2 |
Widget updates
Diffstat (limited to 'muamba-widget.tpl.php')
-rw-r--r-- | muamba-widget.tpl.php | 42 |
1 files changed, 28 insertions, 14 deletions
diff --git a/muamba-widget.tpl.php b/muamba-widget.tpl.php index 3caf614..6923de8 100644 --- a/muamba-widget.tpl.php +++ b/muamba-widget.tpl.php @@ -3,27 +3,41 @@ /** * @file * Template for displaying the muamba widget. - * - * @todo: use $transaction - * Show item status: can it be requested? - * Is this item already requested? */ -// Add javascript and CSS files +// 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'); -$icon = theme('image', - array( - 'path' => $path .'/images/basket.png', - 'alt' => t('Request item'), - 'title' => t('Request item'), - ) -); - $output = '<div class="muamba-widget">'; -$output .= l($icon, 'muamba/request/'. $nid, array('html' => TRUE)); + +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; |