56 private $consumer = null;
62 private $consumerId = null;
74 private $settingsChanged =
false;
80 private $dataConnector = null;
99 $this->settings = array();
100 $this->created = null;
101 $this->updated = null;
127 $this->settingsChanged =
false;
139 public function delete()
154 if (is_null($this->consumer)) {
158 return $this->consumer;
169 $this->consumer = null;
170 $this->consumerId = $consumerId;
230 return $this->dataConnector;
245 if (array_key_exists($name, $this->settings)) {
246 $value = $this->settings[$name];
265 if ($value !== $old_value) {
266 if (!empty($value)) {
267 $this->settings[$name] = $value;
269 unset($this->settings[$name]);
271 $this->settingsChanged =
true;
308 if ($this->settingsChanged) {
326 $url = $this->
getSetting(
'custom_context_setting_url');
343 $url = $this->
getSetting(
'custom_context_setting_url');
345 $response = $service->get($mode);
361 $url = $this->
getSetting(
'custom_context_setting_url');
377 $url = $this->
getSetting(
'custom_context_memberships_url');
391 $url = $this->
getSetting(
'custom_context_memberships_url');
393 $response = $service->get();
411 $context->dataConnector = $dataConnector;
429 $context->consumer = $consumer;
430 $context->dataConnector = $consumer->getDataConnector();
451 private function load($id = null)
setRecordId($id)
Sets the context record ID.
initialize()
Initialise the context.
$settings
Setting values (LTI parameters, custom parameters and local parameters).
$ltiContextId
Context ID as supplied in the last connection request.
getSetting($name, $default= '')
Get a setting value.
save()
Save the context to the database.
$created
Date/time when the object was created.
hasToolSettingsService()
Check if the Tool Settings service is supported.
setToolSettings($settings=array())
Perform a Tool Settings service request.
static fromConsumer($consumer, $ltiContextId)
Class constructor from consumer.
setSettings($settings)
Set an array of all setting values.
getDataConnector()
Get the data connector.
getSettings()
Get an array of all setting values.
getKey()
Get tool consumer key.
getConsumer()
Get tool consumer.
__construct()
Class constructor.
$updated
Date/time when the object was last updated.
getRecordId()
Get the context record ID.
initialise()
Initialise the context.
setConsumerId($consumerId)
Set tool consumer ID.
saveSettings()
Save setting values.
getMembership()
Get Memberships.
getToolSettings($mode=Service\ToolSettings::MODE_CURRENT_LEVEL, $simple=true)
Get Tool Settings.
static fromRecordId($id, $dataConnector)
Load the context from the database.
Class to represent a tool consumer context.
setSetting($name, $value=null)
Set a setting value.
hasMembershipService()
Check if the Membership service is supported.