Moodle PHP Documentation 5.1
Moodle 5.1dev (Build: 20250620) (7d9030acd6e)
|
Backup moodleform bridge. More...
Public Member Functions | |
__construct (backup_ui_stage $uistage, $action=null, $customdata=null, $method='post', $target='', $attributes=null, $editable=true) | |
Creates the form. | |
_process_submission ($method) | |
Internal method. | |
_validate_files (&$files) | |
Internal method. | |
add_action_buttons ($cancel=true, $submitlabel=null) | |
Use this method to a cancel and submit button to the end of your form. | |
add_checkbox_controller ($groupid, $text=null, $attributes=null, $originalValue=0) | |
Adds a link/button that controls the checked state of a group of checkboxes. | |
add_dependencies (backup_setting $setting) | |
Adds dependencies to the form recursively. | |
add_fixed_setting (backup_setting $setting, base_task $task) | |
Adds a fixed or static setting to the form. | |
add_heading ($name, $text) | |
Adds a heading to the form. | |
add_setting (backup_setting $setting, ?base_task $task=null) | |
Adds the backup_setting as a element to the form. | |
add_settings (array $settingstasks) | |
Adds multiple backup_settings as elements to the form. | |
add_sticky_action_buttons (bool $cancel=true, ?string $submitlabel=null) | |
Use this method to make a sticky submit/cancel button at the end of your form. | |
close_task_divs () | |
Closes any open divs. | |
definition () | |
The standard form definition... obviously not much here. | |
moodle_page | definition_after_data () |
Definition applied after the data is organised. | |
display () | |
Displays the form. | |
filter_shown_headers (array $shownonly) | |
Use this method to indicate that the fieldsets should be shown as expanded and all other fieldsets should be hidden. | |
focus ($name=NULL) | |
To autofocus on first form element or first element with error. | |
get_data () | |
Return submitted data if properly submitted or returns NULL if validation fails or if there is no submitted data. | |
get_element ($elementname) | |
Gets an element from the form if it exists. | |
get_file_content ($elname) | |
Get content of uploaded file. | |
get_new_filename ($elname=null) | |
Returns name of uploaded file. | |
get_submitted_data () | |
Return submitted data without validation or NULL if there is no submitted data. | |
init_javascript_enhancement ($element, $enhancement, array $options=array(), ?array $strings=null) | |
Adds an initialisation call for a standard JavaScript enhancement. | |
is_cancelled () | |
Returns true if the form was cancelled, false otherwise. | |
is_submitted () | |
Check that form was submitted. | |
is_validated () | |
Check that form data is valid. | |
moodleform ($action=null, $customdata=null, $method='post', $target='', $attributes=null, $editable=true) | |
Old syntax of class constructor. | |
no_submit_button_pressed () | |
Checks if button pressed is not for submitting the form. | |
optional_param ($name, $default, $type) | |
Checks if a parameter was passed in the previous form submission. | |
remove_element ($elementname) | |
Removes an element from the form if it exists. | |
render () | |
Renders the html form (same as display, but returns the result). | |
repeat_elements ($elementobjs, $repeats, $options, $repeathiddenname, $addfieldsname, $addfieldsno=5, $addstring=null, $addbuttoninside=false, $deletebuttonname='') | |
Method to add a repeating group of elements to a form. | |
repeat_elements_fix_clone ($i, $elementclone, &$namecloned) | |
Helper used by repeat_elements(). | |
require_definition_after_data () | |
Ensures the the definition after data is loaded. | |
save_file ($elname, $pathname, $override=false) | |
Save file to standard filesystem. | |
save_files ($destination) | |
Save verified uploaded files into directory. | |
save_stored_file ($elname, $newcontextid, $newcomponent, $newfilearea, $newitemid, $newfilepath='/', $newfilename=null, $overwrite=false, $newuserid=null) | |
Save file to local filesystem pool. | |
save_temp_file ($elname) | |
Returns a temporary file, do not forget to delete after not needed any more. | |
set_data ($default_values) | |
Load in existing data as form defaults. | |
set_display_vertical () | |
Set display mode for the form when labels take full width of the form and above the elements even on big screens. | |
set_initial_dirty_state ($state=false) | |
Set the initial 'dirty' state of the form. | |
validate_defined_fields ($validateonnosubmit=false) | |
Validate the form. | |
validation ($data, $files) | |
Dummy stub method - override if you needed to perform some extra validation. | |
Static Public Member Functions | |
static | get_js_module () |
Returns a JS module definition for the mforms JS. | |
static | mock_ajax_submit ($simulatedsubmitteddata, $simulatedsubmittedfiles=array(), $method='post', $formidentifier=null) |
Used by tests to simulate submitted form data submission via AJAX. | |
static | mock_generate_submit_keys ($data=[]) |
Used by tests to generate valid submit keys for moodle forms that are submitted with ajax data. | |
static | mock_submit ($simulatedsubmitteddata, $simulatedsubmittedfiles=array(), $method='post', $formidentifier=null) |
Used by tests to simulate submitted form data submission from the user. | |
Protected Member Functions | |
_get_post_params () | |
Internal method - should not be used anywhere. | |
add_html_formatting (backup_setting $setting) | |
Adds HTML formatting for the given backup setting, needed to group/segment correctly. | |
after_definition () | |
After definition hook. | |
get_array_value_by_keys (array $array, array $keys) | |
Returns an element of multi-dimensional array given the list of keys. | |
get_draft_files ($elname) | |
Get draft files of a form element This is a protected method which will be used only inside moodleforms. | |
get_form_identifier () | |
It should returns unique identifier for the form. | |
pop_group () | |
Pops a group from the stack and closes the div. | |
pop_groups_to (string $name) | |
Pops groups from the stack until the given group name is reached. | |
push_group_start (?string $name, string $classes) | |
Pushes a group start to the form. | |
validate_draft_files () | |
Internal method. | |
Protected Attributes | |
array | $_ajaxformdata |
submitted form data when using mforms with ajax | |
mixed | $_customdata |
globals workaround | |
object | $_definition_finalized = false |
definition_after_data executed flag | |
MoodleQuickForm | $_form |
quickform object definition | |
string | $_formname |
name of the form | |
bool null | $_validated = null |
stores the validation result of this form or null if not yet validated | |
array array | $groupstack = [] |
Group stack to control open and closed div groups. | |
base_ui_stage | $uistage = null |
The stage this form belongs to. | |
Static Protected Attributes | |
static int | $uniqueid = 0 |
Unique identifier to be used for action buttons. | |
Backup moodleform bridge.
Ahhh the mighty moodleform bridge! Strong enough to take the weight of 682 full grown african swallows all of whom have been carring coconuts for several days. EWWWWW!!!!!!!!!!!!!!!!!!!!!!!!
backup_moodleform::__construct | ( | backup_ui_stage | $uistage, |
$action = null, | |||
$customdata = null, | |||
$method = 'post', | |||
$target = '', | |||
$attributes = null, | |||
$editable = true ) |
Creates the form.
Overridden for type hinting on the first arg.
backup_ui_stage | $uistage | |
moodle_url | string | $action | |
mixed | $customdata | |
string | $method | get|post |
string | $target | |
array | $attributes | |
bool | $editable |
|
inherited |
Adds dependencies to the form recursively.
backup_setting | $setting |
|
inherited |
Adds a fixed or static setting to the form.
backup_setting | $setting | |
base_task | $task |
|
inherited |
Adds a heading to the form.
string | $name | |
string | $text |
|
protectedinherited |
Adds HTML formatting for the given backup setting, needed to group/segment correctly.
backup_setting | $setting |
|
inherited |
Adds the backup_setting as a element to the form.
backup_setting | $setting | |
base_task | $task |
bool |
|
inherited |
Adds multiple backup_settings as elements to the form.
array | $settingstasks | Consists of array($setting, $task) elements |
bool |
|
inherited |
The standard form definition... obviously not much here.
Reimplemented from moodleform.
|
inherited |
Definition applied after the data is organised.
. why's it here? because I want to add elements on the fly. $PAGE
Reimplemented from moodleform.
Reimplemented in backup_confirmation_form.
|
inherited |
Displays the form.
Reimplemented from moodleform.
|
inherited |
Gets an element from the form if it exists.
string | $elementname |
HTML_QuickForm_input|MoodleQuickForm_group |
|
inherited |
Returns true if the form was cancelled, false otherwise.
bool |
Reimplemented from moodleform.
|
protectedinherited |
Pops a group from the stack and closes the div.
string|null | The name of the group that was popped, or null if the stack is empty. |
|
protectedinherited |
Pops groups from the stack until the given group name is reached.
string | $name | The name of the group to pop to. |
|
protectedinherited |
Pushes a group start to the form.
This method will create a new group div in the form and add it to the group stack. The name can be used to close all stacked groups up to a certain group.
string | null | $name | The name of the group, if any. |
string | $classes | The classes to add to the div. |
|
inherited |
Removes an element from the form if it exists.
string | $elementname |
bool |