Webylon 3.2 API Docs
  • Package
  • Class
  • Tree
  • Deprecated
  • Download
Version: current
  • 3.2
  • 3.1

Packages

  • 1c
    • exchange
      • catalog
  • auth
  • Booking
  • building
    • company
  • cart
    • shipping
    • steppedcheckout
  • Catalog
    • monument
  • cms
    • assets
    • batchaction
    • batchactions
    • bulkloading
    • comments
    • content
    • core
    • export
    • newsletter
    • publishers
    • reports
    • security
    • tasks
  • Dashboard
  • DataObjectManager
  • event
  • faq
  • forms
    • actions
    • core
    • fields-basic
    • fields-dataless
    • fields-datetime
    • fields-files
    • fields-formatted
    • fields-formattedinput
    • fields-relational
    • fields-structural
    • transformations
    • validators
  • googlesitemaps
  • guestbook
  • installer
  • newsletter
  • None
  • photo
    • gallery
  • PHP
  • polls
  • recaptcha
  • sapphire
    • api
    • bulkloading
    • control
    • core
    • cron
    • dev
    • email
    • fields-formattedinput
    • filesystem
    • formatters
    • forms
    • i18n
    • integration
    • misc
    • model
    • parsers
    • search
    • security
    • tasks
    • testing
    • tools
    • validation
    • view
    • widgets
  • seo
    • open
      • graph
  • sfDateTimePlugin
  • spamprotection
  • stealth
    • captha
  • subsites
  • userform
    • pagetypes
  • userforms
  • webylon
  • widgets

Classes

  • EditableCheckbox
  • EditableCheckboxGroupField
  • EditableCountryDropdownField
  • EditableDateField
  • EditableDateTimeField
  • EditableDropdown
  • EditableEmailField
  • EditableFileField
  • EditableFormField
  • EditableFormHeading
  • EditableHiddenField
  • EditableLiteralField
  • EditableMemberListField
  • EditableMultipleOptionField
  • EditableNumericField
  • EditableOption
  • EditablePhoneField
  • EditableRadioField
  • EditableSiteAgreementField
  • EditableTextField
  • EditableTimeField
  • FieldEditor
  • SubmittedFileField
  • SubmittedForm
  • SubmittedFormField
  • SubmittedFormReportField
  • UserDefinedForm
  • UserDefinedForm_EmailRecipient
  • UserDefinedForm_SubmittedFormEmail
  • UserFormsVersionedTask
 1 <?php
 2 
 3 /**
 4  * A file uploaded on a {@link UserDefinedForm} and attached to a single 
 5  * {@link SubmittedForm}
 6  *
 7  * @package userforms
 8  */
 9 
10 class SubmittedFileField extends SubmittedFormField {
11     
12     static $has_one = array(
13         "UploadedFile" => "File"
14     );
15     
16     /**
17      * Return the value of this field for inclusion into things such as reports
18      * 
19      * @return string
20      */
21     function getFormattedValue() {
22         $link = $this->getLink();
23         $title = _t('SubmittedFileField.DOWNLOADFILE', 'Download File');
24         
25         if($link) {
26             return sprintf('<a href="%s">%s</a>', $link, $title);
27         }
28         
29         return false;
30     }
31 
32     /**
33      * Return the link for the file attached to this submitted form field
34      * 
35      * @return string
36      */
37     function getLink() {
38         if($file = $this->UploadedFile()) {
39             if(trim($file->getFilename(), '/') != trim(ASSETS_DIR,'/'))  {
40                 return $this->UploadedFile()->URL;
41             }
42         }
43     }   
44 }
[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -
Webylon 3.2 API Docs API documentation generated by ApiGen 2.8.0