Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

(no description)

File Size: 179 lines (7 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

context:: (8 methods):
  __construct()
  create()
  is_valid_type()
  get_id()
  get_contextid()
  get_deploymentid()
  get_types()
  set_types()


Class: context  - X-Ref

Class context, instances of which represent a context in the platform.

See: http://www.imsglobal.org/spec/lti/v1p3/#context-type-vocabulary for supported context types.

__construct(int $deploymentid, string $contextid, array $types, ?int $id)   X-Ref
Private constructor.

param: int $deploymentid the local id of the deployment instance to which this context belongs.
param: string $contextid the context id string, as provided by the platform during launch.
param: array $types an array of string context types, as provided by the platform during launch.
param: int|null $id local id of this object instance, nullable for new objects.

create(int $deploymentid, string $contextid, array $types, int $id = null)   X-Ref
Factory method for creating a context instance.

return: context the context instance.
param: int $deploymentid the local id of the deployment instance to which this context belongs.
param: string $contextid the context id string, as provided by the platform during launch.
param: array $types an array of string context types, as provided by the platform during launch.
param: int|null $id local id of this object instance, nullable for new objects.

is_valid_type(string $type, bool $includelegacy = false)   X-Ref
Check whether a context is valid or not, checking also deprecated but supported legacy context names.

return: bool true if the type is valid, false otherwise.
param: string $type context type to check.
param: bool $includelegacy whether to check the legacy simple context names too.

get_id()   X-Ref
Get the object instance id.

return: int|null the id, or null if the object doesn't yet have one assigned.

get_contextid()   X-Ref
Return the platform contextid string.

return: string the id of the context in the platform.

get_deploymentid()   X-Ref
Get the id of the local deployment instance to which this context instance belongs.

return: int the id of the local deployment instance to which this context instance belongs.

get_types()   X-Ref
Get the context types this context instance represents.

return: string[] the array of context types this context instance represents.

set_types(array $types)   X-Ref
Set the list of types this context instance represents.

param: array $types the array of string types.