ソースを参照

Genotype module tested

Stephen Ficklin 11 年 前
コミット
930df24d31

+ 6 - 3
tripal_genetic/theme/tripal_feature/tripal_feature.genotypes.tpl.php

@@ -34,7 +34,7 @@ $feature = tripal_core_expand_chado_vars($feature, 'table', 'feature_genotype',
 $feature_genotypes = $feature->feature_genotype->feature_id;
 
 // the total number of records for the paged query is stored in a session variable
-$total_records = $_SESSION['chado_pager'][$element]['total_records'];
+$total_records = $_SESSION['chado_pager'][$feature_pager_id]['total_records'];
 
 // now iterate through the feature genotypes and print a paged table.
 if (count($feature_genotypes) > 0) {?>
@@ -89,8 +89,9 @@ if (count($feature_genotypes) > 0) {?>
       $details = '';
       if(count($properties) > 0) { 
         foreach ($properties as $property){ 
-          $details .=  '<br>' . ucwords(preg_replace('/_/', ' ', $property->type_id->name)) . ': ' . $property->value;
+          $details .=  ucwords(preg_replace('/_/', ' ', $property->type_id->name)) . ': ' . $property->value . '<br>';
         } 
+        $details = substr($details, 0, -4); // remove trailing <br>
       }
       // build the list of germplasm.
       $germplasm = '';
@@ -100,9 +101,11 @@ if (count($feature_genotypes) > 0) {?>
           $gname = $stock->name; 
           if(property_exists($stock, 'nid')) {
             $gname = l($gname, 'node/' . $stock->nid, array('attributes' => array('target' => '_blank')));
+            dpm($gname);
           }
-          $germplasm .= '<br>' . ucwords(preg_replace('/_/', ' ', $stock->type_id->name)) . ': ' . $gname;
+          $germplasm .= ucwords(preg_replace('/_/', ' ', $stock->type_id->name)) . ': ' . $gname . '<br>';
         }
+        $germplasm = substr($germplasm, 0, -4); // remove trailing <br>
       } 
       // add the fields to the table row
       $rows[] = array(

+ 7 - 5
tripal_genetic/theme/tripal_stock/tripal_stock.genotypes.tpl.php

@@ -11,7 +11,7 @@ $stock = $variables['node']->stock;
 
 // specify the number of genotypes to show by default and the unique pager ID
 $num_results_per_page = 25; 
-$stock_pager_id = 0;
+$stock_pager_id = 15;
 
 // get the genotypes from the stock_genotype table
 $options = array(
@@ -25,7 +25,7 @@ $stock = tripal_core_expand_chado_vars($stock, 'table', 'stock_genotype', $optio
 $stock_genotypes = $stock->stock_genotype;
 
 // the total number of records for the paged query is stored in a session variable
-$total_records = $_SESSION['chado_pager'][$element]['total_records'];
+$total_records = $_SESSION['chado_pager'][$stock_pager_id]['total_records'];
 
 // now iterate through the stock genotypes and print a paged table.
 if (count($stock_genotypes) > 0) {?>
@@ -36,7 +36,7 @@ if (count($stock_genotypes) > 0) {?>
     // the $headers array is an array of fields to use as the colum headers.
     // additional documentation can be found here
     // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
-    $headers = array('Name', 'Type', 'Genotype', 'Details', 'Germplasm');
+    $headers = array('Name', 'Type', 'Genotype', 'Details', 'Markers');
     
     // the $rows array contains an array of rows where each row is an array
     // of values for each column of the table in that row.  Additional documentation
@@ -79,8 +79,9 @@ if (count($stock_genotypes) > 0) {?>
       $details = '';
       if(count($properties) > 0) {
         foreach ($properties as $property){
-          $details .=  '<br>' . ucwords(preg_replace('/_/', ' ', $property->type_id->name)) . ': ' . $property->value;
+          $details .=  ucwords(preg_replace('/_/', ' ', $property->type_id->name)) . ': ' . $property->value . '<br>';
         }
+        $details = substr($details, 0, -4); // remove trailing <br>
       }
       
       // build the list of features.
@@ -92,8 +93,9 @@ if (count($stock_genotypes) > 0) {?>
           if(property_exists($feature, 'nid')) {
             $fname = l($fname, 'node/' . $feature->nid, array('attributes' => array('target' => '_blank')));
           }
-          $germplasm .= '<br>' . ucwords(preg_replace('/_/', ' ', $feature->type_id->name)) . ': ' . $fname;
+          $germplasm .= ucwords(preg_replace('/_/', ' ', $feature->type_id->name)) . ': ' . $fname . '<br>';
         }
+        $germplasm = substr($germplasm, 0, -4); // remove trailing <br>
       }
         
       // add the fields to the table row

+ 4 - 3
tripal_genetic/tripal_genetic.module

@@ -103,7 +103,8 @@ function tripal_genetic_theme($existing, $type, $theme, $path) {
  *
  * @ingroup tripal_genetic
  */
-function tripal_genetic_node_view(&$node, $view_mode, $langcode) {
+function tripal_genetic_node_view($node, $view_mode, $langcode) {
+  
   if ($node->type == 'chado_feature') {
     // the tripal_natural_diversity module provides a tripal_feature_nd_genotype
     // template.  The only difference between them is the addition of
@@ -113,7 +114,7 @@ function tripal_genetic_node_view(&$node, $view_mode, $langcode) {
     if ($view_mode == 'full') {
       if (!array_key_exists('tripal_feature_nd_genotypes', $node->content)) {
         $node->content['tripal_feature_genotypes'] = array(
-          '#value' => theme('tripal_feature_genotypes', $node),
+          '#value' => theme('tripal_feature_genotypes', array('node' => $node)),
         );
       }
     }
@@ -127,7 +128,7 @@ function tripal_genetic_node_view(&$node, $view_mode, $langcode) {
     if ($view_mode == 'full') {
       if (!array_key_exists('tripal_stock_nd_genotypes', $node->content)) {
         $node->content['tripal_stock_genotypes'] = array(
-          '#value' => theme('tripal_stock_genotypes', $node),
+          '#value' => theme('tripal_stock_genotypes', array('node' => $node)),
         );
       }
     }