Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 401 and 402] [Versions 401 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.

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

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

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.
return: step

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

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

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.

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

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

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

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.

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

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

return: string

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

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

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.

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

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.

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

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.

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

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.

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

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.

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

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

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

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.

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

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.

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

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.

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

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

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

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.

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

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

param: string  $string
return: string

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

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