Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
tool_usertours\tour Class Reference

Tour class. More...

Public Member Functions

 add_config_to_form (\MoodleQuickForm &$mform)
 Add the step configuration to the form.
 
 count_steps ()
 Count the number of steps in the tour.
 
 get_client_filter_values (array $filters)
 Gets all filter values for use in client side filters.
 
 get_config ($key=null, $default=null)
 Get the value of the specified configuration item.
 
 get_delete_link ()
 The link to remove this tour.
 
 get_description ()
 The description associated with the tour.
 
 get_display_step_numbers ()
 Get the value of the display step numbers setting.
 
 get_duplicate_link ()
 The link to duplicate this tour.
 
 get_edit_link ()
 The link to edit this tour.
 
 get_enabled ()
 The enabled state of the tour.
 
 get_endtourlabel ()
 The end tour label for the tour.
 
 get_export_link ()
 The link to export this tour.
 
 get_filter_values ($filter)
 Get the configured filter values.
 
 get_id ()
 The ID of the tour.
 
 get_movedown_link ()
 Get the link to move this tour down in the sortorder.
 
 get_moveup_link ()
 Get the link to move this tour up in the sortorder.
 
 get_name ()
 The name of the tour.
 
 get_pathmatch ()
 The path match for the tour.
 
 get_reset_link ()
 The link to reset the state of this tour for all users.
 
 get_sortorder ()
 Get the current sortorder for this tour.
 
 get_steps ()
 Fetch all steps in the tour.
 
 get_tour_key ()
 Get the key for this tour.
 
 get_view_link ()
 The link to view this tour.
 
 is_enabled ()
 Whether the tour is currently enabled.
 
 is_first_tour ()
 Whether this tour is the first tour.
 
 is_last_tour ($tourcount=null)
 Whether this tour is the last tour.
 
 mark_major_change ()
 Update a tour giving it a new major update time.
 
 mark_user_completed ()
 Mark this tour as completed for this user.
 
 matches_all_filters (\context $context, array $filters=null)
 Check whether this tour matches all filters.
 
 persist ($force=false)
 Save the tour and it's configuration to the database.
 
 prepare_data_for_form ()
 Prepare the configuration data for the moodle form.
 
 remove ()
 Remove this step.
 
 request_user_reset ()
 Reset the requested by user date.
 
 reset_step_sortorder ()
 Reset the sortorder for all steps in the tour.
 
 set_config ($key, $value)
 Set the configuration item as specified.
 
 set_description ($value)
 Set the description of the tour to the specified value.
 
 set_display_step_numbers (bool $value)
 Set the value for the display step numbers setting.
 
 set_enabled ($value)
 Set the enabled state of the tour to the specified value.
 
 set_endtourlabel (string $value)
 Set the endtourlabel of the tour to the specified value.
 
 set_filter_values ($filter, array $values=[])
 Set the values for the specified filter.
 
 set_name ($value)
 Set the name of the tour to the specified value.
 
 set_pathmatch ($value)
 Set the patchmatch of the tour to the specified value.
 
 set_sortorder ($value)
 Set the sortorder for this tour.
 
 should_show_for_user ()
 Whether this tour should be displayed to the user.
 
 to_record ()
 Prepare this tour for saving to the database.
 

Static Public Member Functions

static instance ($id)
 Create an instance of the specified tour.
 
static load_from_record ($record, $clean=false)
 Create an instance of tour from its provided DB record.
 

Public Attributes

DISABLED const DISABLED = 0
 The tour is currently disabled.
 
DISABLED const ENABLED = 1
 The tour is currently disabled.
 
TOUR_LAST_COMPLETED_BY_USER const TOUR_LAST_COMPLETED_BY_USER = 'tool_usertours_tour_completion_time_'
 The user preference value to indicate the time of completion of the tour for a user.
 
TOUR_REQUESTED_BY_USER const TOUR_REQUESTED_BY_USER = 'tool_usertours_tour_reset_time_'
 The user preference value to indicate the time that a user last requested to see the tour.
 

Protected Member Functions

 add_config_field_to_form (\MoodleQuickForm &$mform, $key)
 Add the specified step field configuration to the form.
 
 calculate_sortorder ()
 Calculate the next sort-order value.
 
 fetch ($id)
 Fetch the specified tour into the current object.
 
 reload ()
 Reload the current tour from database.
 
 reload_from_record ($record, $clean=false)
 Reload the tour into the current object.
 
 remove_user_preferences ()
 Remove stored user preferences for the tour.
 

Protected Attributes

$config $config
 The configuration object for the tour.
 
$description $description
 The tour description.
 
$dirty $dirty = false
 Whether the current view of the tour has been modified.
 
bool $displaystepnumbers = true
 $displaystepnumbers Display the step numbers in this tour.
 
$enabled $enabled
 The tour enabled state.
 
$endtourlabel $endtourlabel
 The end tour label.
 
$filtervalues $filtervalues
 The filter configuration object for the tour.
 
$id $id
 The tour ID.
 
$name $name
 The tour name.
 
$pathmatch $pathmatch
 The tour pathmatch.
 
$sortorder $sortorder
 The sort order.
 
$steps $steps = []
 The steps in this tour.
 

Detailed Description

Tour class.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ add_config_field_to_form()

tool_usertours\tour::add_config_field_to_form ( \MoodleQuickForm & $mform,
$key )
protected

Add the specified step field configuration to the form.

Parameters
MoodleQuickForm$mformThe form to add configuration to.
string$keyThe key to add.
Return values
$this

◆ add_config_to_form()

tool_usertours\tour::add_config_to_form ( \MoodleQuickForm & $mform)

Add the step configuration to the form.

Parameters
MoodleQuickForm$mformThe form to add configuration to.
Return values
$this

◆ calculate_sortorder()

tool_usertours\tour::calculate_sortorder ( )
protected

Calculate the next sort-order value.

Return values
int

◆ count_steps()

tool_usertours\tour::count_steps ( )

Count the number of steps in the tour.

Return values
int

◆ fetch()

tool_usertours\tour::fetch ( $id)
protected

Fetch the specified tour into the current object.

Parameters
int$idThe ID of the tour to fetch.
Return values
tour

◆ get_client_filter_values()

tool_usertours\tour::get_client_filter_values ( array $filters)

Gets all filter values for use in client side filters.

Parameters
array$filtersArray of clientside filters.
Return values
array

◆ get_config()

tool_usertours\tour::get_config ( $key = null,
$default = null )

Get the value of the specified configuration item.

Parameters
string$keyThe configuration key to set.
mixed$defaultThe default value to use if a value was not found.
Return values
mixed

◆ get_delete_link()

tool_usertours\tour::get_delete_link ( )

The link to remove this tour.

Return values
moodle_url

◆ get_description()

tool_usertours\tour::get_description ( )

The description associated with the tour.

Return values
string

◆ get_display_step_numbers()

tool_usertours\tour::get_display_step_numbers ( )

Get the value of the display step numbers setting.

Return values
bool

◆ get_duplicate_link()

tool_usertours\tour::get_duplicate_link ( )

The link to duplicate this tour.

Return values
moodle_url

◆ get_edit_link()

tool_usertours\tour::get_edit_link ( )

The link to edit this tour.

Return values
moodle_url

◆ get_enabled()

tool_usertours\tour::get_enabled ( )

The enabled state of the tour.

Return values
int

◆ get_endtourlabel()

tool_usertours\tour::get_endtourlabel ( )

The end tour label for the tour.

Return values
string

◆ get_export_link()

tool_usertours\tour::get_export_link ( )

The link to export this tour.

Return values
moodle_url

◆ get_filter_values()

tool_usertours\tour::get_filter_values ( $filter)

Get the configured filter values.

Parameters
string$filterThe filter to retrieve values for.
Return values
array

◆ get_id()

tool_usertours\tour::get_id ( )

The ID of the tour.

Return values
int

◆ get_movedown_link()

tool_usertours\tour::get_movedown_link ( )

Get the link to move this tour down in the sortorder.

Return values
moodle_url

◆ get_moveup_link()

tool_usertours\tour::get_moveup_link ( )

Get the link to move this tour up in the sortorder.

Return values
moodle_url

◆ get_name()

tool_usertours\tour::get_name ( )

The name of the tour.

Return values
string

◆ get_pathmatch()

tool_usertours\tour::get_pathmatch ( )

The path match for the tour.

Return values
string

◆ get_reset_link()

tool_usertours\tour::get_reset_link ( )

The link to reset the state of this tour for all users.

Return values
moodle_url

◆ get_sortorder()

tool_usertours\tour::get_sortorder ( )

Get the current sortorder for this tour.

Return values
int

◆ get_steps()

tool_usertours\tour::get_steps ( )

Fetch all steps in the tour.

Return values
step[]

◆ get_tour_key()

tool_usertours\tour::get_tour_key ( )

Get the key for this tour.

This is used in the session cookie to determine whether the user has seen this tour before.

◆ get_view_link()

tool_usertours\tour::get_view_link ( )

The link to view this tour.

Return values
moodle_url

◆ instance()

static tool_usertours\tour::instance ( $id)
static

Create an instance of the specified tour.

Parameters
int$idThe ID of the tour to load.
Return values
tour

◆ is_enabled()

tool_usertours\tour::is_enabled ( )

Whether the tour is currently enabled.

Return values
boolean

◆ is_first_tour()

tool_usertours\tour::is_first_tour ( )

Whether this tour is the first tour.

Return values
boolean

◆ is_last_tour()

tool_usertours\tour::is_last_tour ( $tourcount = null)

Whether this tour is the last tour.

Parameters
int$tourcountThe pre-fetched count of tours
Return values
boolean

◆ load_from_record()

static tool_usertours\tour::load_from_record ( $record,
$clean = false )
static

Create an instance of tour from its provided DB record.

Parameters
stdClass$recordThe record of the tour to load.
boolean$cleanClean the values.
Return values
tour

◆ mark_major_change()

tool_usertours\tour::mark_major_change ( )

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 values
$this

◆ mark_user_completed()

tool_usertours\tour::mark_user_completed ( )

Mark this tour as completed for this user.

Return values
$this

◆ matches_all_filters()

tool_usertours\tour::matches_all_filters ( \context $context,
array $filters = null )

Check whether this tour matches all filters.

Parameters
context$contextThe context to check.
array | null$filtersOptional array of filters.
Return values
bool

◆ persist()

tool_usertours\tour::persist ( $force = false)

Save the tour and it's configuration to the database.

Parameters
boolean$forceWhether to force writing to the database.
Return values
$this

◆ prepare_data_for_form()

tool_usertours\tour::prepare_data_for_form ( )

Prepare the configuration data for the moodle form.

Return values
object

◆ reload()

tool_usertours\tour::reload ( )
protected

Reload the current tour from database.

Return values
tour

◆ reload_from_record()

tool_usertours\tour::reload_from_record ( $record,
$clean = false )
protected

Reload the tour into the current object.

Parameters
stdClass$recordThe record to reload.
boolean$cleanClean the values.
Return values
tour

◆ request_user_reset()

tool_usertours\tour::request_user_reset ( )

Reset the requested by user date.

Return values
$this

◆ reset_step_sortorder()

tool_usertours\tour::reset_step_sortorder ( )

Reset the sortorder for all steps in the tour.

Return values
$this

◆ set_config()

tool_usertours\tour::set_config ( $key,
$value )

Set the configuration item as specified.

Parameters
string$keyThe configuration key to set.
mixed$valueThe new value for the configuration item.
Return values
$this

◆ set_description()

tool_usertours\tour::set_description ( $value)

Set the description of the tour to the specified value.

Parameters
string$valueThe new description.
Return values
$this

◆ set_display_step_numbers()

tool_usertours\tour::set_display_step_numbers ( bool $value)

Set the value for the display step numbers setting.

Parameters
bool$valueTrue for enable.
Return values
$this

◆ set_enabled()

tool_usertours\tour::set_enabled ( $value)

Set the enabled state of the tour to the specified value.

Parameters
boolean$valueThe new state.
Return values
$this

◆ set_endtourlabel()

tool_usertours\tour::set_endtourlabel ( string $value)

Set the endtourlabel of the tour to the specified value.

Parameters
string$value
Return values
$this

◆ set_filter_values()

tool_usertours\tour::set_filter_values ( $filter,
array $values = [] )

Set the values for the specified filter.

Parameters
string$filterThe filter to set.
array$valuesThe values to set.
Return values
$this

◆ set_name()

tool_usertours\tour::set_name ( $value)

Set the name of the tour to the specified value.

Parameters
string$valueThe new name.
Return values
$this

◆ set_pathmatch()

tool_usertours\tour::set_pathmatch ( $value)

Set the patchmatch of the tour to the specified value.

Parameters
string$valueThe new patchmatch.
Return values
$this

◆ set_sortorder()

tool_usertours\tour::set_sortorder ( $value)

Set the sortorder for this tour.

Parameters
int$valueThe new sortorder to use.
Return values
$this

◆ should_show_for_user()

tool_usertours\tour::should_show_for_user ( )

Whether this tour should be displayed to the user.

Return values
boolean

◆ to_record()

tool_usertours\tour::to_record ( )

Prepare this tour for saving to the database.

Return values
object

The documentation for this class was generated from the following file: