I would like to adapt the csv export functionnality to present exported datas with column titles coming from the label instruction rather than the one from the database.
Suppose to have the following lines in your fields.ini file :
- Code: Select all
[inscription_fin]
widget:label = "Date de fin d'inscription"
In the csv export, how to make this column title to be "Date de fin d'inscription" rather than "inscription_fin" ?
I have been copying the export_csv.php action in my application actions folder and I found that the manipulation should be done in this section (for the non related records) :
- Code: Select all
function rec2data(&$record){
$out = array();
$columns = array_merge(array_keys($record->_table->fields()), array_keys($record->_table->graftedFields()));
foreach ($columns as $key)
$f =& $record->_table->getField($key);
if ( @$f['visibility']['csv'] == 'hidden' ){
unset($f);
continue;
}
$out[] = $record->display($key);
unset($f);
}
return $out;
}
Thanks in advance for your help ...
Zabelle