Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

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

Tour class.

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

Defines 1 class


Class: tour  - X-Ref

Tour class.

instance($id)   X-Ref
Create an instance of the specified tour.

param: int         $id         The ID of the tour to load.
return: tour

load_from_record($record, $clean = false)   X-Ref
Create an instance of tour from its provided DB record.

param: stdClass    $record     The record of the tour to load.
param: boolean     $clean      Clean the values.
return: tour

fetch($id)   X-Ref
Fetch the specified tour into the current object.

param: int         $id         The ID of the tour to fetch.
return: tour

reload()   X-Ref
Reload the current tour from database.

return: tour

reload_from_record($record, $clean = false)   X-Ref
Reload the tour into the current object.

param: stdClass    $record     The record to reload.
param: boolean     $clean      Clean the values.
return: tour

get_steps()   X-Ref
Fetch all steps in the tour.

return: stdClass[]

count_steps()   X-Ref
Count the number of steps in the tour.

return: int

get_id()   X-Ref
The ID of the tour.

return: int

get_name()   X-Ref
The name of the tour.

return: string

set_name($value)   X-Ref
Set the name of the tour to the specified value.

param: string      $value      The new name.
return: $this

get_description()   X-Ref
The description associated with the tour.

return: string

set_description($value)   X-Ref
Set the description of the tour to the specified value.

param: string      $value      The new description.
return: $this

get_pathmatch()   X-Ref
The path match for the tour.

return: string

set_pathmatch($value)   X-Ref
Set the patchmatch of the tour to the specified value.

param: string      $value      The new patchmatch.
return: $this

get_enabled()   X-Ref
The enabled state of the tour.

return: int

is_enabled()   X-Ref
Whether the tour is currently enabled.

return: boolean

set_enabled($value)   X-Ref
Set the enabled state of the tour to the specified value.

param: boolean     $value      The new state.
return: $this

get_view_link()   X-Ref
The link to view this tour.

return: moodle_url

get_edit_link()   X-Ref
The link to edit this tour.

return: moodle_url

get_reset_link()   X-Ref
The link to reset the state of this tour for all users.

return: moodle_url

get_export_link()   X-Ref
The link to export this tour.

return: moodle_url

get_duplicate_link()   X-Ref
The link to duplicate this tour.

return: moodle_url

get_delete_link()   X-Ref
The link to remove this tour.

return: moodle_url

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

return: object

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

return: int

is_first_tour()   X-Ref
Whether this tour is the first tour.

return: boolean

is_last_tour($tourcount = null)   X-Ref
Whether this tour is the last tour.

param: int         $tourcount  The pre-fetched count of tours
return: boolean

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

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

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

return: int

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

return: moodle_url

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

return: moodle_url

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

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

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.


reset_step_sortorder()   X-Ref
Reset the sortorder for all steps in the tour.

return: $this

remove_user_preferences()   X-Ref
Remove stored user preferences for the tour


should_show_for_user()   X-Ref
Whether this tour should be displayed to the user.

return: boolean

get_tour_key()   X-Ref
Get the key for this tour.
This is used in the session cookie to determine whether the user has seen this tour before.


request_user_reset()   X-Ref
Reset the requested by user date.

return: $this

mark_user_completed()   X-Ref
Mark this tour as completed for this user.

return: $this

mark_major_change()   X-Ref
Update a tour giving it a new major update time.
This will ensure that it is displayed to all users, even those who have already seen it.

return: $this

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

get_filter_values($filter)   X-Ref
Get the configured filter values.

param: string      $filter     The filter to retrieve values for.
return: array

set_filter_values($filter, array $values = [])   X-Ref
Set the values for the specified filter.

param: string      $filter     The filter to set.
param: array       $values     The values to set.
return: $this

matches_all_filters(\context $context, array $filters = null)   X-Ref
Check whether this tour matches all filters.

param: \context     $context    The context to check.
param: array|null   $filters    Optional array of filters.
return: bool

get_client_filter_values(array $filters)   X-Ref
Gets all filter values for use in client side filters.

param: array     $filters    Array of clientside filters.
return: array