diff options
Diffstat (limited to 'muamba.module')
-rw-r--r-- | muamba.module | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/muamba.module b/muamba.module index 4e86abd..2a45c70 100644 --- a/muamba.module +++ b/muamba.module @@ -16,6 +16,10 @@ define('MUAMBA_RELEASED', 3); define('MUAMBA_RETURNED', 4); define('MUAMBA_CANCELLED', 4); +// Load requirements. +include_once('muamba.misc.inc'); +include_once('muamba.db.inc'); + /** * Implements hook_permission() */ @@ -93,22 +97,19 @@ function muamba_menu() { /** * Implements hook_node_view() - * - * @todo - * Check widget status - * Check permissions */ function muamba_node_view($node, $view_mode, $langcode) { global $user; - // Do not show widget to the owner or on non-muamba content types - if ($node->uid == $user->uid || $node->type != MUAMBA_NODE_TYPE) { + // Check if widget can be shown + if ($node->uid == $user->uid || $node->type != MUAMBA_NODE_TYPE || !muamba_has_request_access($node)) { return; } if ($view_mode == 'full') { + $transaction = muamba_get_transaction($node); $node->content['muamba'] = array( - '#markup' => theme('muamba_widget', array('nid' => $node->nid)), + '#markup' => theme('muamba_widget', array('nid' => $node->nid, 'transaction' => $transaction)), '#weight' => 100, ); @@ -123,7 +124,10 @@ function muamba_theme($existing, $type, $theme, $path) { return array( 'muamba_widget' => array( 'template' => 'muamba-widget', - 'variables' => array('nid' => NULL), + 'variables' => array( + 'nid' => NULL, + 'transaction' => NULL, + ), ), 'muamba_powered' => array( 'template' => 'muamba-powered', @@ -133,14 +137,20 @@ function muamba_theme($existing, $type, $theme, $path) { 'transactions' => NULL, 'type' => NULL, ), - 'file' => 'muamba.theme.inc', + 'file' => 'muamba.theme.inc', ), 'muamba_colorbox_link' => array( 'variables' => array( 'path' => NULL, 'text' => NULL, ), - 'file' => 'muamba.theme.inc', + 'file' => 'muamba.theme.inc', + ), + 'muamba_request_message' => array( + 'variables' => array( + 'transaction' => NULL, + ), + 'file' => 'muamba.theme.inc', ), ); } |