MINOR Fixed undefined variable error in TableListField->generateExportFileData()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@70257 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2009-01-16 00:54:55 +00:00 committed by Sam Minnee
parent af4637ae61
commit 9c4552efa3

View File

@ -910,25 +910,21 @@ JS
}
}
/**
* the function is to generate string that will be used as
* the content of exported file
*/
function generateExportFileData(&$numColumns, &$numRows){
function generateExportFileData(&$numColumns, &$numRows) {
$separator = $this->csvSeparator;
$csvColumns = ($this->fieldListCsv) ? $this->fieldListCsv : $this->fieldList;
$fileData = "";
$fileData = '';
$columnData = array();
$fieldItems = new DataObjectSet();
if($this->csvHasHeader) {
$fileData .= "\"" . implode("\"{$separator}\"",array_values($csvColumns)) . "\"";
$fileData .= "\"" . implode("\"{$separator}\"", array_values($csvColumns)) . "\"";
$fileData .= "\n";
}
// get data
if(isset($this->customSourceItems)){
if(isset($this->customSourceItems)) {
$items = $this->customSourceItems;
}else{
} else {
$dataQuery = $this->getCsvQuery();
$records = $dataQuery->execute();
$sourceClass = $this->sourceClass;
@ -936,7 +932,6 @@ JS
$items = $dataobject->buildDataObjectSet($records, 'DataObjectSet');
}
$fieldItems = new DataObjectSet();
if($items && $items->count()) foreach($items as $item) {
// create a TableListField_Item to support resolving of
// relation-fields in dot notation via TableListField_Item->Fields()
@ -949,10 +944,8 @@ JS
if($fieldItems) {
foreach($fieldItems as $fieldItem) {
$columnData = array();
$fields = $fieldItem->Fields();
foreach($fields as $field) {
if($fields) foreach($fields as $field) {
$value = $field->Value;
// TODO This should be replaced with casting