Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | Public Attributes | Protected Attributes | List of all members
MoodleQuickForm_filemanager Class Reference
Inheritance diagram for MoodleQuickForm_filemanager:
templatable

Public Member Functions

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

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 More...
 

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)

options provided to initalize filemanager


The documentation for this class was generated from the following file:
FILE_AREA_MAX_BYTES_UNLIMITED
const FILE_AREA_MAX_BYTES_UNLIMITED
Unlimited area size constant.
Definition: filelib.php:41