Documentation

PageView
in package

Page View object

Represents a page view record in Canvas LMS. Tracks user interactions and page visits within Canvas.

Table of Contents

Properties

$action  : string|null
$assetId  : int|null
$assetType  : string|null
$contextId  : int|null
$contextType  : string|null
$controller  : string|null
$createdAt  : string
$id  : string
$interactionSeconds  : float|null
$links  : array<string, mixed>|null
$participated  : bool|null
$remoteIp  : string|null
$url  : string
$userId  : int

Methods

__construct()  : mixed
Constructor
getCreatedAtDate()  : DateTimeInterface|null
Get created timestamp as DateTime
getHumanReadableInteractionTime()  : string|null
Get interaction time in a human-readable format
hadMeaningfulInteraction()  : bool
Check if this was a meaningful interaction (spent time on page)
hasAsset()  : bool
Check if this page view has asset information
hasContext()  : bool
Check if this page view has context information
toArray()  : array<string, mixed>
Convert to array

Properties

$action

public string|null $action = null

Action name within the controller

$assetId

public int|null $assetId = null

Asset ID (specific resource within context)

$assetType

public string|null $assetType = null

Asset type (Assignment, Discussion, etc.)

$contextId

public int|null $contextId = null

Context ID (course, account, etc.)

$contextType

public string|null $contextType = null

Context type (Course, Account, etc.)

$controller

public string|null $controller = null

Controller name that handled the request

$createdAt

public string $createdAt

Timestamp when the page was accessed

$id

public string $id

Unique identifier for the page view

$interactionSeconds

public float|null $interactionSeconds = null

Time spent on the page in seconds

public array<string, mixed>|null $links = null

Links to related resources

$participated

public bool|null $participated = null

Whether this was a participated interaction

$remoteIp

public string|null $remoteIp = null

User's IP address (if available)

$url

public string $url

URL that was visited

$userId

public int $userId

User ID who accessed the page

Methods

__construct()

Constructor

public __construct([array<string, mixed> $data = [] ]) : mixed
Parameters
$data : array<string, mixed> = []

getCreatedAtDate()

Get created timestamp as DateTime

public getCreatedAtDate() : DateTimeInterface|null
Return values
DateTimeInterface|null

getHumanReadableInteractionTime()

Get interaction time in a human-readable format

public getHumanReadableInteractionTime() : string|null
Return values
string|null

hadMeaningfulInteraction()

Check if this was a meaningful interaction (spent time on page)

public hadMeaningfulInteraction() : bool
Return values
bool

hasAsset()

Check if this page view has asset information

public hasAsset() : bool
Return values
bool

hasContext()

Check if this page view has context information

public hasContext() : bool
Return values
bool

toArray()

Convert to array

public toArray() : array<string, mixed>
Return values
array<string, mixed>

        
On this page

Search results