Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 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: 675 lines (18 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)   X-Ref
Load the step instance.

param: stdClass        $record     The step record to be loaded.
param: boolean         $clean      Clean the values.
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: boolean         $clean      Clean the values.
return: step

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_content()   X-Ref
Get the body content of the step.

return: string

set_content($value)   X-Ref
Set the content value for this step.

param: string      $value      The new content to use.
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

to_record()   X-Ref
Prepare this step for saving to the database.

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