LTI Integration Library 5.3.0
PHP class library for building LTI integrations
Loading...
Searching...
No Matches

Class to represent a content item. More...

Inheritance diagram for ContentItem:

Public Member Functions

Item getItem ()
 Get content item.
bool delete (Platform $platform)
 Delete a content-item.
string toJson ()
 Wrap the content item to form a JSON string.
object toJsonObject ()
 Wrap the content items to form a JSON object of the value.

Static Public Member Functions

static ContentItem LtiLinkContentItem null fromType (string $type, ?string $id=null)
 Generate a Content Item object from its type.
static ContentItem LtiLinkContentItem null fromJsonItem (object $item)
 Generate a Content Item object from its JSON representation.
static ContentItem bool fromEndpoint (Platform $platform, string $endpoint)
 Retrieve a content item definition.

Public Attributes

array $readonly = null
 Readonly properties.

Protected Member Functions

bool fromJsonObject (object $obj)
 Extract content item details from its JSON representation.

Protected Attributes

Item $item
 Item object.

Detailed Description

Class to represent a content item.

Author
Stephen P Vickers steph.nosp@m.en@s.nosp@m.pvsof.nosp@m.twar.nosp@m.eprod.nosp@m.ucts.nosp@m..com
Licence: http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3

Member Function Documentation

◆ delete()

bool delete ( Platform $platform)

Delete a content-item.

Parameters
Platform$platformPlatform object
Returns
bool True if successful

References fromType().

◆ fromEndpoint()

ContentItem bool fromEndpoint ( Platform $platform,
string $endpoint )
static

Retrieve a content item definition.

Parameters
Platform$platformPlatform object
string$endpointID value
Returns
ContentItem|bool ContentItem object or false on error

References Util\$strictMode.

Referenced by fromType().

◆ fromJsonItem()

ContentItem LtiLinkContentItem null fromJsonItem ( object $item)
static

Generate a Content Item object from its JSON representation.

Parameters
object$itemA JSON object representing a content item
Returns
ContentItem|LtiLinkContentItem|null The content item object

Referenced by toJsonObject().

◆ fromJsonObject()

bool fromJsonObject ( object $obj)
protected

Extract content item details from its JSON representation.

Parameters
object$objA JSON object representing a content item
Returns
bool True if the item is valid

Reimplemented in LtiLinkContentItem.

◆ fromType()

ContentItem LtiLinkContentItem null fromType ( string $type,
?string $id = null )
static

Generate a Content Item object from its type.

Parameters
string$typeType of content item
string | null$idEndpoint of content item
Returns
ContentItem|LtiLinkContentItem|null The content item object

References fromEndpoint().

Referenced by delete().

◆ getItem()

Item getItem ( )

Get content item.

Returns
Item Item object for this content item.

References $item.

◆ toJson()

string toJson ( )

Wrap the content item to form a JSON string.

Returns
string

◆ toJsonObject()

object toJsonObject ( )

Wrap the content items to form a JSON object of the value.

Returns
object JSON object

Reimplemented in LtiLinkContentItem.

References $item, Util\checkString(), fromJsonItem(), and Util\setMessage().