ILIAS  release_8 Revision v8.24
class.ilLTITool.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
21//use ILIAS\LTI\ToolProvider;
22#use ILIAS\LTI\ToolProvider\DataConnector\DataConnector;
23#use ilLTIDataConnector;
28use ILIAS\LTI\ToolProvider\Http\HTTPMessage;
32#use ILIAS\LTI\ToolProvider\OAuthDataStore;
33//added
36#use ILIAS\LTI\ToolProvider\User;
38
39#use ILIAS\LTI\Profile\Item;
40
41#use ILIAS\LTI\Tool\MediaType;
42#use ILIAS\LTI\Profile;
43
44#use ILIAS\LTI\OAuth;
45
46
53{
57 protected ?\ilLogger $logger = null;
58
64 {
65 global $DIC;
66 $this->logger = ilLoggerFactory::getLogger('ltis');
67 // $this->initialize();
68 if (empty($dataConnector)) {
70 }
71 $this->dataConnector = $dataConnector;
72 // parent::__construct($dataConnector);
73 $this->setParameterConstraint('resource_link_id', true, 50, array('basic-lti-launch-request'));
74 $this->setParameterConstraint('user_id', true, 128, array('basic-lti-launch-request'));
75 $this->setParameterConstraint('roles', true, null, array('basic-lti-launch-request'));
76 $this->setParameterConstraint('lis_person_contact_email_primary', true, 80, array('basic-lti-launch-request'));
77 }
78
82 protected function onLaunch(): void
83 {
84 // save/update current user
85 if ($this->userResult instanceof \ILIAS\LTI\ToolProvider\User) {
86 $this->logger->debug("onLaunch - user");
87 $this->userResult->save();
88 }
89
90 if ($this->context instanceof \ILIAS\LTI\ToolProvider\Context) {
91 $this->logger->debug("onLaunch - context");
92 $this->context->save();
93 }
94
95 if ($this->resourceLink instanceof \ILIAS\LTI\ToolProvider\ResourceLink) {
96 $this->logger->debug("onLaunch - resource");
97 $this->resourceLink->save();
98 }
99 }
100}
Class to represent a content-item object.
Definition: Item.php:32
Class to represent a platform context.
Definition: Context.php:34
Class to represent an HTTP message request.
Definition: Jwt.php:31
Class to represent a platform resource link share key.
Class to represent an LTI Tool.
Definition: Tool.php:39
setParameterConstraint(string $name, bool $required=true, int $maxLength=null, array $messageTypes=null)
Add a parameter constraint to be checked on launch.
Definition: Tool.php:521
Class to represent a platform user.
Definition: User.php:31
static getDataConnector(object $db=null, string $dbTableNamePrefix='', string $type='')
LTI provider for LTI launch.
ilLogger $logger
__construct(ilLTIDataConnector $dataConnector)
ilLTITool constructor.
onLaunch()
Process a valid launch request.
static getLogger(string $a_component_id)
Get component logger.
Component logger with individual log levels by component id.
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: OAuth.php:21
trait ApiHook
Trait to handle API hook registrations.
Definition: ApiHook.php:29
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Message.php:19
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Item.php:19
ilLTIDataConnector $dataConnector
Data connector object.
Definition: System.php:64
Class ChatMainBarProvider \MainMenu\Provider.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...