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

Moodle user analysable. More...

Inheritance diagram for core_analytics\user:
core_analytics\analysable

Public Member Functions

 __construct ($user, ?\context $context=null)
 Constructor.
 
 get_context ()
 get_context
 
 get_end ()
 Get the end timestamp.
 
 get_id ()
 get_id
 
 get_name ()
 The user full name.
 
 get_start ()
 Get the start timestamp.
 
 get_user_data ()
 Returns a user plain object.
 

Static Public Member Functions

static instance ($user, ?\context $context=null)
 Returns an analytics user instance.
 

Public Attributes

const MAX_TIME = PHP_INT_MAX < 9999999999 ? PHP_MAX_INT : 9999999999
 Max timestamp.
 

Protected Member Functions

 load ()
 Loads the analytics user object.
 

Protected Attributes

bool $loaded = false
 Has this user data been already loaded.
 
int int $now = 0
 Store current Unix timestamp.
 
stdClass $user = null
 User object.
 
context_user $usercontext = null
 The user context.
 

Static Protected Attributes

static int $cachedid = 0
 $cachedid self\$cachedinstance analysable id.
 
static core_analytics user $cachedinstance = null
 $cachedinstance
 

Detailed Description

Moodle user analysable.

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

Constructor & Destructor Documentation

◆ __construct()

core_analytics\user::__construct ( $user,
?\context $context = null )

Constructor.

Use self\instance() instead to get cached copies of the class. Instances obtained through this constructor will not be cached.

Parameters
int | stdClass$userUser id
context | null$context
Return values
void

Member Function Documentation

◆ get_context()

core_analytics\user::get_context ( )

get_context

Return values
context

Implements core_analytics\analysable.

◆ get_end()

core_analytics\user::get_end ( )

Get the end timestamp.

Return values
int

Implements core_analytics\analysable.

◆ get_id()

core_analytics\user::get_id ( )

get_id

Return values
int

Implements core_analytics\analysable.

◆ get_name()

core_analytics\user::get_name ( )

The user full name.

Return values
string

Implements core_analytics\analysable.

◆ get_start()

core_analytics\user::get_start ( )

Get the start timestamp.

Return values
int

Implements core_analytics\analysable.

◆ get_user_data()

core_analytics\user::get_user_data ( )

Returns a user plain object.

Return values
stdClass

◆ instance()

static core_analytics\user::instance ( $user,
?\context $context = null )
static

Returns an analytics user instance.

Lazy load of analysable data.

Parameters
int | stdClass$userUser object or user id
context | null$context
Return values
core_analytics\user

◆ load()

core_analytics\user::load ( )
protected

Loads the analytics user object.

Return values
void

Member Data Documentation

◆ MAX_TIME

const core_analytics\analysable::MAX_TIME = PHP_INT_MAX < 9999999999 ? PHP_MAX_INT : 9999999999
inherited

Max timestamp.

We are limited by both PHP's max int value and DB (cross-db) max int allowed. Use the smallest one.


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