Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
MoodleQuickForm_filemanager Class Reference

Filemanager form element. More...

Inheritance diagram for MoodleQuickForm_filemanager:
templatable

Public Member Functions

 __construct ($elementName=null, $elementLabel=null, $attributes=null, $options=null)
 Constructor.
 
 export_for_template (renderer_base $output)
 Function to export the renderer data in a format that is suitable for a mustache template.
 
 getAreamaxbytes ()
 Returns the maximum size of the area.
 
 getElementTemplateType ()
 Returns type of filemanager element.
 
 getHelpButton ()
 Returns html for help button.
 
 getMaxbytes ()
 Returns maximum file size which can be uploaded.
 
 getMaxfiles ()
 Returns maximum number of files which can be uploaded.
 
 getName ()
 Returns name of filemanager.
 
 getSubdirs ()
 Returns true if subdirectoy can be created, else false.
 
 getValue ()
 Returns filemanager attribute value.
 
 MoodleQuickForm_filemanager ($elementName=null, $elementLabel=null, $attributes=null, $options=null)
 Old syntax of class constructor.
 
 onQuickFormEvent ($event, $arg, &$caller)
 Called by HTML_QuickForm whenever form event is made on this element.
 
 setAreamaxbytes ($areamaxbytes)
 Sets the maximum size of the area.
 
 setMaxbytes ($maxbytes)
 Sets maximum file size which can be uploaded.
 
 setMaxfiles ($num)
 Sets maximum number of files which can be uploaded.
 
 setName ($name)
 Sets name of filemanager.
 
 setSubdirs ($allow)
 Set option to create sub directory, while uploading file.
 
 setValue ($value)
 Updates filemanager attribute value.
 
 toHtml ()
 Returns HTML for filemanager form element.
 
 validateSubmitValue ($value)
 Check that all files have the allowed type.
 

Public Attributes

string $_helpbutton = ''
 html for help button, if empty then no help will icon will be dispalyed.
 

Protected Attributes

array $_options
 options provided to initalize filemanager
 

Detailed Description

Filemanager form element.

FilemaneManager lets user to upload/manage multiple files

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Constructor & Destructor Documentation

◆ __construct()

MoodleQuickForm_filemanager::__construct ( $elementName = null,
$elementLabel = null,
$attributes = null,
$options = null )

Constructor.

Parameters
string$elementName(optional) name of the filemanager
string$elementLabel(optional) filemanager label
array$attributes(optional) Either a typical HTML attribute string or an associative array
array$optionsset of options to initalize filemanager

Member Function Documentation

◆ export_for_template()

MoodleQuickForm_filemanager::export_for_template ( renderer_base $output)

Function to export the renderer data in a format that is suitable for a mustache template.

This means:

  1. No complex types - only stdClass, array, int, string, float, bool
  2. Any additional info that is required for the template is pre-calculated (e.g. capability checks).
Parameters
renderer_base$outputUsed to do a final render of any components that need to be rendered for export.
Return values
stdClass|array

Implements templatable.

◆ getAreamaxbytes()

MoodleQuickForm_filemanager::getAreamaxbytes ( )

Returns the maximum size of the area.

Return values
int

◆ getElementTemplateType()

MoodleQuickForm_filemanager::getElementTemplateType ( )

Returns type of filemanager element.

Return values
string

◆ getHelpButton()

MoodleQuickForm_filemanager::getHelpButton ( )

Returns html for help button.

Return values
stringhtml for help button

◆ getMaxbytes()

MoodleQuickForm_filemanager::getMaxbytes ( )

Returns maximum file size which can be uploaded.

Return values
int

◆ getMaxfiles()

MoodleQuickForm_filemanager::getMaxfiles ( )

Returns maximum number of files which can be uploaded.

Return values
int

◆ getName()

MoodleQuickForm_filemanager::getName ( )

Returns name of filemanager.

Return values
string

◆ getSubdirs()

MoodleQuickForm_filemanager::getSubdirs ( )

Returns true if subdirectoy can be created, else false.

Return values
bool

◆ getValue()

MoodleQuickForm_filemanager::getValue ( )

Returns filemanager attribute value.

Return values
string

◆ MoodleQuickForm_filemanager()

MoodleQuickForm_filemanager::MoodleQuickForm_filemanager ( $elementName = null,
$elementLabel = null,
$attributes = null,
$options = null )

Old syntax of class constructor.

Deprecated in PHP7.

Deprecated
since Moodle 3.1

◆ onQuickFormEvent()

MoodleQuickForm_filemanager::onQuickFormEvent ( $event,
$arg,
& $caller )

Called by HTML_QuickForm whenever form event is made on this element.

Parameters
string$eventName of event
mixed$argevent arguments
object$callercalling object
Return values
bool

◆ setAreamaxbytes()

MoodleQuickForm_filemanager::setAreamaxbytes ( $areamaxbytes)

Sets the maximum size of the area.

Parameters
int$areamaxbytessize limit

◆ setMaxbytes()

MoodleQuickForm_filemanager::setMaxbytes ( $maxbytes)

Sets maximum file size which can be uploaded.

Parameters
int$maxbytesfile size

◆ setMaxfiles()

MoodleQuickForm_filemanager::setMaxfiles ( $num)

Sets maximum number of files which can be uploaded.

Parameters
int$numnumber of files

◆ setName()

MoodleQuickForm_filemanager::setName ( $name)

Sets name of filemanager.

Parameters
string$namename of the filemanager

◆ setSubdirs()

MoodleQuickForm_filemanager::setSubdirs ( $allow)

Set option to create sub directory, while uploading file.

Parameters
bool$allowtrue if sub directory can be created.

◆ setValue()

MoodleQuickForm_filemanager::setValue ( $value)

Updates filemanager attribute value.

Parameters
string$valuevalue to set

◆ toHtml()

MoodleQuickForm_filemanager::toHtml ( )

Returns HTML for filemanager form element.

Return values
string

◆ validateSubmitValue()

MoodleQuickForm_filemanager::validateSubmitValue ( $value)

Check that all files have the allowed type.

Parameters
int$valueDraft item id with the uploaded files.
Return values
string|nullValidation error message or null.

Member Data Documentation

◆ $_options

array MoodleQuickForm_filemanager::$_options
protected
Initial value:
= array('mainfile' => '', 'subdirs' => 1, 'maxbytes' => -1, 'maxfiles' => -1,
'accepted_types' => '*', 'return_types' => null, 'areamaxbytes' => FILE_AREA_MAX_BYTES_UNLIMITED)
const FILE_AREA_MAX_BYTES_UNLIMITED
Unlimited area size constant.
Definition filelib.php:41

options provided to initalize filemanager


The documentation for this class was generated from the following file: