Browse Source

Tripal Organism adheres to Drupal coding standards

Pubudu Basnayaka 12 năm trước cách đây
mục cha
commit
aaed62d7f5

+ 18 - 18
tripal_organism/tripal_organism.api.inc

@@ -59,18 +59,18 @@ function tripal_organism_get_organism_by_organism_id($organism_id) {
     return node_load($r->nid);
   }
   else {
-    drupal_set_message("Function: tripal_organism_get_organism_by_organism_id() -no organism with that organism id sync'd with drupal", 'error');
+    drupal_set_message(t("Function: tripal_organism_get_organism_by_organism_id() -no organism with that organism id sync'd with drupal"), 'error');
   }
 
   return 0;
 
 }
 
-/*****
+/**
  * @section Chado Table Descriptions
  * There should be a default table description for all chado tables included
  * in core.
- ****************************************************************************/
+ */
 
 /**
  * Implements hook_chado_organism_schema()
@@ -137,22 +137,22 @@ function tripal_organism_chado_organismprop_schema() {
  */
 function tripal_organism_get_synced() {
 
-   // use this SQL for getting synced organisms
-   $dsql =  "SELECT * FROM {chado_organism}";
-   $orgs = db_query($dsql);
+  // use this SQL for getting synced organisms
+  $dsql =  "SELECT * FROM {chado_organism}";
+  $orgs = db_query($dsql);
 
-   // use this SQL statement for getting the organisms
-   $csql =  "SELECT * FROM {Organism} ".
-            "WHERE organism_id = %d";
+  // use this SQL statement for getting the organisms
+  $csql =  "SELECT * FROM {Organism} ".
+          "WHERE organism_id = %d";
 
-   $org_list = array();
+  $org_list = array();
 
-   // iterate through the organisms and build an array of those that are synced
-   while ($org = db_fetch_object($orgs)) {
-      $previous_db = tripal_db_set_active('chado');  // use chado database
-      $info = db_fetch_object(db_query($csql, $org->organism_id));
-      tripal_db_set_active($previous_db);  // now use drupal database
-      $org_list[] = $info;
-   }
-   return $org_list;
+  // iterate through the organisms and build an array of those that are synced
+  while ($org = db_fetch_object($orgs)) {
+    $previous_db = tripal_db_set_active('chado');  // use chado database
+    $info = db_fetch_object(db_query($csql, $org->organism_id));
+    tripal_db_set_active($previous_db);  // now use drupal database
+    $org_list[] = $info;
+  }
+  return $org_list;
 }

+ 61 - 61
tripal_organism/tripal_organism.install

@@ -6,73 +6,73 @@
  */
 
 /**
-*  Implementation of hook_install();
-*
-* @ingroup tripal_organism
-*/
+ * Implementation of hook_install().
+ *
+ * @ingroup tripal_organism
+ */
 function tripal_organism_install() {
 
-   // create the module's data directory
-   tripal_create_moddir('tripal_organism');
+  // create the module's data directory
+  tripal_create_moddir('tripal_organism');
 
-   // create the directory where image files will be stored.  We create this
-   // here otherwise it will get created when the first organism is synced.
-   // The user that performs the syncing will receive ownership of the
-   // images directory which may not allow for write access by the web server
-   // user.  So, we create it here
-   $dest = file_directory_path() . "/tripal/tripal_organism/images";
-   file_check_directory($dest, FILE_CREATE_DIRECTORY);
+  // create the directory where image files will be stored.  We create this
+  // here otherwise it will get created when the first organism is synced.
+  // The user that performs the syncing will receive ownership of the
+  // images directory which may not allow for write access by the web server
+  // user.  So, we create it here
+  $dest = file_directory_path() . "/tripal/tripal_organism/images";
+  file_check_directory($dest, FILE_CREATE_DIRECTORY);
 
-   // create the tables that correlate drupal nodes with chado
-   // features, organisms, etc....
-   drupal_install_schema('tripal_organism');
+  // create the tables that correlate drupal nodes with chado
+  // features, organisms, etc....
+  drupal_install_schema('tripal_organism');
 
 }
 
 /**
-* Implementation of hook_schema().
-*
-* @ingroup tripal_organism
-*/
+ * Implementation of hook_schema().
+ *
+ * @ingroup tripal_organism
+ */
 function tripal_organism_schema() {
-   $schema = tripal_organism_get_schemas();
+  $schema = tripal_organism_get_schemas();
   return $schema;
 }
 
 /**
-* Implementation of hook_uninstall()
-*
-* @ingroup tripal_organism
-*/
+ * Implementation of hook_uninstall().
+ *
+ * @ingroup tripal_organism
+ */
 function tripal_organism_uninstall() {
-   drupal_uninstall_schema('tripal_organism');
+  drupal_uninstall_schema('tripal_organism');
 
-   // Get the list of nodes to remove
-   $sql_lib_id = "SELECT nid, vid ".
-                 "FROM {node} ".
-                 "WHERE type='chado_organism'";
-   $result = db_query($sql_lib_id);
-   while ($node = db_fetch_object($result)) {
-      node_delete($node->nid);
-   }
+  // Get the list of nodes to remove
+  $sql_lib_id = "SELECT nid, vid ".
+               "FROM {node} ".
+               "WHERE type='chado_organism'";
+  $result = db_query($sql_lib_id);
+  while ($node = db_fetch_object($result)) {
+    node_delete($node->nid);
+  }
 
-   // remove the materialized views
+  // remove the materialized views
 
-   // Remove the custom view if exists
-   if (db_table_exists('tripal_organism_views_common_name')) {
-      $sql = "DROP TABLE {tripal_organism_views_common_name}";
-      db_query($sql);
-   }
+  // Remove the custom view if exists
+  if (db_table_exists('tripal_organism_views_common_name')) {
+    $sql = "DROP TABLE {tripal_organism_views_common_name}";
+    db_query($sql);
+  }
 }
 
 /**
-* This function simply defines all tables needed for the module to work
-* correctly.  By putting the table definitions in a separate function we
-* can easily provide the entire list for hook_install or individual
-* tables for an update.
-*
-* @ingroup tripal_organism
-*/
+ * This function simply defines all tables needed for the module to work
+ * correctly.  By putting the table definitions in a separate function we
+ * can easily provide the entire list for hook_install or individual
+ * tables for an update.
+ *
+ * @ingroup tripal_organism
+ */
 function tripal_organism_get_schemas() {
   $schema = array();
 
@@ -83,18 +83,18 @@ function tripal_organism_get_schemas() {
             'unsigned' => TRUE,
             'not null' => TRUE,
             'default' => 0
-         ),
+          ),
          'nid' => array(
             'type' => 'int',
             'unsigned' => TRUE,
             'not null' => TRUE,
             'default' => 0
-         ),
+          ),
          'organism_id' => array(
             'type' => 'int',
             'not null' => TRUE,
             'default' => 0
-         )
+          )
       ),
       'indexes' => array(
          'organism_id' => array('organism_id')
@@ -115,15 +115,15 @@ function tripal_organism_get_schemas() {
  * @ingroup tripal_organism
  */
 function tripal_organism_requirements($phase) {
-   $requirements = array();
-   if ($phase == 'install') {
-      if (!function_exists('tripal_create_moddir')) {
-         $requirements ['tripal_organism'] = array(
-            'title' => "tripal_organism",
-            'value' => "error. Some required modules are just being installed. Please try again.",
-            'severity' => REQUIREMENT_ERROR,
-         );
-      }
-   }
-   return $requirements;
+  $requirements = array();
+  if ($phase == 'install') {
+    if (!function_exists('tripal_create_moddir')) {
+      $requirements ['tripal_organism'] = array(
+        'title' => "tripal_organism",
+        'value' => "error. Some required modules are just being installed. Please try again.",
+        'severity' => REQUIREMENT_ERROR,
+      );
+    }
+  }
+  return $requirements;
 }

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 442 - 441
tripal_organism/tripal_organism.module


+ 14 - 14
tripal_organism/tripal_organism.views.inc

@@ -37,7 +37,7 @@ function tripal_organism_views_data()  {
     );
     foreach ($tables as $tablename) {
       if (!tripal_views_is_integrated($tablename, 10)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename,TRUE);
+        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE);
         tripal_views_integration_add_entry($table_integration_array);
       }
     }
@@ -49,7 +49,7 @@ function tripal_organism_views_data()  {
     );
     foreach ($tables as $tablename) {
       if (!tripal_views_is_integrated($tablename, 10)) {
-        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename,FALSE);
+        $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE);
         tripal_views_integration_add_entry($table_integration_array);
       }
     }
@@ -68,19 +68,19 @@ function tripal_organism_views_data()  {
  * @ingroup tripal_organism_views
  */
 function tripal_organism_views_handlers() {
- return array(
-   'info' => array(
-     'path' => drupal_get_path('module', 'tripal_organism') . '/views/handlers',
-   ),
-   'handlers' => array(
-     'views_handler_field_computed_organism_nid' => array(
-       'parent' => 'views_handler_field_numeric',
-     ),
-     'views_handler_filter_organism_common_name' => array(
+  return array(
+    'info' => array(
+      'path' => drupal_get_path('module', 'tripal_organism') . '/views/handlers',
+    ),
+    'handlers' => array(
+      'views_handler_field_computed_organism_nid' => array(
+        'parent' => 'views_handler_field_numeric',
+      ),
+      'views_handler_filter_organism_common_name' => array(
       'parent' => 'views_handler_filter_string',
-     ),
-   ),
- );
+    ),
+    ),
+  );
 }
 
 /**

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác