ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
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, DataConnector $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|string $id, DataConnector $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 32 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 99 of file class.ilLTIPlatform.php.

References ilLTIDataConnector\getDataConnector(), and initialize().

100  {
101  $this->initialize();
102  if (empty($dataConnector)) {
103  $dataConnector = ilLTIDataConnector::getDataConnector();
104  }
105  $this->dataConnector = $dataConnector;
106  }
static getDataConnector(mixed $db=null, string $dbTableNamePrefix='', string $type='')
initialize()
Initialise the platform.
+ Here is the call graph for this function:

Member Function Documentation

◆ createSecret()

ilLTIPlatform::createSecret ( )

Create a secret.

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

References setSecret().

219  : void
220  {
221  $this->setSecret(Util::getRandomString(12));
222  }
setSecret(string $secret)
+ Here is the call graph for this function:

◆ deleteGlobalToolConsumerSettings()

ilLTIPlatform::deleteGlobalToolConsumerSettings ( ilLTIDataConnector  $dataConnector)

Delete global tool consumer settings.

Parameters
ilLTIDataConnector$dataConnector

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

References ilLTIDataConnector\deleteGlobalToolConsumerSettings().

380  : void
381  {
382  $dataConnector->deleteGlobalToolConsumerSettings($this);
383  }
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 | null$keyConsumer key
null$dataConnectorA data connector object
bool$autoEnabletrue if the platform is to be enabled automatically (optional, default is false)
Returns
ilLTIPlatform Platform The platform object

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

References ilLoggerFactory\getLogger().

Referenced by ilAuthProviderLTI\findGlobalRole().

298  : ilLTIPlatform
299  {
300  $platform = new ilLTIPlatform($dataConnector);
301  $platform->initialize();
302  $platform->setKey($key);
303  ilLoggerFactory::getLogger('ltis')->debug('Loading with key: ' . $platform->getKey());
304  $dataConnector->loadPlatform($platform);
305  $dataConnector->loadGlobalToolConsumerSettings($platform);
306  return $platform;
307  }
static getLogger(string $a_component_id)
Get component logger.
LTI provider for LTI launch.
string $key
Consumer key/client ID value.
+ 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 332 of file class.ilLTIPlatform.php.

References ilLTIDataConnector\loadGlobalToolConsumerSettings().

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

332  : ilLTIPlatform
333  {
334  $platform = new ilLTIPlatform($dataConnector);
335  //$platform->setRecordId((int) $id);
336  //$dataConnector->loadPlatform($platform);
337  $platform->initialize();
338  $platform->setExtConsumerId($id);
339  if (!$dataConnector->loadGlobalToolConsumerSettings($platform)) {
340  $platform->initialize();
341  }
342  return $platform;
343  }
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 352 of file class.ilLTIPlatform.php.

References ilLTIDataConnector\lookupRecordIdByGlobalSettingsAndRefId().

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

352  : ilLTIPlatform
353  {
354  $toolConsumer = new ilLTIPlatform(null, $a_data_connector);
355  $toolConsumer->initialize();
356  $toolConsumer->setExtConsumerId($a_ext_consumer_id);
357  $toolConsumer->setRefId($a_ref_id);
358 
359  $consumer_pk = $a_data_connector->lookupRecordIdByGlobalSettingsAndRefId($toolConsumer);
360  if ($consumer_pk != null) {
361  $toolConsumer = self::fromRecordId($consumer_pk, $a_data_connector);
362  }
363  return $toolConsumer;
364  }
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,
DataConnector  $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 | null$clientIdThe client ID
string | null$deploymentIdThe deployment ID
ilLTIDataConnector | null$dataConnectorA data connector object
bool$autoEnableTrue if the platform is to be enabled automatically (optional, default is false)
Returns
ilLTIPlatform The platform object

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

References $clientId.

279  : ilLTIPlatform
280  {
281  $platform = new ilLTIPlatform($dataConnector);
282  $platform->initialize();
283  $platform->platformId = $platformId;
284  $platform->clientId = $clientId;
285  $platform->deploymentId = $deploymentId;
286  $dataConnector->loadPlatform($platform);
287  $dataConnector->loadGlobalToolConsumerSettings($platform);
288  return $platform;
289  }
$clientId
Definition: ltiregend.php:26
LTI provider for LTI launch.

◆ fromRecordId()

static ilLTIPlatform::fromRecordId ( int|string  $id,
DataConnector  $dataConnector 
)
static

Load the platform from the database by its record ID.

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

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

References ilLoggerFactory\getLogger().

Referenced by ilAuthProviderLTI\lookupConsumer().

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

◆ getActive()

ilLTIPlatform::getActive ( )

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

References $active.

Referenced by ilLTIDataConnector\saveGlobalToolConsumerSettings().

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

◆ getDescription()

ilLTIPlatform::getDescription ( )

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

References $description.

Referenced by ilLTIDataConnector\saveGlobalToolConsumerSettings().

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

◆ getEnabled()

ilLTIPlatform::getEnabled ( )

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

263  : bool
264  {
265  return $this->enabled;
266  }

◆ getExtConsumerId()

◆ getLanguage()

ilLTIPlatform::getLanguage ( )

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

References $user_language.

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

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

◆ getPrefix()

ilLTIPlatform::getPrefix ( )

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

References $prefix.

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

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

◆ getRefId()

ilLTIPlatform::getRefId ( )

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

References $ref_id.

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

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

◆ getRole()

ilLTIPlatform::getRole ( )

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

References $role.

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

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

◆ getSecret()

ilLTIPlatform::getSecret ( )

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

211  : ?string
212  {
213  return $this->secret;
214  }

◆ getTitle()

ilLTIPlatform::getTitle ( )

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

References $title.

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

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

◆ initialize()

ilLTIPlatform::initialize ( )

Initialise the platform.

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

References ILIAS\Repository\profile(), and ILIAS\Repository\settings().

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

111  : void
112  {
113  $this->id = null;
114  $this->key = null;
115  $this->name = null;
116  $this->secret = null;
117  $this->signatureMethod = 'HMAC-SHA1';
118  $this->encryptionMethod = '';
119  $this->rsaKey = null;
120  $this->kid = null;
121  $this->jku = '';
122  $this->platformId = null;
123  $this->clientId = null;
124  $this->deploymentId = null;
125  $this->ltiVersion = null;
126  $this->consumerName = null;
127  $this->consumerVersion = null;
128  $this->consumerGuid = null;
129  $this->profile = null;
130  $this->toolProxy = null;
131  $this->settings = array();
132  $this->setSettings(array());
133  $this->protected = false;
134  $this->enabled = false;
135  $this->enableFrom = null;
136  $this->enableUntil = null;
137  $this->lastAccess = null;
138  $this->idScope = IdScope::IdOnly;
139  $this->defaultEmail = '';
140  $this->created = null;
141  $this->updated = null;
142  //added
143  $this->authorizationServerId = '';
144  $this->authenticationUrl = '';
145  $this->accessTokenUrl = '';
146  $this->debugMode = false;
147  }
+ 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 371 of file class.ilLTIPlatform.php.

References ilLTIDataConnector\saveGlobalToolConsumerSettings().

371  : void
372  {
373  $dataConnector->saveGlobalToolConsumerSettings($this);
374  }
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 390 of file class.ilLTIPlatform.php.

References ilLTIDataConnector\saveToolConsumerILIAS().

390  : bool
391  {
392  $ok = $dataConnector->saveToolConsumerILIAS($this);
393  return $ok;
394  }
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 237 of file class.ilLTIPlatform.php.

Referenced by ilLTIDataConnector\loadGlobalToolConsumerSettings().

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

◆ setDescription()

ilLTIPlatform::setDescription ( string  $description)

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

References $description.

Referenced by ilLTIDataConnector\loadGlobalToolConsumerSettings().

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

◆ setEnabled()

ilLTIPlatform::setEnabled ( bool  $a_status)

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

258  : void
259  {
260  $this->enabled = $a_status;
261  }

◆ setExtConsumerId()

ilLTIPlatform::setExtConsumerId ( int  $a_id)

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

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

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

◆ setLanguage()

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

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

Referenced by ilLTIDataConnector\loadGlobalToolConsumerSettings().

227  : void
228  {
229  $this->user_language = $lang;
230  }
+ Here is the caller graph for this function:

◆ setPrefix()

ilLTIPlatform::setPrefix ( string  $prefix)

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

References $prefix.

Referenced by ilLTIDataConnector\loadGlobalToolConsumerSettings().

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

◆ setRefId()

ilLTIPlatform::setRefId ( int  $a_ref_id)

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

Referenced by ilLTIDataConnector\loadPlatform().

160  : void
161  {
162  $this->ref_id = $a_ref_id;
163  }
+ Here is the caller graph for this function:

◆ setRole()

ilLTIPlatform::setRole ( int  $role_id)

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

Referenced by ilLTIDataConnector\loadGlobalToolConsumerSettings().

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

◆ setSecret()

ilLTIPlatform::setSecret ( string  $secret)

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

Referenced by createSecret().

206  : void
207  {
208  $this->secret = $secret;
209  }
+ Here is the caller graph for this function:

◆ setTitle()

ilLTIPlatform::setTitle ( string  $title)

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

References $title.

Referenced by ilLTIDataConnector\loadGlobalToolConsumerSettings().

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

Field Documentation

◆ $active

bool ilLTIPlatform::$active = false
protected

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

Referenced by getActive().

◆ $description

string ilLTIPlatform::$description = ''
protected

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

Referenced by getDescription(), and setDescription().

◆ $ext_consumer_id

int ilLTIPlatform::$ext_consumer_id = 0
protected

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

Referenced by getExtConsumerId().

◆ $id

int null ilLTIPlatform::$id = null
private

System ID value.

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

◆ $key

string null ilLTIPlatform::$key = null
private

Consumer key/client ID value.

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

◆ $prefix

string ilLTIPlatform::$prefix = ''
protected

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

Referenced by getPrefix(), and setPrefix().

◆ $ref_id

int ilLTIPlatform::$ref_id = 0
protected

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

Referenced by getRefId().

◆ $role

int ilLTIPlatform::$role = 0
protected

Definition at line 67 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 79 of file class.ilLTIPlatform.php.

◆ $title

string ilLTIPlatform::$title = ''
protected

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

Referenced by getTitle(), and setTitle().

◆ $user_language

string ilLTIPlatform::$user_language = ''
protected

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

Referenced by getLanguage().


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