ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilLTIToolConsumer Class Reference

LTI provider for LTI launch. More...

+ Inheritance diagram for ilLTIToolConsumer:
+ Collaboration diagram for ilLTIToolConsumer:

Public Member Functions

 setExtConsumerId ($a_id)
 
 getExtConsumerId ()
 
 setRefId ($a_ref_id)
 
 getRefId ()
 
 getId ()
 
 setTitle ($title)
 
 getTitle ()
 
 setDescription ($description)
 
 getDescription ()
 
 setPrefix ($prefix)
 
 getPrefix ()
 
 setSecret ($secret)
 
 getSecret ()
 
 createSecret ()
 Create a secret. More...
 
 setLanguage ($lang)
 
 getLanguage ()
 
 setActive ($value)
 
 getActive ()
 
 setRole ($role_id)
 
 getRole ()
 
 setEnabled ($a_status)
 
 getEnabled ()
 
 saveGlobalToolConsumerSettings (ilLTIDataConnector $dataConnector)
 Save global consumer settings. More...
 
 deleteGlobalToolConsumerSettings (ilLTIDataConnector $dataConnector)
 Delete global tool consumer settings. More...
 
 saveLTI ($dataConnector)
 Save the tool consumer to the database with ILIAS extension. More...
 
- Public Member Functions inherited from IMSGlobal\LTI\ToolProvider\ToolConsumer
 __construct ($key=null, $dataConnector=null, $autoEnable=false)
 Class constructor. More...
 
 initialize ()
 Initialise the tool consumer. More...
 
 initialise ()
 Initialise the tool consumer. More...
 
 save ()
 Save the tool consumer to the database. More...
 
 delete ()
 Delete the tool consumer from the database. More...
 
 getRecordId ()
 Get the tool consumer record ID. More...
 
 setRecordId ($id)
 Sets the tool consumer record ID. More...
 
 getKey ()
 Get the tool consumer key. More...
 
 setKey ($key)
 Set the tool consumer key. More...
 
 getDataConnector ()
 Get the data connector. More...
 
 getIsAvailable ()
 Is the consumer key available to accept launch requests? More...
 
 getSetting ($name, $default='')
 Get a setting value. More...
 
 setSetting ($name, $value=null)
 Set a setting value. More...
 
 getSettings ()
 Get an array of all setting values. More...
 
 setSettings ($settings)
 Set an array of all setting values. More...
 
 saveSettings ()
 Save setting values. More...
 
 hasToolSettingsService ()
 Check if the Tool Settings service is supported. More...
 
 getToolSettings ($simple=true)
 Get Tool Settings. More...
 
 setToolSettings ($settings=array())
 Perform a Tool Settings service request. More...
 
 signParameters ($url, $type, $version, $params)
 Add the OAuth signature to an LTI message. More...
 
 doServiceRequest ($service, $method, $format, $data)
 Perform a service request. More...
 

Static Public Member Functions

static fromRecordId ($id, $dataConnector)
 Load the tool consumer from the database by its record ID. More...
 
static fromExternalConsumerId ($id, $dataConnector)
 
static fromGlobalSettingsAndRefId ($a_ext_consumer_id, $a_ref_id, ilLTIDataConnector $a_data_connector)
 Load consumer from global settings and ref_id. More...
 
- Static Public Member Functions inherited from IMSGlobal\LTI\ToolProvider\ToolConsumer
static addSignature ($endpoint, $consumerKey, $consumerSecret, $data, $method='POST', $type=null)
 Add the OAuth signature to an array of message parameters or to a header string. More...
 
static fromRecordId ($id, $dataConnector)
 Load the tool consumer from the database by its record ID. More...
 

Protected Attributes

 $ref_id
 
 $ext_consumer_id = 0
 
 $title = ''
 
 $description = ''
 
 $prefix = ''
 
 $user_language = ''
 
 $role = 0
 

Additional Inherited Members

- Data Fields inherited from IMSGlobal\LTI\ToolProvider\ToolConsumer
 $name = null
 Local name of tool consumer. More...
 
 $secret = null
 Shared secret. More...
 
 $ltiVersion = null
 LTI version (as reported by last tool consumer connection). More...
 
 $consumerName = null
 Name of tool consumer (as reported by last tool consumer connection). More...
 
 $consumerVersion = null
 Tool consumer version (as reported by last tool consumer connection). More...
 
 $consumerGuid = null
 Tool consumer GUID (as reported by first tool consumer connection). More...
 
 $cssPath = null
 Optional CSS path (as reported by last tool consumer connection). More...
 
 $protected = false
 Whether the tool consumer instance is protected by matching the consumer_guid value in incoming requests. More...
 
 $enabled = false
 Whether the tool consumer instance is enabled to accept incoming connection requests. More...
 
 $enableFrom = null
 Date/time from which the the tool consumer instance is enabled to accept incoming connection requests. More...
 
 $enableUntil = null
 Date/time until which the tool consumer instance is enabled to accept incoming connection requests. More...
 
 $lastAccess = null
 Date of last connection from this tool consumer. More...
 
 $idScope = ToolProvider::ID_SCOPE_ID_ONLY
 Default scope to use when generating an Id value for a user. More...
 
 $defaultEmail = ''
 Default email address (or email domain) to use when no email address is provided for a user. More...
 
 $settings = null
 Setting values (LTI parameters, custom parameters and local parameters). More...
 
 $created = null
 Date/time when the object was created. More...
 
 $updated = null
 Date/time when the object was last updated. 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 13 of file class.ilLTIToolConsumer.php.

Member Function Documentation

◆ createSecret()

ilLTIToolConsumer::createSecret ( )

Create a secret.

Definition at line 149 of file class.ilLTIToolConsumer.php.

References setSecret().

150  {
151  $this->setSecret(\IMSGlobal\LTI\ToolProvider\DataConnector\DataConnector::getRandomString(12));
152  }
+ Here is the call graph for this function:

◆ deleteGlobalToolConsumerSettings()

ilLTIToolConsumer::deleteGlobalToolConsumerSettings ( ilLTIDataConnector  $dataConnector)

Delete global tool consumer settings.

Parameters
ilLTIDataConnector$dataConnector

Definition at line 292 of file class.ilLTIToolConsumer.php.

References ilLTIDataConnector\deleteGlobalToolConsumerSettings().

293  {
294  $dataConnector->deleteGlobalToolConsumerSettings($this);
295  }
deleteGlobalToolConsumerSettings(ilLTIToolConsumer $consumer)
Delete global tool consumer settings.
+ Here is the call graph for this function:

◆ fromExternalConsumerId()

static ilLTIToolConsumer::fromExternalConsumerId (   $id,
  $dataConnector 
)
static
Parameters
type$id
type$dataConnector

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

References IMSGlobal\LTI\ToolProvider\ToolConsumer\$dataConnector, and IMSGlobal\LTI\ToolProvider\ToolConsumer\$id.

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

245  {
246  $toolConsumer = new ilLTIToolConsumer(null, $dataConnector);
247  $toolConsumer->initialize();
248  $toolConsumer->setExtConsumerId($id);
249  if (!$dataConnector->loadGlobalToolConsumerSettings($toolConsumer)) {
250  $toolConsumer->initialize();
251  }
252  return $toolConsumer;
253  }
LTI provider for LTI launch.
$dataConnector
Data connector object or string.
+ Here is the caller graph for this function:

◆ fromGlobalSettingsAndRefId()

static ilLTIToolConsumer::fromGlobalSettingsAndRefId (   $a_ext_consumer_id,
  $a_ref_id,
ilLTIDataConnector  $a_data_connector 
)
static

Load consumer from global settings and ref_id.

Parameters
type$a_ext_consumer_id
type$a_ref_id
ilLTIDataConnector$a_data_connectorilLTIToolConsumer

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

References ilLTIDataConnector\lookupRecordIdByGlobalSettingsAndRefId().

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

264  {
265  $toolConsumer = new ilLTIToolConsumer(null, $a_data_connector);
266  $toolConsumer->initialize();
267  $toolConsumer->setExtConsumerId($a_ext_consumer_id);
268  $toolConsumer->setRefId($a_ref_id);
269 
270  $consumer_pk = $a_data_connector->lookupRecordIdByGlobalSettingsAndRefId($toolConsumer);
271  if ($consumer_pk) {
272  return self::fromRecordId($consumer_pk, $a_data_connector);
273  }
274  $toolConsumer->initialize();
275  return $toolConsumer;
276  }
LTI provider for LTI launch.
lookupRecordIdByGlobalSettingsAndRefId(ilLTIToolConsumer $consumer)
Lookup record id for global settings and ref_id.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fromRecordId()

static ilLTIToolConsumer::fromRecordId (   $id,
  $dataConnector 
)
static

Load the tool consumer from the database by its record ID.

Parameters
int$idThe consumer key record ID
DataConnector$dataConnectorDatabase connection object
Returns
object ToolConsumer The tool consumer object

Definition at line 223 of file class.ilLTIToolConsumer.php.

References IMSGlobal\LTI\ToolProvider\ToolConsumer\$dataConnector, IMSGlobal\LTI\ToolProvider\ToolConsumer\$id, and ilLoggerFactory\getLogger().

Referenced by ilAuthProviderLTI\lookupConsumer().

224  {
225  $toolConsumer = new ilLTIToolConsumer(null, $dataConnector);
226 
227  $toolConsumer->initialize();
228  $toolConsumer->setRecordId($id);
229  if (!$dataConnector->loadToolConsumerILIAS($toolConsumer)) {
230  $toolConsumer->initialize();
231  }
232  $toolConsumer->setRecordId($id);
233 
234  ilLoggerFactory::getLogger('lti')->info('Loading with record id: ' . $toolConsumer->getRecordId());
235 
236  return $toolConsumer;
237  }
LTI provider for LTI launch.
$dataConnector
Data connector object or string.
static getLogger($a_component_id)
Get component logger.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getActive()

ilLTIToolConsumer::getActive ( )
Returns
integer

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

Referenced by ilLTIDataConnector\saveGlobalToolConsumerSettings().

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

◆ getDescription()

ilLTIToolConsumer::getDescription ( )
Returns
string

Definition at line 108 of file class.ilLTIToolConsumer.php.

References $description.

Referenced by ilLTIDataConnector\saveGlobalToolConsumerSettings().

109  {
110  return $this->description;
111  }
+ Here is the caller graph for this function:

◆ getEnabled()

ilLTIToolConsumer::getEnabled ( )

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

References IMSGlobal\LTI\ToolProvider\ToolConsumer\$enabled.

209  {
210  return $this->enabled;
211  }
$enabled
Whether the tool consumer instance is enabled to accept incoming connection requests.

◆ getExtConsumerId()

◆ getId()

ilLTIToolConsumer::getId ( )
Returns
integer

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

References IMSGlobal\LTI\ToolProvider\ToolConsumer\getRecordId().

76  {
77  return $this->getRecordId();
78  }
getRecordId()
Get the tool consumer record ID.
+ Here is the call graph for this function:

◆ getLanguage()

ilLTIToolConsumer::getLanguage ( )
Returns
string

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

References $user_language.

Referenced by ilLTIDataConnector\saveGlobalToolConsumerSettings().

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

◆ getPrefix()

ilLTIToolConsumer::getPrefix ( )
Returns
string

Definition at line 124 of file class.ilLTIToolConsumer.php.

References $prefix.

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

125  {
126  return $this->prefix;
127  }
+ Here is the caller graph for this function:

◆ getRefId()

ilLTIToolConsumer::getRefId ( )

Definition at line 67 of file class.ilLTIToolConsumer.php.

References $ref_id.

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

68  {
69  return $this->ref_id;
70  }
+ Here is the caller graph for this function:

◆ getRole()

ilLTIToolConsumer::getRole ( )
Returns
integer

Definition at line 197 of file class.ilLTIToolConsumer.php.

References $role.

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

198  {
199  return $this->role;
200  }
+ Here is the caller graph for this function:

◆ getSecret()

ilLTIToolConsumer::getSecret ( )
Returns
string

Definition at line 140 of file class.ilLTIToolConsumer.php.

References IMSGlobal\LTI\ToolProvider\ToolConsumer\$secret.

141  {
142  return $this->secret;
143  }

◆ getTitle()

ilLTIToolConsumer::getTitle ( )
Returns
string

Definition at line 92 of file class.ilLTIToolConsumer.php.

References $title.

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

93  {
94  return $this->title;
95  }
+ Here is the caller graph for this function:

◆ saveGlobalToolConsumerSettings()

ilLTIToolConsumer::saveGlobalToolConsumerSettings ( ilLTIDataConnector  $dataConnector)

Save global consumer settings.

Parameters
ilLTIDataConnector$dataConnector

Definition at line 283 of file class.ilLTIToolConsumer.php.

References ilLTIDataConnector\saveGlobalToolConsumerSettings().

284  {
285  $dataConnector->saveGlobalToolConsumerSettings($this);
286  }
saveGlobalToolConsumerSettings(ilLTIToolConsumer $consumer)
Save lti_ext_consumer type $DIC.
+ Here is the call graph for this function:

◆ saveLTI()

ilLTIToolConsumer::saveLTI (   $dataConnector)

Save the tool consumer to the database with ILIAS extension.

Returns
boolean True if the object was successfully saved

Definition at line 303 of file class.ilLTIToolConsumer.php.

References IMSGlobal\LTI\ToolProvider\ToolConsumer\$dataConnector, and $ok.

304  {
305  $ok = $dataConnector->saveToolConsumerILIAS($this);
306  return $ok;
307  }
$dataConnector
Data connector object or string.

◆ setActive()

ilLTIToolConsumer::setActive (   $value)
Parameters
integer$value

Definition at line 173 of file class.ilLTIToolConsumer.php.

Referenced by ilLTIDataConnector\loadGlobalToolConsumerSettings(), and ilLTIDataConnector\loadObjectToolConsumerSettings().

174  {
175  $this->active = $value;
176  }
+ Here is the caller graph for this function:

◆ setDescription()

ilLTIToolConsumer::setDescription (   $description)
Parameters
string$description

Definition at line 100 of file class.ilLTIToolConsumer.php.

References $description.

Referenced by ilLTIDataConnector\loadGlobalToolConsumerSettings(), and ilLTIDataConnector\loadObjectToolConsumerSettings().

101  {
102  $this->description = $description;
103  }
+ Here is the caller graph for this function:

◆ setEnabled()

ilLTIToolConsumer::setEnabled (   $a_status)

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

204  {
205  $this->enabled = $a_status;
206  }

◆ setExtConsumerId()

ilLTIToolConsumer::setExtConsumerId (   $a_id)

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

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

53  {
54  $this->ext_consumer_id = $a_id;
55  }
+ Here is the caller graph for this function:

◆ setLanguage()

ilLTIToolConsumer::setLanguage (   $lang)
Parameters
string$lang(int?)

Definition at line 157 of file class.ilLTIToolConsumer.php.

References $lang.

Referenced by ilLTIDataConnector\loadGlobalToolConsumerSettings(), and ilLTIDataConnector\loadObjectToolConsumerSettings().

158  {
159  $this->user_language = $lang;
160  }
+ Here is the caller graph for this function:

◆ setPrefix()

ilLTIToolConsumer::setPrefix (   $prefix)
Parameters
string$prefix

Definition at line 116 of file class.ilLTIToolConsumer.php.

References $prefix.

Referenced by ilLTIDataConnector\loadGlobalToolConsumerSettings(), and ilLTIDataConnector\loadObjectToolConsumerSettings().

117  {
118  $this->prefix = $prefix;
119  }
+ Here is the caller graph for this function:

◆ setRefId()

ilLTIToolConsumer::setRefId (   $a_ref_id)

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

Referenced by ilLTIDataConnector\loadToolConsumerILIAS().

63  {
64  $this->ref_id = $a_ref_id;
65  }
+ Here is the caller graph for this function:

◆ setRole()

ilLTIToolConsumer::setRole (   $role_id)
Parameters
integer$role_id

Definition at line 189 of file class.ilLTIToolConsumer.php.

Referenced by ilLTIDataConnector\loadGlobalToolConsumerSettings(), and ilLTIDataConnector\loadObjectToolConsumerSettings().

190  {
191  $this->role = $role_id;
192  }
+ Here is the caller graph for this function:

◆ setSecret()

ilLTIToolConsumer::setSecret (   $secret)
Parameters
string$secret

Definition at line 132 of file class.ilLTIToolConsumer.php.

References IMSGlobal\LTI\ToolProvider\ToolConsumer\$secret.

Referenced by createSecret().

133  {
134  $this->secret = $secret;
135  }
+ Here is the caller graph for this function:

◆ setTitle()

ilLTIToolConsumer::setTitle (   $title)
Parameters
string$title

Definition at line 83 of file class.ilLTIToolConsumer.php.

References $title.

Referenced by ilLTIDataConnector\loadGlobalToolConsumerSettings(), and ilLTIDataConnector\loadObjectToolConsumerSettings().

84  {
85  $this->title = $title;
86  // $this->consumerName = $title;
87  }
+ Here is the caller graph for this function:

Field Documentation

◆ $description

ilLTIToolConsumer::$description = ''
protected

Definition at line 34 of file class.ilLTIToolConsumer.php.

Referenced by getDescription(), and setDescription().

◆ $ext_consumer_id

ilLTIToolConsumer::$ext_consumer_id = 0
protected

Definition at line 24 of file class.ilLTIToolConsumer.php.

Referenced by getExtConsumerId().

◆ $prefix

ilLTIToolConsumer::$prefix = ''
protected

Definition at line 39 of file class.ilLTIToolConsumer.php.

Referenced by getPrefix(), and setPrefix().

◆ $ref_id

ilLTIToolConsumer::$ref_id
protected

Definition at line 18 of file class.ilLTIToolConsumer.php.

Referenced by getRefId().

◆ $role

ilLTIToolConsumer::$role = 0
protected

Definition at line 49 of file class.ilLTIToolConsumer.php.

Referenced by getRole().

◆ $title

ilLTIToolConsumer::$title = ''
protected

Definition at line 29 of file class.ilLTIToolConsumer.php.

Referenced by getTitle(), and setTitle().

◆ $user_language

ilLTIToolConsumer::$user_language = ''
protected

Definition at line 44 of file class.ilLTIToolConsumer.php.

Referenced by getLanguage().


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