2008-09-29 05:18:23 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* A file uploaded on a UserDefinedForm field
|
2009-12-07 03:04:20 +01: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 SubmittedFileField extends SubmittedFormField {
|
|
|
|
|
|
|
|
static $has_one = array(
|
|
|
|
"UploadedFile" => "File"
|
|
|
|
);
|
|
|
|
|
2009-04-14 06:11:05 +02:00
|
|
|
/**
|
|
|
|
* Return the Value of this Field
|
|
|
|
*
|
|
|
|
* @return String
|
|
|
|
*/
|
2010-05-16 05:55:03 +02:00
|
|
|
function getFormattedValue() {
|
2010-02-14 08:53:16 +01:00
|
|
|
return '<a href="'.$this->getLink().'">'. _t('SubmittedFileField.DOWNLOADFILE', 'Download File') .'</a>';
|
2009-04-14 06:11:05 +02:00
|
|
|
}
|
2010-05-16 05:55:03 +02:00
|
|
|
|
2009-04-14 06:11:05 +02:00
|
|
|
/**
|
|
|
|
* Return the Link object for this field
|
|
|
|
*
|
|
|
|
* @return String
|
|
|
|
*/
|
|
|
|
function getLink() {
|
|
|
|
return ($this->UploadedFile()) ? $this->UploadedFile()->URL : "";
|
2009-12-07 03:04:20 +01:00
|
|
|
}
|
|
|
|
}
|