silverstripe-userforms/code/model/submissions/SubmittedFormField.php
Fred Condo 656a9fbb4e BUG: Fix access to static configuration variables
- Make statics private
- Use Config::get rather than eval to read private statics
- Add a helper function to expose UserDefinedForm_EmailRecipient::$summary_fields
  (to make them available for i18n).
2013-04-03 14:31:37 -07:00

46 lines
914 B
PHP
Executable File

<?php
/**
* Data received from a UserDefinedForm submission
*
* @package userforms
*/
class SubmittedFormField extends DataObject {
private static $db = array(
"Name" => "Varchar",
"Value" => "Text",
"Title" => "Varchar(255)"
);
private static $has_one = array(
"Parent" => "SubmittedForm"
);
private static $summary_fields = array(
'Title',
'FormattedValue' => 'Value'
);
/**
* Generate a formatted value for the reports and email notifications.
* Converts new lines (which are stored in the database text field) as
* <brs> so they will output as newlines in the reports
*
* @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;
}
}