163 $this->groupSets = null;
164 $this->groups = null;
165 $this->created = null;
166 $this->updated = null;
188 $this->settingsChanged =
false;
199 public function delete():
bool 241 if (is_null($this->platform)) {
254 $this->platform = null;
315 if (array_key_exists($name, $this->
settings)) {
332 if ($value !== $old_value) {
333 if (!empty($value)) {
338 $this->settingsChanged =
true;
368 if ($this->settingsChanged) {
384 $has = !empty($this->
getSetting(
'custom_context_setting_url'));
401 if (!empty($this->
getSetting(
'custom_context_setting_url'))) {
405 $this->lastServiceRequest =
$service->getHttpMessage();
406 $ok = $settings !==
false;
410 $hook =
new $className($this);
411 $settings = $hook->getToolSettings($mode, $simple);
425 if (!empty($this->
getSetting(
'custom_context_setting_url'))) {
429 $this->lastServiceRequest =
$service->getHttpMessage();
433 $hook =
new $className($this);
434 $ok = $hook->setToolSettings($settings);
447 $has = !empty($this->
getSetting(
'custom_context_groups_url'));
461 $groupsUrl = $this->
getSetting(
'custom_context_groups_url');
462 $groupsetsUrl = $this->
getSetting(
'custom_context_group_sets_url');
465 if (!empty(
$service->getHttpMessage())) {
466 $this->lastServiceRequest =
$service->getHttpMessage();
470 $hook =
new $className($this);
471 $ok = $hook->getGroups();
488 'Method ceLTIc\LTI\Context::hasMembershipService() has been deprecated; please use ceLTIc\LTI\Context::hasMembershipsService() instead.',
501 $has = !empty($this->
getSetting(
'custom_context_memberships_url')) || !empty($this->
getSetting(
'custom_context_memberships_v2_url'));
519 'Method ceLTIc\LTI\Context::getMembership() has been deprecated; please use ceLTIc\LTI\Context::getMemberships() instead.',
533 $userResults = array();
534 $hasMembershipsService = !empty($this->
getSetting(
'custom_context_memberships_url'));
535 $hasNRPService = !empty($this->
getSetting(
'custom_context_memberships_v2_url'));
536 $hasGroupsService = !empty($this->
getSetting(
'custom_context_groups_url')) ||
539 if (($hasMembershipsService || $hasNRPService) && (!$withGroups || ($hasNRPService && $hasGroupsService) || !$hasApiHook)) {
540 if ($hasNRPService) {
548 if (!$withGroups || !$hasNRPService) {
551 $userResults =
$service->getWithGroups();
553 if (!empty(
$service->getHttpMessage())) {
554 $this->lastServiceRequest =
$service->getHttpMessage();
556 $ok = $userResults !==
false;
558 if (!$ok && $hasApiHook) {
560 $hook =
new $className($this);
561 $userResults = $hook->getMemberships($withGroups);
575 if (!empty($this->
getSetting(
'custom_ags_scopes'))) {
578 $has = !empty($this->
getSetting(
'custom_lineitems_url'));
593 if (!empty($this->
getSetting(
'custom_ags_scopes'))) {
596 $has = !empty($this->
getSetting(
'custom_lineitems_url'));
611 if (!empty($this->
getSetting(
'custom_ags_scopes'))) {
614 $has = !empty($this->
getSetting(
'custom_lineitems_url'));
628 public function getLineItems(
string $resourceId = null,
string $tag = null,
int $limit = null)
631 $this->lastServiceRequest = null;
633 if (!empty($lineItemService)) {
634 $lineItems = $lineItemService->getAll(null, $resourceId, $tag);
635 $http = $lineItemService->getHttpMessage();
636 $this->lastServiceRequest =
$http;
651 if (!empty($lineItemService)) {
652 $ok = $lineItemService->createLineItem($lineItem);
701 if (!empty($ltiContextId)) {
717 private function load(
int $id = null): bool
735 $lineItemService =
false;
738 return $lineItemService;
getToolSettings(int $mode=Service\ToolSettings::MODE_CURRENT_LEVEL, bool $simple=true)
Get Tool Settings.
initialize()
Initialise the context.
string $title
Context title.
setToolSettings(array $settings=array())
Set Tool Settings.
getRecordId()
Get the context record ID.
getLineItems(string $resourceId=null, string $tag=null, int $limit=null)
Get line items.
getKey()
Get consumer key.
initialise()
Initialise the context.
Class ChatMainBarProvider .
getMembership()
Get Membership.
setSettings(array $settings)
Set an array of all setting values.
static fromRecordId(int $id, \ILIAS\LTI\ToolProvider\DataConnector\DataConnector $dataConnector)
Load the context from the database.
setSetting(string $name, string $value=null)
Set a setting value.
getGroups()
Get course group sets and groups.
int $platformId
Platform ID for this context.
ILIAS LTI ToolProvider DataConnector DataConnector $dataConnector
Data connector object or string.
hasGroupService()
Check if a Course Group service is available.
hasResultService()
Check if the Result service is available.
array $groups
User groups (null if the platform does not support the groups enhancement)
getSettings()
Get an array of all setting values.
setPlatformId(int $platformId)
Set platform ID.
hasToolSettingsService()
Check if the Tool Settings service is available.
string $ltiContextId
Context ID as supplied in the last connection request.
saveSettings()
Save setting values.
static fromPlatform(Platform $platform, string $ltiContextId)
Class constructor from consumer.
HTTPMessage $lastServiceRequest
HttpMessage object for last service request.
hasMembershipService()
Check if the Membership service is supported.
getSetting(string $name, string $default='')
Get a setting value.
string $type
Context type.
save()
Save the context to the database.
getMemberships(bool $withGroups=false)
Get Memberships.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setRecordId(int $id)
Sets the context record ID.
array $groupSets
User group sets (null if the platform does not support the groups enhancement)
getLineItemService()
Get the Line Item service object.
Platform $platform
Platform for this context.
__construct()
Class constructor.
hasLineItemService()
Check if the Line Item service is available.
int $updated
Timestamp for when the object was last updated.
createLineItem(LineItem $lineItem)
Create a new line item.
hasMembershipsService()
Check if a Membership service is available.
Class to represent a platform context.
getDataConnector()
Get the data connector.
int $id
ID for this context.
load(int $id=null)
Load the context from the database.
int $created
Timestamp for when the object was created.
bool $settingsChanged
Whether the settings value have changed since last saved.
getPlatform()
Get tool consumer.
hasScoreService()
Check if the Score service is available.
array $settings
Setting values (LTI parameters, custom parameters and local parameters).