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