ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
IMSGlobal\LTI\ToolProvider\ToolProxy Class Reference

Class to represent an LTI Tool Proxy. More...

+ Collaboration diagram for IMSGlobal\LTI\ToolProvider\ToolProxy:

Public Member Functions

 __construct ($dataConnector, $id=null)
 Class constructor. More...
 
 initialize ()
 Initialise the tool proxy. More...
 
 initialise ()
 Initialise the tool proxy. More...
 
 getRecordId ()
 Get the tool proxy record ID. More...
 
 setRecordId ($recordId)
 Sets the tool proxy record ID. More...
 
 getConsumer ()
 Get tool consumer. More...
 
 setConsumerId ($consumerId)
 Set tool consumer ID. More...
 
 getDataConnector ()
 Get the data connector. More...
 

Data Fields

 $id = null
 Local id of tool consumer. More...
 

Private Member Functions

 load ($id)
 Load the tool proxy from the database. More...
 

Private Attributes

 $consumer = null
 Tool Consumer for this tool proxy. More...
 
 $consumerId = null
 Tool Consumer ID for this tool proxy. More...
 
 $recordId = null
 
 $dataConnector = null
 Data connector object. More...
 
 $toolProxy = null
 Tool Proxy document. More...
 

Detailed Description

Class to represent an LTI Tool Proxy.

Author
Stephen P Vickers svick.nosp@m.ers@.nosp@m.imsgl.nosp@m.obal.nosp@m..org
Date
2016
Version
3.0.2 GNU Lesser General Public License, version 3 (http://www.gnu.org/licenses/lgpl.html)

Definition at line 17 of file ToolProxy.php.

Constructor & Destructor Documentation

◆ __construct()

IMSGlobal\LTI\ToolProvider\ToolProxy::__construct (   $dataConnector,
  $id = null 
)

Class constructor.

Parameters
DataConnector$dataConnectorData connector
string$idTool Proxy ID (optional, default is null)

Definition at line 64 of file ToolProxy.php.

References IMSGlobal\LTI\ToolProvider\ToolProxy\$dataConnector, $id, IMSGlobal\LTI\ToolProvider\DataConnector\DataConnector\getRandomString(), IMSGlobal\LTI\ToolProvider\ToolProxy\initialize(), and IMSGlobal\LTI\ToolProvider\ToolProxy\load().

65  {
66 
67  $this->initialize();
68  $this->dataConnector = $dataConnector;
69  if (!empty($id)) {
70  $this->load($id);
71  } else {
72  $this->recordId = DataConnector::getRandomString(32);
73  }
74 
75  }
$dataConnector
Data connector object.
Definition: ToolProxy.php:50
if(!array_key_exists('StateId', $_REQUEST)) $id
load($id)
Load the tool proxy from the database.
Definition: ToolProxy.php:180
initialize()
Initialise the tool proxy.
Definition: ToolProxy.php:80
static getRandomString($length=8)
Generate a random string.
+ Here is the call graph for this function:

Member Function Documentation

◆ getConsumer()

IMSGlobal\LTI\ToolProvider\ToolProxy::getConsumer ( )

Get tool consumer.

Returns
ToolConsumer Tool consumer object for this context.

Definition at line 132 of file ToolProxy.php.

References $consumer, IMSGlobal\LTI\ToolProvider\ToolConsumer\fromRecordId(), and IMSGlobal\LTI\ToolProvider\ToolProxy\getDataConnector().

133  {
134 
135  if (is_null($this->consumer)) {
136  $this->consumer = ToolConsumer::fromRecordId($this->consumerId, $this->getDataConnector());
137  }
138 
139  return $this->consumer;
140 
141  }
getDataConnector()
Get the data connector.
Definition: ToolProxy.php:161
static fromRecordId($id, $dataConnector)
Load the tool consumer from the database by its record ID.
$consumer
Definition: demo.php:30
+ Here is the call graph for this function:

◆ getDataConnector()

IMSGlobal\LTI\ToolProvider\ToolProxy::getDataConnector ( )

Get the data connector.

Returns
DataConnector Data connector object

Definition at line 161 of file ToolProxy.php.

Referenced by IMSGlobal\LTI\ToolProvider\ToolProxy\getConsumer().

162  {
163 
164  return $this->dataConnector;
165 
166  }
+ Here is the caller graph for this function:

◆ getRecordId()

IMSGlobal\LTI\ToolProvider\ToolProxy::getRecordId ( )

Get the tool proxy record ID.

Returns
int Tool Proxy record ID value

Definition at line 108 of file ToolProxy.php.

109  {
110 
111  return $this->recordId;
112 
113  }

◆ initialise()

IMSGlobal\LTI\ToolProvider\ToolProxy::initialise ( )

Initialise the tool proxy.

Pseudonym for initialize().

Definition at line 96 of file ToolProxy.php.

References IMSGlobal\LTI\ToolProvider\ToolProxy\initialize().

97  {
98 
99  $this->initialize();
100 
101  }
initialize()
Initialise the tool proxy.
Definition: ToolProxy.php:80
+ Here is the call graph for this function:

◆ initialize()

IMSGlobal\LTI\ToolProvider\ToolProxy::initialize ( )

Initialise the tool proxy.

Definition at line 80 of file ToolProxy.php.

Referenced by IMSGlobal\LTI\ToolProvider\ToolProxy\__construct(), IMSGlobal\LTI\ToolProvider\ToolProxy\initialise(), and IMSGlobal\LTI\ToolProvider\ToolProxy\load().

81  {
82 
83  $this->id = null;
84  $this->recordId = null;
85  $this->toolProxy = null;
86  $this->created = null;
87  $this->updated = null;
88 
89  }
+ Here is the caller graph for this function:

◆ load()

IMSGlobal\LTI\ToolProvider\ToolProxy::load (   $id)
private

Load the tool proxy from the database.

Parameters
string$idThe tool proxy id value
Returns
boolean True if the tool proxy was successfully loaded

Definition at line 180 of file ToolProxy.php.

References $id, $ok, and IMSGlobal\LTI\ToolProvider\ToolProxy\initialize().

Referenced by IMSGlobal\LTI\ToolProvider\ToolProxy\__construct().

181  {
182 
183  $this->initialize();
184  $this->id = $id;
185  $ok = $this->dataConnector->loadToolProxy($this);
186  if (!$ok) {
187  $this->enabled = $autoEnable;
188  }
189 
190  return $ok;
191 
192  }
if(!array_key_exists('StateId', $_REQUEST)) $id
initialize()
Initialise the tool proxy.
Definition: ToolProxy.php:80
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setConsumerId()

IMSGlobal\LTI\ToolProvider\ToolProxy::setConsumerId (   $consumerId)

Set tool consumer ID.

Parameters
int$consumerIdTool Consumer ID for this resource link.

Definition at line 148 of file ToolProxy.php.

References IMSGlobal\LTI\ToolProvider\ToolProxy\$consumerId.

149  {
150 
151  $this->consumer = null;
152  $this->consumerId = $consumerId;
153 
154  }
$consumerId
Tool Consumer ID for this tool proxy.
Definition: ToolProxy.php:38

◆ setRecordId()

IMSGlobal\LTI\ToolProvider\ToolProxy::setRecordId (   $recordId)

Sets the tool proxy record ID.

Parameters
int$recordIdTool Proxy record ID value

Definition at line 120 of file ToolProxy.php.

References IMSGlobal\LTI\ToolProvider\ToolProxy\$recordId.

121  {
122 
123  $this->recordId = $recordId;
124 
125  }

Field Documentation

◆ $consumer

ToolConsumer IMSGlobal\LTI\ToolProvider\ToolProxy::$consumer = null
private

Tool Consumer for this tool proxy.

Definition at line 32 of file ToolProxy.php.

◆ $consumerId

int IMSGlobal\LTI\ToolProvider\ToolProxy::$consumerId = null
private

Tool Consumer ID for this tool proxy.

Definition at line 38 of file ToolProxy.php.

Referenced by IMSGlobal\LTI\ToolProvider\ToolProxy\setConsumerId().

◆ $dataConnector

DataConnector IMSGlobal\LTI\ToolProvider\ToolProxy::$dataConnector = null
private

Data connector object.

Definition at line 50 of file ToolProxy.php.

Referenced by IMSGlobal\LTI\ToolProvider\ToolProxy\__construct().

◆ $id

int IMSGlobal\LTI\ToolProvider\ToolProxy::$id = null

Local id of tool consumer.

Consumer ID value.

Definition at line 25 of file ToolProxy.php.

◆ $recordId

IMSGlobal\LTI\ToolProvider\ToolProxy::$recordId = null
private

Definition at line 44 of file ToolProxy.php.

Referenced by IMSGlobal\LTI\ToolProvider\ToolProxy\setRecordId().

◆ $toolProxy

MediaType ToolProxy IMSGlobal\LTI\ToolProvider\ToolProxy::$toolProxy = null
private

Tool Proxy document.

Definition at line 56 of file ToolProxy.php.


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