Browse Source

featuremap: cleaned up docs

Lacey Sanderson 11 năm trước cách đây
mục cha
commit
90f2b33b87

+ 15 - 2
tripal_featuremap/api/tripal_featuremap.api.inc

@@ -1,4 +1,8 @@
 <?php
+/**
+ * @file
+ * Provides an application programming interface (API) to manage chado feature maps
+ */
 
 /**
  * @defgroup tripal_featuremap_api Feature Map API
@@ -69,6 +73,7 @@ function tripal_featuremap_insert_property($featuremap_id, $property, $value, $u
 function tripal_featuremap_update_property($featuremap_id, $property, $value, $insert_if_missing = 0) {
   return chado_update_property('featuremap', $featuremap_id, $property, 'featuremap_property', $value, $insert_if_missing);
 }
+
 /**
  * Delete a given property
  *
@@ -89,8 +94,16 @@ function tripal_featuremap_delete_property($featuremap_id, $property) {
   return chado_delete_property('featuremap', $featuremap_id, $property, 'featuremap_property');
 }
 
-/*
+/**
+ * Add a dbxref to the featuremap_dbxref table
  *
+ * @param $featuremap_id
+ *  The id of the featuremap of interest
+ * @param $featuremap_dbxref
+ *  A string describing the dbxref with the db name separated from the dbxref accession
+ *  by a colon (:)
+ *
+ * @ingroup tripal_featuremap_api
  */
 function tripal_featuremap_add_featuremap_dbxref($featuremap_id, $featuremap_dbxref) {
 
@@ -150,4 +163,4 @@ function tripal_featuremap_add_featuremap_dbxref($featuremap_id, $featuremap_dbx
     return FALSE;
   }
   return $results;
-}
+}

+ 6 - 10
tripal_featuremap/includes/tripal_featuremap.admin.inc

@@ -1,7 +1,13 @@
 <?php
+/**
+ * @file
+ * Administration of feature maps
+ */
 
 /**
  * Admin launchpad
+ *
+ * @ingroup tripal_featuremap
  */
 function tripal_featuremap_admin_featuremaps_listing() {
   $output = '';
@@ -47,13 +53,3 @@ function tripal_featuremap_admin() {
 
   return system_settings_form($form);
 }
-
-
-/**
- *
- * @ingroup tripal_featuremap
- */
-function tripal_featuremap_admin_validate($form, &$form_state) {
-
-}
-

+ 28 - 7
tripal_featuremap/includes/tripal_featuremap.chado_node.inc

@@ -1,5 +1,12 @@
 <?php
 /**
+ * @file
+ * Hooks implementing the feature map node content type
+ */
+
+/**
+ * Implements hook_node_info().
+ *
  * Provide information to drupal about the node types that we're creating
  * in this module
  *
@@ -31,6 +38,7 @@ function tripal_featuremap_node_info() {
   );
   return $nodes;
 }
+
 /**
  *  When editing or creating a new node of type 'chado_featuremap' we need
  *  a form.  This function creates the form that will be used for this.
@@ -150,8 +158,9 @@ function chado_featuremap_form($node, &$form_state) {
 
   return $form;
 }
+
 /**
- *  validates submission of form when adding or updating a map node
+ * Validates submission of form when adding or updating a map node
  *
  * @ingroup tripal_featuremap
  */
@@ -192,9 +201,8 @@ function chado_featuremap_validate($node, $form, &$form_state) {
   }
 }
 
-
 /**
- * Implement hook_access().
+ * Implement hook_node_access().
  *
  * This hook allows node modules to limit access to the node types they define.
  *
@@ -249,7 +257,9 @@ function chado_featuremap_node_access($node, $op, $account) {
 }
 
 /**
- *  When a new chado_featuremap node is created we also need to add information
+ * Implements hook_insert().
+ *
+ * When a new chado_featuremap node is created we also need to add information
  *  to our chado_featuremap table.  This function is called on insert of a new node
  *  of type 'chado_featuremap' and inserts the necessary information.
  *
@@ -331,8 +341,9 @@ function chado_featuremap_insert($node) {
     drupal_write_record('chado_featuremap', $record);
   }
 }
+
 /**
- * Update nodes
+ * Implements hook_update(). Update nodes
  *
  * @ingroup tripal_featuremap
  */
@@ -396,7 +407,10 @@ function chado_featuremap_update($node) {
   chado_update_node_form_dbxrefs($node, $details);
 
 }
+
 /**
+ * Implements hook_load().
+ *
  *  When a node is requested by the user this function is called to allow us
  *  to add auxiliary data to the node object.
  *
@@ -417,7 +431,10 @@ function chado_featuremap_load($nodes) {
   }
 
 }
+
 /**
+ * Implements hook_delete().
+ *
  * Delete data from drupal and chado databases when a node is deleted
  * @ingroup tripal_featuremap
  */
@@ -446,9 +463,11 @@ function chado_featuremap_delete(&$node) {
   chado_query("DELETE FROM {featuremap}        WHERE featuremap_id = :featuremap_id", array(':featuremap_id' => $featuremap_id));
 
 }
+
 /**
+ * Implements hook_node_presave(). Acts on all content types.
  *
- * @param $node
+ * @ingroup tripal_featuremap
  */
 function tripal_featuremap_node_presave($node) {
   switch ($node->type) {
@@ -465,7 +484,9 @@ function tripal_featuremap_node_presave($node) {
       break;
   }
 }
+
 /**
+ * Implements hook_node_view(). Acts on all content types.
  *
  * @ingroup tripal_feature
  */
@@ -508,4 +529,4 @@ function tripal_featuremap_node_view($node, $view_mode, $langcode) {
       }
       break;
   }
-}
+}

+ 22 - 8
tripal_featuremap/tripal_featuremap.install

@@ -1,11 +1,14 @@
 <?php
 /**
  * @file
- * @todo Add file header description
+ * Handles installation of the feature map module
  */
 
 /**
+ * Implements hook_disable().
  * Disable default views when module is disabled
+ *
+ * @ingroup tripal_featuremap
  */
 function tripal_featuremap_disable() {
 
@@ -20,6 +23,8 @@ function tripal_featuremap_disable() {
 
 /**
  * Implementation of hook_requirements().
+ *
+ * @ingroup tripal_featuremap
  */
 function tripal_featuremap_requirements($phase) {
   $requirements = array();
@@ -102,20 +107,22 @@ function tripal_featuremap_schema() {
 }
 
 /**
+ * Add cvs needed by the featuremap module
  *
+ * @ingroup tripal_featuremap
  */
 function tripal_featuremap_add_cvs() {
-  
+
   tripal_cv_add_cv(
-    'featuremap_units', 
+    'featuremap_units',
     'Contains map unit types for the unittype_id column of the featuremap table.'
   );
-  
+
   tripal_cv_add_cv(
-    'featurepos_property', 
+    'featurepos_property',
     'Contains terms map properties.'
   );
-  
+
   tripal_cv_add_cv(
     'featuremap_property',
     'Contains positional types for the feature positions'
@@ -123,7 +130,9 @@ function tripal_featuremap_add_cvs() {
 }
 
 /**
+ * Add cv terms needed by the featuremap module
  *
+ * @ingroup tripal_featuremap
  */
 function tripal_featuremap_add_cvterms() {
 
@@ -163,7 +172,7 @@ function tripal_featuremap_add_cvterms() {
      ),
      'featuremap_units', 0, 1, 'tripal'
    );
-   
+
    // featurepos properties
    tripal_cv_add_cvterm(
      array(
@@ -240,8 +249,13 @@ function tripal_featuremap_add_cvterms() {
 
 }
 
-/*
+/**
+ * Add custom tables needed by the feature map module
+ *  - featuremapprop
+ *  - featuremap_dbxref
+ *  - featureposprop
  *
+ * @ingroup tripal_featuremap
  */
 function tripal_featuremap_add_custom_tables(){
   // add the featuremaprop table to Chado

+ 35 - 34
tripal_featuremap/tripal_featuremap.module

@@ -1,4 +1,8 @@
 <?php
+/**
+ * @file
+ * Integrates the Chado Map module with Drupal Nodes & Views
+ */
 
 /**
  * @defgroup tripal_featuremap Feature Map Module
@@ -8,26 +12,23 @@
  * @}
  */
 
-require('api/tripal_featuremap.api.inc');
-require('theme/tripal_featuremap.theme.inc');
-require('includes/tripal_featuremap.admin.inc');
-require('includes/tripal_featuremap.chado_node.inc');
-
-/**
- *
- * @ingroup tripal_featuremap
- */
-function tripal_featuremap_init() {
+require 'api/tripal_featuremap.api.inc';
 
-}
+require 'theme/tripal_featuremap.theme.inc';
 
+require 'includes/tripal_featuremap.admin.inc';
+require 'includes/tripal_featuremap.chado_node.inc';
 
 /**
+ * Implements hook_help().
  * Display help and module information
- * @param path which path of the site we're displaying help
- * @param arg array that holds the current path as would be returned from arg()
- * function
- * @return help text for the path
+ *
+ * @param path
+ *   which path of the site we're displaying help
+ * @param arg
+ *   array that holds the current path as would be returned from arg() function
+ * @return
+ *  help text for the path
  *
  * @ingroup tripal_featuremap
  */
@@ -43,8 +44,6 @@ function tripal_featuremap_help($path, $arg) {
   return $output;
 }
 
-
-
 /**
  * Implements hook_permission().
  *
@@ -80,6 +79,8 @@ function tripal_featuremap_permission() {
 }
 
 /**
+ * Implements hook_menu().
+ *
  * Menu items are automatically added for the new node types created
  * by this module to the 'Create Content' Navigation menu item.  This function
  * adds more menu items needed for this module.
@@ -148,21 +149,24 @@ function tripal_featuremap_menu() {
 }
 
 /**
- * Implements hook_views_api()
- * Purpose: Essentially this hook tells drupal that there is views support for
- *  for this module which then includes tripal_db.views.inc where all the
+ * Implements hook_views_api().
+ *
+ * Essentially this hook tells drupal that there is views support for
+ *  for this module which then includes tripal_featuremap.views.inc where all the
  *  views integration code is
  *
  * @ingroup tripal_featuremap
  */
 function tripal_featuremap_views_api() {
   return array(
-    'api' => 2.0,
+    'api' => 3.0,
   );
 }
 
 /**
- *  We need to let drupal know about our theme functions and their arguments.
+ * Implements hook_theme().
+ *
+ * We need to let drupal know about our theme functions and their arguments.
  *  We create theme functions to allow users of the module to customize the
  *  look and feel of the output generated in this module
  *
@@ -218,7 +222,9 @@ function tripal_featuremap_theme($existing, $type, $theme, $path) {
 }
 
 /**
- * @ingroup tripal_library
+ * Implements hook_block_info().
+ *
+ * @ingroup tripal_featuremap
  */
 function tripal_featuremap_block_info() {
 
@@ -239,8 +245,11 @@ function tripal_featuremap_block_info() {
 
   return $blocks;
 }
+
 /**
- * @ingroup tripal_library
+ * Implements hook_block_view().
+ *
+ * @ingroup tripal_featuremap
  */
 function tripal_featuremap_block_view($delta = '') {
 
@@ -276,21 +285,14 @@ function tripal_featuremap_block_view($delta = '') {
   }
 }
 
-/**
- *
- * @ingroup tripal_featuremap
- */
-function tripal_featuremap_cron() {
-
-}
-
-
 /**
  * Implementation of hook_form_alter()
  *
  * @param $form
  * @param $form_state
  * @param $form_id
+ *
+ * @ingroup tripal_featuremap
  */
 function tripal_featuremap_form_alter(&$form, &$form_state, $form_id) {
   // turn of preview button for insert/updates
@@ -298,4 +300,3 @@ function tripal_featuremap_form_alter(&$form, &$form_state, $form_id) {
     $form['actions']['preview']['#access'] = FALSE;
   }
 }
-

+ 12 - 1
tripal_featuremap/tripal_featuremap.views_default.inc

@@ -1,7 +1,13 @@
 <?php
+/**
+ * @file
+ * Default feature map views
+ */
 
 /**
+ * Implements hook_views_default_views().
  *
+ * @ingroup tripal_featuremap
  */
 function tripal_featuremap_views_default_views() {
   $views = array();
@@ -12,6 +18,11 @@ function tripal_featuremap_views_default_views() {
   return $views;
 }
 
+/**
+ * Describes the default featuremap admin view
+ *
+ * @ingroup tripal_featuremap
+ */
 function tripal_featuremap_defaultview_admin_featuremaps() {
 
   $view = new view();
@@ -185,4 +196,4 @@ function tripal_featuremap_defaultview_admin_featuremaps() {
   $handler->display->display_options['tab_options']['weight'] = '0';
 
   return $view;
-}
+}