Author: mcantelon
Date: Thu Jan 5 11:48:56 2012
New Revision: 10571
Log:
Added logic so you can set status variables when creating an import object.
Modified:
trunk/lib/QubitFlatfileImport.class.php
trunk/lib/task/csvImportTask.class.php
Modified: trunk/lib/QubitFlatfileImport.class.php
==============================================================================
--- trunk/lib/QubitFlatfileImport.class.php Thu Jan 5 11:25:36 2012
(r10570)
+++ trunk/lib/QubitFlatfileImport.class.php Thu Jan 5 11:48:56 2012
(r10571)
@@ -30,6 +30,7 @@
public function __construct($options)
{
$allowedOptions = array(
+ 'status',
'ignoreColumns',
'columns',
'defaultStatusId',
@@ -58,9 +59,8 @@
}
// initialize bookkeeping of rows processed
- $this->status = array(
- 'rows' => 0
- );
+ $this->status = ($options['status']) ? $options['status'] : array();
+ $this->status['rows'] = 0;
// initialize row status variables
$this->rowStatusVars = array();
Modified: trunk/lib/task/csvImportTask.class.php
==============================================================================
--- trunk/lib/task/csvImportTask.class.php Thu Jan 5 11:25:36 2012
(r10570)
+++ trunk/lib/task/csvImportTask.class.php Thu Jan 5 11:48:56 2012
(r10571)
@@ -94,6 +94,12 @@
// Define import
$import = new QubitFlatfileImport(array(
+ /* the status array is a place to put data that should be accessible
+ from closure logic using the getStatus method */
+ 'status' => array(
+ 'options' => $options,
+ 'materialTypes' => $materialTypes
+ ),
'columns' => fgetcsv($fh, 60000), // 1st row supplies column names/order
'defaultStatusId' => $defaultStatusId,
'defaultStatusTypeId' => $defaultStatusTypeId,
@@ -173,7 +179,7 @@
}
)
),
- /* these values get stored to ZZZZ */
+ /* these values get stored to the rowStatusVars array */
'variableColumns' => array(
'datesOfCreation',
'copyrightStatus',
@@ -183,7 +189,7 @@
'datesOfCreationStart',
'datesOfCreationEnd'
),
- /* these values get stored to ZZZZ */
+ /* these values get exploded and stored to the rowStatusVars array */
'arrayColumns' => array(
'creators' => '|',
'creatorHistory' => '|',
@@ -381,9 +387,6 @@
}
));
- $import->setStatus('options', $options);
- $import->setStatus('materialTypes', $materialTypes);
-
$import->addColumnHandler('levelOfDescription', function(&$self, $data)
{
$self->informationObject->setLevelOfDescriptionByName($data);
--
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.