Переглянути джерело

PHP syntax error fix to library base tpl

Lacey Sanderson 11 роки тому
батько
коміт
e0f7361b48

+ 15 - 15
tripal_library/theme/tripal_library/tripal_library.base.tpl.php

@@ -10,19 +10,19 @@ $description = $libprop->value;
 ?>
 <div id="tripal_library-base-box" class="tripal_library-info-box tripal-info-box">
   <div class="tripal_library-info-box-title tripal-info-box-title">Library Details</div>
-  <div class="tripal_library-info-box-desc tripal-info-box-desc"></div> <?php 
-  
-  // the $headers array is an array of fields to use as the colum headers. 
-  // additional documentation can be found here 
+  <div class="tripal_library-info-box-desc tripal-info-box-desc"></div> <?php
+
+  // 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
   // This table for the library has a vertical header (down the first column)
   // so we do not provide headers here, but specify them in the $rows array below.
   $headers = array();
-  
+
   // 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
   // can be found here:
-  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7 
+  // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
   $rows = array();
 
   // Name row
@@ -42,12 +42,12 @@ $description = $libprop->value;
     ),
     $library->uniquename
   );
-  
+
   // Organism row
   $organism = $library->organism_id->genus ." " . $library->organism_id->species ." (" .$library->organism_id->common_name .")";
   if ($library->organism_id->nid) {
     $organism = l("<i>" . $library->organism_id->genus . " " . $library->organism_id->species . "</i> (" .$library->organism_id->common_name .")", "node/".$library->organism_id->nid, array('html' => TRUE));
-  } 
+  }
   $rows[] = array(
     array(
       'data' => 'Organism',
@@ -64,14 +64,14 @@ $description = $libprop->value;
     ),
     $library->type_id->name,
   );
-  
+
   // allow site admins to see the library ID
   if (user_access('access administration pages')) {
     // Library ID
     $rows[] = array(
       array(
         'data' => 'Library ID',
-        'header' => TRUE
+        'header' => TRUE,
         'class' => 'tripal-site-admin-only-table-row',
       ),
       array(
@@ -80,7 +80,7 @@ $description = $libprop->value;
       ),
     );
   }
-  
+
   // the $table array contains the headers and rows array as well as other
   // options for controlling the display of the table.  Additional
   // documentation can be found here:
@@ -96,14 +96,14 @@ $description = $libprop->value;
     'colgroups' => array(),
     'empty' => '',
   );
-  
+
   // once we have our table array structure defined, we call Drupal's theme_table()
   // function to generate the table.
-  print theme_table($table); 
-  
+  print theme_table($table);
+
   // now add in the description below the table if one exists
   if ($description) { ?>
-    <div style="text-align: justify"><?php print $description; ?></div> <?php  
+    <div style="text-align: justify"><?php print $description; ?></div> <?php
   }
   ?>
 </div>

+ 11 - 11
tripal_library/theme/tripal_library/tripal_library.terms.tpl.php

@@ -4,34 +4,34 @@ $library = $variables['node']->library;
 
 $options = array('return_array' => 1);
 $library = tripal_core_expand_chado_vars($library, 'table', 'library_cvterm', $options);
-$terms = $library->library_cvterm;
+$terms = (isset($library->library_cvterm)) ? $library->library_cvterm : array();
 
 // order the terms by CV
 $s_terms = array();
 foreach ($terms as $term) {
-  $s_terms[$term->cvterm_id->cv_id->name][] = $term;  
+  $s_terms[$term->cvterm_id->cv_id->name][] = $term;
 }
 
 if (count($s_terms) > 0) { ?>
   <div id="tripal_library-terms-box" class="tripal_library-info-box tripal-info-box">
     <div class="tripal_library-info-box-title tripal-info-box-title">Annotated Terms</div>
     <div class="tripal_library-info-box-desc tripal-info-box-desc">The following terms have been associated with this <?php print $node->library->type_id->name ?>:</div>  <?php
-    
+
     // iterate through each term
     $i = 0;
-    foreach ($s_terms as $cv => $terms) {  
+    foreach ($s_terms as $cv => $terms) {
       // 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('Term', 'Definition');
-      
+
       // 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
       // can be found here:
       // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
       $rows = array();
-      
-      foreach ($terms as $term) { 
+
+      foreach ($terms as $term) {
 
         $accession = $term->cvterm_id->dbxref_id->accession;
         if (is_numeric($term->cvterm_id->dbxref_id->accession)) {
@@ -39,13 +39,13 @@ if (count($s_terms) > 0) { ?>
         }
         if ($term->cvterm_id->dbxref_id->db_id->urlprefix) {
           $accession = l($accession, $term->cvterm_id->dbxref_id->db_id->urlprefix . $accession, array('attributes' => array("target" => '_blank')));
-        } 
-        
+        }
+
         $rows[] = array(
           $accession,
           $term->cvterm_id->name
         );
-      } 
+      }
       // the $table array contains the headers and rows array as well as other
       // options for controlling the display of the table.  Additional
       // documentation can be found here:
@@ -61,7 +61,7 @@ if (count($s_terms) > 0) { ?>
         'colgroups' => array(),
         'empty' => '',
       );
-      
+
       // once we have our table array structure defined, we call Drupal's theme_table()
       // function to generate the table.
       print theme_table($table);