Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 310 and 400] [Versions 311 and 400] [Versions 39 and 400] [Versions 400 and 402] [Versions 400 and 403]

Step class.

Copyright: 2016 Andrew Nicols <andrew@nicols.co.uk>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 835 lines (24 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: step  - X-Ref

Step class.

instance($id)   X-Ref
Fetch the step instance.

return: step
param: int             $id         The id of the step to be retrieved.

load_from_record($record, $clean = false, bool $isimporting = false)   X-Ref
Load the step instance.

return: step
param: stdClass $record The step record to be loaded.
param: bool $clean Clean the values.
param: bool $isimporting Whether the step is being imported or not.

fetch($id)   X-Ref
Fetch the step instance.

return: step
param: int             $id         The id of the step to be retrieved.

reload()   X-Ref
Refresh the current step from the datbase.

return: step

reload_from_record($record, $clean = false)   X-Ref
Reload the current step from the supplied record.

return: step
param: stdClass $record The step record to be loaded.
param: bool $clean Clean the values.

set_importing(bool $isimporting = false)   X-Ref
Set the import state for the step.

return: void
param: bool $isimporting True if the step is imported, otherwise false.

get_id()   X-Ref
Get the ID of the step.

return: int

get_tourid()   X-Ref
Get the Tour ID of the step.

return: int

get_tour()   X-Ref
Get the Tour instance that this step belongs to.

return: tour

set_tourid($value)   X-Ref
Set the id of the tour.

return: self
param: int             $value      The id of the tour.

get_title()   X-Ref
Get the Title of the step.

return: string

set_title($value)   X-Ref
Set the title for this step.

return: $this
param: string      $value      The new title to use.

get_contentformat()   X-Ref
Get the content format of the step.

return: int

get_content()   X-Ref
Get the body content of the step.

return: string

set_content($value, $format = FORMAT_HTML)   X-Ref
Set the content value for this step.

return: $this
param: string      $value      The new content to use.
param: int         $format     The new format to use: FORMAT_MOODLE/FORMAT_HTML/FORMAT_PLAIN/FORMAT_MARKDOWN.

get_targettype()   X-Ref
Get the content value for this step.

return: string

set_targettype($value)   X-Ref
Set the type of target for this step.

return: $this
param: string      $value      The new target to use.

get_targetvalue()   X-Ref
Get the target value for this step.

return: string

set_targetvalue($value)   X-Ref
Set the target value for this step.

return: $this
param: string      $value      The new target value to use.

get_target()   X-Ref
Get the target instance for this step.

return: target

get_sortorder()   X-Ref
Get the current sortorder for this step.

return: int

is_first_step()   X-Ref
Whether this step is the first step in the tour.

return: boolean

is_last_step()   X-Ref
Whether this step is the last step in the tour.

return: boolean

set_sortorder($value)   X-Ref
Set the sortorder for this step.

return: $this
param: int         $value      The new sortorder to use.

get_moveup_link()   X-Ref
Get the link to move this step up in the sortorder.

return: moodle_url

get_movedown_link()   X-Ref
Get the link to move this step down in the sortorder.

return: moodle_url

get_config($key = null, $default = null)   X-Ref
Get the value of the specified configuration item.

If notvalue was found, and no default was specified, the default for the tour will be used.

return: mixed
param: string      $key        The configuration key to set.
param: mixed       $default    The default value to use if a value was not found.

set_config($key, $value)   X-Ref
Set the configuration item as specified.

return: $this
param: string      $key        The configuration key to set.
param: mixed       $value      The new value for the configuration item.

get_edit_link()   X-Ref
Get the edit link for this step.

return: moodle_url

get_delete_link()   X-Ref
Get the delete link for this step.

return: moodle_url

embed_files()   X-Ref
Embed attached file to the json file for step.

return: array List of files.

extract_files()   X-Ref
Get the embed files information and create store_file for this step.

return: void

to_record(bool $isexporting = false)   X-Ref
Prepare this step for saving to the database.

return: object
param: bool $isexporting Whether the step is being exported or not.

calculate_sortorder()   X-Ref
Calculate the next sort-order value.

return: int

persist($force = false)   X-Ref
Save the tour and it's configuration to the database.

return: $this
param: boolean     $force      Whether to force writing to the database.

remove()   X-Ref
Remove this step.


get_placement_options()   X-Ref
Get the list of possible placement options.

return: array

get_config_keys()   X-Ref
The list of possible configuration keys.

return: array

add_config_to_form(\MoodleQuickForm $mform)   X-Ref
Add the step configuration to the form.

return: $this
param: MoodleQuickForm $mform      The form to add configuration to.

add_config_field_to_form(\MoodleQuickForm $mform, $key)   X-Ref
Add the specified step field configuration to the form.

return: $this
param: MoodleQuickForm $mform      The form to add configuration to.
param: string          $key        The key to add.

prepare_data_for_form()   X-Ref
Prepare the configuration data for the moodle form.

return: object

handle_form_submission(local\forms\editstep &$mform, stdClass $data)   X-Ref
Handle submission of the step editing form.

return: $this
param: local\forms\editstep  $mform      The sumitted form.
param: stdClass        $data       The submitted data.

get_string_from_input($string)   X-Ref
Attempt to fetch any matching langstring if the string is in the
format identifier,component.

return: string
param: string  $string

get_step_image_from_input(string $content)   X-Ref
Attempt to replace PIXICON placeholder with the correct images for tour step content.

return: string Processed tour content
param: string $content Tour content