array( 'title' => t('Request an item'), 'description' => t('Request an item to be borrowed or donated.'), ), ); } /** * Implements hook_menu() */ function muamba_menu() { $items['admin/config/system/muamba'] = array( 'title' => 'Muamba Configuration', 'description' => 'Configure options for Muamba System', 'page callback' => 'drupal_get_form', 'page arguments' => array('muamba_config_form'), 'access arguments' => array('administer muamba'), 'file' => 'muamba.admin.inc', 'type' => MENU_NORMAL_ITEM, ); $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('access content'), 'type' => MENU_SUGGESTED_ITEM, 'file' => 'muamba.business.inc', ); $items['muamba/reject'] = array( 'title' => 'Reject an item request', 'page callback' => 'muamba_reject', 'access arguments' => array('access content'), 'type' => MENU_SUGGESTED_ITEM, 'file' => 'muamba.business.inc', ); $items['muamba/cancel'] = array( 'title' => 'Cancel a request', 'page callback' => 'muamba_cancel', 'access arguments' => array('access content'), 'type' => MENU_SUGGESTED_ITEM, 'file' => 'muamba.business.inc', ); $items['muamba/recover'] = array( 'title' => 'Recover an item', 'page callback' => 'muamba_recover', 'access arguments' => array('access content'), 'type' => MENU_SUGGESTED_ITEM, 'file' => 'muamba.business.inc', ); $items['muamba/return'] = array( 'title' => 'Return an item', 'page callback' => 'muamba_return', 'access arguments' => array('access content'), 'type' => MENU_SUGGESTED_ITEM, 'file' => 'muamba.business.inc', ); $items['muamba/lost'] = array( 'title' => 'Report a lost item', 'page callback' => 'muamba_lost', 'access arguments' => array('access content'), 'type' => MENU_SUGGESTED_ITEM, 'file' => 'muamba.business.inc', ); return $items; } /** * Implements hook_node_view() */ function muamba_node_view($node, $view_mode, $langcode) { if ($view_mode == 'full') { $node->content['muamba'] = array( '#markup' => muamba_widget($node, 'big'), '#weight' => 100, ); return $node; } } /** * Implements hook_theme() */ function muamba_theme($existing, $type, $theme, $path) { return array( 'muamba_widget' => array( 'template' => 'muamba-widget', 'variables' => array( 'node' => NULL, 'transactions' => NULL, 'available' => NULL, 'size' => 'small', 'messages' => FALSE, ), ), 'muamba_widget_owner' => array( 'variables' => array( 'transaction' => NULL, 'size' => 'small', 'messages' => FALSE, ), 'file' => 'muamba.theme.inc', ), 'muamba_widget_requester' => array( 'variables' => array( 'transaction' => NULL, 'size' => 'small', 'messages' => FALSE, ), 'file' => 'muamba.theme.inc', ), 'muamba_powered' => array( 'template' => 'muamba-powered', ), 'muamba_transactions' => array( 'variables' => array( 'transactions' => NULL, 'type' => NULL, ), 'file' => 'muamba.theme.inc', ), 'muamba_colorbox_link' => array( 'variables' => array( 'path' => NULL, 'text' => NULL, ), 'file' => 'muamba.theme.inc', ), 'muamba_request_message' => array( 'variables' => array( 'transaction' => NULL, ), 'file' => 'muamba.theme.inc', ), 'muamba_accept_message' => array( 'variables' => array( 'transaction' => NULL, ), 'file' => 'muamba.theme.inc', ), 'muamba_reject_message' => array( 'variables' => array( 'transaction' => NULL, ), 'file' => 'muamba.theme.inc', ), 'muamba_cancel_message' => array( 'variables' => array( 'transaction' => NULL, ), 'file' => 'muamba.theme.inc', ), 'muamba_return_message' => array( 'variables' => array( 'transaction' => NULL, ), 'file' => 'muamba.theme.inc', ), 'muamba_recover_message' => array( 'variables' => array( 'transaction' => NULL, ), 'file' => 'muamba.theme.inc', ), 'muamba_lost_message' => array( 'variables' => array( 'transaction' => NULL, ), 'file' => 'muamba.theme.inc', ), 'muamba_widget_icon' => array( 'variables' => array( 'status' => MUAMBA_REQUESTED, 'id' => NULL, 'size' => 'small', ), '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; } /** * Implements hook_privatemsg_view_alter() */ function muamba_privatemsg_view_alter(&$content) { $thread = $content['#thread']['thread_id']; $transaction = muamba_get_transaction($thread, 'thread_id'); if (!empty($transaction)) { include_once('muamba.embed.inc'); $title = '