ENHANCEMENT: show link to file download in CSV export. Fixes #32

This commit is contained in:
Will Rossiter 2012-05-07 21:19:16 +12:00
parent 2e66d41c56
commit 52f68059d9
3 changed files with 21 additions and 2 deletions

View File

@ -109,7 +109,7 @@ class SubmittedFormReportField extends FormField {
$row = array(); $row = array();
foreach($fields as $field) { foreach($fields as $field) {
$row[$field->Name] = $field->Value; $row[$field->Name] = $field->getExportValue();
} }
$row['Submitted'] = $submission->Created; $row['Submitted'] = $submission->Created;

View File

@ -29,6 +29,15 @@ class SubmittedFileField extends SubmittedFormField {
return false; 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 * Return the link for the file attached to this submitted form field
* *

View File

@ -22,9 +22,19 @@ class SubmittedFormField extends DataObject {
* Converts new lines (which are stored in the database text field) as * Converts new lines (which are stored in the database text field) as
* <brs> so they will output as newlines in the reports * <brs> so they will output as newlines in the reports
* *
* @return String * @return string
*/ */
public function getFormattedValue() { public function getFormattedValue() {
return nl2br($this->dbObject('Value')->ATT()); 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;
}
} }