Author: mcantelon
Date: Wed Jan 11 14:07:26 2012
New Revision: 10645

Log:
Moved helper function into QubitFlatfile for easier reuse.

Modified:
   trunk/lib/QubitFlatfileImport.class.php
   trunk/lib/task/csvImportTask.class.php

Modified: trunk/lib/QubitFlatfileImport.class.php
==============================================================================
--- trunk/lib/QubitFlatfileImport.class.php     Wed Jan 11 14:00:27 2012        
(r10644)
+++ trunk/lib/QubitFlatfileImport.class.php     Wed Jan 11 14:07:26 2012        
(r10645)
@@ -586,6 +586,22 @@
     return $terms;
   }
 
+  public function loadTermsFromTaxonomies($taxonomies)
+  {
+    $taxonomyTerms = array();
+
+    foreach($taxonomies as $taxonomyId => $varName)
+    {
+      $taxonomyTerms[$varName] = array();
+      foreach(QubitFlatfileImport::getTaxonomyTerms($taxonomyId) as $termId => 
$term)
+      {
+        $taxonomyTerms[$varName][$termId] = $term->name;
+      }
+    }
+
+    return $taxonomyTerms;
+  }
+
   public function createRightAndRelation($options)
   {
     // add right

Modified: trunk/lib/task/csvImportTask.class.php
==============================================================================
--- trunk/lib/task/csvImportTask.class.php      Wed Jan 11 14:00:27 2012        
(r10644)
+++ trunk/lib/task/csvImportTask.class.php      Wed Jan 11 14:07:26 2012        
(r10645)
@@ -53,22 +53,6 @@
 EOF;
   }
 
-  protected function loadTaxonomyTerms($taxonomies)
-  {
-    $taxonomyTerms = array();
-
-    foreach($taxonomies as $taxonomyId => $varName)
-    {
-      $taxonomyTerms[$varName] = array();
-      foreach(QubitFlatfileImport::getTaxonomyTerms($taxonomyId) as $termId => 
$term)
-      {
-        $taxonomyTerms[$varName][$termId] = $term->name;
-      }
-    }
-
-    return $taxonomyTerms;
-  }
-
   protected function validateOptions($options)
   {
     if ($options['rows-until-update'] && 
!is_numeric($options['rows-until-update']))
@@ -113,7 +97,7 @@
     );
 
     // Load taxonomies into variables to avoid use of magic numbers
-    $termData = $this->loadTaxonomyTerms(array(
+    $termData = QubitFlatfileImport::loadTermsFromTaxonomies(array(
       QubitTaxonomy::NOTE_TYPE_ID      => 'noteTypes',
       QubitTaxonomy::RAD_TITLE_NOTE_ID => 'titleNoteTypes',
       QubitTaxonomy::MATERIAL_TYPE_ID  => 'materialTypes'

-- 
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/qubit-commits?hl=en.

Reply via email to