Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
core_analytics\prediction_action Class Reference

Representation of a suggested action associated with a prediction. More...

Inheritance diagram for core_analytics\prediction_action:
core_analytics\action

Public Member Functions

 __construct ($actionname, core_analytics\prediction $prediction, moodle_url $actionurl, pix_icon $icon, $text, $primary=false, $attributes=array(), $type=false)
 Prediction action constructor.
 
 get_action_link ()
 Returns the link to the action.
 
 get_action_name ()
 Returns the action name.
 
 get_text ()
 Returns the action text.
 
 get_type ()
 Returns the type of action.
 
 get_url ()
 Returns the url to the action.
 
 set_type ($type=false)
 Sets the type of the action according to its positiveness.
 

Static Public Member Functions

static transform_to_forward_url (\moodle_url $actionurl, string $actionname, int $predictionid)
 Transforms the provided url to an action url so we can record the user actions.
 

Public Attributes

Action const TYPE_NEGATIVE = 'notuseful'
 type notuseful.
 
Action const TYPE_NEUTRAL = 'neutral'
 type neutral.
 
Action const TYPE_POSITIVE = 'useful'
 type useful.
 

Protected Attributes

renderable $actionlink = null
 
string $actionname = null
 
string $text = null
 
string string $type = ''
 Store the action type.
 
moodle_url $url = null
 

Detailed Description

Representation of a suggested action associated with a prediction.

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

Constructor & Destructor Documentation

◆ __construct()

core_analytics\prediction_action::__construct ( $actionname,
core_analytics\prediction $prediction,
moodle_url $actionurl,
pix_icon $icon,
$text,
$primary = false,
$attributes = array(),
$type = false )

Prediction action constructor.

Parameters
string$actionnameThey should match a-zA-Z_0-9-, as we apply a PARAM_ALPHANUMEXT filter
core_analytics\prediction$prediction
moodle_url$actionurlThe final URL where the user should be forwarded.
pix_icon$iconLink icon
string$textLink text
bool$primaryPrimary button or secondary.
array$attributesLink attributes
string | false$type
Return values
void

Member Function Documentation

◆ get_action_link()

core_analytics\action::get_action_link ( )
inherited

Returns the link to the action.

Return values
renderable

◆ get_action_name()

core_analytics\action::get_action_name ( )
inherited

Returns the action name.

Return values
string

◆ get_text()

core_analytics\action::get_text ( )
inherited

Returns the action text.

Return values
string

◆ get_type()

core_analytics\action::get_type ( )
inherited

Returns the type of action.

Return values
stringThe positiveness of the action (self\TYPE_POSITIVE, self\TYPE_NEGATIVE or self\TYPE_NEUTRAL)

◆ get_url()

core_analytics\action::get_url ( )
inherited

Returns the url to the action.

Return values
moodle_url

◆ set_type()

core_analytics\action::set_type ( $type = false)
inherited

Sets the type of the action according to its positiveness.

Exceptions
coding_exception
Parameters
string | false$typecore_analytics\action\TYPE_POSITIVE, TYPE_NEGATIVE or TYPE_NEUTRAL

◆ transform_to_forward_url()

static core_analytics\prediction_action::transform_to_forward_url ( \moodle_url $actionurl,
string $actionname,
int $predictionid )
static

Transforms the provided url to an action url so we can record the user actions.

Note that it is the caller responsibility to check that the provided actionname is valid for the prediction target.

Parameters
moodle_url$actionurl
string$actionname
int$predictionid
Return values
moodle_url

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