aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--muamba.info1
-rw-r--r--muamba.install18
-rw-r--r--muamba.module64
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;
+ }
+}