Kaynağa Gözat

Tripal Feature adheres to Drupal coding standards

Pubudu Basnayaka 12 yıl önce
ebeveyn
işleme
35583d0246

Dosya farkı çok büyük olduğundan ihmal edildi
+ 222 - 219
tripal_feature/tripal_feature.module


+ 23 - 22
tripal_feature/views/chado_feature.views.inc

@@ -1,7 +1,8 @@
 <?php
 
 /**
- * Purpose: this function returns the portion of the data array 
+ * @file
+ * Purpose: this function returns the portion of the data array
  *   which describes the chado_feature drupal table, it's fields and any joins between it and other tables
  * @see tripal_feature_views_data() --in tripal_feature.views.inc
  *
@@ -9,14 +10,14 @@
  *
  * @ingroup tripal_feature_views
  */
-function retrieve_chado_feature_views_data () {
-	global $db_url;
+function retrieve_chado_feature_views_data() {
+  global $db_url;
   $data = array();
-  
+
   // if the chado database is not local to the drupal database
   // then we need to set the database name.  This should always
   // be 'chado'.
-  if(is_array($db_url) and array_key_exists('chado',$db_url)){
+  if (is_array($db_url) and array_key_exists('chado', $db_url)) {
      // return empty data array b/c if chado is external then no join to the nodetable can be made
      return $data;
   }
@@ -26,43 +27,43 @@ function retrieve_chado_feature_views_data () {
     'field' => 'nid',
     'group' => 'Chado Feature'
   );
-  
+
   $data['chado_feature']['nid'] = array(
     'title' => t('Feature Node ID'),
     'help' => t('The node ID for this feature'),
     'field' => array(
-     	'handler' => 'views_handler_field_numeric',
- 		  'click sortable' => TRUE,
+       'handler' => 'views_handler_field_numeric',
+       'click sortable' => TRUE,
     ),
     'filter' => array(
-     	'handler' => 'views_handler_filter_numeric',
+       'handler' => 'views_handler_filter_numeric',
     ),
     'sort' => array(
-     	'handler' => 'views_handler_sort',
+       'handler' => 'views_handler_sort',
     ),
   );
 
   // Note: No joins need to be made from $data['feature']['table']
-  
+
   // Join the chado feature table to feature
   $data['chado_feature']['table']['join']['feature'] = array(
-  	'left_field' => 'feature_id',
-  	'field' => 'feature_id',
+    'left_field' => 'feature_id',
+    'field' => 'feature_id',
   );
-  
+
   // Join the node table to chado feature
   $data['node']['table']['join']['chado_feature'] = array(
-  	'left_field' => 'nid',
-  	'field' => 'nid',
+    'left_field' => 'nid',
+    'field' => 'nid',
   );
-  
+
   // Join the node table to feature
   $data['node']['table']['join']['feature'] = array(
-  	'left_table' => 'chado_feature',
-  	'left_field' => 'nid',
-  	'field' => 'nid',
+    'left_table' => 'chado_feature',
+    'left_field' => 'nid',
+    'field' => 'nid',
   );
-  
+
   // Add relationship between chado_feature and feature
   $data['chado_feature']['feature_nid'] = array(
     'group' => 'Feature',
@@ -95,5 +96,5 @@ function retrieve_chado_feature_views_data () {
     ),
   );
 
-	return $data;
+  return $data;
 }

+ 38 - 36
tripal_feature/views/feature.views.inc

@@ -1,7 +1,8 @@
 <?php
 
 /**
- * Purpose: this function returns the portion of the data array 
+ * @file
+ * Purpose: this function returns the portion of the data array
  *   which describes the feature table, it's fields and any joins between it and other tables
  * @see tripal_feature_views_data() --in tripal_feature.views.inc
  *
@@ -36,17 +37,17 @@
  * @ingroup tripal_feature_views
  */
  function retrieve_feature_views_data() {
-	global $db_url;
-	$data = array();
-	
+  global $db_url;
+  $data = array();
+
   // if the chado database is not local to the drupal database
   // then we need to set the database name.  This should always
   // be 'chado'.
-  if(is_array($db_url) and array_key_exists('chado',$db_url)){
+  if (is_array($db_url) and array_key_exists('chado', $db_url)) {
      $database = 'chado';
   }
 
-	
+
    // Basic table definition
    $data['feature']['table']['group'] = 'Chado Feature';
    $data['feature']['table']['base'] = array(
@@ -55,17 +56,17 @@
      'help' => 'Features are Sequence Data Records in Chado.',
    );
 
-	if($database){
-		$data['feature']['table']['base']['database'] = $database;
-	}
-	
+  if ($database) {
+    $data['feature']['table']['base']['database'] = $database;
+  }
+
 
   //Relationship Definitions---------------------------------
   //Join: feature => nd_reagent
   $data['feature']['table']['join']['nd_reagent'] = array(
     'left_field' => 'feature_id',
     'field' => 'feature_id',
-  );  
+  );
 
   // Table Field Definitions----------------------
   // Field: feature_id (primary key)
@@ -73,29 +74,30 @@
     'title' => 'Feature ID',
     'help' => 'The primary key of a feature',
     'field' => array(
-     	'handler' => 'views_handler_field_numeric',
- 		  'click sortable' => TRUE,
+       'handler' => 'views_handler_field_numeric',
+       'click sortable' => TRUE,
     ),
     'filter' => array(
-     	'handler' => 'views_handler_filter_numeric',
+       'handler' => 'views_handler_filter_numeric',
     ),
     'sort' => array(
-     	'handler' => 'views_handler_sort',
+       'handler' => 'views_handler_sort',
     ),
   );
 
   // Calculated Field: Node ID
   //  use custom field handler to query drupal for the node ID
   //  this is only needed if chado is in a separate database from drupal
-  if($database){
-  	$data['feature']['feature_nid'] = array(
-    	'title' => 'Node ID',
-			'help' => 'This is the node ID of this feature. It can be used as a link to the node.',
-    	'field' => array(
-      	'handler' => 'views_handler_field_computed_feature_nid',
+  if ($database) {
+    $data['feature']['feature_nid'] = array(
+      'title' => 'Node ID',
+      'help' => 'This is the node ID of this feature. It can be used as a link to the node.',
+      'field' => array(
+        'handler' => 'views_handler_field_computed_feature_nid',
       ),
-  	);
-  } else {
+    );
+  }
+  else {
     // Add relationship between chado_feature and feature
     $data['feature']['feature_nid'] = array(
       'group' => 'Feature',
@@ -113,16 +115,16 @@
     );
 
   }
-  
+
   // Field: organism_id (forgeign key)
   //  join between organism table and this one in tripal_organism/views/organism.views.inc
-  
+
   // Field: dbxref_id (forgeign key)
   //  join between dbxref table and this one in tripal_db/views/dbxref.views.inc
-  
+
   // Field: type_id (forgeign key)
   //  join between cvterm table and this one in tripal_cv/views/cvterm.views.inc
-  
+
   // Field: name (varchar 255)
   $data['feature']['name'] = array(
     'title' => 'Name',
@@ -141,7 +143,7 @@
       'handler' => 'views_handler_argument_string',
     ),
   );
-  // if joined to the node table add a "Link to Node" option for the field  
+  // if joined to the node table add a "Link to Node" option for the field
   if (!$database && module_exists('tripal_views')) {
     $data['feature']['name']['field']['handler'] = 'views_handler_field_node_optional';
   }
@@ -164,7 +166,7 @@
       'handler' => 'views_handler_argument_string',
     ),
   );
-  // if joined to the node table add a "Link to Node" option for the field  
+  // if joined to the node table add a "Link to Node" option for the field
   if (!$database && module_exists('tripal_views')) {
     $data['feature']['uniquename']['field']['handler'] = 'views_handler_field_node_optional';
   }
@@ -273,14 +275,14 @@
   // Calculated Field: Number of Analysis' (Count -Int)
   // Provides the number of analysis' for a given feature
   // @see tripal_analysis/views/misc_tables.views.inc
-  
+
   //Calculated Field: Number of Libraries (Count -Int)
   // Provides the number of libraries for a given feature
-  // @see tripal_library/views/misc_tables.views.inc 
+  // @see tripal_library/views/misc_tables.views.inc
 
-	// Calculated Field: feature relationships
-	// uses a custom field handler which pulls results from the view
-	$data['feature']['relationships'] = array(
+  // Calculated Field: feature relationships
+  // uses a custom field handler which pulls results from the view
+  $data['feature']['relationships'] = array(
     'title' => t('Feature Relationships'),
     'help' => t('Relationships including the current feature.'),
     'field' => array(
@@ -288,7 +290,7 @@
       'help' => t('Display a given type of relationships including the current feature.'),
       'handler' => 'views_handler_field_chado_rel_by_type',
     ),
-  ); 
-  
+  );
+
   return $data;
  }

+ 12 - 12
tripal_feature/views/handlers/views_handler_field_computed_feature_nid.inc

@@ -7,17 +7,17 @@
  * @ingroup views_field_handlers
  */
 class views_handler_field_computed_feature_nid extends views_handler_field_numeric {
-	function construct() {
-		parent::construct();
-		$this->additional_fields['feature_id'] = array('table' => 'feature', 'field' => 'feature_id');
-	}
+  function construct() {
+    parent::construct();
+    $this->additional_fields['feature_id'] = array('table' => 'feature', 'field' => 'feature_id');
+  }
 
-	function query() { 
-		$this->ensure_my_table();
-		$this->add_additional_fields(); 
-	}
+  function query() {
+    $this->ensure_my_table();
+    $this->add_additional_fields();
+  }
 
-	function render($values) { 
-		return $values->feature_nid;
-	}
-} 
+  function render($values) {
+    return $values->feature_nid;
+  }
+}

+ 8 - 8
tripal_feature/views/handlers/views_handler_field_residues.inc

@@ -7,19 +7,19 @@
  */
 class views_handler_field_residues extends views_handler_field {
 
-	function construct() {
-		parent::construct();
+  function construct() {
+    parent::construct();
       $this->additional_fields['residues'] = array('table' => 'feature', 'field' => 'residues');
-	}
+  }
 
-	function query() { 
-		$this->ensure_my_table();
-		$this->add_additional_fields(); 
-	}
+  function query() {
+    $this->ensure_my_table();
+    $this->add_additional_fields();
+  }
 
   function render($values) {
     // add a <br> every 100 bp
-    return ereg_replace("(.{100})","\\1<br>",$values->feature_residues);
+    return ereg_replace("(.{100})", "\\1<br>", $values->feature_residues);
 
   }
 }

+ 7 - 6
tripal_feature/views/misc_tables.views.inc

@@ -1,6 +1,7 @@
 <?php
 
 /**
+ * @file
  * Purpose: Allows the feature module to add fields to other module views
  *
  *   For example, a field counting the number of features associted with a given organism would be
@@ -13,14 +14,14 @@
           'handler' => 'views_handler_field_chado_count',
           'table_to_query' => 'feature',
         ),
-      ); 
+      );
  *   @endcode
  *
  * @ingroup tripal_feature_views
  */
 function retrieve_feature_misc_tables_views_data() {
   $data = array();
- 
+
   // Table: Organism--------------------------------------------------------------------------------
   // Calculated Field: Number of features (Count -Int)
   // Provides the number of features for a given organism
@@ -31,7 +32,7 @@ function retrieve_feature_misc_tables_views_data() {
       'handler' => 'views_handler_field_chado_count',
       'table_to_query' => 'feature',
     ),
-  );  
+  );
 
   // Table: Library---------------------------------------------------------------------------------
   // Calculated Field: Number of features (Count -Int)
@@ -43,7 +44,7 @@ function retrieve_feature_misc_tables_views_data() {
       'handler' => 'views_handler_field_chado_count',
       'table_to_query' => 'library_feature',
     ),
-  );   
+  );
 
   // Table: Analysis--------------------------------------------------------------------------------
   // Calculated Field: Number of features (Count -Int)
@@ -55,6 +56,6 @@ function retrieve_feature_misc_tables_views_data() {
       'handler' => 'views_handler_field_chado_count',
       'table_to_query' => 'analysisfeature',
     ),
-  ); 
+  );
   return $data;
-}
+}

+ 28 - 28
tripal_feature/views/template.node_join.views.inc

@@ -5,18 +5,18 @@
  *
  *  - simply replace all XXX with the original chado table you want to join to it's drupal nodes.
  *    (ie: If you want to join features to their drupal nodes then XXX=feature)
- * 
- *  NOTE: Creating the table definition file is not enough. You also need to call the 
+ *
+ *  NOTE: Creating the table definition file is not enough. You also need to call the
  *        retrieve_XXX_views_data() function from ../tripal_feature.views.inc:tripal_feature_views_data()
  *        by adding the following line:
  *           $data = array_merge($data, retrieve_XXX_views_data());
- *        to the function and including the file directly above the function (blow the function 
+ *        to the function and including the file directly above the function (blow the function
  *        header by adding:
  *           require_once('views/XXX.views.inc');
  *
  *  REMOVE THIS COMMENT IN THE COPY!
- */ 
- 
+ */
+
 /**
  *  @file
  *  This file defines the data array for a given chado table. This array
@@ -24,31 +24,31 @@
  *  with this module in:
  *  @see tripal_feature.views.inc --in tripal_feature_views_data()
  *
- *  Note: All chado tables are joined to their drupal nodes through the chado_XXX linking table. 
+ *  Note: All chado tables are joined to their drupal nodes through the chado_XXX linking table.
  *        This file simply defines this linking table and joins the three tables together.
  *        No modification of XXX.views.inc is needed.
  *
- *  Documentation on views integration can be found at 
+ *  Documentation on views integration can be found at
  *  http://views2.logrus.com/doc/html/index.html.
  */
- 
+
 /**
- * Purpose: this function returns the portion of the data array 
- *   which describes the chado_XXX drupal table, it's fields and any joins between it 
+ * Purpose: this function returns the portion of the data array
+ *   which describes the chado_XXX drupal table, it's fields and any joins between it
  *   and other tables
  * @see tripal_feature_views_data() --in tripal_feature.views.inc
  *
  * The main need for description of this table to views is to join chado data with drupal nodes
  *
  */
-function retrieve_chado_XXX_views_data () {
-	global $db_url;
+function retrieve_chado_XXX_views_data() {
+  global $db_url;
   $data = array();
-  
+
   // if the chado database is not local to the drupal database
   // then we need to set the database name.  This should always
   // be 'chado'.
-  if(is_array($db_url) and array_key_exists('chado',$db_url)){
+  if (is_array($db_url) and array_key_exists('chado', $db_url)) {
      // return empty data array b/c if chado is external then no join to the nodetable can be made
      return $data;
   }
@@ -57,28 +57,28 @@ function retrieve_chado_XXX_views_data () {
   $data['chado_XXX']['table'] = array(
     'field' => 'nid',
   );
-  
+
   //Relationship Definitions---------------------------------
   // Note: No joins need to be made from $data['XXX']['table']
-  
+
   // Join the chado_XXX table to XXX
   $data['chado_XXX']['table']['join']['XXX'] = array(
-  	'left_field' => 'XXX_id',
-  	'field' => 'XXX_id',
+    'left_field' => 'XXX_id',
+    'field' => 'XXX_id',
   );
-  
+
   // Join the node table to chado_XXX
   $data['node']['table']['join']['chado_XXX'] = array(
-  	'left_field' => 'nid',
-  	'field' => 'nid',
+    'left_field' => 'nid',
+    'field' => 'nid',
   );
-  
+
   // Join the node table to XXX
   $data['node']['table']['join']['XXX'] = array(
-  	'left_table' => 'chado_XXX',
-  	'left_field' => 'nid',
-  	'field' => 'nid',
-  );  
+    'left_table' => 'chado_XXX',
+    'left_field' => 'nid',
+    'field' => 'nid',
+  );
 
-	return $data;
-}
+  return $data;
+}

Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor