]> gitweb.fluxo.info Git - drupal/muamba.git/commitdiff
Fixing schema
authorSilvio Rhatto <rhatto@riseup.net>
Fri, 23 Sep 2011 16:12:54 +0000 (13:12 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Fri, 23 Sep 2011 16:12:54 +0000 (13:12 -0300)
muamba.info
muamba.install
muamba.module

index bcfbcf4bd25f5cde2163d8cd57ee6d1ef823be26..78f0120d4f7faa01f377682fade6b36e482a7be0 100644 (file)
@@ -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
index 23f7585c093a74dd7c1b1806f3d09244770f1c15..14debbe3e430884c9076d2d4a6aa7257da89cc81 100644 (file)
@@ -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'),
     ),
   );
 
index 08daf724894cdf6c4635d81fedeb656cafafbe82..ada81d0d579781cb2984bc85c252e4f2e2456b62 100644 (file)
@@ -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;
+  }
+}