Browse Source

Fixed minor typo in formatters

Stephen Ficklin 7 years ago
parent
commit
553375d108

+ 11 - 11
tripal/includes/TripalFieldDownloaders/TripalCSVDownloader.inc

@@ -34,7 +34,7 @@ class TripalCSVDownloader extends TripalFieldDownloader {
   protected function formatEntity($entity) {
     $bundle_name = $entity->bundle;
     $site = !property_exists($entity, 'site_id') ? 'local' : $entity->site_id;
-    $row = array();
+    $col = array();
 
     // Iterate through all of the printable fields and add the value to
     // the row.
@@ -43,7 +43,7 @@ class TripalCSVDownloader extends TripalFieldDownloader {
       // If this field is not present for this entity then add an empty
       // element and move on.
       if (!array_key_exists($accession, $this->fields2terms[$site][$bundle_name]['by_accession'])) {
-        $row[] = '';
+        $col[] = '';
         continue;
       }
 
@@ -60,33 +60,33 @@ class TripalCSVDownloader extends TripalFieldDownloader {
         // If the single element is not an array then this is good.
         if (!is_array($value)) {
           if (is_numeric($value) or !$value) {
-            $row[] = $value;
+            $col[] = $value;
           }
           else {
-            $row[] = '"' . $value . '"';
+            $col[] = '"' . $value . '"';
           }
         }
         else {
-          if (array_key_exists('rdfs:label', $entity->{$field_name}['und'][0]['value'])) {
-            $row[] = '"' . strip_tags($entity->{$field_name}['und'][0]['value']['rdfs:label']) . '"';
+          if (array_key_exists('rdfs:label', $value)) {
+            $col[] = '"' . strip_tags($entity->{$field_name}['und'][0]['value']['rdfs:label']) . '"';
           }
-          elseif (array_key_exists('schema:description', $entity->{$field_name}['und'][0]['value'])) {
+          elseif (array_key_exists('schema:description', $value)) {
             $label = $entity->{$field_name}['und'][0]['value']['schema:description'];
-            $row[] = strip_tags($label);
+            $col[] = strip_tags($label);
           }
           else {
-            $row[] = '';
+            $col[] = '';
           }
           // TODO: What to do with fields that are arrays?
         }
       }
       // If we have multiple items then deal with that.
       else {
-        $row[] = '';
+        $col[] = '';
         // TODO: What to do with fields that have multiple values?
       }
     }
-    return array(implode(",", $row));
+    return array(implode(",", $col));
   }
 
   /**

+ 10 - 10
tripal/includes/TripalFieldDownloaders/TripalTabDownloader.inc

@@ -34,7 +34,7 @@ class TripalTabDownloader extends TripalFieldDownloader {
    protected function formatEntity($entity) {
      $bundle_name = $entity->bundle;
      $site = !property_exists($entity, 'site_id') ? 'local' : $entity->site_id;
-     $row = array();
+     $col = array();
 
      // Iterate through all of the printable fields and add the value to
      // the row.
@@ -43,7 +43,7 @@ class TripalTabDownloader extends TripalFieldDownloader {
        // If this field is not present for this entity then add an empty
        // element and move on.
        if (!array_key_exists($accession, $this->fields2terms[$site][$bundle_name]['by_accession'])) {
-         $row[] = '';
+         $col[] = '';
          continue;
        }
 
@@ -59,30 +59,30 @@ class TripalTabDownloader extends TripalFieldDownloader {
 
          // If the single element is not an array then this is good.
          if (!is_array($value)) {
-           $row[] = $value;
+           $col[] = $value;
          }
          else {
-           if (array_key_exists('rdfs:label', $entity->{$field_name}['und'][0]['value'])) {
+           if (array_key_exists('rdfs:label', $value)) {
              $label = $entity->{$field_name}['und'][0]['value']['rdfs:label'];
-             $row[] = strip_tags($label);
+             $col[] = strip_tags($label);
            }
-           elseif (array_key_exists('schema:description', $entity->{$field_name}['und'][0]['value'])) {
+           elseif (array_key_exists('schema:description', $value)) {
              $label = $entity->{$field_name}['und'][0]['value']['schema:description'];
-             $row[] = strip_tags($label);
+             $col[] = strip_tags($label);
            }
            else {
-             $row[] = '';
+             $col[] = '';
            }
            // TODO: What to do with fields that are arrays?
          }
        }
        // If we have multiple items then deal with that.
        else {
-         $row[] = '';
+         $col[] = '';
          // TODO: What to do with fields that have multiple values?
        }
     }
-    return array(implode("\t", $row));
+    return array(implode("\t", $col));
   }
 
   /**