Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | Public Attributes | Protected Attributes | List of all members
MoodleQuickForm_float Class Reference

Float type form element. More...

Inheritance diagram for MoodleQuickForm_float:
MoodleQuickForm_text templatable

Public Member Functions

 __construct ($elementName=null, $elementLabel=null, $attributes=null)
 MoodleQuickForm_float constructor. More...
 
 _getPersistantData ()
 Used by getFrozenHtml() to pass the element's value if _persistantFreeze is on. More...
 
 export_for_template (renderer_base $output)
 Function to export the renderer data in a format that is suitable for a mustache template. More...
 
 exportValue (&$submitValues, $assoc=false)
 Returns a 'safe' element's value. More...
 
 freeze ()
 Freeze the element so that only its value is returned and set persistantfreeze to false. More...
 
 get_force_ltr ()
 Get force LTR option. More...
 
 getFrozenHtml ()
 Returns the html to be used when the element is frozen. More...
 
 getHelpButton ()
 get html for help button More...
 
 getValue ()
 Returns the value of the form element. More...
 
 MoodleQuickForm_text ($elementName=null, $elementLabel=null, $attributes=null)
 Old syntax of class constructor. More...
 
 onQuickFormEvent ($event, $arg, &$caller)
 Called by HTML_QuickForm whenever form event is made on this element. More...
 
 set_force_ltr ($value)
 Force the field to flow left-to-right. More...
 
 setHiddenLabel ($hiddenLabel)
 Sets label to be hidden. More...
 
 setValue ($value)
 Sets the value of the form element. More...
 
 toHtml ()
 Returns HTML for this form element. More...
 
 validateSubmitValue ($value)
 Checks that the submitted value is a valid float number. More...
 

Public Attributes

string $_helpbutton =''
 html for help button, if empty then no help
 
bool $_hiddenLabel =false
 if true label will be hidden
 

Protected Attributes

bool $forceltr = false
 Whether to force the display of this element to flow LTR.
 

Detailed Description

Float type form element.

This is preferred over the text element when working with float numbers, and takes care of the fact that different languages may use different symbols as the decimal separator. Using this element, submitted float numbers will be automatically translated from the localised format into the computer format, and vice versa when they are being displayed.

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

Constructor & Destructor Documentation

◆ __construct()

MoodleQuickForm_float::__construct (   $elementName = null,
  $elementLabel = null,
  $attributes = null 
)

MoodleQuickForm_float constructor.

Parameters
string$elementName(optional) name of the float field
string$elementLabel(optional) float field label
string$attributes(optional) Either a typical HTML attribute string or an associative array

Reimplemented from MoodleQuickForm_text.

Member Function Documentation

◆ _getPersistantData()

MoodleQuickForm_float::_getPersistantData ( )

Used by getFrozenHtml() to pass the element's value if _persistantFreeze is on.

Return values
string

◆ export_for_template()

templatable::export_for_template ( renderer_base  $output)
inherited

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

Implemented in forumreport_summary\output\filters, core_user\output\unified_filter, core_user\output\status_field, core_tag\output\taglist, core_tag\output\tagindex, core_tag\output\tagfeed, core_tag\output\tagcloud, core_tag\output\tag, report_competency\output\user_course_navigation, report_competency\output\report, core_privacy\output\exported_navigation_page, core_privacy\output\exported_html_page, MoodleQuickForm_wikieditor, mod_lti\output\tool_configure_page, mod_lti\output\external_registration_return_page, mod_forum\output\quick_search_form, mod_forum\output\big_search_form, mod_feedback\output\summary, booktool_print\output\print_book_page, booktool_print\output\print_book_chapter_page, assign_attempt_history_chooser, mod_assign\output\grading_app, login_signup_form, progress_bar, action_menu, tabtree, tabobject, custom_menu_item, initials_bar, paging_bar, url_select, single_select, pix_icon, pix_icon_font, help_icon, component_action, MoodleQuickForm_warning, MoodleQuickForm_url, MoodleQuickForm_textarea, MoodleQuickForm_tags, MoodleQuickForm_submit, MoodleQuickForm_static, MoodleQuickForm_selectwithlink, MoodleQuickForm_selectgroups, MoodleQuickForm_select, MoodleQuickForm_recaptcha, MoodleQuickForm_passwordunmask, MoodleQuickForm_group, MoodleQuickForm_grading, MoodleQuickForm_filepicker, MoodleQuickForm_filemanager, MoodleQuickForm_editor, MoodleQuickForm_date_time_selector, MoodleQuickForm_date_selector, MoodleQuickForm_checkbox, MoodleQuickForm_autocomplete, MoodleQuickForm_advcheckbox, core\output\chooser_section, core\output\chooser_item, core\output\chooser, core\output\checkbox_toggleall, core_group\output\index_page, core_group\output\group_details, enrol_lti\output\registration, core_course\output\modchooser, block_timeline\output\main, block_starredcourses\output\main, block_search_forums\output\search_form, block_recentlyaccesseditems\output\main, block_recentlyaccessedcourses\output\main, block_myprofile\output\myprofile, block_myoverview\output\main, block_lp\output\summary, block_lp\output\plans_to_review_page, block_lp\output\competencies_to_review_page, core_auth\output\verify_age_location_page, core_auth\output\login, core_auth\output\digital_minor_page, tool_templatelibrary\output\list_templates_page, tool_policy\output\page_viewdoc, tool_policy\output\page_viewalldoc, tool_policy\output\page_nopermission, tool_policy\output\page_managedocs_list, tool_policy\output\page_agreedocs, tool_policy\output\guestconsent, tool_policy\output\acceptances, tool_lp\output\user_evidence_list_page, tool_lp\output\user_competency_summary_in_course, tool_lp\output\user_competency_summary, tool_lp\output\user_competency_course_navigation, tool_lp\output\template_competencies_page, tool_lp\output\related_competencies, tool_lp\output\plans_page, tool_lp\output\module_navigation, tool_lp\output\manage_templates_page, tool_lp\output\manage_competency_frameworks_page, tool_lp\output\manage_competencies_page, tool_lp\output\course_competencies_page, tool_lp\output\competency_summary, tool_lp\output\competency_plan_navigation, tool_langimport\output\langimport_page, tool_dataprivacy\output\summary_page, tool_dataprivacy\output\request_filter, tool_dataprivacy\output\purposes, tool_dataprivacy\output\my_data_requests_page, tool_dataprivacy\output\defaults_page, tool_dataprivacy\output\data_requests_page, tool_dataprivacy\output\data_registry_page, tool_dataprivacy\output\data_registry_compliance_page, tool_dataprivacy\output\data_deletion_page, tool_dataprivacy\output\categories, and tool_customlang\output\translator.

◆ exportValue()

MoodleQuickForm_float::exportValue ( $submitValues,
  $assoc = false 
)

Returns a 'safe' element's value.

Parameters
array$submitValuesarray of submitted values to search
bool$assocwhether to return the value as associative array
Return values
mixed

◆ freeze()

MoodleQuickForm_text::freeze ( )
inherited

Freeze the element so that only its value is returned and set persistantfreeze to false.

Since
Moodle 2.4
Return values
void

◆ get_force_ltr()

MoodleQuickForm_text::get_force_ltr ( )
inherited

Get force LTR option.

Return values
bool

◆ getFrozenHtml()

MoodleQuickForm_text::getFrozenHtml ( )
inherited

Returns the html to be used when the element is frozen.

Since
Moodle 2.4
Return values
stringFrozen html

◆ getHelpButton()

MoodleQuickForm_text::getHelpButton ( )
inherited

get html for help button

Return values
stringhtml for help button

◆ getValue()

MoodleQuickForm_float::getValue ( )

Returns the value of the form element.

Return values
false|float

◆ MoodleQuickForm_text()

MoodleQuickForm_text::MoodleQuickForm_text (   $elementName = null,
  $elementLabel = null,
  $attributes = null 
)
inherited

Old syntax of class constructor.

Deprecated in PHP7.

Deprecated:
since Moodle 3.1

◆ onQuickFormEvent()

MoodleQuickForm_float::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

◆ set_force_ltr()

MoodleQuickForm_text::set_force_ltr (   $value)
inherited

Force the field to flow left-to-right.

This is useful for fields such as URLs, passwords, settings, etc...

Parameters
bool$valueThe value to set the option to.

◆ setHiddenLabel()

MoodleQuickForm_text::setHiddenLabel (   $hiddenLabel)
inherited

Sets label to be hidden.

Parameters
bool$hiddenLabelsets if label should be hidden

◆ setValue()

MoodleQuickForm_float::setValue (   $value)

Sets the value of the form element.

Parameters
string$valueDefault value of the form element

◆ toHtml()

MoodleQuickForm_text::toHtml ( )
inherited

Returns HTML for this form element.

Return values
string

◆ validateSubmitValue()

MoodleQuickForm_float::validateSubmitValue (   $value)

Checks that the submitted value is a valid float number.

Parameters
string$valueThe localised float number that is submitted.
Return values
string|nullValidation error message or null.

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