aboutsummaryrefslogtreecommitdiff
path: root/muamba.module
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2011-10-04 13:10:59 -0300
committerSilvio Rhatto <rhatto@riseup.net>2011-10-04 13:10:59 -0300
commitf47b73d4bc46351a2ed6fdb842ce452b815df58e (patch)
treeb3618ceb3918b13661d0e394b8cd32cdfcac5b5a /muamba.module
parenta3336da7dd92a2b8d31f2f33a6106a1802b5a387 (diff)
downloadmuamba-f47b73d4bc46351a2ed6fdb842ce452b815df58e.tar.gz
muamba-f47b73d4bc46351a2ed6fdb842ce452b815df58e.tar.bz2
Enhancing request/accept
Diffstat (limited to 'muamba.module')
-rw-r--r--muamba.module30
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',
),
);
}