From 61c12bd9539cd0d74f43bc74414f79609621b397 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Wed, 9 Nov 2011 14:23:04 -0200 Subject: Showing muamba widget at muamba_privatemsg_view_alter() --- muamba.module | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'muamba.module') diff --git a/muamba.module b/muamba.module index 3aa94bc..b03dea8 100644 --- a/muamba.module +++ b/muamba.module @@ -249,12 +249,27 @@ function muamba_block_view($delta = '') { /** * Implements hook_privatemsg_view_alter() - * - * @todo */ function muamba_privatemsg_view_alter(&$content) { - $bar = 'TODO: Add here request management bar.'; - $content['participants']['#markup'] = $bar . $content['participants']['#markup']; + $thread = $content['#thread']['thread_id']; + $transaction = muamba_get_transaction($thread, 'thread_id'); + + if (!empty($transaction)) { + global $user; + + $node = node_load($transaction['nid']); + $available = muamba_check_availability($node->nid); + $widget = ($node->uid == $user->uid) ? 'owner' : 'requester'; + + $bar = theme('muamba_widget_'. $widget, array( + 'node' => $node, + 'transaction' => $transaction, + 'available' => $available, + 'size' => 'big', + )); + + $content['participants']['#markup'] = $bar . $content['participants']['#markup']; + } } /** -- cgit v1.2.3