2008-09-29 05:18:23 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Data received from a UserDefinedForm submission
|
2009-04-15 06:23:43 +02:00
|
|
|
*
|
|
|
|
* @package userforms
|
2008-09-29 05:18:23 +02:00
|
|
|
*/
|
2009-12-07 03:04:20 +01:00
|
|
|
|
2008-09-29 05:18:23 +02:00
|
|
|
class SubmittedFormField extends DataObject {
|
|
|
|
|
2013-04-03 03:34:43 +02:00
|
|
|
private static $db = array(
|
2008-09-29 05:18:23 +02:00
|
|
|
"Name" => "Varchar",
|
|
|
|
"Value" => "Text",
|
2009-11-24 21:11:50 +01:00
|
|
|
"Title" => "Varchar(255)"
|
2008-09-29 05:18:23 +02:00
|
|
|
);
|
|
|
|
|
2013-04-03 03:34:43 +02:00
|
|
|
private static $has_one = array(
|
2008-09-29 05:18:23 +02:00
|
|
|
"Parent" => "SubmittedForm"
|
|
|
|
);
|
2013-03-04 22:45:54 +01:00
|
|
|
|
2013-04-03 03:34:43 +02:00
|
|
|
private static $summary_fields = array(
|
2013-03-04 22:45:54 +01:00
|
|
|
'Title',
|
|
|
|
'FormattedValue' => 'Value'
|
|
|
|
);
|
|
|
|
|
2010-05-16 05:55:03 +02:00
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*
|
2012-05-07 11:19:16 +02:00
|
|
|
* @return string
|
2010-05-16 05:55:03 +02:00
|
|
|
*/
|
2012-05-04 03:39:08 +02:00
|
|
|
public function getFormattedValue() {
|
2011-12-05 11:19:20 +01:00
|
|
|
return nl2br($this->dbObject('Value')->ATT());
|
2010-05-16 05:55:03 +02:00
|
|
|
}
|
2012-05-07 11:19:16 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the value of this submitted form field suitable for inclusion
|
|
|
|
* into the CSV
|
|
|
|
*
|
|
|
|
* @return Text
|
|
|
|
*/
|
|
|
|
public function getExportValue() {
|
|
|
|
return $this->Value;
|
|
|
|
}
|
2008-09-29 05:18:23 +02:00
|
|
|
}
|