ILIAS  release_8 Revision v8.23
class.ilLTITool.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
21 //use ILIAS\LTI\ToolProvider;
22 #use ILIAS\LTI\ToolProvider\DataConnector\DataConnector;
23 #use ilLTIDataConnector;
29 use ILIAS\LTIOAuth;
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)) {
69  $dataConnector = ilLTIDataConnector::getDataConnector();
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 }
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
static getLogger(string $a_component_id)
Get component logger.
Class ChatMainBarProvider .
LTI provider for LTI launch.
static getDataConnector(object $db=null, string $dbTableNamePrefix='', string $type='')
__construct(ilLTIDataConnector $dataConnector)
ilLTITool constructor.
onLaunch()
Process a valid launch request.
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: Item.php:19
ilLogger $logger
ilLTIDataConnector $dataConnector
Data connector object.
Definition: System.php:64
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...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: OAuth.php:21
Component logger with individual log levels by component id.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Message.php:19
Class to represent a platform context.
Definition: Context.php:33