From 26806c934827c9f58feccb27cc8b6f42d829f38c Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sun, 6 Nov 2011 20:46:47 -0200 Subject: Fixing #34 --- muamba-widget.tpl.php | 49 ++++++++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 21 deletions(-) (limited to 'muamba-widget.tpl.php') 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 .= '
'; + foreach (muamba_actions_available('received', $transaction['status']) as $action) { + $content .= theme('muamba_widget_icon', array('status' => $action, 'id' => $transaction['mid'])); + } + } } if (!empty($content)) { -- cgit v1.2.3