ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilLTITool Class Reference

LTI provider for LTI launch. More...

+ Inheritance diagram for ilLTITool:
+ Collaboration diagram for ilLTITool:

Public Member Functions

 __construct (ilLTIDataConnector $dataConnector)
 ilLTITool constructor. More...
 
 parsePostBody (ArrayBasedRequestWrapper $postData)
 
 handleRequest (bool $strictMode=null, bool $disableCookieCheck=false, bool $generateWarnings=false)
 

Protected Member Functions

 onLaunch ()
 Process a valid launch request. More...
 

Protected Attributes

ilLogger $logger = null
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilLTITool::__construct ( ilLTIDataConnector  $dataConnector)

ilLTITool constructor.

Parameters
ilLTIDataConnector$dataConnector

Definition at line 43 of file class.ilLTITool.php.

44 {
45 $this->logger = ilLoggerFactory::getLogger('ltis');
46 // $this->initialize();
47 if (empty($dataConnector)) {
48 $dataConnector = ilLTIDataConnector::getDataConnector();
49 }
50 $this->dataConnector = $dataConnector;
51 //parent::__construct($dataConnector);
52 $this->setParameterConstraint('resource_link_id', true, 50, array('basic-lti-launch-request'));
53 $this->setParameterConstraint('user_id', true, 64, array('basic-lti-launch-request'));
54 $this->setParameterConstraint('roles', true, null, array('basic-lti-launch-request'));
55 $this->setParameterConstraint('lis_person_contact_email_primary', true, 80, array('basic-lti-launch-request'));
56 }
static getDataConnector(mixed $db=null, string $dbTableNamePrefix='', string $type='')
static getLogger(string $a_component_id)
Get component logger.

References ilLTIDataConnector\getDataConnector(), ilLoggerFactory\getLogger(), and ILIAS\Repository\logger().

+ Here is the call graph for this function:

Member Function Documentation

◆ handleRequest()

ilLTITool::handleRequest ( bool  $strictMode = null,
bool  $disableCookieCheck = false,
bool  $generateWarnings = false 
)

Definition at line 90 of file class.ilLTITool.php.

90 : void
91 {
92 global $DIC;
93
94 $_POST = $this->parsePostBody($DIC->http()->wrapper()->post());
95 $_GET = $DIC->http()->request()->getQueryParams();
96
97 if (isset($_POST['lti_version']) && $_POST['lti_version'] === 'LTI-1p0') {
98 $_SERVER['REQUEST_URI'] = rtrim(preg_replace('/([?&])client_id=[^&]+(&|$)/', '$1', $_SERVER['REQUEST_URI']), '?&');
99 }
100
101 self::$authenticateUsingGet = true;
102
103 parent::handleRequest($strictMode, $disableCookieCheck, $generateWarnings);
104 }
parsePostBody(ArrayBasedRequestWrapper $postData)
$_GET['cmd']
Definition: lti.php:26
$_POST['cmd']
Definition: lti.php:27
$_SERVER['HTTP_HOST']
Definition: raiseError.php:26
global $DIC
Definition: shib_login.php:26

References $_GET, $_POST, $_SERVER, $DIC, and parsePostBody().

+ Here is the call graph for this function:

◆ onLaunch()

ilLTITool::onLaunch ( )
protected

Process a valid launch request.

Definition at line 61 of file class.ilLTITool.php.

61 : void
62 {
63 // save/update current user
64 if ($this->userResult instanceof User) {
65 $this->logger->debug("onLaunch - user");
66 $this->userResult->save();
67 }
68
69 if ($this->context instanceof Context) {
70 $this->logger->debug("onLaunch - context");
71 $this->context->save();
72 }
73
74 if ($this->resourceLink instanceof ResourceLink) {
75 $this->logger->debug("onLaunch - resource");
76 $this->resourceLink->save();
77 }
78 }

References ILIAS\Repository\logger().

+ Here is the call graph for this function:

◆ parsePostBody()

ilLTITool::parsePostBody ( ArrayBasedRequestWrapper  $postData)

Definition at line 80 of file class.ilLTITool.php.

80 : array
81 {
82 global $DIC;
83 $res = [];
84 foreach ($postData->keys() as $key) {
85 $res[$key] = $postData->retrieve($key, $DIC->refinery()->kindlyTo()->string());
86 }
87 return $res;
88 }
retrieve(string $key, Transformation $transformation)
@inheritDoc
$res
Definition: ltiservices.php:69

References $DIC, $res, ILIAS\HTTP\Wrapper\ArrayBasedRequestWrapper\keys(), and ILIAS\HTTP\Wrapper\ArrayBasedRequestWrapper\retrieve().

Referenced by handleRequest().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $logger

ilLogger ilLTITool::$logger = null
protected

Definition at line 37 of file class.ilLTITool.php.


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