Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
core\event\badge_criteria_created Class Reference
Inheritance diagram for core\event\badge_criteria_created:
core\event\base

Public Member Functions

 __get ($name)
 Magic getter for read only access.
 
 __isset ($name)
 Is data property set?
 
 __set ($name, $value)
 Magic setter.
 
 add_record_snapshot ($tablename, $record)
 Add cached data that will be most probably used in event observers.
 
 can_view ($user_or_id=null)
 This method was originally intended for granular access control on the event level, unfortunately the proper implementation would be too expensive in many cases.
 
 get_context ()
 Returns event context.
 
 get_data ()
 Return standardised event data as array.
 
 get_description ()
 Returns non-localised event description with id's for admin use only.
 
 get_logextra ()
 Return auxiliary data that was stored in logs.
 
 get_record_snapshot ($tablename, $id)
 Returns cached record or fetches data from database if not cached.
 
 get_url ()
 Returns relevant URL.
 
 getIterator ()
 Create an iterator because magic vars can't be seen by 'foreach'.
 
 is_dispatched ()
 Used from event manager to prevent direct access.
 
 is_restored ()
 Was this event restored?
 
 is_triggered ()
 Was this event already triggered?
 
 trigger ()
 Trigger event.
 

Static Public Member Functions

static create (array $data=null)
 Create new event.
 
static get_explanation ()
 Get an explanation of what the class does.
 
static get_name ()
 Returns localised general event name.
 
static get_name_with_info ()
 Returns the event name complete with metadata information.
 
static get_objectid_mapping ()
 Used for maping events on restore.
 
static get_other_mapping ()
 Used for maping events on restore.
 
static get_static_info ()
 Get static information about an event.
 
static is_deprecated ()
 Whether this event has been marked as deprecated.
 
static restore (array $data, array $logextra)
 Restore event from existing historic data.
 
static restore_legacy ($legacy)
 Create fake event from legacy log data.
 

Public Attributes

const LEVEL_OTHER = 0
 Other level.
 
const LEVEL_PARTICIPATING = 2
 Participating level.
 
const LEVEL_TEACHING = 1
 Teaching level.
 
const NOT_FOUND = -31338
 The value used when an id can not be found during a restore.
 
const NOT_MAPPED = -31337
 The value used when an id can not be mapped during a restore.
 
const USER_NOTLOGGEDIN = 0
 User id to use when the user is not logged in.
 
const USER_OTHER = -1
 User id to use when actor is not an actual user but system, cli or cron.
 

Protected Member Functions

 init ()
 Set basic properties for the event.
 
 validate_before_trigger ()
 Validate all properties right before triggering the event.
 
 validate_data ()
 Custom validations.
 

Static Protected Member Functions

static restore_unknown (array $data, array $logextra)
 Restore unknown event.
 

Protected Attributes

context $context
 of this event
 
array $data
 event data
 
array $logextra
 the format is standardised by logging API
 

Member Function Documentation

◆ __get()

core\event\base::__get ( $name)
inherited

Magic getter for read only access.

Parameters
string$name
Return values
mixed

◆ __isset()

core\event\base::__isset ( $name)
inherited

Is data property set?

Parameters
string$name
Return values
bool

◆ __set()

core\event\base::__set ( $name,
$value )
inherited

Magic setter.

Note: we must not allow modification of data from outside, after trigger() the data MUST NOT CHANGE!!!

Parameters
string$name
mixed$value
Exceptions
coding_exception

◆ add_record_snapshot()

core\event\base::add_record_snapshot ( $tablename,
$record )
finalinherited

Add cached data that will be most probably used in event observers.

This is used to improve performance, but it is required for data that was just deleted.

Parameters
string$tablename
stdClass$record
Exceptions
coding_exceptionif used after trigger()

◆ can_view()

core\event\base::can_view ( $user_or_id = null)
inherited

This method was originally intended for granular access control on the event level, unfortunately the proper implementation would be too expensive in many cases.

Deprecated
since 2.7
Parameters
int | stdClass$user_or_idID of the user.
Return values
boolTrue if the user can view the event, false otherwise.

Reimplemented in mod_feedback\event\response_deleted, and mod_feedback\event\response_submitted.

◆ create()

static core\event\base::create ( array $data = null)
staticfinalinherited

Create new event.

The optional data keys as: 1/ objectid - the id of the object specified in class name 2/ context - the context of this event 3/ other - the other data describing the event, can not contain objects 4/ relateduserid - the id of user which is somehow related to this event

Parameters
array$data
Return values
core\event\basereturns instance of new event
Exceptions
coding_exception

◆ get_context()

core\event\base::get_context ( )
inherited

Returns event context.

Return values
context

◆ get_data()

core\event\base::get_data ( )
inherited

Return standardised event data as array.

Return values
arrayAll elements are scalars except the 'other' field which is array.

◆ get_description()

core\event\badge_criteria_created::get_description ( )

Returns non-localised event description with id's for admin use only.

Return values
string

Reimplemented from core\event\base.

◆ get_explanation()

static core\event\base::get_explanation ( )
staticinherited

Get an explanation of what the class does.

By default returns the phpdocs from the child event class. Ideally this should be overridden to return a translatable get_string style markdown. e.g. return new lang_string('eventyourspecialevent', 'plugin_type');

Return values
stringAn explanation of the event formatted in markdown style.

◆ get_logextra()

core\event\base::get_logextra ( )
inherited

Return auxiliary data that was stored in logs.

List of standard properties:

  • origin: IP number, cli,cron
  • realuserid: id of the user when logged-in-as
Return values
arraythe format is standardised by logging API

◆ get_name()

static core\event\badge_criteria_created::get_name ( )
static

Returns localised general event name.

Return values
string

Reimplemented from core\event\base.

◆ get_name_with_info()

static core\event\base::get_name_with_info ( )
staticinherited

Returns the event name complete with metadata information.

This includes information about whether the event has been deprecated so should not be used in all situations - for example within reports themselves.

If overriding this function, please ensure that you call the parent version too.

Return values
string

◆ get_objectid_mapping()

static core\event\badge_criteria_created::get_objectid_mapping ( )
static

Used for maping events on restore.

Return values
array

Reimplemented from core\event\base.

◆ get_other_mapping()

static core\event\badge_criteria_created::get_other_mapping ( )
static

Used for maping events on restore.

Return values
bool

Reimplemented from core\event\base.

◆ get_record_snapshot()

core\event\base::get_record_snapshot ( $tablename,
$id )
finalinherited

Returns cached record or fetches data from database if not cached.

Parameters
string$tablename
int$id
Return values
stdClass
Exceptions
coding_exceptionif used after restore()

◆ get_static_info()

static core\event\base::get_static_info ( )
staticfinalinherited

Get static information about an event.

This is used in reports and is not for general use.

Return values
arrayStatic information about the event.

◆ get_url()

core\event\badge_criteria_created::get_url ( )

Returns relevant URL.

Return values
moodle_url

Reimplemented from core\event\base.

◆ getIterator()

core\event\base::getIterator ( )
inherited

Create an iterator because magic vars can't be seen by 'foreach'.

Return values
ArrayIterator

◆ init()

core\event\badge_criteria_created::init ( )
protected

Set basic properties for the event.

Reimplemented from core\event\base.

◆ is_deprecated()

static core\event\base::is_deprecated ( )
staticinherited

Whether this event has been marked as deprecated.

Events cannot be deprecated in the normal fashion as they must remain to support historical data. Once they are deprecated, there is no way to trigger the event, so it does not make sense to list it in some parts of the UI (e.g. Event Monitor).

Return values
boolean

Reimplemented in core\event\course_module_instances_list_viewed, and core\event\role_capabilities_updated.

◆ is_dispatched()

core\event\base::is_dispatched ( )
finalinherited

Used from event manager to prevent direct access.

Return values
bool

◆ is_restored()

core\event\base::is_restored ( )
finalinherited

Was this event restored?

Return values
bool

◆ is_triggered()

core\event\base::is_triggered ( )
finalinherited

Was this event already triggered?

Return values
bool

◆ restore()

static core\event\base::restore ( array $data,
array $logextra )
staticfinalinherited

Restore event from existing historic data.

Parameters
array$data
array$logextrathe format is standardised by logging API
Return values
bool|core\event\base

◆ restore_legacy()

static core\event\base::restore_legacy ( $legacy)
staticfinalinherited

Create fake event from legacy log data.

Parameters
stdClass$legacy
Return values
base

◆ restore_unknown()

static core\event\base::restore_unknown ( array $data,
array $logextra )
staticfinalprotectedinherited

Restore unknown event.

Parameters
array$data
array$logextra
Return values
unknown_logged

◆ validate_before_trigger()

core\event\base::validate_before_trigger ( )
protectedinherited

Validate all properties right before triggering the event.

This throws coding exceptions for fatal problems and debugging for minor problems.

Exceptions
coding_exception

Reimplemented in core\event\url_blocked.

◆ validate_data()

core\event\badge_criteria_created::validate_data ( )
protected

Custom validations.

Exceptions
coding_exception
Return values
void

Reimplemented from core\event\base.

Member Data Documentation

◆ LEVEL_PARTICIPATING

const core\event\base::LEVEL_PARTICIPATING = 2
inherited

Participating level.

Any event that is performed by a user, and is related (or could be related) to his learning experience.

◆ LEVEL_TEACHING

const core\event\base::LEVEL_TEACHING = 1
inherited

Teaching level.

Any event that is performed by someone (typically a teacher) and has a teaching value, anything that is affecting the learning experience/environment of the students.


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