aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--muamba-widget.tpl.php21
-rw-r--r--muamba.module4
2 files changed, 15 insertions, 10 deletions
diff --git a/muamba-widget.tpl.php b/muamba-widget.tpl.php
index d2c6ca7..06d547b 100644
--- a/muamba-widget.tpl.php
+++ b/muamba-widget.tpl.php
@@ -13,24 +13,24 @@ global $user;
drupal_add_js($path .'/muamba.js');
drupal_add_css($path .'/muamba.css');
-$output = '<div class="muamba-widget">';
-$output .= '<h3>'. t('Options') .'</h3>';
+$content = '';
+$output = '';
-if (empty($transaction)) {
- $output .= theme('muamba_widget_icon', array('status' => MUAMBA_REQUESTED, 'id' => $nid));
+if (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) {
- $output .= theme('muamba_widget_icon', array('status' => $action, 'id' => $transaction['mid']));
+ $content .= theme('muamba_widget_icon', array('status' => $action, 'id' => $transaction['mid']));
}
}
elseif ($transaction['owner'] == $user->uid) {
foreach (muamba_actions_available('received', $transaction['status']) as $action) {
- $output .= theme('muamba_widget_icon', array('status' => $action, 'id' => $transaction['mid']));
+ $content .= theme('muamba_widget_icon', array('status' => $action, 'id' => $transaction['mid']));
}
}
else {
- $icon = theme('image',
+ $content .= theme('image',
array(
'path' => $path .'/images/unavailable.png',
'alt' => t('Item unavailable'),
@@ -39,6 +39,11 @@ else {
);
}
-$output .= '</div>';
+if (!empty($content)) {
+ $output = '<div class="muamba-widget">';
+ $output .= '<h3>'. t('Options') .'</h3>';
+ $output .= $content;
+ $output .= '</div>';
+}
print $output;
diff --git a/muamba.module b/muamba.module
index 5552d8b..840136d 100644
--- a/muamba.module
+++ b/muamba.module
@@ -119,7 +119,7 @@ function muamba_node_view($node, $view_mode, $langcode) {
if ($view_mode == 'full') {
$transaction = muamba_current_transaction($node);
$node->content['muamba'] = array(
- '#markup' => theme('muamba_widget', array('nid' => $node->nid, 'transaction' => $transaction)),
+ '#markup' => theme('muamba_widget', array('node' => $node, 'transaction' => $transaction)),
'#weight' => 100,
);
@@ -135,7 +135,7 @@ function muamba_theme($existing, $type, $theme, $path) {
'muamba_widget' => array(
'template' => 'muamba-widget',
'variables' => array(
- 'nid' => NULL,
+ 'node' => NULL,
'transaction' => NULL,
),
),