Browse Source

Added additional documentation to tripal_analysis function headers

Lacey Sanderson 12 years ago
parent
commit
14835a0ec9

+ 45 - 5
tripal_analysis/tripal_analysis.admin.inc

@@ -1,11 +1,8 @@
 <?php
-//
-// Copyright 2009 Clemson University
-//
 
 /**
  * @file
- * @todo Add file header description
+ * Contains functions displaying administrative pages and forms
  */
 
 /**
@@ -136,12 +133,16 @@ function tripal_analysis_module_description_page() {
   return $text;
 }
 
-/*******************************************************************************
+/**
  * Administration page callbacks for the Tripal Analysis module
+ *
  * We have defined a hook_get_settings() function. When a sub-module
  * is enabled, we'll look for this function to provide a form for the
  * administrative setting.
  *
+ * @return
+ *  A form API array describing an administrative form
+ *
  * @ingroup tripal_analysis
  */
 function tripal_analysis_admin() {
@@ -209,6 +210,13 @@ function tripal_analysis_admin() {
 }
 
 /**
+ * Displays the Set Drupal Taxonomy for Analysis Features From
+ *
+ * @param $form
+ *  The administrative form as it is currently
+ *
+ * @return
+ *  A form API array describing an administrative form
  *
  * @ingroup tripal_analysis
  */
@@ -254,7 +262,15 @@ function get_tripal_analysis_admin_form_taxonomy_set(&$form) {
       '#weight'      => 3
   );
 }
+
 /**
+ * The "Reindex Analysis Nodes" form
+ *
+ * @param $form
+ *  The administrative form as it is currently
+ *
+ * @return
+ *  A form API array describing an administrative form
  *
  * @ingroup tripal_analysis
  */
@@ -298,7 +314,15 @@ function get_tripal_analysis_admin_form_reindex_set(&$form) {
       '#weight' => 3,
   );
 }
+
 /**
+ * The "Clean-up orphaned analysis & nodes" Form
+ *
+ * @param $form
+ *  The administrative form as it is currently
+ *
+ * @return
+ *  A form API array describing an administrative form
  *
  * @ingroup tripal_analysis
  */
@@ -322,7 +346,15 @@ function get_tripal_analysis_admin_form_cleanup_set(&$form) {
       '#weight' => 2,
   );
 }
+
 /**
+ * The "sync Analysis in chado with drupal" form
+ *
+ * @param $form
+ *  The administrative form as it is currently
+ *
+ * @return
+ *  A form API array describing an administrative form
  *
  * @ingroup tripal_analysis
  */
@@ -400,7 +432,15 @@ function get_tripal_analysis_admin_form_sync_set(&$form) {
     );
   }
 }
+
 /**
+ * Validate the administrative form
+ * @todo Stephen: Why is validate used rather then submit?
+ *
+ * @param $form
+ *   The form API array of the form to be validated
+ * @form_state
+ *   The user submitted values
  *
  * @ingroup tripal_analysis
  */

+ 109 - 108
tripal_analysis/tripal_analysis.api.inc

@@ -2,17 +2,119 @@
 
 /**
  * @file
- * @todo Add file header description
- */
-
-/**
+ * API functions relating to Analysis'
+ *
  * @defgroup tripal_analysis_api Analysis Module API
  * @ingroup tripal_analysis
  * @ingroup tripal_api
  */
+
+/**
+ * Retrieve properties of a given type for a given analysis
+ *
+ * @param $analysis_id
+ *    The analysis_id of the properties you would like to retrieve
+ * @param $property
+ *    The cvterm name of the properties to retrieve
+ *
+ * @return
+ *    An analysis chado variable with the specified properties expanded
+ *
+ * @ingroup tripal_analysis_api
+ */
+function tripal_analysis_get_property($analysis_id, $property) {
+  return tripal_core_get_property('analysis', $analysis_id, $property, 'tripal');
+}
+
+/**
+ * Insert a given property
+ *
+ * @param $analysis_id
+ *   The analysis_id of the property to insert
+ * @param $property
+ *   The cvterm name of the property to insert
+ * @param $value
+ *   The value of the property to insert
+ * @param $update_if_present
+ *   A boolean indicated whether to update the record if it's already present
+ *
+ * @return
+ *   True of success, False otherwise
+ *
+ * @ingroup tripal_analysis_api
+ */
+function tripal_analysis_insert_property($analysis_id, $property, $value, $update_if_present = 0) {
+    return tripal_core_insert_property('analysis', $analysis_id, $property, 'tripal', $value, $update_if_present);
+}
+
+/**
+ * Update a given property
+ *
+ * @param $analysis_id
+ *   The analysis_id of the property to update
+ * @param $property
+ *   The cvterm name of the property to update
+ * @param $value
+ *   The value of the property to update
+ * @param $insert_if_missing
+ *   A boolean indicated whether to insert the record if it's absent
+ *
+ * Note: The property will be identified using the unique combination of the $analysis_id and $property
+ * and then it will be updated with the supplied value
+ *
+ * @return
+ *   True of success, False otherwise
+ *
+ * @ingroup tripal_analysis_api
+ */
+function tripal_analysis_update_property($analysis_id, $property, $value, $insert_if_missing = 0) {
+  return tripal_core_update_property('analysis', $analysis_id, $property, 'tripal', $value, $insert_if_missing);
+}
+
+/**
+ * Delete a given property
+ *
+ * @param $analysis_id
+ *   The analysis_id of the property to delete
+ * @param $property
+ *   The cvterm name of the property to delete
+ *
+ * Note: The property will be identified using the unique combination of the $analysis_id and $property
+ * and then it will be deleted
+ *
+ * @return
+ *   True of success, False otherwise
+ *
+ * @ingroup tripal_analysis_api
+ */
+function tripal_analysis_delete_property($analysis_id, $property) {
+  return tripal_core_delete_property('analysis', $analysis_id, $property, 'tripal');
+}
+
+/**
+ * Retreives the node of a sync'ed analysis
+ *
+ * @param $analysis_id
+ *   The analysis_id of the property to delete
+ *
+ * @return
+ *   node of analysis on success, null otherwise
+ *
+ * @ingroup tripal_analysis_api
+ */
+function tripal_analysis_get_node($analysis_id) {
+  $sql = "SELECT *
+           FROM chado_analysis CA
+              INNER JOIN node N on CA.nid = N.nid
+           WHERE analysis_id = %d";
+  $node = db_fetch_object(db_query($sql, $analysis_id));
+  return $node;
+}
+
 /**
  * @section Chado Table Descriptions
  */
+
 /**
  * Implements hook_chado_analysis_schema()
  * Purpose: To add descriptions and foreign keys to default table description
@@ -39,7 +141,7 @@ function tripal_analysis_chado_analysis_schema() {
   return $description;
 }
 
- /****************************************************************************
+/**
  * Implements hook_chado_analysisfeature_schema()
  * Purpose: To add descriptions and foreign keys to default table description
  * Note: This array will be merged with the array from all other implementations
@@ -69,7 +171,7 @@ function tripal_analysis_chado_analysisfeature_schema() {
   return $description;
 }
 
- /****************************************************************************
+/**
  * Implements hook_chado_analysisfeatureprop_schema()
  * Purpose: To add descriptions and foreign keys to default table description
  * Note: This array will be merged with the array from all other implementations
@@ -99,7 +201,7 @@ function tripal_analysis_chado_analysisfeatureprop_schema() {
 }
 
 
- /****************************************************************************
+/**
   * Implements hook_chado_analysisprop_schema()
   * Purpose: To add descriptions and foreign keys to default table description
   * Note: This array will be merged with the array from all other implementations
@@ -128,104 +230,3 @@ function tripal_analysis_chado_analysisprop_schema() {
 
   return $description;
 }
-
-/**
- * Retrieve properties of a given type for a given analysis
- *
- * @param $analysis_id
- *    The analysis_id of the properties you would like to retrieve
- * @param $property
- *    The cvterm name of the properties to retrieve
- *
- * @return
- *    An analysis chado variable with the specified properties expanded
- *
- * @ingroup tripal_analysis_api
- */
-function tripal_analysis_get_property($analysis_id, $property) {
-  return tripal_core_get_property('analysis', $analysis_id, $property, 'tripal');
-}
-
-/**
- * Insert a given property
- *
- * @param $analysis_id
- *   The analysis_id of the property to insert
- * @param $property
- *   The cvterm name of the property to insert
- * @param $value
- *   The value of the property to insert
- * @param $update_if_present
- *   A boolean indicated whether to update the record if it's already present
- *
- * @return
- *   True of success, False otherwise
- *
- * @ingroup tripal_analysis_api
- */
-function tripal_analysis_insert_property($analysis_id, $property, $value, $update_if_present = 0) {
-    return tripal_core_insert_property('analysis', $analysis_id, $property, 'tripal', $value, $update_if_present);
-}
-
-/**
- * Update a given property
- *
- * @param $analysis_id
- *   The analysis_id of the property to update
- * @param $property
- *   The cvterm name of the property to update
- * @param $value
- *   The value of the property to update
- * @param $insert_if_missing
- *   A boolean indicated whether to insert the record if it's absent
- *
- * Note: The property will be identified using the unique combination of the $analysis_id and $property
- * and then it will be updated with the supplied value
- *
- * @return
- *   True of success, False otherwise
- *
- * @ingroup tripal_analysis_api
- */
-function tripal_analysis_update_property($analysis_id, $property, $value, $insert_if_missing = 0) {
-  return tripal_core_update_property('analysis', $analysis_id, $property, 'tripal', $value, $insert_if_missing);
-}
-
-/**
- * Delete a given property
- *
- * @param $analysis_id
- *   The analysis_id of the property to delete
- * @param $property
- *   The cvterm name of the property to delete
- *
- * Note: The property will be identified using the unique combination of the $analysis_id and $property
- * and then it will be deleted
- *
- * @return
- *   True of success, False otherwise
- *
- * @ingroup tripal_analysis_api
- */
-function tripal_analysis_delete_property($analysis_id, $property) {
-  return tripal_core_delete_property('analysis', $analysis_id, $property, 'tripal');
-}
-/**
- * Retreives the node of a sync'ed analysis
- *
- * @param $analysis_id
- *   The analysis_id of the property to delete
- *
- * @return
- *   node of analysis on success, null otherwise
- *
- * @ingroup tripal_analysis_api
- */
-function tripal_analysis_get_node($analysis_id) {
-  $sql = "SELECT *
-           FROM chado_analysis CA
-              INNER JOIN node N on CA.nid = N.nid
-           WHERE analysis_id = %d";
-  $node = db_fetch_object(db_query($sql, $analysis_id));
-  return $node;
-}

+ 55 - 50
tripal_analysis/tripal_analysis.install

@@ -1,10 +1,10 @@
 <?php
 /**
  * @file
- * @todo Add file header description
+ * Implements hooks from the Schema API
  */
 
-/*******************************************************************************
+/**
  * Implementation of hook_install().
  */
 function tripal_analysis_install() {
@@ -38,7 +38,7 @@ function tripal_analysis_install() {
       'or special characters) abbreviation for the analysis.'), 'tripal', 0, 1 , 'tripal');
 }
 
-/*******************************************************************************
+/**
  * Implementation of hook_uninstall().
  */
 function tripal_analysis_uninstall() {
@@ -54,66 +54,71 @@ function tripal_analysis_uninstall() {
   }
 }
 
-/*******************************************************************************
- * Implementation of hook_schema() creates two tables. chado_analysis table
- * stores nodes that are also saved in the analysis table of chado database.
- * tripal_analysis table stores the sub-module names, such as
- * tripal_analysis_blast, that are registered with this module.
+/**
+ * Implementation of hook_schema() creates two tables.
+ *
+ * - chado_analysis table
+ *     stores nodes that are also saved in the analysis table of chado database.
+ * - tripal_analysis table
+ *     stores the sub-module names, such as tripal_analysis_blast, that are registered
+ *     with this module.
  */
 function tripal_analysis_schema() {
   // chado_analysis table
   $schema['chado_analysis'] = array(
-      'fields' => array(
-         'vid' => array(
-            'type' => 'int',
-            'unsigned' => TRUE,
-            'not null' => TRUE,
-            'default' => 0
-  ),
-         'nid' => array(
-            'type' => 'int',
-            'unsigned' => TRUE,
-            'not null' => TRUE,
-            'default' => 0
-  ),
-         'analysis_id' => array(
-            'type' => 'int',
-            'not null' => TRUE,
-            'default' => 0
-  )
-  ),
-      'indexes' => array(
-         'analysis_id' => array('analysis_id')
-  ),
-      'unique keys' => array(
-         'nid_vid' => array('nid', 'vid'),
-         'vid' => array('vid')
-  ),
-      'primary key' => array('nid'),
+    'fields' => array(
+      'vid' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0
+      ),
+      'nid' => array(
+        'type' => 'int',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+        'default' => 0
+      ),
+      'analysis_id' => array(
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0
+      )
+    ),
+    'indexes' => array(
+      'analysis_id' => array('analysis_id')
+    ),
+    'unique keys' => array(
+      'nid_vid' => array('nid', 'vid'),
+      'vid' => array('vid')
+    ),
+    'primary key' => array('nid'),
   );
 
   // tripal_analysis table
   $schema['tripal_analysis'] = array(
-      'description' => t('Table to store analysis sub-modules'),
-      'fields' => array(
-         'modulename' => array(
-            'type' => 'text',
-            'size' => 'small',
-            'not null' => TRUE,
-            'description' => t('The module name. Tripal Analysis will use the '.
-                               'module name to call module_setting_form()')
-  )
-  ),
-      'unique keys' => array(
-         'modulename' => array('modulename')
-  )
+    'description' => t('Table to store analysis sub-modules'),
+    'fields' => array(
+      'modulename' => array(
+        'type' => 'text',
+        'size' => 'small',
+        'not null' => TRUE,
+        'description' => t('The module name. Tripal Analysis will use the '.
+                            'module name to call module_setting_form()')
+      )
+    ),
+    'unique keys' => array(
+      'modulename' => array('modulename')
+    )
   );
+
   return $schema;
 }
 
-/*******************************************************************************
+/**
  * Implementation of hook_requirements(). Make sure 'Tripal Core' is enabled
  * before installation
+ * @todo: Check if this is needed
  */
 function tripal_analysis_requirements($phase) {
   $requirements = array();
@@ -129,7 +134,7 @@ function tripal_analysis_requirements($phase) {
   return $requirements;
 }
 
-/*******************************************************************************
+/**
  * Provide update script for adding new cvterms
  */
 function tripal_analysis_update_6001() {

+ 42 - 17
tripal_analysis/tripal_analysis.module

@@ -3,9 +3,7 @@
 /**
  * @file
  * Contains all the main hook implementations for the tripal_analysis module
- */
-
-/**
+ *
  * @defgroup tripal_analysis Analysis Module
  * @{
  * Provides functions for managing chado analysis' including creating details pages for each one
@@ -16,9 +14,11 @@
 require('tripal_analysis.api.inc');
 require('tripal_analysis_privacy.inc');
 
-
 /**
+ * Register tripal_analysis sub-modules
  *
+ * @param $modulename
+ *  The name of the module to be registered as a tripal analysis submodule
  *
  * @ingroup tripal_analysis
  */
@@ -26,8 +26,12 @@ function tripal_analysis_register_child($modulename) {
   $sql = "INSERT INTO {tripal_analysis} (modulename) VALUES ('%s')";
   db_query($sql, $modulename);
 }
+
 /**
+ * Un-register a tripal analysis sub-module
  *
+ * @param $modulename
+ *  The name of the module to un-register
  *
  * @ingroup tripal_analysis
  */
@@ -39,6 +43,7 @@ function tripal_analysis_unregister_child($modulename) {
 }
 
 /**
+ * Add tripal javascript to page headers
  *
  * @ingroup tripal_analysis
  */
@@ -47,7 +52,6 @@ function tripal_analysis_init() {
 }
 
 /**
- * tripal_analysis_menu().
  * Implementation of hook_menu().
  * Entry points and paths of the module
  *
@@ -112,8 +116,8 @@ function tripal_analysis_show_analyses() {
 }
 
 /**
- *  Provide information to drupal about the node types that we're creating
- *  in this module
+ * Provide information to drupal about the node types that we're creating
+ * in this module
  *
  * @ingroup tripal_analysis
  */
@@ -131,6 +135,7 @@ function tripal_analysis_node_info() {
   );
   return $nodes;
 }
+
 /**
  *  When a new chado_analysis node is created we also need to add information
  *  to our chado_analysis table.  This function is called on insert of a new
@@ -218,7 +223,12 @@ function chado_analysis_insert($node) {
     $node->analysis = $analysis;
     $node->analysis_id = $analysis_id; // we need to set this for children
 }
+
 /**
+ * Removes analysis from the chado database
+ *
+ * @param $node
+ *   The node object specifying which chado record to delete
  *
  * @ingroup tripal_analysis
  */
@@ -254,6 +264,9 @@ function chado_analysis_delete($node) {
 /**
  * Update analyses
  *
+ * @param $node
+ *   The updated node object
+ *
  * @ingroup tripal_analysis
  */
 function chado_analysis_update($node) {
@@ -661,6 +674,7 @@ function tripal_analysis_sync_analyses($analysis_id = NULL, $job_id = NULL) {
 }
 
 /**
+ * Validates the user input before creating an analysis node
  *
  * @ingroup tripal_analysis
  */
@@ -668,17 +682,16 @@ function chado_analysis_validate($node, &$form) {
    // use the analysis parent to validate the node
   tripal_analysis_validate($node, $form);
 }
+
 /**
-  *
-  * @ingroup tripal_analysis
-  */
+ * This validation is being used for three activities:
+ *   CASE A: Update a node that exists in both drupal and chado
+ *   CASE B: Synchronizing a node from chado to drupal
+ *   CASE C: Inserting a new node that exists in niether drupal nor chado
+ *
+ * @ingroup tripal_analysis
+ */
 function tripal_analysis_validate($node, &$form) {
-##dprint_r($node);
-
-    // This validation is being used for three activities:
-    // CASE A: Update a node that exists in both drupal and chado
-    // CASE B: Synchronizing a node from chado to drupal
-    // CASE C: Inserting a new node that exists in niether drupal nor chado
 
     // Only nodes being updated will have an nid already
     if ($node->nid) {
@@ -722,6 +735,7 @@ function tripal_analysis_validate($node, &$form) {
         }
     }
 }
+
 /**
  * Display help and module information
  * @param path which path of the site we're displaying help
@@ -742,6 +756,7 @@ function tripal_analysis_help($path, $arg) {
   }
   return $output;
 }
+
 /**
  *  The following function proves access control for users trying to
  *  perform actions on data managed by this module
@@ -776,7 +791,7 @@ function chado_analysis_access($op, $node, $account) {
 /**
  *  Set the permission types that the chado module uses.  Essentially we
  *  want permissionis that protect creation, editing and deleting of chado
- #  data objects
+ *  data objects
  *
  * @ingroup tripal_analysis
  */
@@ -846,8 +861,12 @@ function get_chado_analyses() {
     return $analyses;
   }
 }
+
 /**
+ * Theme the List Analysis page
  *
+ * @param $analyses
+ *   An array of analyses to list
  *
  * @ingroup tripal_analysis
  */
@@ -902,7 +921,12 @@ function theme_tripal_analysis_analysis_page($analyses) {
 }
 
 /**
+ * Remove orphaned drupal nodes or chado analysis
  *
+ * @param $dummy
+ *   Not Used -kept for backwards compatibility
+ * @param $job_id
+ *   The id of the tripal job executing this function
  *
  * @ingroup tripal_analysis
  */
@@ -1058,6 +1082,7 @@ function tripal_analysis_taxonify_features ($analysis_id = NULL, $job_id = NULL)
   }
 }
  */
+
 /**
  * Implements hook_views_api()
  * Purpose: Essentially this hook tells drupal that there is views support for

+ 1 - 1
tripal_analysis/tripal_analysis.views.inc

@@ -112,7 +112,7 @@ function tripal_analysis_views_data_alter(&$data) {
 }
 
 /**
- *
+ * Implements hook_views_default_views().
  *
  * @ingroup tripal_analysis_views
  */

+ 0 - 567
tripal_analysis/tripal_analysis.views.inc.orig

@@ -1,567 +0,0 @@
-<?php
-
-/**
- *  @file
- *  This file contains the basic functions for views integration of
- *  chado/tripal analysis tables. Supplementary functions can be found in
- *  ./views/
- *
- *  Documentation on views integration can be found at
- *  http://views2.logrus.com/doc/html/index.html.
- */
-
-/**
- * @defgroup tripal_analysis_views Analysis Views Integration
- * @ingroup views
- * @ingroup tripal_analysis
- */
-
-<<<<<<< HEAD
-=======
-require('views/analysis.views.inc');
-require('views/chado_analysis.views.inc');
-require('views/misc_tables.views.inc');
->>>>>>> 6.x-0.4-dev
-/**
- * Implements hook_views_data()
- *
- * Purpose: Describe chado/tripal tables & fields to views
- *
- * @return: a data array which follows the structure outlined in the
- *   views2 documentation for this hook. Essentially, it's an array of table
- *   definitions keyed by chado/tripal table name. Each table definition
- *   includes basic details about the table, fields in that table and
- *   relationships between that table and others (joins)
- *
- * @ingroup tripal_analysis_views
- */
-function tripal_analysis_views_data()  {
-  $data = array();
-
-  if (module_exists('tripal_views')) {
-		// Base Table: Analysis
-		$tablename = 'analysis';
-		if (!tripal_views_is_integrated($tablename, 10)) {
-			$table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE);
-			tripal_views_integration_add_entry($table_integration_array);
-		}
-
-
-    $tables = array(
-      'analysisfeature',
-      'analysisprop'
-    );
-    foreach ($tables as $tablename) {
-      if (!tripal_views_is_integrated($tablename, 10)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE);
-        tripal_views_integration_add_entry($table_integration_array);
-      }
-    }
-
-  }
-
-  return $data;
-}
-
-/**
- * Implements hook_views_handlers()
- *
- * Purpose: Register all custom handlers with views
- *   where a handler describes either "the type of field",
- *   "how a field should be filtered", "how a field should be sorted"
- *
- * @return
- *   An array of handler definitions
- *
- * @ingroup tripal_analysis_views
- */
-function tripal_analysis_views_views_handlers() {
-  return array(
-    'info' => array(
-      'path' => drupal_get_path('module', 'tripal_analysis') . '/views/handlers',
-    ),
-    'handlers' => array(
-      'views_handler_field_computed_analysis_nid' => array(
-        'parent' => 'views_handler_field_numeric',
-      ),
-      'views_handler_field_readable_date' => array(
-        'parent' => 'views_handler_field',
-      ),
-    ),
-  );
-}
-
-/**
- * Implementation of hook_views_data_alter().
- */
-function tripal_analysis_views_data_alter(&$data) {
-
-  if (!(is_array($db_url) and array_key_exists('chado', $db_url)) ) {
-
-    // Add featuer relationship to node
-    $data['node']['analysis_chado_nid'] = array(
-      'group' => 'Analysis',
-      'title' => 'Analysis Node',
-      'help' => 'Links Chado analysis Fields/Data to the Nodes in the current View.',
-      'real field' => 'nid',
-      'relationship' => array(
-        'handler' => 'views_handler_relationship',
-        'title' => t('Node => Chado'),
-        'label' => t('Node => Chado'),
-        'real field' => 'nid',
-        'base' => 'chado_analysis',
-        'base field' => 'nid'
-      ),
-    );
-  }
-
-}
-
-/**
- *
- *
- * @ingroup tripal_analysis_views
- */
-function tripal_analysis_views_default_views() {
-  $views = array();
-
-  // Main default view
-  // List all cvterms based on cv
-  $view = new view;
-  $view->name = 'all_analysis';
-  $view->description = 'A listing of all analysis\'';
-  $view->tag = 'chado';
-  $view->view_php = '';
-  $view->base_table = 'analysis';
-  $view->is_cacheable = FALSE;
-  $view->api_version = 2;
-  $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
-  $handler = $view->new_display('default', 'Defaults', 'default');
-  $handler->override_option('fields', array(
-    'name' => array(
-      'label' => 'Name',
-      'alter' => array(
-        'alter_text' => 0,
-        'text' => '',
-        'make_link' => 0,
-        'path' => '',
-        'link_class' => '',
-        'alt' => '',
-        'prefix' => '',
-        'suffix' => '',
-        'target' => '',
-        'help' => '',
-        'trim' => 0,
-        'max_length' => '',
-        'word_boundary' => 1,
-        'ellipsis' => 1,
-        'html' => 0,
-        'strip_tags' => 0,
-      ),
-      'empty' => '',
-      'hide_empty' => 0,
-      'empty_zero' => 0,
-      'link_to_node' => 1,
-      'exclude' => 0,
-      'id' => 'name',
-      'table' => 'analysis',
-      'field' => 'name',
-      'relationship' => 'none',
-    ),
-    'algorithm' => array(
-      'label' => 'Algorithm',
-      'alter' => array(
-        'alter_text' => 0,
-        'text' => '',
-        'make_link' => 0,
-        'path' => '',
-        'link_class' => '',
-        'alt' => '',
-        'prefix' => '',
-        'suffix' => '',
-        'target' => '',
-        'help' => '',
-        'trim' => 0,
-        'max_length' => '',
-        'word_boundary' => 1,
-        'ellipsis' => 1,
-        'html' => 0,
-        'strip_tags' => 0,
-      ),
-      'empty' => '',
-      'hide_empty' => 0,
-      'empty_zero' => 0,
-      'exclude' => 0,
-      'id' => 'algorithm',
-      'table' => 'analysis',
-      'field' => 'algorithm',
-      'relationship' => 'none',
-    ),
-    'program' => array(
-      'label' => 'Program',
-      'alter' => array(
-        'alter_text' => 0,
-        'text' => '',
-        'make_link' => 0,
-        'path' => '',
-        'link_class' => '',
-        'alt' => '',
-        'prefix' => '',
-        'suffix' => '',
-        'target' => '',
-        'help' => '',
-        'trim' => 0,
-        'max_length' => '',
-        'word_boundary' => 1,
-        'ellipsis' => 1,
-        'html' => 0,
-        'strip_tags' => 0,
-      ),
-      'empty' => '',
-      'hide_empty' => 0,
-      'empty_zero' => 0,
-      'exclude' => 0,
-      'id' => 'program',
-      'table' => 'analysis',
-      'field' => 'program',
-      'relationship' => 'none',
-    ),
-    'programversion' => array(
-      'label' => 'Program Version',
-      'alter' => array(
-        'alter_text' => 0,
-        'text' => '',
-        'make_link' => 0,
-        'path' => '',
-        'link_class' => '',
-        'alt' => '',
-        'prefix' => '',
-        'suffix' => '',
-        'target' => '',
-        'help' => '',
-        'trim' => 0,
-        'max_length' => '',
-        'word_boundary' => 1,
-        'ellipsis' => 1,
-        'html' => 0,
-        'strip_tags' => 0,
-      ),
-      'empty' => '',
-      'hide_empty' => 0,
-      'empty_zero' => 0,
-      'exclude' => 0,
-      'id' => 'programversion',
-      'table' => 'analysis',
-      'field' => 'programversion',
-      'relationship' => 'none',
-    ),
-    'description' => array(
-      'label' => 'Description',
-      'alter' => array(
-        'alter_text' => 0,
-        'text' => '',
-        'make_link' => 0,
-        'path' => '',
-        'link_class' => '',
-        'alt' => '',
-        'prefix' => '',
-        'suffix' => '',
-        'target' => '',
-        'help' => '',
-        'trim' => 0,
-        'max_length' => '',
-        'word_boundary' => 1,
-        'ellipsis' => 1,
-        'html' => 0,
-        'strip_tags' => 0,
-      ),
-      'empty' => '',
-      'hide_empty' => 0,
-      'empty_zero' => 0,
-      'exclude' => 0,
-      'id' => 'description',
-      'table' => 'analysis',
-      'field' => 'description',
-      'relationship' => 'none',
-    ),
-    'sourcename' => array(
-      'label' => 'Source Name',
-      'alter' => array(
-        'alter_text' => 0,
-        'text' => '',
-        'make_link' => 0,
-        'path' => '',
-        'link_class' => '',
-        'alt' => '',
-        'prefix' => '',
-        'suffix' => '',
-        'target' => '',
-        'help' => '',
-        'trim' => 0,
-        'max_length' => '',
-        'word_boundary' => 1,
-        'ellipsis' => 1,
-        'html' => 0,
-        'strip_tags' => 0,
-      ),
-      'empty' => '',
-      'hide_empty' => 0,
-      'empty_zero' => 0,
-      'exclude' => 0,
-      'id' => 'sourcename',
-      'table' => 'analysis',
-      'field' => 'sourcename',
-      'relationship' => 'none',
-    ),
-    'sourceuri' => array(
-      'label' => 'Source URL',
-      'alter' => array(
-        'alter_text' => 0,
-        'text' => '',
-        'make_link' => 0,
-        'path' => '',
-        'link_class' => '',
-        'alt' => '',
-        'prefix' => '',
-        'suffix' => '',
-        'target' => '',
-        'help' => '',
-        'trim' => 0,
-        'max_length' => '',
-        'word_boundary' => 1,
-        'ellipsis' => 1,
-        'html' => 0,
-        'strip_tags' => 0,
-      ),
-      'empty' => '',
-      'hide_empty' => 0,
-      'empty_zero' => 0,
-      'exclude' => 0,
-      'id' => 'sourceuri',
-      'table' => 'analysis',
-      'field' => 'sourceuri',
-      'relationship' => 'none',
-    ),
-    'sourceversion' => array(
-      'label' => 'Source Version',
-      'alter' => array(
-        'alter_text' => 0,
-        'text' => '',
-        'make_link' => 0,
-        'path' => '',
-        'link_class' => '',
-        'alt' => '',
-        'prefix' => '',
-        'suffix' => '',
-        'target' => '',
-        'help' => '',
-        'trim' => 0,
-        'max_length' => '',
-        'word_boundary' => 1,
-        'ellipsis' => 1,
-        'html' => 0,
-        'strip_tags' => 0,
-      ),
-      'empty' => '',
-      'hide_empty' => 0,
-      'empty_zero' => 0,
-      'exclude' => 0,
-      'id' => 'sourceversion',
-      'table' => 'analysis',
-      'field' => 'sourceversion',
-      'relationship' => 'none',
-    ),
-    'num_features' => array(
-      'label' => 'Number of Features',
-      'alter' => array(
-        'alter_text' => 0,
-        'text' => '',
-        'make_link' => 0,
-        'path' => '',
-        'link_class' => '',
-        'alt' => '',
-        'prefix' => '',
-        'suffix' => '',
-        'target' => '',
-        'help' => '',
-        'trim' => 0,
-        'max_length' => '',
-        'word_boundary' => 1,
-        'ellipsis' => 1,
-        'html' => 0,
-        'strip_tags' => 0,
-      ),
-      'empty' => '',
-      'hide_empty' => 0,
-      'empty_zero' => 0,
-      'exclude' => 0,
-      'id' => 'num_features',
-      'table' => 'analysis',
-      'field' => 'num_features',
-      'relationship' => 'none',
-    ),
-    'timeexecuted' => array(
-      'label' => 'Time Executed',
-      'alter' => array(
-        'alter_text' => 0,
-        'text' => '',
-        'make_link' => 0,
-        'path' => '',
-        'link_class' => '',
-        'alt' => '',
-        'prefix' => '',
-        'suffix' => '',
-        'target' => '',
-        'help' => '',
-        'trim' => 0,
-        'max_length' => '',
-        'word_boundary' => 1,
-        'ellipsis' => 1,
-        'html' => 0,
-        'strip_tags' => 0,
-      ),
-      'empty' => '',
-      'hide_empty' => 0,
-      'empty_zero' => 0,
-      'date_format' => 'large',
-      'custom_date_format' => '',
-      'exclude' => 0,
-      'id' => 'timeexecuted',
-      'table' => 'analysis',
-      'field' => 'timeexecuted',
-      'relationship' => 'none',
-    ),
-  ));
-  $handler->override_option('filters', array(
-    'program' => array(
-      'operator' => '=',
-      'value' => 'All',
-      'group' => '0',
-      'exposed' => TRUE,
-      'expose' => array(
-        'use_operator' => 0,
-        'operator' => 'program_op',
-        'identifier' => 'program',
-        'label' => 'Program',
-        'optional' => 1,
-        'remember' => 0,
-      ),
-      'case' => 0,
-      'id' => 'program',
-      'table' => 'analysis',
-      'field' => 'program',
-      'relationship' => 'none',
-    ),
-    'sourcename' => array(
-      'operator' => 'contains',
-      'value' => '',
-      'group' => '0',
-      'exposed' => TRUE,
-      'expose' => array(
-        'use_operator' => 0,
-        'operator' => 'sourcename_op',
-        'identifier' => 'sourcename',
-        'label' => 'Source Name Contains',
-        'optional' => 1,
-        'remember' => 0,
-      ),
-      'case' => 0,
-      'id' => 'sourcename',
-      'table' => 'analysis',
-      'field' => 'sourcename',
-      'relationship' => 'none',
-    ),
-  ));
-  $handler->override_option('access', array(
-    'type' => 'perm',
-    'perm' => 'access chado_analysis content',
-  ));
-  $handler->override_option('cache', array(
-    'type' => 'none',
-  ));
-  $handler->override_option('title', 'Analysis');
-  $handler->override_option('empty', 'No analysis match the supplied criteria.');
-  $handler->override_option('empty_format', '1');
-  $handler->override_option('items_per_page', 50);
-  $handler->override_option('use_pager', '1');
-  $handler->override_option('style_plugin', 'table');
-  $handler->override_option('style_options', array(
-    'grouping' => '',
-    'override' => 1,
-    'sticky' => 0,
-    'order' => 'asc',
-    'columns' => array(
-      'algorithm' => 'algorithm',
-      'description' => 'description',
-      'name' => 'name',
-      'num_features' => 'num_features',
-      'program' => 'program',
-      'programversion' => 'programversion',
-      'sourcename' => 'sourcename',
-      'sourceuri' => 'sourceuri',
-      'sourceversion' => 'sourceversion',
-      'timeexecuted' => 'timeexecuted',
-    ),
-    'info' => array(
-      'algorithm' => array(
-        'sortable' => 1,
-        'separator' => '',
-      ),
-      'description' => array(
-        'sortable' => 1,
-        'separator' => '',
-      ),
-      'name' => array(
-        'sortable' => 1,
-        'separator' => '',
-      ),
-      'num_features' => array(
-        'separator' => '',
-      ),
-      'program' => array(
-        'sortable' => 1,
-        'separator' => '',
-      ),
-      'programversion' => array(
-        'sortable' => 1,
-        'separator' => '',
-      ),
-      'sourcename' => array(
-        'sortable' => 1,
-        'separator' => '',
-      ),
-      'sourceuri' => array(
-        'sortable' => 1,
-        'separator' => '',
-      ),
-      'sourceversion' => array(
-        'sortable' => 1,
-        'separator' => '',
-      ),
-      'timeexecuted' => array(
-        'sortable' => 1,
-        'separator' => '',
-      ),
-    ),
-    'default' => 'timeexecuted',
-  ));
-  $handler = $view->new_display('page', 'Page', 'page_1');
-  $handler->override_option('path', 'analyses');
-  $handler->override_option('menu', array(
-    'type' => 'normal',
-    'title' => 'Analyses',
-    'description' => '',
-    'weight' => '0',
-    'name' => 'primary-links',
-  ));
-  $handler->override_option('tab_options', array(
-    'type' => 'none',
-    'title' => '',
-    'description' => '',
-    'weight' => 0,
-    'name' => 'navigation',
-  ));
-  $views[$view->name] = $view;
-
-  return $views;
-}

+ 13 - 4
tripal_analysis/tripal_analysis_privacy.inc

@@ -1,11 +1,14 @@
 <?php
 /**
  * @file
- * @todo Add file header description
+ * Perform permission check (required node_privacy_byrole module)
  */
 
-/*
- *  Perform permission check by analysis_id only if 'node_privacy_byrole' module is enabled
+/**
+ * Perform permission check by analysis_id only if 'node_privacy_byrole' module is enabled
+ *
+ * @param $analysis_id
+ *   Which analysis to check if the user has permission to view
  */
 function tripal_analysis_check_permission($analysis_id) {
   if (module_exists('node_privacy_byrole')) {
@@ -34,8 +37,14 @@ function tripal_analysis_check_permission($analysis_id) {
   }
 }
 
-/*
+/**
  * Set permissions for features associated with an analysis
+ * @todo Stephen: ensure the $nid param is defined correctly
+ *
+ * @param $analysis_id
+ *   Features associated with this analysis will have their permissions set
+ * @param $nid
+ *   The node ID of the analysis
  */
 function tripal_analysis_set_feature_permission($analysis_id, $nid) {