Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
tool_usertours\tour Class Reference

Tour class. More...

Public Member Functions

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

Static Public Member Functions

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

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. More...
 
 calculate_sortorder ()
 Calculate the next sort-order value. More...
 
 fetch ($id)
 Fetch the specified tour into the current object. More...
 
 reload ()
 Reload the current tour from database. More...
 
 reload_from_record ($record, $clean=false)
 Reload the tour into the current object. More...
 
 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.
 
$enabled $enabled
 The tour enabled state.
 
$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_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_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_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
stdClass[]

◆ 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)

Check whether this tour matches all filters.

Parameters
context$contextThe context to check
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_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_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: