diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2011-09-23 13:12:54 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2011-09-23 13:12:54 -0300 |
commit | 38ceba80bef2c989d3431ba3173ea1f9a58b6fa6 (patch) | |
tree | fb5bbb32c97f6a4d5deb001c9b1442d341a395d4 | |
parent | d39c2f5803fb6f01bc2b42b1f955fee3c2c64038 (diff) | |
download | muamba-38ceba80bef2c989d3431ba3173ea1f9a58b6fa6.tar.gz muamba-38ceba80bef2c989d3431ba3173ea1f9a58b6fa6.tar.bz2 |
Fixing schema
-rw-r--r-- | muamba.info | 1 | ||||
-rw-r--r-- | muamba.install | 18 | ||||
-rw-r--r-- | muamba.module | 64 |
3 files changed, 74 insertions, 9 deletions
diff --git a/muamba.info b/muamba.info index bcfbcf4..78f0120 100644 --- a/muamba.info +++ b/muamba.info @@ -3,3 +3,4 @@ description = Multi-user Asset Manager and Borrowing Ambient core = 7.x files[] = muamba.module files[] = muamba.install +files[] = muamba.misc.inc diff --git a/muamba.install b/muamba.install index 23f7585..14debbe 100644 --- a/muamba.install +++ b/muamba.install @@ -12,25 +12,25 @@ function muamba_schema() { $schema['muamba'] = array( 'description' => 'The base table for muamba assets.', 'fields' => array( - 'nid' => array( - 'description' => t('The {node}.nid of the borrowed item.'), + 'uid' => array( + 'description' => t('The {user}.uid requesting an item.'), 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), - 'uid' => array( - 'description' => t('The {user}.uid requesting an item.'), + 'nid' => array( + 'description' => t('The {node}.nid of the borrowed item.'), 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), - 'primary key' => array('uid', 'nid'), - 'indexes' => array( - 'nid' => array('nid'), - 'uid' => array('uid'), - ), + ), + 'primary key' => array('uid', 'nid'), + 'indexes' => array( + 'nid' => array('nid'), + 'uid' => array('uid'), ), ); diff --git a/muamba.module b/muamba.module index 08daf72..ada81d0 100644 --- a/muamba.module +++ b/muamba.module @@ -4,3 +4,67 @@ * @file * Multiple-user Asset Manager and Borrowing Ambient. */ + +/** + * Implements hook_permission() + */ +function muamba_permission() { + return array( + /* + *'administer my module' => array( + * 'title' => t('Administer my module'), + * 'description' => t('Perform administration tasks for my module.'), + *), + */ + 'request item' => array( + 'title' => t('Request an item.'), + 'description' => t('Request an item to be borrowed or donated.'), + ), + ); +} + +/** + * Implements hook_menu() + */ +function muamba_menu() { + /* + *$items['blog'] = array( + * 'title' => 'blogs', + * 'page callback' => 'blog_page', + * 'access arguments' => array('access content'), + * 'type' => MENU_SUGGESTED_ITEM, + *); + */ + $items['muamba/request'] = array( + 'title' => 'Request item', + 'page callback' => 'muamba_request', + 'access arguments' => array('request item'), + 'type' => MENU_SUGGESTED_ITEM, + 'file' => 'muamba.misc.inc', + ); + + return $items; +} + +/** + * Implements hook_node_view() + */ +function muamba_node_view($node, $view_mode, $langcode) { + /* + *$node->content['my_additional_field'] = array( + * '#markup' => $additional_field, + * '#weight' => 10, + * '#theme' => 'mymodule_my_additional_field', + *); + */ + global $user; + + if ($view_mode == 'full') { + $node->content['muamba'] = array( + '#markup' => 'Request item.', + '#weight' => 100, + ); + + return $node; + } +} |