ILIAS  release_8 Revision v8.23
ilLTIPlatform Class Reference

LTI provider for LTI launch. More...

+ Inheritance diagram for ilLTIPlatform:
+ Collaboration diagram for ilLTIPlatform:

Public Member Functions

 __construct (ilLTIDataConnector $dataConnector=null)
 Class constructor. More...
 
 initialize ()
 Initialise the platform. More...
 
 setExtConsumerId (int $a_id)
 
 getExtConsumerId ()
 
 setRefId (int $a_ref_id)
 
 getRefId ()
 
 setTitle (string $title)
 
 getTitle ()
 
 setDescription (string $description)
 
 getDescription ()
 
 setPrefix (string $prefix)
 
 getPrefix ()
 
 setSecret (string $secret)
 
 getSecret ()
 
 createSecret ()
 Create a secret. More...
 
 setLanguage (string $lang)
 
 getLanguage ()
 
 setActive (bool $value)
 
 getActive ()
 
 setRole (int $role_id)
 
 getRole ()
 
 setEnabled (bool $a_status)
 
 getEnabled ()
 
 saveGlobalToolConsumerSettings (ilLTIDataConnector $dataConnector)
 Save global consumer settings. More...
 
 deleteGlobalToolConsumerSettings (ilLTIDataConnector $dataConnector)
 Delete global tool consumer settings. More...
 
 saveLTI (ilLTIDataConnector $dataConnector)
 Save the tool consumer to the database with ILIAS extension. More...
 

Static Public Member Functions

static fromPlatformId (string $platformId, string $clientId, string $deploymentId, ilLTIDataConnector $dataConnector=null, bool $autoEnable=false)
 Load the platform from the database by its platform, client and deployment IDs. More...
 
static fromConsumerKey (?string $key=null, $dataConnector=null, bool $autoEnable=false)
 Load the platform from the database by its consumer key. More...
 
static fromRecordId (int $id, ilLTIDataConnector $dataConnector)
 Load the platform from the database by its record ID. More...
 
static fromExternalConsumerId (int $id, ilLTIDataConnector $dataConnector)
 
static fromGlobalSettingsAndRefId (int $a_ext_consumer_id, int $a_ref_id, ilLTIDataConnector $a_data_connector)
 Load consumer from global settings and ref_id. More...
 

Protected Attributes

int $ref_id = 0
 
int $ext_consumer_id = 0
 
string $title = ''
 
string $description = ''
 
string $prefix = ''
 
string $user_language = ''
 
int $role = 0
 
bool $active = false
 

Private Attributes

array $settings = null
 Setting values (LTI parameters, custom parameters and local parameters). More...
 
int $id = null
 System ID value. More...
 
string $key = null
 Consumer key/client ID value. More...
 

Detailed Description

LTI provider for LTI launch.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e

Definition at line 35 of file class.ilLTIPlatform.php.

Constructor & Destructor Documentation

◆ __construct()

ilLTIPlatform::__construct ( ilLTIDataConnector  $dataConnector = null)

Class constructor.

Parameters
ilLTIDataConnector | null$dataConnectorA data connector object

Definition at line 102 of file class.ilLTIPlatform.php.

References ILIAS\LTI\ToolProvider\$dataConnector, ilLTIDataConnector\getDataConnector(), and initialize().

103  {
104  $this->initialize();
105  if (empty($dataConnector)) {
106  $dataConnector = ilLTIDataConnector::getDataConnector();
107  }
108  $this->dataConnector = $dataConnector;
109  }
static getDataConnector(object $db=null, string $dbTableNamePrefix='', string $type='')
ilLTIDataConnector $dataConnector
Data connector object.
Definition: System.php:64
initialize()
Initialise the platform.
+ Here is the call graph for this function:

Member Function Documentation

◆ createSecret()

ilLTIPlatform::createSecret ( )

Create a secret.

Definition at line 221 of file class.ilLTIPlatform.php.

References setSecret().

221  : void
222  {
223  $this->setSecret(\ILIAS\LTI\ToolProvider\Util::getRandomString(12));
224  }
Class ChatMainBarProvider .
setSecret(string $secret)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ deleteGlobalToolConsumerSettings()

ilLTIPlatform::deleteGlobalToolConsumerSettings ( ilLTIDataConnector  $dataConnector)

Delete global tool consumer settings.

Parameters
ilLTIDataConnector$dataConnector

Definition at line 382 of file class.ilLTIPlatform.php.

References ilLTIDataConnector\deleteGlobalToolConsumerSettings().

382  : void
383  {
384  $dataConnector->deleteGlobalToolConsumerSettings($this);
385  }
deleteGlobalToolConsumerSettings(ilLTIPlatform $platform)
Delete global tool consumer settings.
+ Here is the call graph for this function:

◆ fromConsumerKey()

static ilLTIPlatform::fromConsumerKey ( ?string  $key = null,
  $dataConnector = null,
bool  $autoEnable = false 
)
static

Load the platform from the database by its consumer key.

Parameters
string$keyConsumer key
ilLTIDataConnector$dataConnectorA data connector object
bool$autoEnabletrue if the platform is to be enabled automatically (optional, default is false)
Returns
Platform The platform object

Definition at line 300 of file class.ilLTIPlatform.php.

References ILIAS\LTI\ToolProvider\$dataConnector, ilLoggerFactory\getLogger(), ilLTIDataConnector\loadGlobalToolConsumerSettings(), and ilLTIDataConnector\loadPlatform().

Referenced by ILIAS\LTI\ToolProvider\parseMessage().

301  {
302  $platform = new ilLTIPlatform($dataConnector);
303  $platform->initialize();
304  $platform->setKey($key);
305  ilLoggerFactory::getLogger('ltis')->debug('Loading with key: ' . $platform->getKey());
306  $dataConnector->loadPlatform($platform);
308  return $platform;
309  }
static getLogger(string $a_component_id)
Get component logger.
loadPlatform(\ILIAS\LTI\ToolProvider\Platform $platform)
Load platform object.
LTI provider for LTI launch.
string $key
Consumer key/client ID value.
ilLTIDataConnector $dataConnector
Data connector object.
Definition: System.php:64
loadGlobalToolConsumerSettings(ilLTIPlatform $platform)
Load tool consumer settings.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fromExternalConsumerId()

static ilLTIPlatform::fromExternalConsumerId ( int  $id,
ilLTIDataConnector  $dataConnector 
)
static
Parameters
int$id
ilLTIDataConnector$dataConnector
Returns
ilLTIPlatform

Definition at line 334 of file class.ilLTIPlatform.php.

References ilLTIDataConnector\loadGlobalToolConsumerSettings().

Referenced by ilObjLTIAdministrationGUI\changeStatusLTIConsumer(), ilObjLTIAdministrationGUI\deleteLTIConsumer(), ilObjLTIAdministrationGUI\editConsumer(), ilObjLTIAdministration\getActiveObjectTypes(), and ilObjLTIAdministrationGUI\updateLTIConsumer().

335  {
336  $platform = new ilLTIPlatform($dataConnector);
337  //$platform->setRecordId((int) $id);
338  //$dataConnector->loadPlatform($platform);
339  $platform->initialize();
340  $platform->setExtConsumerId($id);
341  if (!$dataConnector->loadGlobalToolConsumerSettings($platform)) {
342  $platform->initialize();
343  }
344  return $platform;
345  }
int $id
System ID value.
LTI provider for LTI launch.
loadGlobalToolConsumerSettings(ilLTIPlatform $platform)
Load tool consumer settings.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fromGlobalSettingsAndRefId()

static ilLTIPlatform::fromGlobalSettingsAndRefId ( int  $a_ext_consumer_id,
int  $a_ref_id,
ilLTIDataConnector  $a_data_connector 
)
static

Load consumer from global settings and ref_id.

Parameters
int$a_ext_consumer_id
int$a_ref_id
ilLTIDataConnector$a_data_connector
Returns
ilLTIPlatform

Definition at line 354 of file class.ilLTIPlatform.php.

References ilLTIDataConnector\lookupRecordIdByGlobalSettingsAndRefId().

Referenced by ilLTIProviderObjectSettingGUI\initObjectSettingsForm(), and ilLTIProviderObjectSettingGUI\updateSettings().

354  : ilLTIPlatform
355  {
356  $toolConsumer = new ilLTIPlatform(null, $a_data_connector);
357  $toolConsumer->initialize();
358  $toolConsumer->setExtConsumerId($a_ext_consumer_id);
359  $toolConsumer->setRefId($a_ref_id);
360 
361  $consumer_pk = $a_data_connector->lookupRecordIdByGlobalSettingsAndRefId($toolConsumer);
362  if ($consumer_pk != null) {
363  $toolConsumer = self::fromRecordId($consumer_pk, $a_data_connector);
364  }
365  return $toolConsumer;
366  }
lookupRecordIdByGlobalSettingsAndRefId(ilLTIPlatform $platform)
Load extended tool consumer object with ILIAS extension.
LTI provider for LTI launch.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fromPlatformId()

static ilLTIPlatform::fromPlatformId ( string  $platformId,
string  $clientId,
string  $deploymentId,
ilLTIDataConnector  $dataConnector = null,
bool  $autoEnable = false 
)
static

Load the platform from the database by its platform, client and deployment IDs.

Parameters
string$platformIdThe platform ID
string$clientIdThe client ID
string$deploymentIdThe deployment ID
ilLTIDataConnector$dataConnectorA data connector object
bool$autoEnableTrue if the platform is to be enabled automatically (optional, default is false)
Returns
Platform The platform object

Definition at line 281 of file class.ilLTIPlatform.php.

References $clientId, ILIAS\LTI\ToolProvider\$dataConnector, ilLTIDataConnector\loadGlobalToolConsumerSettings(), and ilLTIDataConnector\loadPlatform().

Referenced by ILIAS\LTI\ToolProvider\parseMessage(), and ILIAS\LTI\ToolProvider\Tool\sendAuthenticationRequest().

281  : ilLTIPlatform
282  {
283  $platform = new ilLTIPlatform($dataConnector);
284  $platform->initialize();
285  $platform->platformId = $platformId;
286  $platform->clientId = $clientId;
287  $platform->deploymentId = $deploymentId;
288  $dataConnector->loadPlatform($platform);
289  $dataConnector->loadGlobalToolConsumerSettings($platform);
290  return $platform;
291  }
$clientId
Definition: ltiregend.php:27
loadPlatform(\ILIAS\LTI\ToolProvider\Platform $platform)
Load platform object.
LTI provider for LTI launch.
loadGlobalToolConsumerSettings(ilLTIPlatform $platform)
Load tool consumer settings.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fromRecordId()

static ilLTIPlatform::fromRecordId ( int  $id,
ilLTIDataConnector  $dataConnector 
)
static

Load the platform from the database by its record ID.

Parameters
int$idThe platform record ID
ilLTIDataConnector$dataConnectorDatabase connection object
Returns
Platform The platform object

Definition at line 317 of file class.ilLTIPlatform.php.

References ilLoggerFactory\getLogger(), ilLTIDataConnector\loadGlobalToolConsumerSettings(), and ilLTIDataConnector\loadPlatform().

Referenced by ILIAS\LTI\ToolProvider\Context\getPlatform(), and ilAuthProviderLTI\lookupConsumer().

318  {
319 // $platform = new static($dataConnector);
320  $platform = new ilLTIPlatform($dataConnector);
321  $platform->initialize();
322  $platform->setRecordId((int) $id);
323  ilLoggerFactory::getLogger('ltis')->info('Loading with record id: ' . $platform->getRecordId());
324  $dataConnector->loadPlatform($platform);
325  $dataConnector->loadGlobalToolConsumerSettings($platform);
326  return $platform;
327  }
static getLogger(string $a_component_id)
Get component logger.
loadPlatform(\ILIAS\LTI\ToolProvider\Platform $platform)
Load platform object.
int $id
System ID value.
LTI provider for LTI launch.
loadGlobalToolConsumerSettings(ilLTIPlatform $platform)
Load tool consumer settings.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getActive()

ilLTIPlatform::getActive ( )

Definition at line 244 of file class.ilLTIPlatform.php.

References $active.

Referenced by ilLTIDataConnector\saveGlobalToolConsumerSettings().

244  : bool
245  {
246  return $this->active;
247  }
+ Here is the caller graph for this function:

◆ getDescription()

ilLTIPlatform::getDescription ( )

Definition at line 193 of file class.ilLTIPlatform.php.

References $description.

Referenced by ilLTIDataConnector\saveGlobalToolConsumerSettings().

193  : string
194  {
195  return $this->description;
196  }
+ Here is the caller graph for this function:

◆ getEnabled()

ilLTIPlatform::getEnabled ( )

Definition at line 265 of file class.ilLTIPlatform.php.

References ILIAS\LTI\ToolProvider\$enabled.

265  : bool
266  {
267  return $this->enabled;
268  }
bool $enabled
Whether the system instance is enabled to accept connection requests.
Definition: System.php:123

◆ getExtConsumerId()

◆ getLanguage()

ilLTIPlatform::getLanguage ( )

Definition at line 234 of file class.ilLTIPlatform.php.

References $user_language.

Referenced by ilAuthProviderLTI\createUser(), and ilLTIDataConnector\saveGlobalToolConsumerSettings().

234  : string
235  {
236  return $this->user_language;
237  }
+ Here is the caller graph for this function:

◆ getPrefix()

ilLTIPlatform::getPrefix ( )

Definition at line 203 of file class.ilLTIPlatform.php.

References $prefix.

Referenced by ilAuthProviderLTI\createUser(), and ilLTIDataConnector\saveGlobalToolConsumerSettings().

203  : string
204  {
205  return $this->prefix;
206  }
+ Here is the caller graph for this function:

◆ getRefId()

ilLTIPlatform::getRefId ( )

Definition at line 167 of file class.ilLTIPlatform.php.

References $ref_id.

Referenced by ilLTIDataConnector\lookupRecordIdByGlobalSettingsAndRefId(), and ilLTIDataConnector\saveToolConsumerILIAS().

167  : int
168  {
169  return $this->ref_id;
170  }
+ Here is the caller graph for this function:

◆ getRole()

ilLTIPlatform::getRole ( )

Definition at line 254 of file class.ilLTIPlatform.php.

References $role.

Referenced by ilAuthProviderLTI\createUser(), ilLTIDataConnector\saveGlobalToolConsumerSettings(), and ilAuthProviderLTI\updateUser().

254  : int
255  {
256  return $this->role;
257  }
+ Here is the caller graph for this function:

◆ getSecret()

ilLTIPlatform::getSecret ( )

Definition at line 213 of file class.ilLTIPlatform.php.

References ILIAS\LTI\ToolProvider\$secret.

213  : ?string
214  {
215  return $this->secret;
216  }
string $secret
Shared secret.
Definition: System.php:43

◆ getTitle()

ilLTIPlatform::getTitle ( )

Definition at line 183 of file class.ilLTIPlatform.php.

References $title.

Referenced by ilLTIDataConnector\saveGlobalToolConsumerSettings(), and ilLTIDataConnector\saveToolConsumerILIAS().

183  : string
184  {
185  return $this->title;
186  }
+ Here is the caller graph for this function:

◆ initialize()

ilLTIPlatform::initialize ( )

Initialise the platform.

Definition at line 114 of file class.ilLTIPlatform.php.

References ILIAS\LTI\ToolProvider\Tool\ID_SCOPE_ID_ONLY, and ILIAS\Repository\settings().

Referenced by __construct(), and ilLTIDataConnector\deleteGlobalToolConsumerSettings().

114  : void
115  {
116  $this->id = null;
117  $this->key = null;
118  $this->name = null;
119  $this->secret = null;
120  $this->signatureMethod = 'HMAC-SHA1';
121  $this->encryptionMethod = '';
122  $this->rsaKey = null;
123  $this->kid = null;
124  $this->jku = '';
125  $this->platformId = null;
126  $this->clientId = null;
127  $this->deploymentId = null;
128  $this->ltiVersion = null;
129  $this->consumerName = null;
130  $this->consumerVersion = null;
131  $this->consumerGuid = null;
132  $this->profile = null;
133  $this->toolProxy = null;
134  $this->settings = array();
135  $this->protected = false;
136  $this->enabled = false;
137  $this->enableFrom = null;
138  $this->enableUntil = null;
139  $this->lastAccess = null;
141  $this->defaultEmail = '';
142  $this->created = null;
143  $this->updated = null;
144  //added
145  $this->authorizationServerId = '';
146  $this->authenticationUrl = '';
147  $this->accessTokenUrl = '';
148  $this->debugMode = false;
149  }
const ID_SCOPE_ID_ONLY
Use ID value only.
Definition: Tool.php:51
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveGlobalToolConsumerSettings()

ilLTIPlatform::saveGlobalToolConsumerSettings ( ilLTIDataConnector  $dataConnector)

Save global consumer settings.

Parameters
ilLTIDataConnector$dataConnector

Definition at line 373 of file class.ilLTIPlatform.php.

References ilLTIDataConnector\saveGlobalToolConsumerSettings().

373  : void
374  {
375  $dataConnector->saveGlobalToolConsumerSettings($this);
376  }
saveGlobalToolConsumerSettings(ilLTIPlatform $platform)
Save platform object.
+ Here is the call graph for this function:

◆ saveLTI()

ilLTIPlatform::saveLTI ( ilLTIDataConnector  $dataConnector)

Save the tool consumer to the database with ILIAS extension.

Parameters
ilLTIDataConnector$dataConnector
Returns
boolean True if the object was successfully saved

Definition at line 392 of file class.ilLTIPlatform.php.

References ilLTIDataConnector\saveToolConsumerILIAS().

392  : bool
393  {
394  $ok = $dataConnector->saveToolConsumerILIAS($this);
395  return $ok;
396  }
saveToolConsumerILIAS(ilLTIPlatform $platform)
Save extended tool consumer object with ILIAS extensions.
+ Here is the call graph for this function:

◆ setActive()

ilLTIPlatform::setActive ( bool  $value)

Definition at line 239 of file class.ilLTIPlatform.php.

Referenced by ilLTIDataConnector\loadGlobalToolConsumerSettings().

239  : void
240  {
241  $this->active = $value;
242  }
+ Here is the caller graph for this function:

◆ setDescription()

ilLTIPlatform::setDescription ( string  $description)

Definition at line 188 of file class.ilLTIPlatform.php.

References $description.

Referenced by ilLTIDataConnector\loadGlobalToolConsumerSettings().

188  : void
189  {
190  $this->description = $description;
191  }
+ Here is the caller graph for this function:

◆ setEnabled()

ilLTIPlatform::setEnabled ( bool  $a_status)

Definition at line 260 of file class.ilLTIPlatform.php.

260  : void
261  {
262  $this->enabled = $a_status;
263  }

◆ setExtConsumerId()

ilLTIPlatform::setExtConsumerId ( int  $a_id)

Definition at line 152 of file class.ilLTIPlatform.php.

Referenced by ilLTIDataConnector\saveGlobalToolConsumerSettings().

152  : void
153  {
154  $this->ext_consumer_id = $a_id;
155  }
+ Here is the caller graph for this function:

◆ setLanguage()

ilLTIPlatform::setLanguage ( string  $lang)
Parameters
string$lang

Definition at line 229 of file class.ilLTIPlatform.php.

References $lang.

Referenced by ilLTIDataConnector\loadGlobalToolConsumerSettings().

229  : void
230  {
231  $this->user_language = $lang;
232  }
$lang
Definition: xapiexit.php:26
+ Here is the caller graph for this function:

◆ setPrefix()

ilLTIPlatform::setPrefix ( string  $prefix)

Definition at line 198 of file class.ilLTIPlatform.php.

References $prefix.

Referenced by ilLTIDataConnector\loadGlobalToolConsumerSettings().

198  : void
199  {
200  $this->prefix = $prefix;
201  }
+ Here is the caller graph for this function:

◆ setRefId()

ilLTIPlatform::setRefId ( int  $a_ref_id)

Definition at line 162 of file class.ilLTIPlatform.php.

162  : void
163  {
164  $this->ref_id = $a_ref_id;
165  }

◆ setRole()

ilLTIPlatform::setRole ( int  $role_id)

Definition at line 249 of file class.ilLTIPlatform.php.

Referenced by ilLTIDataConnector\loadGlobalToolConsumerSettings().

249  : void
250  {
251  $this->role = $role_id;
252  }
+ Here is the caller graph for this function:

◆ setSecret()

ilLTIPlatform::setSecret ( string  $secret)

Definition at line 208 of file class.ilLTIPlatform.php.

References ILIAS\LTI\ToolProvider\$secret.

Referenced by createSecret().

208  : void
209  {
210  $this->secret = $secret;
211  }
string $secret
Shared secret.
Definition: System.php:43
+ Here is the caller graph for this function:

◆ setTitle()

ilLTIPlatform::setTitle ( string  $title)

Definition at line 177 of file class.ilLTIPlatform.php.

References $title.

Referenced by ilLTIDataConnector\loadGlobalToolConsumerSettings().

177  : void
178  {
179  $this->title = $title;
180  // $this->consumerName = $title;
181  }
+ Here is the caller graph for this function:

Field Documentation

◆ $active

bool ilLTIPlatform::$active = false
protected

Definition at line 75 of file class.ilLTIPlatform.php.

Referenced by getActive().

◆ $description

string ilLTIPlatform::$description = ''
protected

Definition at line 55 of file class.ilLTIPlatform.php.

Referenced by getDescription(), and setDescription().

◆ $ext_consumer_id

int ilLTIPlatform::$ext_consumer_id = 0
protected

Definition at line 45 of file class.ilLTIPlatform.php.

Referenced by getExtConsumerId().

◆ $id

int null ilLTIPlatform::$id = null
private

System ID value.

Definition at line 89 of file class.ilLTIPlatform.php.

◆ $key

string null ilLTIPlatform::$key = null
private

Consumer key/client ID value.

Definition at line 96 of file class.ilLTIPlatform.php.

◆ $prefix

string ilLTIPlatform::$prefix = ''
protected

Definition at line 60 of file class.ilLTIPlatform.php.

Referenced by getPrefix(), and setPrefix().

◆ $ref_id

int ilLTIPlatform::$ref_id = 0
protected

Definition at line 40 of file class.ilLTIPlatform.php.

Referenced by getRefId().

◆ $role

int ilLTIPlatform::$role = 0
protected

Definition at line 70 of file class.ilLTIPlatform.php.

Referenced by getRole().

◆ $settings

array ilLTIPlatform::$settings = null
private

Setting values (LTI parameters, custom parameters and local parameters).

Definition at line 82 of file class.ilLTIPlatform.php.

◆ $title

string ilLTIPlatform::$title = ''
protected

Definition at line 50 of file class.ilLTIPlatform.php.

Referenced by getTitle(), and setTitle().

◆ $user_language

string ilLTIPlatform::$user_language = ''
protected

Definition at line 65 of file class.ilLTIPlatform.php.

Referenced by getLanguage().


The documentation for this class was generated from the following file: