Author: mcantelon
Date: Thu Dec 29 17:33:05 2011
New Revision: 10484

Log:
Minor refactoring of import createEvent method so we can add actors, etc.

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

Modified: trunk/lib/task/csvImportTask.class.php
==============================================================================
--- trunk/lib/task/csvImportTask.class.php      Thu Dec 29 17:00:21 2011        
(r10483)
+++ trunk/lib/task/csvImportTask.class.php      Thu Dec 29 17:33:05 2011        
(r10484)
@@ -175,10 +175,12 @@
              ? $self->rowStatusVars['endYear'] .'-00-00'
              : false;
 
-          $self->createEvent(
+          $event = $self->createEvent(
             QubitTerm::CREATION_ID,
-            $self->rowStatusVars['startYear'] .'-00-00',
-            $endDate
+            array(
+              'startDate' => $self->rowStatusVars['startYear'] .'-00-00',
+              'endDate' => $endDate
+            )
           );
         }
       }
@@ -189,6 +191,11 @@
       $self->informationObject->setLevelOfDescriptionByName($data);
     });
 
+    $import->addColumnHandler('Creator history', function(&$self, $data)
+    {
+      $self->rowStatusVars['creatorHistory'] = $data;
+    });
+
     $import->addColumnHandler('START YEAR', function(&$self, $data)
     {
       $self->rowStatusVars['startYear'] = $data;
@@ -409,19 +416,19 @@
     return $note;
   }
 
-  public function createEvent($typeId, $startDate, $endDate = false)
+  public function createEvent($typeId, $options = array())
   {
-    $date = new QubitEvent;
-    $date->informationObjectId = $this->informationObject->id;
-    $date->typeId = $typeId;
-    $date->startDate = $startDate;
-    if ($endDate)
+    $event = new QubitEvent;
+    $event->informationObjectId = $this->informationObject->id;
+    $event->typeId = $typeId;
+    $event->startDate = $options['startDate'];
+    if ($options['endDate'])
     {
-      $date->endDate = $endDate;
+      $event->endDate = $options['endDate'];
     }
     if (!isset($self->testing) || !$self->testing)
     {
-      $date->save();
+      $event->save();
     }
   }
 

-- 
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