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

Class to implement the Link and Content service. More...

Inheritance diagram for LinkContent:

Public Member Functions

 __construct (Platform $platform, string $endpoint, ?int $limit=null, bool $pagingMode=false)
 Class constructor.
ContentItem[] bool getAll (?string $ltiResourceLinkId=null, ?int $limit=null)
 Retrieve all content items.
bool createContentItem (ContentItem &$contentItem)
 Create a new content item.
bool saveContentItem (ContentItem $contentItem)
 Save a content item.
bool deleteContentItem ()
 Delete a content item.
ContentItem bool get ()
 Retrieve a content item.
Public Member Functions inherited from Service
 __construct (Platform $platform, ?string $endpoint)
 Class constructor.
Platform getPlatform ()
 Get platform.
string getScope ()
 Get access scope.
HttpMessage send (string $method, ?array $parameters=[], string $body="")
 Send a service request.
HttpMessage getHttpMessage ()
 Get HttpMessage object for last request.

Public Attributes

const MEDIA_TYPE_CONTENT_ITEM = 'application/json'
 Content item media type.
const MEDIA_TYPE_CONTENT_ITEMS = 'application/json'
 Content item container media type.
Public Attributes inherited from Service
bool $unsigned = false
 Whether service request should be sent unsigned.

Static Public Attributes

static string $SCOPE_READ = 'https://purl.imsglobal.org/spec/lti/scope/contentitem.read'
 Read access scope.
static string $SCOPE_CREATE = 'https://purl.imsglobal.org/spec/lti/scope/contentitem.create'
 Read access scope.
static string $SCOPE_UPDATE = 'https://purl.imsglobal.org/spec/lti/scope/contentitem.update'
 Update access scope.
static string $SCOPE_DELETE = 'https://purl.imsglobal.org/spec/lti/scope/contentitem.delete'
 Delete access scope.
static int $defaultLimit = null
 Default limit on size of container to be returned from requests.

Additional Inherited Members

Protected Member Functions inherited from Service
array parseContextsInArray (object|array $contexts, array $arr)
 Parse the JSON for context references.
Protected Attributes inherited from Service
string $endpoint = null
 Service endpoint.
string $scope = null
 Service access scope.
string $mediaType = null
 Media type of message body.

Detailed Description

Class to implement the Link and Content service.

This service can be used as either the context-level or item-level service.

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

Constructor & Destructor Documentation

◆ __construct()

__construct ( Platform $platform,
string $endpoint,
?int $limit = null,
bool $pagingMode = false )

Class constructor.

Parameters
Platform$platformPlatform object for this service request
string$endpointService endpoint
int | null$limitLimit of content items to be returned in each request, null for all
bool$pagingModeTrue if only a single page should be requested when a limit is set

Member Function Documentation

◆ createContentItem()

bool createContentItem ( ContentItem & $contentItem)

Create a new content item.

Parameters
ContentItem$contentItemContent item object
Returns
bool True if successful

◆ deleteContentItem()

bool deleteContentItem ( )

Delete a content item.

Returns
bool True if successful

◆ get()

ContentItem bool get ( )

Retrieve a content item.

Returns
ContentItem|bool ContentItem object, or false on error

◆ getAll()

ContentItem[] bool getAll ( ?string $ltiResourceLinkId = null,
?int $limit = null )

Retrieve all content items.

The returned items can be filtered by a resource link ID. Requests can also be limited to a number of items which may mean that multiple requests will be made to retrieve the full list.

Parameters
string | null$ltiResourceLinkIdLTI resource link ID (optional)
int | null$limitLimit of content items to be returned in each request, null for service default (optional)
Returns
ContentItem[]|bool Array of ContentItem objects or false on error

◆ saveContentItem()

bool saveContentItem ( ContentItem $contentItem)

Save a content item.

Parameters
ContentItem$contentItemContent item object
Returns
bool True if successful