Moodle  2.2.1
http://www.collinsharper.com
HTML_QuickForm_file Class Reference
Inheritance diagram for HTML_QuickForm_file:
Collaboration diagram for HTML_QuickForm_file:

Public Member Functions

 HTML_QuickForm_file ($elementName=null, $elementLabel=null, $attributes=null)
 setSize ($size)
 getSize ()
 freeze ()
 setValue ($value)
 getValue ()
 onQuickFormEvent ($event, $arg, &$caller)
 moveUploadedFile ($dest, $fileName= '')
 isUploadedFile ()
 _ruleIsUploadedFile ($elementValue)
 _ruleCheckMaxFileSize ($elementValue, $maxSize)
 _ruleCheckMimeType ($elementValue, $mimeType)
 _ruleCheckFileName ($elementValue, $regex)
 _findValue ()

Data Fields

 $_value = null

Detailed Description

HTML class for a file type element

Author:
Adam Daniel <adaniel1@eesus.jnj.com>
Bertrand Mansion <bmansion@mamasam.com>
Version:
1.0
Since:
PHP4.04pl1 public

Definition at line 41 of file file.php.


Member Function Documentation

Tries to find the element value from the values array

Needs to be redefined here as $_FILES is populated differently from other arrays when element name is of the form foo[bar]

private

Returns:
mixed

Definition at line 320 of file file.php.

Here is the call graph for this function:

Here is the caller graph for this function:

_ruleCheckFileName ( elementValue,
regex 
)

Checks if the given element contains an uploaded file of the filename regex

Parameters:
arrayUploaded file info (from $_FILES)
stringRegular expression private
Returns:
bool true if name matches regex, false otherwise

Definition at line 300 of file file.php.

Here is the call graph for this function:

_ruleCheckMaxFileSize ( elementValue,
maxSize 
)

Checks that the file does not exceed the max file size

Parameters:
arrayUploaded file info (from $_FILES)
intMax file size private
Returns:
bool true if filesize is lower than maxsize, false otherwise

Definition at line 255 of file file.php.

Here is the call graph for this function:

_ruleCheckMimeType ( elementValue,
mimeType 
)

Checks if the given element contains an uploaded file of the right mime type

Parameters:
arrayUploaded file info (from $_FILES)
mixedMime Type (can be an array of allowed types) private
Returns:
bool true if mimetype is correct, false otherwise

Definition at line 278 of file file.php.

Here is the call graph for this function:

_ruleIsUploadedFile ( elementValue)

Checks if the given element contains an uploaded file

Parameters:
arrayUploaded file info (from $_FILES) private
Returns:
bool true if file has been uploaded, false otherwise

Definition at line 234 of file file.php.

Here is the caller graph for this function:

freeze ( )

Freeze the element so that only its value is returned

public

Returns:
bool

Reimplemented from HTML_QuickForm_element.

Definition at line 109 of file file.php.

getSize ( )

Returns size of file element

Since:
1.0 public
Returns:
int

Definition at line 95 of file file.php.

Here is the call graph for this function:

getValue ( )

Returns information about the uploaded file

Since:
3.0 public
Returns:
array

Reimplemented from HTML_QuickForm_input.

Definition at line 145 of file file.php.

HTML_QuickForm_file ( elementName = null,
elementLabel = null,
attributes = null 
)

Class constructor

Parameters:
stringInput field name attribute
stringInput field label
mixed(optional)Either a typical HTML attribute string or an associative array
Since:
1.0 public

Definition at line 64 of file file.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Checks if the element contains an uploaded file

public

Returns:
bool true if file has been uploaded, false otherwise

Definition at line 219 of file file.php.

Here is the call graph for this function:

moveUploadedFile ( dest,
fileName = '' 
)

Moves an uploaded file into the destination

Parameters:
stringDestination directory path
stringNew file name public
Returns:
bool Whether the file was moved successfully

Definition at line 197 of file file.php.

onQuickFormEvent ( event,
arg,
&$  caller 
)

Called by HTML_QuickForm whenever form event is made on this element

Parameters:
stringName of event
mixedevent arguments
objectcalling object
Since:
1.0 public
Returns:
bool

Reimplemented from HTML_QuickForm_input.

Reimplemented in MoodleQuickForm_file.

Definition at line 163 of file file.php.

Here is the call graph for this function:

setSize ( size)

Sets size of file element

Parameters:
intSize of file element
Since:
1.0 public

Definition at line 80 of file file.php.

Here is the call graph for this function:

setValue ( value)

Sets value for file element.

Actually this does nothing. The function is defined here to override HTML_Quickform_input's behaviour of setting the 'value' attribute. As no sane user-agent uses <input type="file">'s value for anything (because of security implications) we implement file's value as a read-only property with a special meaning.

Parameters:
mixedValue for file element
Since:
3.0 public

Reimplemented from HTML_QuickForm_input.

Definition at line 130 of file file.php.


Field Documentation

$_value = null

Definition at line 49 of file file.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations