diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2011-11-06 20:46:47 -0200 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2011-11-06 20:46:47 -0200 |
commit | 26806c934827c9f58feccb27cc8b6f42d829f38c (patch) | |
tree | 9ad38fba5b4e029caf655a1af3e8a34505cb9cab /muamba-widget.tpl.php | |
parent | d60f3e3eb1563ec388b2c4ee15499627d8c0265a (diff) | |
download | muamba-26806c934827c9f58feccb27cc8b6f42d829f38c.tar.gz muamba-26806c934827c9f58feccb27cc8b6f42d829f38c.tar.bz2 |
Fixing #34
Diffstat (limited to 'muamba-widget.tpl.php')
-rw-r--r-- | muamba-widget.tpl.php | 49 |
1 files changed, 28 insertions, 21 deletions
diff --git a/muamba-widget.tpl.php b/muamba-widget.tpl.php index 1c79606..09b43bc 100644 --- a/muamba-widget.tpl.php +++ b/muamba-widget.tpl.php @@ -16,31 +16,38 @@ drupal_add_css($path .'/muamba.css'); $content = ''; $output = ''; -if (!user_is_logged_in()) { - print t('You have to be logged in to be able to ask for this item.'); - return; -} -elseif (empty($transaction) && $node->uid != $user->uid) { - $content .= theme('muamba_widget_icon', array('status' => MUAMBA_REQUESTED, 'id' => $node->nid)); -} -elseif ($transaction['uid'] == $user->uid) { - foreach (muamba_actions_available('sent', $transaction['status']) as $action) { - $content .= theme('muamba_widget_icon', array('status' => $action, 'id' => $transaction['mid'])); +if ($node->uid != $user->uid) { + if (!user_is_logged_in()) { + print t('You have to be logged in to be able to ask for this item.'); + return; } -} -elseif ($transaction['owner'] == $user->uid) { - foreach (muamba_actions_available('received', $transaction['status']) as $action) { - $content .= theme('muamba_widget_icon', array('status' => $action, 'id' => $transaction['mid'])); + elseif (!$available && $transactions['uid'] != $user->uid) { + $content .= theme('image', + array( + 'path' => $path .'/images/unavailable.png', + 'alt' => t('Item unavailable'), + 'title' => t('Item unavailable'), + ) + ); + } + elseif ($transactions['uid'] == $user->uid) { + foreach (muamba_actions_available('sent', $transactions['status']) as $action) { + $content .= theme('muamba_widget_icon', array('status' => $action, 'id' => $transactions['mid'])); + } + } + else { + $content .= theme('muamba_widget_icon', array('status' => MUAMBA_REQUESTED, 'id' => $node->nid)); } } else { - $content .= theme('image', - array( - 'path' => $path .'/images/unavailable.png', - 'alt' => t('Item unavailable'), - 'title' => t('Item unavailable'), - ) - ); + foreach ($transactions as $transaction) { + $requester = user_load($transaction['uid']); + $content .= t('Request from @name.', array('@name' => $requester->name)); + $content .= '<br />'; + foreach (muamba_actions_available('received', $transaction['status']) as $action) { + $content .= theme('muamba_widget_icon', array('status' => $action, 'id' => $transaction['mid'])); + } + } } if (!empty($content)) { |