mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
ENHANCEMENT: show link to file download in CSV export. Fixes #32
This commit is contained in:
parent
2e66d41c56
commit
52f68059d9
@ -109,7 +109,7 @@ class SubmittedFormReportField extends FormField {
|
||||
|
||||
$row = array();
|
||||
foreach($fields as $field) {
|
||||
$row[$field->Name] = $field->Value;
|
||||
$row[$field->Name] = $field->getExportValue();
|
||||
}
|
||||
|
||||
$row['Submitted'] = $submission->Created;
|
||||
|
@ -29,6 +29,15 @@ class SubmittedFileField extends SubmittedFormField {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the value for this field in the CSV export
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
public function getExportValue() {
|
||||
return ($link = $this->getLink()) ? $link : "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the link for the file attached to this submitted form field
|
||||
*
|
||||
|
@ -22,9 +22,19 @@ class SubmittedFormField extends DataObject {
|
||||
* Converts new lines (which are stored in the database text field) as
|
||||
* <brs> so they will output as newlines in the reports
|
||||
*
|
||||
* @return String
|
||||
* @return string
|
||||
*/
|
||||
public function getFormattedValue() {
|
||||
return nl2br($this->dbObject('Value')->ATT());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the value of this submitted form field suitable for inclusion
|
||||
* into the CSV
|
||||
*
|
||||
* @return Text
|
||||
*/
|
||||
public function getExportValue() {
|
||||
return $this->Value;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user