diff options
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)) { |