array( 'title' => t('Request an item'), 'description' => t('Request an item to be borrowed or donated.'), ), ); } /** * Implements hook_menu() */ function muamba_menu() { $items['muamba'] = array( 'title' => 'My items', 'page callback' => 'muamba', 'access arguments' => array('access content'), 'type' => MENU_SUGGESTED_ITEM, 'file' => 'muamba.business.inc', ); $items['muamba/request'] = array( 'title' => 'Request an item', 'page callback' => 'muamba_request', 'access arguments' => array('request item'), 'type' => MENU_SUGGESTED_ITEM, 'file' => 'muamba.business.inc', ); $items['muamba/accept'] = array( 'title' => 'Accept an item request', 'page callback' => 'muamba_accept', 'access arguments' => array('accept item'), 'type' => MENU_SUGGESTED_ITEM, 'file' => 'muamba.business.inc', ); $items['muamba/reject'] = array( 'title' => 'Reject an item request', 'page callback' => 'muamba_reject', 'access arguments' => array('reject item'), 'type' => MENU_SUGGESTED_ITEM, 'file' => 'muamba.business.inc', ); $items['muamba/release'] = array( 'title' => 'Release an item', 'page callback' => 'muamba_release', 'access arguments' => array('release item'), 'type' => MENU_SUGGESTED_ITEM, 'file' => 'muamba.business.inc', ); $items['muamba/return'] = array( 'title' => 'Return an item', 'page callback' => 'muamba_return', 'access arguments' => array('return item'), 'type' => MENU_SUGGESTED_ITEM, 'file' => 'muamba.business.inc', ); $items['muamba/cancel'] = array( 'title' => 'Cancel a request', 'page callback' => 'muamba_cancel', 'access arguments' => array('cancel item'), 'type' => MENU_SUGGESTED_ITEM, 'file' => 'muamba.business.inc', ); return $items; } /** * 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) { return; } if ($view_mode == 'full') { $node->content['muamba'] = array( '#markup' => theme('muamba_widget', array('nid' => $node->nid)), '#weight' => 100, ); return $node; } } /** * Implements hook_theme() */ function muamba_theme($existing, $type, $theme, $path) { return array( 'muamba_widget' => array( 'template' => 'muamba-widget', 'variables' => array('nid' => NULL), ), 'muamba_powered' => array( 'template' => 'muamba-powered', ), 'muamba_transactions' => array( 'variables' => array( 'transactions' => NULL, 'type' => NULL, ), 'file' => 'muamba.theme.inc', ), ); } /** * Implements hook_block_info() */ function muamba_block_info() { $blocks['muamba_powered'] = array( 'info' => t('Muamba powered'), 'cache' => DRUPAL_NO_CACHE, 'status' => TRUE, 'region' => 'footer', ); return $blocks; } /** * Implements hook_block_view() */ function muamba_block_view($delta = '') { $block = array(); switch ($delta) { case 'muamba_powered': $block['subject'] = NULL; $block['content'] = theme('muamba_powered'); break; } return $block; }