Browse Source

Pub: cleaned up doc

Lacey Sanderson 11 years ago
parent
commit
8287eb8a21

+ 78 - 15
tripal_pub/api/tripal_pub.api.inc

@@ -1,4 +1,9 @@
 <?php
+/**
+ * @file
+ * Provides an application programming interface (API) to manage chado publications
+ */
+
 /**
  * @defgroup tripal_pub_api Publication Module API
  * @ingroup tripal_api
@@ -7,7 +12,7 @@
  * @}
  */
 
-/*
+/**
  * Retrieves a list of publications as an associated array where
  *  keys correspond directly with Tripal Pub CV terms.
  *
@@ -61,7 +66,15 @@ function tripal_pub_get_remote_search_results($remote_db, $search_array, $num_to
   }
   return $pubs;
 }
-/*
+
+/**
+ * @stephen
+ *
+ * @param $dbxref
+ *
+ * @return
+ *
+ *
  * @ingroup tripal_pub_api
  */
 function tripal_pub_get_raw_data($dbxref) {
@@ -94,7 +107,14 @@ function tripal_pub_get_raw_data($dbxref) {
   }
   return 'Invalid DB xref';
 }
-/*
+
+/**
+ * @stephen
+ *
+ * @param $do_contact
+ * @param $dbxref
+ * @param $db
+ *
  * @ingroup tripal_pub_api
  */
 function tripal_pub_update_publications($do_contact = FALSE, $dbxref = NULL, $db = NULL) {
@@ -181,9 +201,14 @@ function tripal_pub_update_publications($do_contact = FALSE, $dbxref = NULL, $db
   }
   print "Done.\n";
 }
+
 /**
+ * @stephen
+ *
+ * @param $import_id
+ * @param $job_id
  *
- * @param $pub_importer_id
+ * @ingroup tripal_pub_api
  */
 function tripal_pub_import_publications_by_import_id($import_id, $job_id = NULL) {
   print "\nNOTE: Loading of publications is performed using a database transaction. \n" .
@@ -243,7 +268,13 @@ function tripal_pub_import_publications_by_import_id($import_id, $job_id = NULL)
   }
   print "Done.\n";
 }
-/*
+
+/**
+ * @stephen
+ *
+ * @param $report_email
+ * @param $do_update
+ *
  * @ingroup tripal_pub_api
  */
 function tripal_pub_import_publications($report_email = FALSE, $do_update = FALSE) {
@@ -331,7 +362,14 @@ function tripal_pub_import_publications($report_email = FALSE, $do_update = FALS
   }
   print "Done.\n";
 }
-/*
+
+/**
+ * @stephen
+ *
+ * @param $pub_dbxref
+ * @param $do_contact
+ * @param $do_update
+ *
  * @ingroup tripal_pub_api
  */
 function tripal_pub_import_by_dbxref($pub_dbxref, $do_contact = FALSE, $do_update) {
@@ -390,11 +428,17 @@ function tripal_pub_import_by_dbxref($pub_dbxref, $do_contact = FALSE, $do_updat
 
   print "Done.\n";
 }
+
 /**
+ * @stephen
  *
  * @param $pubs
  * @param $do_contact
  * @param $update
+ *
+ * @return
+ *
+ * @ingroup tripal_pub_api
  */
 function tripal_pub_add_publications($pubs, $do_contact, $update = FALSE) {
   $report = array();
@@ -439,8 +483,18 @@ function tripal_pub_add_publications($pubs, $do_contact, $update = FALSE) {
   print "\n";
   return $report;
 }
+
 /**
  * Adds a dbxref record to a publication
+ *
+ * @stephen
+ *
+ * @param $pub_id
+ * @param $pub_dbxref
+ *
+ * @return
+ *
+ * @ingroup tripal_pub_api
  */
 function tripal_pub_add_pub_dbxref($pub_id, $pub_dbxref) {
 
@@ -501,6 +555,7 @@ function tripal_pub_add_pub_dbxref($pub_id, $pub_dbxref) {
   }
   return $results;
 }
+
 /**
  * Returns the list of publications that are assigned the database
  * cross-reference provided
@@ -516,7 +571,6 @@ function tripal_pub_add_pub_dbxref($pub_id, $pub_dbxref) {
  *   is returned.
  *
  * @ingroup tripal_pub_api
- *
  */
 function tripal_pub_get_pubs_by_dbxref($pub_dbxref) {
 
@@ -542,6 +596,7 @@ function tripal_pub_get_pubs_by_dbxref($pub_dbxref) {
   }
   return $return;
 }
+
 /**
  * Returns the list of publications that match a given title, type and year
  *
@@ -550,7 +605,7 @@ function tripal_pub_get_pubs_by_dbxref($pub_dbxref) {
  * @param type
  *   Optional. The publication type. The value of this field should come from
  *   the Tripal Pub vocabulary. This should be the type name (e.g. cvterm.name)
- * @param year
+ * @param pyear
  *   Optional. The year the publication was published.
  * @param series_name
  *   Optional.  The name of the series (e.g. Journal name)
@@ -561,7 +616,6 @@ function tripal_pub_get_pubs_by_dbxref($pub_dbxref) {
  *   is returned.
  *
  * @ingroup tripal_pub_api
- *
  */
 function tripal_pub_get_pubs_by_title_type_pyear_series($title, $type = NULL, $pyear = NULL, $series_name = NULL) {
 
@@ -601,6 +655,7 @@ function tripal_pub_get_pubs_by_title_type_pyear_series($title, $type = NULL, $p
   }
   return $return;
 }
+
 /**
  * Returns the list of publications that match a given title, type and year
  *
@@ -620,7 +675,6 @@ function tripal_pub_get_pubs_by_title_type_pyear_series($title, $type = NULL, $p
  *   is returned.
  *
  * @ingroup tripal_pub_api
- *
  */
 function tripal_pub_get_pub_by_uniquename($name) {
 
@@ -642,6 +696,7 @@ function tripal_pub_get_pub_by_uniquename($name) {
   }
   return $return;
 }
+
 /**
  * Adds a new publication to the Chado, along with all properties and
  * database cross-references. If the publication does not already exist
@@ -670,6 +725,7 @@ function tripal_pub_get_pub_by_uniquename($name) {
  *   the $action variable is set to 'inserted'.  If the function failes then the
  *   $action variable is set to 'error'
  *
+ * @ingroup tripal_pub_api
  */
 function tripal_pub_add_publication($pub_details, &$action, $do_contact = FALSE, $update_if_exists = FALSE) {
   $pub_id = 0;
@@ -852,8 +908,14 @@ function tripal_pub_add_publication($pub_details, &$action, $do_contact = FALSE,
   return $pub_id;
 }
 
-/*
+/**
+ * @stephen
+ *
+ * @param $pub_id
+ * @param $authors
+ * @param $do_contact
  *
+ * @ingroup tripal_pub_api
  */
 function tripal_pub_add_authors($pub_id, $authors, $do_contact) {
   $rank = 0;
@@ -987,6 +1049,7 @@ function tripal_pub_insert_property($pub_id, $property, $value, $update_if_prese
 function tripal_pub_update_property($pub_id, $property, $value, $insert_if_missing = 0) {
   return chado_update_property('pub', $pub_id, $property, 'tripal_pub', $value, $insert_if_missing);
 }
+
 /**
  * Delete a given property
  *
@@ -1007,8 +1070,6 @@ function tripal_pub_delete_property($pub_id, $property) {
   return chado_delete_property('pub', $pub_id, $property, 'tripal_pub');
 }
 
-
-
 /**
  * This function generates an array suitable for use with the
  * tripal_pub_create_citation function for any publication
@@ -1024,8 +1085,9 @@ function tripal_pub_delete_property($pub_id, $property) {
  * @return
  *   An array suitable for the trpial_pub_create_citation function. On
  *   failure returns FALSE.
+ *
+ * @ingroup tripal_pub_api
  */
-
 function tripal_pub_get_publication_array($pub_id, $skip_existing = TRUE) {
 
   $options = array('return_array' => 1);
@@ -1197,7 +1259,6 @@ function tripal_pub_get_publication_array($pub_id, $skip_existing = TRUE) {
   return $pub_array;
 }
 
-
 /**
  * This function generates citations for publications.  It requires
  * an array structure with keys being the terms in the Tripal
@@ -1222,6 +1283,8 @@ function tripal_pub_get_publication_array($pub_id, $skip_existing = TRUE) {
  *
  * @return
  *   A text string containing the citation
+ *
+ * @ingroup tripal_pub_api
  */
 function tripal_pub_create_citation($pub) {
   $citation = '';

+ 94 - 18
tripal_pub/includes/importers/tripal_pub.AGL.inc

@@ -1,9 +1,23 @@
 <?php
 /**
+ * @file
+ * @stephen
+ */
+
+/**
+ * @stephen
+ *
+ * @param $form
+ * @param $form_state
+ * @param $num_criteria
+ *
+ * @return
+ *   The form (drupal form api)
  *
+ * @ingroup tripal_pub
  */
 function tripal_pub_remote_alter_form_AGL($form, $form_state, $num_criteria = 1) {
-  
+
   // So far we haven't been able to get AGL to filter results to only
   // include pubs by the XX number days in the past.  So, we will
   // change the 'days' element to be the year to query
@@ -16,8 +30,17 @@ function tripal_pub_remote_alter_form_AGL($form, $form_state, $num_criteria = 1)
   }
   return $form;
 }
+
 /**
+ * @stephen
+ *
+ * @param $form
+ * @param $form_state
  *
+ * @return
+ *  The form (drupal form api)
+ *
+ * @ingroup tripal_pub
  */
 function tripal_pub_remote_validate_form_AGL($form, $form_state) {
   $days =  trim($form_state['values']["days"]);
@@ -43,8 +66,18 @@ function tripal_pub_remote_validate_form_AGL($form, $form_state) {
   }
   return $form;
 }
+
 /**
+ * @stephen
  *
+ * @param $search_array
+ * @param $num_to_retrieve
+ * @param $page
+ *
+ * @return
+ *
+ *
+ * @ingroup tripal_pub
  */
 function tripal_pub_remote_search_AGL($search_array, $num_to_retrieve, $page) {
   // get some values from the serach array
@@ -324,7 +357,7 @@ function tripal_pub_remote_search_AGL($search_array, $num_to_retrieve, $page) {
     "author"   => "u=1003",
     "abstract" => "u=62",
     "id"       => "u=12",
-    "year"     => "u=30 r=o", 
+    "year"     => "u=30 r=o",
     "journal"  => "u=1033"
   );
   yaz_ccl_conf($yazc, $fields);
@@ -339,10 +372,10 @@ function tripal_pub_remote_search_AGL($search_array, $num_to_retrieve, $page) {
     );
   }
   $search_str = $cclresult["rpn"];
- 
-  // get the total number of records 
+
+  // get the total number of records
   $total_records = tripal_pub_AGL_count($yazc, $search_str);
-  
+
   // get the pubs in the specified rang
   $start = $page * $num_to_retrieve;
   $results = tripal_pub_AGL_range($yazc, $search_str, $start, $num_to_retrieve, $total_records);
@@ -352,8 +385,20 @@ function tripal_pub_remote_search_AGL($search_array, $num_to_retrieve, $page) {
 
   return $results;
 }
+
 /**
- * 
+ * @stephen
+ *
+ * @param $yazc
+ * @param $search_str
+ * @param $start
+ * @param $num_to_retrieve
+ * @param $total_records
+ *
+ * @return
+ *
+ *
+ * @ingroup tripal_pub
  */
 function tripal_pub_AGL_range($yazc, $search_str, $start, $num_to_retrieve, $total_records) {
   yaz_range($yazc, 1, $total_records);
@@ -376,7 +421,7 @@ function tripal_pub_AGL_range($yazc, $search_str, $start, $num_to_retrieve, $tot
   if ($start + $num_to_retrieve > $total_records) {
     $num_to_retrieve = $total_records - $start;
   }
-  
+
   $pubs = array();
   for($i = $start; $i < $start + $num_to_retrieve; $i++) {
     $pub_xml = yaz_record($yazc, $i + 1, 'xml; charset=marc-8,utf-8');
@@ -389,10 +434,20 @@ function tripal_pub_AGL_range($yazc, $search_str, $start, $num_to_retrieve, $tot
     'pubs'          => $pubs,
   );
 }
-/*
+
+/**
  * This function is used as the callback function when used with the
- * tripal_pager_callback function.  This function returns a count of
- * the dataset to be paged.
+ * tripal_pager_callback function.
+ *
+ * @stephen
+ *
+ * @param $yazc
+ * @param $search_str
+ *
+ * @return
+ * a count of the dataset to be paged.
+ *
+ * @ingroup tripal_pub
  */
 function tripal_pub_AGL_count($yazc, $search_str) {
 
@@ -427,11 +482,19 @@ function tripal_pub_AGL_count($yazc, $search_str) {
   return $count;
 }
 
-
-/*
+/**
+ * Parse publication XML for a single publication
+ *
  * Description of XML format:
  * http://www.loc.gov/marc/bibliographic/bdsummary.html
  *
+ * @param $pub_xml
+ *  A string containing the XML for a single publications
+ *
+ * @return
+ *  An array containing the details of the publication
+ *
+ * @ingroup tripal_pub
  */
 function tripal_pub_AGL_parse_pubxml($pub_xml) {
   $pub = array();
@@ -469,9 +532,9 @@ function tripal_pub_AGL_parse_pubxml($pub_xml) {
           break;
         case '008':  // fixed length data elements
           $month = array(
-            '01' => 'Jan', '02' => 'Feb', '03' => 'Mar', 
-            '04' => 'Apr', '05' => 'May', '06' => 'Jun', 
-            '07' => 'Jul', '08' => 'Aug', '09' => 'Sep', 
+            '01' => 'Jan', '02' => 'Feb', '03' => 'Mar',
+            '04' => 'Apr', '05' => 'May', '06' => 'Jun',
+            '07' => 'Jul', '08' => 'Aug', '09' => 'Sep',
             '10' => 'Oct', '11' => 'Nov', '12' => 'Dec'
             );
             $date0 = substr($value, 0, 6);  // date entered on file
@@ -809,7 +872,7 @@ function tripal_pub_AGL_parse_pubxml($pub_xml) {
     $pub['Authors'] = $authors;
   }
   else {
-    $pub['Authors'] = $pub['Author List'];  
+    $pub['Authors'] = $pub['Author List'];
   }
 
   // build the citation
@@ -819,9 +882,15 @@ function tripal_pub_AGL_parse_pubxml($pub_xml) {
   return $pub;
 }
 
-/*
+/**
+ * @stephen
+ *
+ * @param $xml
  *
+ * @return
  *
+ *
+ * @ingroup tripal_pub
  */
 function tripal_pub_remote_search_AGL_get_subfield($xml) {
   $codes = array();
@@ -842,9 +911,16 @@ function tripal_pub_remote_search_AGL_get_subfield($xml) {
   return $codes;
 }
 
-/*
+/**
+ * @stephen
+ *
+ * @param $xml
+ * @param $ind1
+ *
+ * @return
  *
  *
+ * @ingroup tripal_pub
  */
 function tripal_pub_remote_search_AGL_get_author($xml, $ind1) {
   $author = array();

+ 120 - 13
tripal_pub/includes/importers/tripal_pub.PMID.inc

@@ -5,7 +5,13 @@
  */
 
 /**
+ * @stephen
  *
+ * @param $form
+ * @param $form_state
+ * @param $num_criteria
+ *
+ * @ingroup tripal_pub
  */
 function tripal_pub_remote_alter_form_PMID($form, $form_state, $num_criteria = 1) {
   // PubMed doesn't have an 'Abstract' field, so we need to convert the criteria
@@ -18,7 +24,15 @@ function tripal_pub_remote_alter_form_PMID($form, $form_state, $num_criteria = 1
 }
 
 /**
+ * Validate the pub med form
+ *
+ * @param $form
+ * @param $form_state
  *
+ * @return
+ *   The form (drupal form api)
+ *
+ * @ingroup tripal_pub
  */
 function tripal_pub_remote_validate_form_PMID($form, $form_state) {
   $num_criteria = $form_state['values']['num_criteria'];
@@ -32,8 +46,15 @@ function tripal_pub_remote_validate_form_PMID($form, $form_state) {
   }
   return $form;
 }
+
 /**
+ * @stephen
  *
+ * @param $search_array
+ * @param $num_to_retrieve
+ * @param $page
+ *
+ * @ingroup tripal_pub
  */
 function tripal_pub_remote_search_PMID($search_array, $num_to_retrieve, $page) {
   // convert the terms list provicded by the caller into a string with words
@@ -144,8 +165,13 @@ function tripal_pub_remote_search_PMID($search_array, $num_to_retrieve, $page) {
   );
 }
 
-/*
+/**
+ * @stephen
  *
+ * @param $search_str
+ * @param $retmax
+ *
+ * @ingroup tripal_pub
  */
 function tripal_pub_PMID_search_init($search_str, $retmax){
 
@@ -208,8 +234,18 @@ function tripal_pub_PMID_search_init($search_str, $retmax){
   return $result;
 }
 
-/*
+/**
+ * @stephen
+ *
+ * @param $query_key
+ * @param $web_env
+ * @param $rettype
+ * @param $retmod
+ * @param $start
+ * @param $limit
+ * @param $args
  *
+ * @ingroup tripal_pub
  */
 function tripal_pub_PMID_fetch($query_key, $web_env, $rettype = 'null',
 $retmod = 'null', $start = 0, $limit = 10, $args = array()){
@@ -267,6 +303,14 @@ $retmod = 'null', $start = 0, $limit = 10, $args = array()){
  *
  * Information about PubMed's citation format can be found here
  * http://www.nlm.nih.gov/bsd/policy/cit_format.html
+ *
+ * @param $pub_xml
+ *  An XML string describing a single publication
+ *
+ * @return
+ *  An array describing the publication
+ *
+ * @ingroup tripal_pub
  */
 function tripal_pub_PMID_parse_pubxml($pub_xml) {
   $pub = array();
@@ -360,8 +404,13 @@ function tripal_pub_PMID_parse_pubxml($pub_xml) {
   return $pub;
 }
 
-/*
+/**
+ * @stephen
  *
+ * @param $xml
+ * @param $pub
+ *
+ * @ingroup tripal_pub
  */
 function tripal_pub_PMID_parse_medline_journal_info($xml, &$pub) {
   while ($xml->read()) {
@@ -395,8 +444,13 @@ function tripal_pub_PMID_parse_medline_journal_info($xml, &$pub) {
   }
 }
 
-/*
+/**
+ * @stephen
+ *
+ * @param $xml
+ * @param $pub
  *
+ * @ingroup tripal_pub
  */
 function tripal_pub_PMID_parse_article($xml, &$pub) {
 
@@ -481,12 +535,20 @@ function tripal_pub_PMID_parse_article($xml, &$pub) {
     }
   }
 }
-/*
+
+/**
+ * @stephen
+ *
  * A full list of publication types can be found here:
  * http://www.nlm.nih.gov/mesh/pubtypes.html.
  *
  * The Tripal Pub ontology doesn't yet have terms for all of the
  * publication types so we store the value in the 'publication_type' term.
+ *
+ * @param $xml
+ * @param $pub
+ *
+ * @ingroup tripal_pub
  */
 function tripal_pub_PMID_parse_publication_type($xml, &$pub) {
 
@@ -521,8 +583,14 @@ function tripal_pub_PMID_parse_publication_type($xml, &$pub) {
     }
   }
 }
-/*
+
+/**
+ * @stephen
+ *
+ * @param $xml
+ * @param $pub
  *
+ * @ingroup tripal_pub
  */
 function tripal_pub_PMID_parse_abstract($xml, &$pub) {
   $abstract = '';
@@ -562,8 +630,14 @@ function tripal_pub_PMID_parse_abstract($xml, &$pub) {
     }
   }
 }
-/*
+
+/**
+ * @stephen
+ *
+ * @param $xml
+ * @param $pub
  *
+ * @ingroup tripal_pub
  */
 function tripal_pub_PMID_parse_pagination($xml, &$pub) {
   while ($xml->read()) {
@@ -587,8 +661,14 @@ function tripal_pub_PMID_parse_pagination($xml, &$pub) {
     }
   }
 }
-/*
+
+/**
+ * @stephen
  *
+ * @param $xml
+ * @param $pub
+ *
+ * @ingroup tripal_pub
  */
 function tripal_pub_PMID_parse_journal($xml, &$pub) {
 
@@ -631,8 +711,14 @@ function tripal_pub_PMID_parse_journal($xml, &$pub) {
     }
   }
 }
-/*
+
+/**
+ * @stephen
+ *
+ * @param $xml
+ * @param $pub
  *
+ * @ingroup tripal_pub
  */
 function tripal_pub_PMID_parse_journal_issue($xml, &$pub) {
 
@@ -684,10 +770,15 @@ function tripal_pub_PMID_parse_journal_issue($xml, &$pub) {
   }
 }
 
-/*
+/**
+ * @stephen
  *
+ * @param $xml
+ * @param $element_name
+ *
+ * @ingroup tripal_pub
  */
-function tripal_pub_PMID_parse_date ($xml, $element_name) {
+function tripal_pub_PMID_parse_date($xml, $element_name) {
   $date = array();
 
   while ($xml->read()) {
@@ -724,8 +815,14 @@ function tripal_pub_PMID_parse_date ($xml, $element_name) {
     }
   }
 }
-/*
+
+/**
+ * @stephen
+ *
+ * @param $xml
+ * @param $pub
  *
+ * @ingroup tripal_pub
  */
 function tripal_pub_PMID_parse_authorlist($xml, &$pub) {
   $num_authors = 0;
@@ -797,9 +894,19 @@ function tripal_pub_PMID_parse_authorlist($xml, &$pub) {
   }
 }
 
-/*
+/**
+ * Get the name of the language based on an abbreviation
+ *
  * Language abbreviations were obtained here:
  * http://www.nlm.nih.gov/bsd/language_table.html
+ *
+ * @param $lang_abbr
+ *   The abbreviation of the language to return
+ *
+ * @return
+ *   The full name of the language
+ *
+ * @ingroup tripal_pub
  */
 function tripal_pub_remote_search_get_language($lang_abbr) {
   $languages = array(

+ 24 - 10
tripal_pub/includes/tripal_pub.admin.inc

@@ -1,7 +1,13 @@
 <?php
+/**
+ * @file
+ * Administration of publications
+ */
 
 /**
+ * Admin launchpad
  *
+ * @ingroup tripal_pub
  */
 function tripal_pub_admin_pub_view() {
   $output = '';
@@ -33,7 +39,6 @@ function tripal_pub_admin_pub_view() {
   return $output;
 }
 
-
 /**
  * Administrative settings form
  *
@@ -41,17 +46,17 @@ function tripal_pub_admin_pub_view() {
  */
 function tripal_pub_admin() {
   $form = array();
-  
+
   // -----------------------------------------
   // add in the fields for selecting which fields are used when search for pubs
   $form['searching'] = array(
     '#type' => 'fieldset',
     '#title' => t('Searching Options'),
-    '#description' => t("The list of checkboxes below indicate which fields a user 
-      can search with when using the publication search tool.  Check the fields that you want 
+    '#description' => t("The list of checkboxes below indicate which fields a user
+      can search with when using the publication search tool.  Check the fields that you want
       to allow users to search with.  Click the 'Save configuration' button below to save changes."),
   );
-  
+
   // get publication properties list
   $properties = array();
   $properties[] = 'Any Field';
@@ -79,7 +84,7 @@ function tripal_pub_admin() {
   );
 
   // -----------------------------------------
-  // add the field set for syncing publications 
+  // add the field set for syncing publications
   $form['import'] = array(
     '#type' => 'fieldset',
     '#title' => t('Import Settings'),
@@ -136,7 +141,7 @@ function tripal_pub_admin() {
     '#type' => 'select',
     '#title' => t('Publication Type'),
     '#options' => $pub_types,
-    '#description' => t('Please set a default publiation type used for manual entry of a new 
+    '#description' => t('Please set a default publiation type used for manual entry of a new
       publication.  This is useful in the event that someone is manually adding the same
       publication type repetitively'),
     '#default_value' => $d_type_id
@@ -145,8 +150,8 @@ function tripal_pub_admin() {
   return system_settings_form($form);
 }
 
-
 /**
+ * Validate the admin settings form
  *
  * @ingroup tripal_pub
  */
@@ -171,9 +176,18 @@ function tripal_pub_admin_validate($form, &$form_state) {
 
 }
 
-
 /**
+ * Set the URL for a publication
+ *
+ * @param $node
+ *   The publication node from pub_load().
+ * @param $pub_id
+ *   The chado pub_id of the publication to set the url for
  *
+ * @return
+ *   The url alias set
+ *
+ * @ingroup tripal_pub
  */
 function tripal_pub_set_pub_url($node, $pub_id) {
 
@@ -187,4 +201,4 @@ function tripal_pub_set_pub_url($node, $pub_id) {
   path_save($path_alias);
 
   return $url_alias;
-}
+}

+ 91 - 68
tripal_pub/includes/tripal_pub.chado_node.inc

@@ -1,10 +1,13 @@
 <?php
+/**
+ * @file
+ * Implements the pub node content type
+ */
 
 /**
- * Implementation of hook_tripal_pub_node_info().
- *
- * This node_info, is a simple node that describes the functionallity of the module.
+ * Implements hook_node_info().
  *
+ * @ingroup tripal_pub
  */
 function tripal_pub_node_info() {
 
@@ -34,10 +37,10 @@ function tripal_pub_node_info() {
 }
 
 /**
- * This is the chado_pub node form callback. The arguments
- * are out of order from a typical form because it's a defined callback
+ * Implements hook_form().
+ *
+ * @ingroup tripal_pub
  */
-
 function chado_pub_form($node, $form_state) {
   $form = array();
 
@@ -294,8 +297,11 @@ function chado_pub_form($node, $form_state) {
   return $form;
 
 }
-/*
+
+/**
+ * Implements hook_validate().
  *
+ * @ingroup tripal_pub
  */
 function chado_pub_validate($node, $form, &$form_state) {
 
@@ -414,9 +420,14 @@ function chado_pub_validate($node, $form, &$form_state) {
     chado_pub_validate_check_uniquename($uniquename);
   }
 }
+
 /**
+ * Validate the publication uniquename. To be called from hook_validate().
  *
- * @param unknown $uniquename
+ * @param $uniquename
+ *  The uniquename of the publication
+ *
+ * @ingroup tripal_pub
  */
 function chado_pub_validate_check_uniquename($uniquename, $pub_id = NULL) {
 
@@ -432,8 +443,22 @@ function chado_pub_validate_check_uniquename($uniquename, $pub_id = NULL) {
     form_set_error('uniquename', $message);
   }
 }
+
 /**
+ * Check for duplicate publications. To be called from hook_validate().
  *
+ * @param $title
+ *   The title of the publication
+ * @param $pyear
+ *   The year the publication was published
+ * @param $series_name
+ *   The series name of the publication
+ * @param $cvterm
+ *   The type of publication
+ * @param $pub_id
+ *   the unique id of the publication
+ *
+ * @ingroup tripal_pub
  */
 function chado_pub_validate_check_duplicate($title, $pyear, $series_name, $cvterm, $pub_id = NULL) {
 
@@ -484,9 +509,8 @@ function chado_pub_validate_check_duplicate($title, $pyear, $series_name, $cvter
   }
 }
 
-
 /**
- * Implement hook_access().
+ * Implement hook_node_access().
  *
  * This hook allows node modules to limit access to the node types they define.
  *
@@ -506,8 +530,9 @@ function chado_pub_validate_check_duplicate($title, $pyear, $series_name, $cvter
  *  access.  The only exception is when the $op == 'create'.  We will always
  *  return TRUE if the permission is set.
  *
+ * @ingroup tripal_pub
  */
-function chado_pub_node_access($node, $op, $account ) {
+function chado_pub_node_access($node, $op, $account) {
   if ($op == 'create') {
     if (!user_access('create chado_pub content', $account)) {
       return FALSE;
@@ -533,20 +558,10 @@ function chado_pub_node_access($node, $op, $account ) {
   return NULL;
 }
 
-
-
-
-
 /**
- * Implementation of tripal_pub_insert().
- *
- * This function inserts user entered information pertaining to the Publication instance into the
- * 'pubauthor', 'pubprop', 'chado_pub', 'pub' talble of the database.
- *
- *  @parm $node
- *    Then node which contains the information stored within the node-ID
- *
+ * Implements hook_insert().
  *
+ * @ingroup tripal_pub
  */
 function chado_pub_insert($node) {
 
@@ -737,19 +752,18 @@ function chado_pub_insert($node) {
 
 }
 
-/*
+/**
+ * Implements hook_update().
  *
-* Implements hook_update
-*
-* The purpose of the function is to allow the module to take action when an edited node is being
-* updated. It updates any name changes to the database tables that werec reated upon registering a Publication.
-* As well, the database will be changed, so the user changed information will be saved to the database.
-*
-* @param $node
-*   The node being updated
-*
-* @ingroup tripal_pub
-*/
+ * The purpose of the function is to allow the module to take action when an edited node is being
+ * updated. It updates any name changes to the database tables that werec reated upon registering a Publication.
+ * As well, the database will be changed, so the user changed information will be saved to the database.
+ *
+ * @param $node
+ *   The node being updated
+ *
+ * @ingroup tripal_pub
+ */
 function chado_pub_update($node) {
   $title        = trim($node->pubtitle);
   $pyear        = trim($node->pyear);
@@ -924,17 +938,16 @@ function chado_pub_update($node) {
   chado_update_node_form_dbxrefs($node, $details);
 }
 
-
 /**
- * Implementation of tripal_pub_load().
- *
+ * Implements hook_load().
  *
  * @param $node
- *   The node that is to be accessed from the database
+ *   The node that is to be loaded
  *
  * @return $node
  *   The node with the information to be loaded into the database
  *
+ * @ingroup tripal_pub
  */
 function chado_pub_load($nodes) {
 
@@ -959,15 +972,16 @@ function chado_pub_load($nodes) {
 }
 
 /**
- * Implementation of tripal_pub_delete().
+ * Implements hook_delete().
  *
  * This function takes a node and if the delete button has been chosen by the user, the publication
  * and it's details will be removed.Following,given the node-ID, the instance will be deleted from
  * the 'chado_pub' table.
  *
- *  @parm $node
- *    Then node which contains the information stored within the node-ID
+ * @parm $node
+ *    Then node to be deleted
  *
+ * @ingroup tripal_pub
  */
 function chado_pub_delete(&$node) {
 
@@ -993,11 +1007,10 @@ function chado_pub_delete(&$node) {
   chado_query("DELETE FROM {pub} WHERE pub_id = :pub_id", array(':pub_id' => $pub_id));
 }
 
-
-
 /**
+ * Implements hook_node_view(). Acts on all content types.
  *
- * @ingroup tripal_feature
+ * @ingroup tripal_pub
  */
 function tripal_pub_node_view($node, $view_mode, $langcode) {
   switch ($node->type) {
@@ -1064,35 +1077,41 @@ function tripal_pub_node_view($node, $view_mode, $langcode) {
       break;
   }
 }
+
 /**
+ * Implements hook_node_insert(). Acts on all content types.
  *
- * @param $node
+ * We want the publications to always have a URL of http://[base url]/pub/[pub id]
+ * where [pub id] is the Chado publication ID.  This will allow for easy linking
+ * into the publication without needing to know the node.  Of course if you know the
+ * node that will still work too (e.g. http://[base url]/node/[node id]
+ * so the nodeapi function ensures that the URL path is set after insert or update
+ * of the node and when the node is loaded if it hasn't yet been set.
+ *
+ * @ingroup tripal_pub
  */
 function tripal_pub_node_insert($node) {
-  // we want the publications to always have a URL of http://[base url]/pub/[pub id]
-  // where [pub id] is the Chado publication ID.  This will allow for easy linking
-  // into the publication without needing to know the node.  Of course if you know the
-  // node that will still work too (e.g. http://[base url]/node/[node id]
-  // so the nodeapi function ensures that the URL path is set after insert or update
-  // of the node and when the node is loaded if it hasn't yet been set.
+
   if ($node->type == 'chado_pub') {
     $pub_id = chado_get_id_from_nid('pub', $node->nid);
     tripal_pub_set_pub_url($node, $pub_id);
   }
 }
+
 /**
+ * Implements hook_node_load(). Acts on all content types.
  *
- * @param $node
- * @param $types
+ * We want the publications to always have a URL of http://[base url]/pub/[pub id]
+ * where [pub id] is the Chado publication ID.  This will allow for easy linking
+ * into the publication without needing to know the node.  Of course if you know the
+ * node that will still work too (e.g. http://[base url]/node/[node id]
+ * so the nodeapi function ensures that the URL path is set after insert or update
+ * of the node and when the node is loaded if it hasn't yet been set.
+ *
+ * @ingroup tripal_pub
  */
 function tripal_pub_node_load($nodes, $types) {
 
-  // we want the publications to always have a URL of http://[base url]/pub/[pub id]
-  // where [pub id] is the Chado publication ID.  This will allow for easy linking
-  // into the publication without needing to know the node.  Of course if you know the
-  // node that will still work too (e.g. http://[base url]/node/[node id]
-  // so the nodeapi function ensures that the URL path is set after insert or update
-  // of the node and when the node is loaded if it hasn't yet been set.
   if (count(array_intersect(array('chado_pub'), $types))) {
     foreach ($nodes as $nid => $node) {
       if ($node->type == 'chado_pub' and !property_exists($node, 'path')) {
@@ -1102,19 +1121,23 @@ function tripal_pub_node_load($nodes, $types) {
     }
   }
 }
+
 /**
+ * Implements hook_node_update(). Acts on all content types.
  *
- * @param $node
+ * We want the publications to always have a URL of http://[base url]/pub/[pub id]
+ * where [pub id] is the Chado publication ID.  This will allow for easy linking
+ * into the publication without needing to know the node.  Of course if you know the
+ * node that will still work too (e.g. http://[base url]/node/[node id]
+ * so the nodeapi function ensures that the URL path is set after insert or update
+ * of the node and when the node is loaded if it hasn't yet been set.
+ *
+ * @ingroup tripal_pub
  */
 function tripal_pub_node_update($node) {
-  // we want the publications to always have a URL of http://[base url]/pub/[pub id]
-  // where [pub id] is the Chado publication ID.  This will allow for easy linking
-  // into the publication without needing to know the node.  Of course if you know the
-  // node that will still work too (e.g. http://[base url]/node/[node id]
-  // so the nodeapi function ensures that the URL path is set after insert or update
-  // of the node and when the node is loaded if it hasn't yet been set.
+
   if ($node->type == 'chado_pub') {
     $pub_id = chado_get_id_from_nid('pub', $node->nid);
     tripal_pub_set_pub_url($node, $pub_id);
   }
-}
+}

+ 51 - 31
tripal_pub/includes/tripal_pub.pub_citation.inc

@@ -1,27 +1,36 @@
 <?php
-/*
+/**
+ * @file
+ * Functions to manage citations
+ */
+
+/**
  * The admin form for submitting job to create citations
-*/
+ *
+ * @param $form_state
+ *
+ * @ingroup tripal_pub
+ */
 function tripal_pub_citation_form($form_state) {
 
   $form['instructions'] = array(
     '#markup' => '<p>Use this form to unify publication citations. Citations are created automtically when
-      importing publications but citations are set by the user when publications are added manually.  
-      Or publications added to the Chado database by tools other than the Tripal Publication Importer may 
-      not have citations set. If you are certain that all necessary information for all publications is present (e.g. 
+      importing publications but citations are set by the user when publications are added manually.
+      Or publications added to the Chado database by tools other than the Tripal Publication Importer may
+      not have citations set. If you are certain that all necessary information for all publications is present (e.g.
       authors, volume, issue, page numbers, etc.) but citations are not consistent, then you can
       choose to update all citations for all publications using the form below. Alternatively, you
       can update citations only for publication that do not already have one.</p>'
   );
-  
+
   $form['options'] = array(
     '#type' => 'radios',
     '#options' => array(
-      'all' => 'Create citation for all publications. Replace the existing citation if it exists.', 
+      'all' => 'Create citation for all publications. Replace the existing citation if it exists.',
       'new' => 'Create citation for publication only if it does not already have one.'),
     '#default_value' => 'all'
   );
-  
+
   $form['submit'] = array(
     '#type' => 'submit',
     '#value' => t('Submit')
@@ -30,43 +39,54 @@ function tripal_pub_citation_form($form_state) {
   return $form;
 }
 
-/*
+/**
  * Submit form. Create Tripal job for citations
+ *
+ * @param $form_state
+ *
+ * @ingroup tripal_pub
  */
-
 function tripal_pub_citation_form_submit(&$form_state) {
   $options [0] = $form_state['options']['#value'];
   tripal_add_job("Create citations ($options[0])", 'tripal_pub', 'tripal_pub_create_citations', $options, $user->uid);
 }
 
-/*
- * Launch the Tripal job to generate citations
+/**
+ * Launch the Tripal job to generate citations. Called by tripal jobs
+ *
+ * @param $options
+ *  Options pertaining to what publications to generate citations for.
+ *  One of the following must be present:
+ *   - all: Create and replace citation for all pubs
+ *   - new: Create citation for pubs that don't already have one
+ *
+ * @ingroup tripal_pub
  */
-function tripal_pub_create_citations ($options) {
+function tripal_pub_create_citations($options) {
   $skip_existing = TRUE;
   $sql = "
-    SELECT cvterm_id 
-    FROM {cvterm} 
-    WHERE 
-      name = 'Citation' AND 
+    SELECT cvterm_id
+    FROM {cvterm}
+    WHERE
+      name = 'Citation' AND
       cv_id = (SELECT cv_id FROM {cv} WHERE name = 'tripal_pub')
   ";
   $citation_type_id = chado_query($sql)->fetchField();
-  
+
   // Create and replace citation for all pubs
   if ($options == 'all') {
     $sql = "SELECT pub_id FROM {pub} P WHERE pub_id <> 1";
-    $skip_existing = FALSE;  
-  } 
+    $skip_existing = FALSE;
+  }
   // Create citation for pubs that don't already have one
   else if ($options == 'new') {
     $sql = "
-      SELECT pub_id 
-      FROM {pub} P 
-      WHERE 
-        (SELECT value 
-         FROM {pubprop} PB 
-         WHERE type_id = :type_id AND P.pub_id = PB.pub_id AND rank = 0) IS NULL 
+      SELECT pub_id
+      FROM {pub} P
+      WHERE
+        (SELECT value
+         FROM {pubprop} PB
+         WHERE type_id = :type_id AND P.pub_id = PB.pub_id AND rank = 0) IS NULL
         AND  pub_id <> 1
     ";
     $skip_existing = TRUE;
@@ -83,23 +103,23 @@ function tripal_pub_create_citations ($options) {
       // Replace if citation exists. This condition is never TRUE if $skip_existing is TRUE
       if ($pub_arr['Citation']) {
         $sql = "
-          UPDATE {pubprop} SET value = :value 
+          UPDATE {pubprop} SET value = :value
           WHERE pub_id = :pub_id  AND type_id = :type_id AND rank = :rank
         ";
-        chado_query($sql, array(':value' => $citation, ':pub_id' => $pub->pub_id, 
+        chado_query($sql, array(':value' => $citation, ':pub_id' => $pub->pub_id,
           ':type_id' => $citation_type_id, ':rank' => 0));
         $counter_updated ++;
       // Generate a new citation
       } else {
         $sql = "
-          INSERT INTO {pubprop} (pub_id, type_id, value, rank) 
+          INSERT INTO {pubprop} (pub_id, type_id, value, rank)
           VALUES (:pub_id, :type_id, :value, :rank)
         ";
-        chado_query($sql, array(':pub_id' => $pub->pub_id, ':type_id' => $citation_type_id, 
+        chado_query($sql, array(':pub_id' => $pub->pub_id, ':type_id' => $citation_type_id,
           ':value' => $citation, ':rank' => 0));
         $counter_generated ++;
       }
     }
   }
   print "$counter_generated citations generated. $counter_updated citations updated.\n";
-}
+}

+ 91 - 59
tripal_pub/includes/tripal_pub.pub_importers.inc

@@ -1,4 +1,9 @@
 <?php
+/**
+ * @file
+ * Management of importers
+ */
+
 /**
  * A function to generate a table containing the list of publication importers
  *
@@ -7,7 +12,7 @@
 function tripal_pub_importers_list() {
   // clear out the session variable when we view the list.
   unset($_SESSION['tripal_pub_import']);
-  
+
   $header = array('', 'Importer Name', 'Database', 'Search String', 'Disabled', 'Create Contact', '');
   $rows = array();
   $importers = db_query("SELECT * FROM {tripal_pub_import} ORDER BY name");
@@ -43,37 +48,38 @@ function tripal_pub_importers_list() {
   $page  = "<ul class='action-links'>";
   $page .= '  <li>' . l('New Importer', 'admin/tripal/chado/tripal_pub/import/new') . '</li>';
   $page .= '</ul>';
-  
+
   $page .= '<p>' . t(
     "A publication importer is used to create a set of search criteria that can be used
-     to query a remote database, find publications that match the specified criteria 
+     to query a remote database, find publications that match the specified criteria
      and then import those publications into the Chado database. An example use case would
      be to peridocially add new publications to this Tripal site that have appeared in PubMed
      in the last 30 days.  You can import publications in one of two ways:
      <ol>
       <li>Create a new importer by clicking the 'New Importer' link above, and after saving it should appear in the list below.  Click the
           link labeled 'Import Pubs' to schedule a job to import the publications</li>
-      <li>The first method only performs the import once.  However, you can schedule the 
-          importer to run peridically by adding a cron job. See the " . 
-     l("Pub Module help instructions", "admin/tripal/chado/tripal_pub/help") . " to learn how to 
+      <li>The first method only performs the import once.  However, you can schedule the
+          importer to run peridically by adding a cron job. See the " .
+     l("Pub Module help instructions", "admin/tripal/chado/tripal_pub/help") . " to learn how to
      set the importers to run automatically.") . '</li>
      </ol><br>';
 
   $page .= theme('table', array('header' => $header, 'rows' => $rows));
-  
+
   return $page;
 }
 
 /**
- * 
- * @param  action
+ * @stephen
+ *
+ * @param $action
  * @param $pub_import_id
- * 
- * 
+ *
+ * @ingroup tripal_pub
  */
 function tripal_pub_importer_setup_page($action = 'new', $pub_import_id = NULL) {
   global $base_path;
-  
+
   // make sure the tripal_pub and tripal_contact ontologies are loaded
   $values = array('name' => 'tripal_pub');
   $tpub_cv = chado_select_record('cv', array('cv_id'), $values);
@@ -85,7 +91,7 @@ function tripal_pub_importer_setup_page($action = 'new', $pub_import_id = NULL)
   if (count($tpub_cv) == 0) {
     drupal_set_message(t('If you want to create contact pages for authors, you must first ') . l(t('load the Tripal Contact Ontology'), 'admin/tripal/tripal_cv/obo_loader'), 'error');
   }
-  
+
   if(!extension_loaded ('yaz')){
     drupal_set_message(t('<b>Note:</b> In order to create an importer using the USDA National Agricultural Library (AGL) you must install the yaz libraries. See the ') . l(t('Pub Module help page'), 'admin/tripal/chado/tripal_pub/help') . ' for assistance.  If you do not want to use AGL you can ignore this warning.', 'warning');
   }
@@ -101,7 +107,7 @@ function tripal_pub_importer_setup_page($action = 'new', $pub_import_id = NULL)
     $remote_db = $_SESSION['tripal_pub_import']['remote_db'];
     $num_criteria = $_SESSION['tripal_pub_import']['num_criteria'];
     $days = $_SESSION['tripal_pub_import']['days'];
-  
+
     $search_array = array();
     $search_array['remote_db'] = $remote_db;
     $search_array['num_criteria'] = $num_criteria;
@@ -112,19 +118,19 @@ function tripal_pub_importer_setup_page($action = 'new', $pub_import_id = NULL)
       $search_array['criteria'][$i]['is_phrase']    = $_SESSION['tripal_pub_import']['criteria'][$i]['is_phrase'];
       $search_array['criteria'][$i]['operation']    = $_SESSION['tripal_pub_import']['criteria'][$i]['operation'];
     }
-  
+
     // if the form has been submitted with the 'test' button then get the results
     if ($_SESSION['tripal_pub_import']['perform_search']) {
-      
+
       $limit = 25;
-      
+
       // get the list of publications from the remote database using the search criteria.
       $page = isset($_GET['page']) ? $_GET['page'] : '0';
       $results = tripal_pub_get_remote_search_results($remote_db, $search_array, $limit, $page);
       $total_records = $results['total_records'];
       $search_str    = $results['search_str'];
       $pubs          = $results['pubs'];
-      
+
       // iterate through the results and construct the table displaying the publications
       $rows = array();
       $i = $page * $limit + 1;
@@ -143,7 +149,7 @@ function tripal_pub_importer_setup_page($action = 'new', $pub_import_id = NULL)
           $i++;
         }
       }
-      
+
       if (count($rows) == 0) {
         $rows[] = array(
           array(
@@ -152,7 +158,7 @@ function tripal_pub_importer_setup_page($action = 'new', $pub_import_id = NULL)
           ),
         );
       }
-      
+
       $headers = array('', 'Publication', 'Raw Results');
       $table = array(
         'header' => $headers,
@@ -168,7 +174,7 @@ function tripal_pub_importer_setup_page($action = 'new', $pub_import_id = NULL)
       // once we have our table array structure defined, we call Drupal's theme_table()
       // function to generate the table.
       $table = theme_table($table);
-      
+
       // generate the pager
       pager_default_initialize($total_records, $limit);
       $pager = array(
@@ -178,11 +184,11 @@ function tripal_pub_importer_setup_page($action = 'new', $pub_import_id = NULL)
         'quantity' => $limit,
       );
       $pager = theme_pager($pager);
-      
+
       // because this is an ajax callback, the theme_pager will set the URL to be
       // "system/ajax", so we need to reset that
       $pager = str_replace($base_path . "system/ajax", "", $pager) ;
-      
+
       // join all to form the results
       $total_pages = (int) ($total_records / $limit) + 1;
       $page = isset($_GET['page']) ? $_GET['page'] : '0';
@@ -194,7 +200,14 @@ function tripal_pub_importer_setup_page($action = 'new', $pub_import_id = NULL)
 }
 
 /**
- * Purpose: Provides the form to search pubmed
+ * Provides the form to search pubmed
+ *
+ * @stephen
+ *
+ * @param $form
+ * @param $form_state
+ * @param $pub_import_id
+ * @param $action
  *
  * @ingroup tripal_pub
  */
@@ -202,14 +215,14 @@ function tripal_pub_importer_setup_form($form, &$form_state = NULL, $pub_import_
 
   // Default values can come in the following ways:
   //
-  // 1) as elements of the $pub_importer object.  This occurs when editing an existing importer 
+  // 1) as elements of the $pub_importer object.  This occurs when editing an existing importer
   // 2) in the $form_state['values'] array which occurs on a failed validation or
   //    ajax callbacks from non submit form elements
   // 3) in the $form_state['input'] array which occurs on ajax callbacks from submit
   //    form elements and the form is being rebuilt
   //
   // set form field defaults
-    
+
   // Set the default values. If the pub_import_id isn't already defined by the form values
   // and one is provided then look it up in the database
   $criteria = NULL;
@@ -219,7 +232,7 @@ function tripal_pub_importer_setup_form($form, &$form_state = NULL, $pub_import_
   $do_contact = '';
   $num_criteria = 1;
   $loader_name = '';
-  
+
   // if this is an edit the we are pulling an import object from the database
   if ($action == "edit") {
     $sql = "SELECT * FROM {tripal_pub_import} WHERE pub_import_id = :pub_import_id";
@@ -233,7 +246,7 @@ function tripal_pub_importer_setup_form($form, &$form_state = NULL, $pub_import_
     $num_criteria   = $criteria['num_criteria'];
     $loader_name    = $criteria['loader_name'];
   }
-  
+
   // if there are any session variables then use those
   if (array_key_exists('tripal_pub_import', $_SESSION)) {
     $remote_db    = $_SESSION['tripal_pub_import']['remote_db'];
@@ -242,14 +255,14 @@ function tripal_pub_importer_setup_form($form, &$form_state = NULL, $pub_import_
     $do_contact   = $_SESSION['tripal_pub_import']['do_contact'];
     $num_criteria = $_SESSION['tripal_pub_import']['num_criteria'];
     $loader_name  = $_SESSION['tripal_pub_import']['loader_name'];
-    
+
     // check if the pub_import_id in the session variable is not the same as the one we've been provided
     // if so, then clear the session variable
     if ($pub_import_id and $pub_import_id != $_SESSION['tripal_pub_import']['pub_import_id']) {
       unset($_SESSION['tripal_pub_import']);
     }
   }
-  
+
   // if we are re constructing the form from a failed validation or ajax callback
   // then use the $form_state['values'] values
   if (array_key_exists('values', $form_state)) {
@@ -268,7 +281,7 @@ function tripal_pub_importer_setup_form($form, &$form_state = NULL, $pub_import_
     $disabled     = $form_state['input']['disabled'];
     $do_contact   = $form_state['input']['do_contact'];
     $loader_name  = $form_state['input']['loader_name'];
-    
+
     // because the num_criteria is a value and not a visible or hidden form
     // element it is not part of the ['input'] array, so we need to get it from the form
     $num_criteria = $form_state['complete form']['num_criteria']['#value'];
@@ -282,9 +295,9 @@ function tripal_pub_importer_setup_form($form, &$form_state = NULL, $pub_import_
   $form_state['triggering_element']['#name'] == 'remove') {
     $num_criteria--;
   }
-  
 
-  
+
+
   // set the values we need for later but that should not be shown on the form
   $form['num_criteria']= array(
     '#type'  => 'value',
@@ -353,7 +366,7 @@ function tripal_pub_importer_setup_form($form, &$form_state = NULL, $pub_import_
        additional information such as affilation, etc. Otherwise, only authors names are retrieved.'),
     '#default_value' => $do_contact,
   );
-  
+
   // add in the form for the criteria
   tripal_pub_importer_setup_add_criteria_fields($form, $form_state, $num_criteria, $criteria);
 
@@ -371,30 +384,33 @@ function tripal_pub_importer_setup_form($form, &$form_state = NULL, $pub_import_
     '#value'        => t('Delete Importer'),
     '#attributes'  => array('style' => 'float: right;')
   );
-  
+
   // add in the section where the test results will appear
   $form['results'] = array(
     '#markup' => '<div id="tripal-pub-importer-test-section"></div>',
   );
-  
+
   // allow the selected remote database to make changes to the form if needed
   $callback = "tripal_pub_remote_alter_form_$remote_db";
   $form = call_user_func($callback, $form, $form_state, $num_criteria);
- 
+
   $form['themed_element']['#theme'] = 'tripal_pub_importer_setup_form_elements';
-  
+
   return $form;
 }
 
 /**
- * 
+ * @stephen
+ *
  * @param $form
  * @param $form_state
  * @param $num_criteria
  * @param $criteria
+ *
+ * @ingroup tripal_pub
  */
 function tripal_pub_importer_setup_add_criteria_fields(&$form, &$form_state, $num_criteria, $criteria){
-  
+
   // choices array
   $scope_choices = array(
     'any'      => 'Any Field',
@@ -404,7 +420,7 @@ function tripal_pub_importer_setup_add_criteria_fields(&$form, &$form_state, $nu
     'title'    => 'Title',
     'journal'   => 'Journal Name'
   );
-  
+
   $first_op_choices = array(
     ''    => '',
     'NOT' => 'NOT'
@@ -414,15 +430,15 @@ function tripal_pub_importer_setup_add_criteria_fields(&$form, &$form_state, $nu
     'OR'  => 'OR',
     'NOT' => 'NOT'
   );
-  
+
   for($i = 1; $i <= $num_criteria; $i++) {
     $is_phrase = 1;
-    
+
     $search_terms = '';
     $scope = '';
     $is_phrase = '';
     $operation = '';
-  
+
     // if we have criteria supplied from the database then use that as the initial defaults
     if ($criteria) {
       $search_terms = $criteria['criteria'][$i]['search_terms'];
@@ -438,7 +454,7 @@ function tripal_pub_importer_setup_add_criteria_fields(&$form, &$form_state, $nu
       $is_phrase    = isset($_SESSION['tripal_pub_import']['criteria'][$i]['is_phrase'])    ? $_SESSION['tripal_pub_import']['criteria'][$i]['is_phrase']    : $is_phrase;
       $operation    = isset($_SESSION['tripal_pub_import']['criteria'][$i]['operation'])    ? $_SESSION['tripal_pub_import']['criteria'][$i]['operation']    : $operation;
     }
-    
+
     // If the form_state has variables then use those.  This happens when an error occurs on the form or the
     // form is resbumitted using AJAX
     if (array_key_exists('values', $form_state)) {
@@ -467,7 +483,7 @@ function tripal_pub_importer_setup_add_criteria_fields(&$form, &$form_state, $nu
       '#title'   => t('Is Phrase?'),
       '#default_value' => $is_phrase,
     );
-  
+
     if ($i == 1) {
       /*
        $form['criteria'][$i]["operation-$i"] = array(
@@ -533,23 +549,32 @@ function tripal_pub_importer_setup_add_criteria_fields(&$form, &$form_state, $nu
     }
   }
 }
+
 /**
  * This function is used to rebuild the form if an ajax call is made vai a button.
  * The button causes the form to be submitted. We don't want this so we override
  * the validate and submit routines on the form button. Therefore, this function
  * only needs to tell Drupal to rebuild the form
+ *
+ * @ingroup tripal_pub
  */
 function  tripal_pub_setup_form_ajax_button_validate($form, &$form_state){
   $form_state['rebuild'] = TRUE;
 }
+
 /**
  * This function is just a dummy to override the default form submit on ajax calls for buttons
+ *
+ * @ingroup tripal_pub
  */
 function tripal_pub_setup_form_ajax_button_submit($form, &$form_state){
   // do nothing
 }
+
 /**
+ * Validate the tripal_pub_importer_setup_form form
  *
+ * @ingroup tripal_pub
  */
 function tripal_pub_importer_setup_form_validate($form, &$form_state) {
   $num_criteria = $form_state['values']['num_criteria'];
@@ -564,7 +589,7 @@ function tripal_pub_importer_setup_form_validate($form, &$form_state) {
     $scope =  $form_state['values']["scope-$i"];
     $is_phrase =  $form_state['values']["is_phrase-$i"];
     $operation = '';
-    if($i > 1) {      
+    if($i > 1) {
       $operation =  $form_state['values']["operation-$i"];
     }
 
@@ -586,7 +611,9 @@ function tripal_pub_importer_setup_form_validate($form, &$form_state) {
 }
 
 /**
+ * Submit the tripal_pub_importer_setup_form form
  *
+ * @ingroup tripal_pub
  */
 function tripal_pub_importer_setup_form_submit($form, &$form_state) {
 
@@ -681,18 +708,21 @@ function tripal_pub_importer_setup_form_submit($form, &$form_state) {
     }
   }
 }
+
 /**
- * AJAX callback for updating the form.  
+ * AJAX callback for updating the form.
+ *
+ * @ingroup tripal_pub
  */
 function tripal_pubs_setup_form_ajax_update($form, $form_state) {
   return $form['themed_element'];
 }
 
 /**
- * 
- * @param $form
+ * Theme the tripal_pub_importer_setup_form form.
+ *
+ * @ingroup tripal_pub
  */
-
 function theme_tripal_pub_importer_setup_form_elements($variables) {
   $form = $variables['form'];
 
@@ -721,7 +751,7 @@ function theme_tripal_pub_importer_setup_form_elements($variables) {
       );
     }
   }
-  
+
   $headers = array('Operation','Scope', 'Search Terms', '','');
   $table = array(
     'header' => $headers,
@@ -734,34 +764,36 @@ function theme_tripal_pub_importer_setup_form_elements($variables) {
   );
   $criteria_table = theme_table($table);
   $markup .= $criteria_table;
-  
+
   // add the rendered form
   $form = array(
     '#markup' => $markup,
     '#prefix' => '<div id="tripal-pubs-importer-setup">',
     '#suffix' => '</div>',
   );
-  
+
   return drupal_render($form);
 }
 
 /**
  * Add a job to import publications
- * 
+ *
  * @param $pub_importer_id
+ *   The id of the importer to submit a job to update
+ *
+ * @ingroup tripal_pub
  */
 function tripal_pub_importer_submit_job($import_id) {
   global $user;
-  
+
   // get all of the loaders
   $args = array(':import_id' => $import_id);
   $sql = "SELECT * FROM {tripal_pub_import} WHERE pub_import_id = :import_id ";
   $import = db_query($sql, $args)->fetchObject();
-  
+
   $args = array($import_id);
   tripal_add_job("Import publications $import->name", 'tripal_pub',
     'tripal_pub_import_publications_by_import_id', $args, $user->uid);
-  
+
   drupal_goto('admin/tripal/chado/tripal_pub/import_list');
 }
-

+ 64 - 38
tripal_pub/includes/tripal_pub.pub_search.inc

@@ -1,6 +1,13 @@
 <?php
-/*
+/**
+ * @file
+ * Functions related to searching remote publication databases
+ */
+
+/**
+ * @stephen
  *
+ * @ingroup tripal_pub
  */
 function tripal_pub_search_page() {
 
@@ -11,12 +18,12 @@ function tripal_pub_search_page() {
   $output = drupal_render($form);
 
   // retrieve any results
-  if (array_key_exists('tripal_pub_search_form', $_SESSION) and 
+  if (array_key_exists('tripal_pub_search_form', $_SESSION) and
       $_SESSION['tripal_pub_search_form']['perform_search']) {
     $num_criteria = $_SESSION['tripal_pub_search_form']['num_criteria'];
     $from_year    = $_SESSION['tripal_pub_search_form']['from_year'];
     $to_year      = $_SESSION['tripal_pub_search_form']['to_year'];
-     
+
     $search_array = array();
     $search_array['num_criteria'] = $num_criteria;
     $search_array['from_year']    = $from_year;
@@ -40,7 +47,7 @@ function tripal_pub_search_page() {
     foreach ($pubs as $pub) {
       // get the citation for this publication
       $values = array(
-        'pub_id' => $pub->pub_id, 
+        'pub_id' => $pub->pub_id,
         'type_id' => array(
           'name' => 'Citation',
         ),
@@ -65,7 +72,7 @@ function tripal_pub_search_page() {
       );
       $i++;
     }
-    
+
     if (count($rows) == 0) {
       $rows[] = array(
         array(
@@ -86,7 +93,7 @@ function tripal_pub_search_page() {
       'empty' => '',
     );
     $results = theme_table($table);
-    
+
     // generate the pager
     pager_default_initialize($total_records, $limit);
     $pager = array(
@@ -96,16 +103,17 @@ function tripal_pub_search_page() {
       'quantity' => $limit,
     );
     $pager = theme_pager($pager);
-    
+
     // join all to form the results
     $output .= "<br><p><b>Found " . number_format($total_records) .
       ". Page " . ($page + 1) . " of $total_pages. " .
-      " Results</b></br>" . $results . $pager;    
+      " Results</b></br>" . $results . $pager;
   }
   return $output;
 }
+
 /**
- * Purpose: Provides the form to search pubmed
+ * Provides the form to search pubmed
  *
  * @ingroup tripal_pub
  */
@@ -118,7 +126,7 @@ function tripal_pub_search_form($form, &$form_state) {
   // 3) in the $form_state['input'] array which occurs on ajax callbacks from submit
   //    form elements and the form is being rebuilt
   //
-  
+
   // Set the default values. If the pub_import_id isn't already defined by the form values
   // and one is provided then look it up in the database
   $criteria = NULL;
@@ -142,7 +150,7 @@ function tripal_pub_search_form($form, &$form_state) {
     $num_criteria = $form_state['input']['num_criteria'] ? $form_state['input']['num_criteria'] : $num_criteria;
     $from_year    = $form_state['input']['from_year']    ? $form_state['input']['from_year']    : $from_year;
     $to_year      = $form_state['input']['to_year']      ? $form_state['input']['to_year']      : $to_year;
-    
+
   }
 
   if (array_key_exists('triggering_element', $form_state) and
@@ -153,22 +161,22 @@ function tripal_pub_search_form($form, &$form_state) {
   $form_state['triggering_element']['#name'] == 'remove') {
     $num_criteria--;
   }
-  
+
   $form['num_criteria']= array(
     '#type'          => 'hidden',
     '#default_value' => $num_criteria,
   );
-  
+
   $form['admin-instructions'] = array(
-    '#markup'  =>  theme('tripal_admin_message', array('message' => 
+    '#markup'  =>  theme('tripal_admin_message', array('message' =>
       t('Administrators, you can select the fields with which a user can use to search,
          by checking the desired fields on the ' .
          l('Publication Module Settings Page', 'admin/tripal/chado/tripal_pub/configuration'). ' in
         the section titled "Search Options".  The selected fields will appear in the dropdowns below.'))),
-  ); 
+  );
   $form['instructions'] = array(
-    '#markup'  =>  t('To search for publications enter keywords in the text boxes below.  
-        You can limit your search by selecting the field in the dropdown box. Click the 
+    '#markup'  =>  t('To search for publications enter keywords in the text boxes below.
+        You can limit your search by selecting the field in the dropdown box. Click the
         add and remove buttons to add additional fields for searching. '),
   );
 
@@ -181,10 +189,10 @@ function tripal_pub_search_form($form, &$form_state) {
       INNER JOIN {cvterm} CVTS ON CVTP.subject_id = CVTS.cvterm_id
       INNER JOIN {cvterm} CVTO ON CVTP.object_id = CVTO.cvterm_id
       INNER JOIN {cv} ON CVTO.cv_id = CV.cv_id
-    WHERE CV.name = 'tripal_pub' and 
-      (CVTO.name = 'Publication Details' or CVTS.name = 'Publication Type') and 
+    WHERE CV.name = 'tripal_pub' and
+      (CVTO.name = 'Publication Details' or CVTS.name = 'Publication Type') and
       NOT CVTS.is_obsolete = 1
-    ORDER BY CVTS.name ASC 
+    ORDER BY CVTS.name ASC
   ";
   $allowed_fields = variable_get('tripal_pub_allowed_search_fields', array());
   $prop_types = chado_query($sql);
@@ -207,7 +215,7 @@ function tripal_pub_search_form($form, &$form_state) {
       $mode         = $_SESSION['tripal_pub_search_form']['criteria'][$i]['mode']         ? $_SESSION['tripal_pub_search_form']['criteria'][$i]['mode']         : $mode;
       $operation    = $_SESSION['tripal_pub_search_form']['criteria'][$i]['operation']    ? $_SESSION['tripal_pub_search_form']['criteria'][$i]['operation']    : $operation;
     }
-    if (array_key_exists('values', $form_state)) {      
+    if (array_key_exists('values', $form_state)) {
       $search_terms = array_key_exists("search_terms-$i", $form_state['values']) ? $form_state['values']["search_terms-$i"] : $search_terms;
       $scope        = array_key_exists("scope-$i", $form_state['values'])        ? $form_state['values']["scope-$i"]        : $scope;
       $mode         = array_key_exists("mode-$i", $form_state['values'])         ? $form_state['values']["mode-$i"]         : $mode;
@@ -283,7 +291,7 @@ function tripal_pub_search_form($form, &$form_state) {
         );
       }
       $form['criteria'][$i]["add-$i"] = array(
-        '#type'  => 'button',      
+        '#type'  => 'button',
         '#name'  => 'add',
         '#value' => t('Add'),
         '#ajax' => array(
@@ -336,30 +344,37 @@ function tripal_pub_search_form($form, &$form_state) {
     '#type'         => 'submit',
     '#value'        => t('Reset'),
   );
-  
+
   $form['criteria']['#theme'] = 'tripal_pub_search_setup_form_elements';
 
   return $form;
 }
+
 /**
  * This function is used to rebuild the form if an ajax call is made vai a button.
  * The button causes the form to be submitted. We don't want this so we override
  * the validate and submit routines on the form button. Therefore, this function
  * only needs to tell Drupal to rebuild the form
+ *
+ * @ingroup tripal_pub
  */
 function tripal_pub_search_form_ajax_button_submit() {
   $form_state['rebuild'] = TRUE;
-  
 }
+
 /**
  * This function is just a dummy to override the default form submit on ajax calls for buttons
+ *
+ * @ingroup tripal_pub
  */
 function tripal_pub_search_form_ajax_button_validate() {
   // do nothing
 }
 
 /**
+ * Validate the tripal_pub_search_form form
  *
+ * @ingroup tripal_pub
  */
 function tripal_pub_search_form_validate($form, &$form_state) {
   $num_criteria = $form_state['values']['num_criteria'];
@@ -385,8 +400,11 @@ function tripal_pub_search_form_validate($form, &$form_state) {
     form_set_error('to_year', 'Please provide a 4-digit year.');
   }
 }
+
 /**
+ * Submit the tripal_pub_search_form form
  *
+ * @ingroup tripal_pub
  */
 function tripal_pub_search_form_submit($form, &$form_state) {
   $num_criteria = $form_state['values']['num_criteria'];
@@ -413,14 +431,14 @@ function tripal_pub_search_form_submit($form, &$form_state) {
         $operation =  $form_state['values']["operation-$i"];
       }
       //$mode =  $form_state['values']["mode-$i"];
-      
+
       $_SESSION['tripal_pub_search_form']['criteria'][$i] = array(
         'search_terms' => $search_terms,
         'scope' => $scope,
         'mode' => $mode,
         'operation' => $operation
       );
-      
+
     }
     $_SESSION['tripal_pub_search_form']['from_year'] = $from_year;
     $_SESSION['tripal_pub_search_form']['to_year'] = $to_year;
@@ -431,8 +449,10 @@ function tripal_pub_search_form_submit($form, &$form_state) {
   }
 }
 
-/*
+/**
  * AHAH callback
+ *
+ * @ingroup tripal_pub
  */
 function tripal_pub_search_page_update_criteria($action, $i) {
   $status = TRUE;
@@ -448,21 +468,24 @@ function tripal_pub_search_page_update_criteria($action, $i) {
   // return the updated JSON
   drupal_json(
   array(
-      'status'   => $status, 
+      'status'   => $status,
       'data'     => $data,
       'settings' => $settings,
   )
   );
 }
+
 /**
+ * @stephen
  *
+ * @ingroup tripal_pub
  */
 function tripal_pub_get_search_results($search_array, $limit) {
 
   // build the SQL based on the criteria provided by the user
   $select = "SELECT DISTINCT P.*, CP.nid ";
   $from   = "FROM {pub} P
-               LEFT JOIN public.chado_pub CP on P.pub_id = CP.pub_id 
+               LEFT JOIN public.chado_pub CP on P.pub_id = CP.pub_id
                INNER JOIN {cvterm} CVT on CVT.cvterm_id = P.type_id
             ";
   $where  = "WHERE (NOT P.title = 'null') "; // always exclude the dummy pub
@@ -539,7 +562,7 @@ function tripal_pub_get_search_results($search_array, $limit) {
     elseif ($type_id == 0) { //'Any Field'
       $from .= " LEFT JOIN {pubprop} PP$i ON PP$i.pub_id = P.pub_id ";
       $where .= " $op (lower(PP$i.value)  LIKE lower(:crit$i) OR
-                       lower(P.title) LIKE lower(:crit$i) OR 
+                       lower(P.title) LIKE lower(:crit$i) OR
                        lower(P.volumetitle) LIKE lower(:crit$i) OR
                        lower(P.publisher) LIKE lower(:crit$i) OR
                        lower(P.uniquename) LIKE lower(:crit$i) OR
@@ -567,16 +590,19 @@ function tripal_pub_get_search_results($search_array, $limit) {
 }
 
 /**
- * 
+ * Ajax callback to update the form
+ *
+ * @ingroup tripal_pub
  */
 function tripal_pubs_search_form_ajax_update($form, $form_state) {
   return $form['criteria'];
 }
 
 /**
-*
-* @param unknown $form
-*/
+ * Theme the tripal_pub_search_setup_form form
+ *
+ * @ingroup tripal_pub
+ */
 function theme_tripal_pub_search_setup_form_elements($variables) {
   $form = $variables['form'];
 
@@ -591,7 +617,7 @@ function theme_tripal_pub_search_setup_form_elements($variables) {
         drupal_render($element["search_terms-$i"]),
         array(
           'data' => drupal_render($element["add-$i"]) . drupal_render($element["remove-$i"]),
-          'nowrap' => 'nowrap', 
+          'nowrap' => 'nowrap',
         ),
       );
     }
@@ -613,8 +639,8 @@ function theme_tripal_pub_search_setup_form_elements($variables) {
     ),
     ''
   );
-  
-  $headers = array();  
+
+  $headers = array();
   $table = array(
     'header' => $headers,
     'rows' => $rows,
@@ -628,4 +654,4 @@ function theme_tripal_pub_search_setup_form_elements($variables) {
   $results .= theme_table($table);
   $results .= '</div>';
   return $results;
-}
+}

+ 8 - 2
tripal_pub/tripal_pub.drush.inc

@@ -1,5 +1,4 @@
 <?php
-
 /**
  * @file
  * Contains function relating to drush-integration of this module.
@@ -10,6 +9,8 @@
  *
  * @return
  *   The first line of description when executing the help for a given command
+ *
+ * @ingroup tripal_drush
  */
 function tripal_pub_drush_help($command) {
   switch ($command) {
@@ -23,6 +24,8 @@ function tripal_pub_drush_help($command) {
  *
  * @return
  *   And array of command descriptions
+ *
+ * @ingroup tripal_drush
  */
 function tripal_pub_drush_command() {
   $items = array();
@@ -37,7 +40,7 @@ function tripal_pub_drush_command() {
     'examples' => array(
       'Standard example' => 'drush tripal-pubs-import',
       'Standard example' => 'drush -l http://[site url] tripal-pubs-import --report=[email]. Where [site url] is the URL of the website and [email] is the email address of the recipient to receive the HTML report',
-      'Import single publication' => 'drush tripal-pub-import --dbxref=PMID:23582642',  
+      'Import single publication' => 'drush tripal-pub-import --dbxref=PMID:23582642',
   ),
     'aliases' => array('tpubs-import'),
   );
@@ -63,6 +66,7 @@ function tripal_pub_drush_command() {
 /**
  * Imports publications into Chado
  *
+ * @ingroup tripal_drush
  */
 function drush_tripal_pub_tripal_pubs_import() {
   $create_contacts = drush_get_option('create_contacts');
@@ -84,9 +88,11 @@ function drush_tripal_pub_tripal_pubs_import() {
     tripal_pub_import_publications($do_report, $update);
   }
 }
+
 /**
  * Imports publications into Chado
  *
+ * @ingroup tripal_drush
  */
 function drush_tripal_pub_tripal_pubs_update() {
   $create_contacts = drush_get_option('create_contacts');

+ 25 - 10
tripal_pub/tripal_pub.install

@@ -1,17 +1,14 @@
 <?php
-
 /**
  * @file
- * This file contains all the functions which describe and implement drupal database tables
- * needed by this module. This module was developed by Chad N.A. Krilow and Lacey-Anne Sanderson,
- * University of Saskatchewan.
- *
- * The project manamgenet module allows you to sync data in a chado/Tripal instance with
- * multiple project/mysql instances as well as manage and create such project instances
+ * Installation of the publication module
  */
 
 /**
+ * Implements hook_disable().
  * Disable default views when module is disabled
+ *
+ * @ingroup tripal_pub
  */
 function tripal_pub_disable() {
 
@@ -26,6 +23,8 @@ function tripal_pub_disable() {
 
 /**
  * Implementation of hook_requirements().
+ *
+ * @ingroup tripal_pub
  */
 function tripal_pub_requirements($phase) {
   $requirements = array();
@@ -44,6 +43,8 @@ function tripal_pub_requirements($phase) {
 
 /**
  * Implementation of hook_install().
+ *
+ * @ingroup tripal_pub
  */
 function tripal_pub_install() {
   global $base_path;
@@ -66,13 +67,17 @@ function tripal_pub_install() {
 
 /**
  * Implementation of hook_uninstall().
+ *
+ * @ingroup tripal_pub
  */
 function tripal_pub_uninstall() {
 
 }
 
 /**
+ * Implements hook_enable().
  *
+ * @ingroup tripal_pub
  */
 function tripal_pub_enable() {
   // make sure we have our supported databases
@@ -82,9 +87,10 @@ function tripal_pub_enable() {
   variable_set('tripal_pub_supported_dbs', array('PMID', 'AGL'));
 }
 
-
 /**
  * Implementation of hook_schema().
+ *
+ * @ingroup tripal_pub
  */
 function tripal_pub_schema() {
 
@@ -161,9 +167,11 @@ function tripal_pub_schema() {
   return $schema;
 }
 
-
-/*
+/**
+ * Add custom table related to publications
+ *  - pubauthor_contact
  *
+ * @ingroup tripal_pub
  */
 function tripal_pub_add_custom_tables() {
   $schema = array (
@@ -210,7 +218,9 @@ function tripal_pub_add_custom_tables() {
 }
 
 /**
+ * Add cvs related to publications
  *
+ * @ingroup tripal_pub
  */
 function tripal_pub_add_cvs() {
 
@@ -220,8 +230,11 @@ function tripal_pub_add_cvs() {
     'Contains Types of relationships between publications.'
   );
 }
+
 /**
+ * Add cvterms related to publications
  *
+ * @ingroup tripal_pub
  */
 function tripal_pub_add_cvterms() {
 
@@ -229,6 +242,8 @@ function tripal_pub_add_cvterms() {
 
 /**
  * This is the required update for tripal_contact when upgrading from Drupal core API 6.x.
+ *
+ * @ingroup tripal_pub
  */
 function tripal_pub_update_7000() {
 

+ 38 - 33
tripal_pub/tripal_pub.module

@@ -1,14 +1,20 @@
 <?php
+/**
+ * @file
+ * Basic functionality of the pub module
+ */
+
+require_once 'api/tripal_pub.api.inc';
+
+require_once 'theme/tripal_pub.theme.inc';
 
-require_once "api/tripal_pub.api.inc";
-require_once "theme/tripal_pub.theme.inc";
-require_once "includes/tripal_pub.admin.inc";
-require_once "includes/tripal_pub.chado_node.inc";
-require_once "includes/tripal_pub.pub_importers.inc";
-require_once "includes/tripal_pub.pub_search.inc";
-require_once "includes/tripal_pub.pub_citation.inc";
-require_once "includes/importers/tripal_pub.PMID.inc";
-require_once "includes/importers/tripal_pub.AGL.inc";
+require_once 'includes/tripal_pub.admin.inc';
+require_once 'includes/tripal_pub.chado_node.inc';
+require_once 'includes/tripal_pub.pub_importers.inc';
+require_once 'includes/tripal_pub.pub_search.inc';
+require_once 'includes/tripal_pub.pub_citation.inc';
+require_once 'includes/importers/tripal_pub.PMID.inc';
+require_once 'includes/importers/tripal_pub.AGL.inc';
 
 /**
  * @defgroup tripal_pub Publication Module
@@ -24,24 +30,17 @@ require_once "includes/importers/tripal_pub.AGL.inc";
  * @}
  */
 
-
 /**
+ * Implements hook_menu().
  *
- * @ingroup tripal_pub
- */
-function tripal_pub_init() {
-
-}
-
-/**
- * Tripal-Publication-Menu
- *
- * Implements hook_menu(): Adds menu items for the tripal_pub module menu. This section
+ * Adds menu items for the tripal_pub module menu. This section
  * gives the outline for the main menu of the Tripal-Publication module
  *
  * @return
  *   An array of menu items that is visible within the Drupal Menu, returned as soon
  *   as the program is ran
+ *
+ * @ingroup tripal_pub
  */
 function tripal_pub_menu() {
   $items = array();
@@ -181,14 +180,14 @@ function tripal_pub_menu() {
   return $items;
 }
 
-
 /**
- * Implements hook_theme(): Register themeing functions for this module
- *
+ * Implements hook_theme().
+ * Register themeing functions for this module
  *
  * @return
  *   An array of themeing functions to register
  *
+ * @ingroup tripal_pub
  */
 function tripal_pub_theme($existing, $type, $theme, $path) {
   $core_path = drupal_get_path('module', 'tripal_core');
@@ -279,8 +278,10 @@ function tripal_pub_theme($existing, $type, $theme, $path) {
 }
 
 /**
- * Implements hook_help()
- * Purpose: Adds a help page to the module list
+ * Implements hook_help().
+ * Adds a help page to the module list
+ *
+ * @ingroup tripal_pub
  */
 function tripal_pub_help ($path, $arg) {
   if ($path == 'admin/help#tripal_pub') {
@@ -289,8 +290,9 @@ function tripal_pub_help ($path, $arg) {
 }
 
 /**
- * Implements hook_views_api()
- * Purpose: Essentially this hook tells drupal that there is views support for
+ * Implements hook_views_api().
+ *
+ * Essentially this hook tells drupal that there is views support for
  *  for this module which then includes tripal_db.views.inc where all the
  *  views integration code is
  *
@@ -332,11 +334,10 @@ function tripal_pub_permission() {
   );
 }
 
-
-
-
 /**
+ * Implements hook_mail().
  *
+ * @ingroup tripal_pub
  */
 function tripal_pub_mail($key, &$message, $params) {
   $language = $message['language'];
@@ -358,13 +359,14 @@ function tripal_pub_mail($key, &$message, $params) {
   }
 }
 
-
 /**
- * Implementation of hook_form_alter()
+ * Implementation of hook_form_alter().
  *
  * @param $form
  * @param $form_state
  * @param $form_id
+ *
+ * @ingroup tripal_pub
  */
 function tripal_pub_form_alter(&$form, &$form_state, $form_id) {
   // turn of preview button for insert/updates
@@ -391,9 +393,12 @@ function tripal_pub_form_alter(&$form, &$form_state, $form_id) {
 }
 
 /**
+ * Implements hook_job_describe_args().
  *
  * @param $callback
  * @param $args
+ *
+ * @ingroup tripal_pub
  */
 function tripal_pub_job_describe_args($callback, $args) {
 
@@ -407,4 +412,4 @@ function tripal_pub_job_describe_args($callback, $args) {
     $new_args['Importer'] = $import->name;
   }
   return $new_args;
-}
+}

+ 12 - 2
tripal_pub/tripal_pub.views_default.inc

@@ -1,8 +1,13 @@
 <?php
+/**
+ * @file
+ * Describe publication default views
+ */
 
 /**
+ * Implements hook_views_default_views().
  *
- *
+ * @ingroup tripal_pub
  */
 function tripal_pub_views_default_views() {
   $views = array();
@@ -14,6 +19,11 @@ function tripal_pub_views_default_views() {
   return $views;
 }
 
+/**
+ * Default publication administration view
+ *
+ * @ingroup tripal_pub
+ */
 function tripal_pub_defaultview_admin_publications() {
 
   $view = new view();
@@ -195,4 +205,4 @@ function tripal_pub_defaultview_admin_publications() {
   */
 
   return $view;
-}
+}