ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilLTIConsumerEmbeddedContentGUI Class Reference
+ Collaboration diagram for ilLTIConsumerEmbeddedContentGUI:

Public Member Functions

 __construct (ilObjLTIConsumer $object)
 
 executeCommand ()
 

Static Public Member Functions

static isEmbeddedLaunchRequest ()
 

Data Fields

const CMD_SHOW_PAGE = 'showPage'
 
const CMD_SHOW_EMBEDDED = 'showEmbedded'
 

Protected Member Functions

 showPage ()
 
 showEmbedded ()
 
 getLaunchParameters ()
 
 initCmixUser ()
 

Protected Attributes

 $object
 
 $cmixUser
 

Detailed Description

Definition at line 14 of file class.ilLTIConsumerEmbeddedContentGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilLTIConsumerEmbeddedContentGUI::__construct ( ilObjLTIConsumer  $object)
Parameters
ilObjLTIConsumer$object

Definition at line 32 of file class.ilLTIConsumerEmbeddedContentGUI.php.

References $object.

Member Function Documentation

◆ executeCommand()

ilLTIConsumerEmbeddedContentGUI::executeCommand ( )

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

38 {
39 global $DIC; /* @var \ILIAS\DI\Container $DIC */
40
41 if ($this->object->getProvider()->getAvailability() == ilLTIConsumeProvider::AVAILABILITY_NONE) {
42 throw new ilLtiConsumerException('access denied!');
43 }
44
45 $command = $DIC->ctrl()->getCmd(self::CMD_SHOW_PAGE);
46
47 $this->{$command}();
48 }
$DIC
Definition: xapitoken.php:46

References $DIC, and ilLTIConsumeProvider\AVAILABILITY_NONE.

◆ getLaunchParameters()

ilLTIConsumerEmbeddedContentGUI::getLaunchParameters ( )
protected

Definition at line 91 of file class.ilLTIConsumerEmbeddedContentGUI.php.

92 {
93 global $DIC; /* @var \ILIAS\DI\Container $DIC */
94
95 $ilLTIConsumerLaunch = new ilLTIConsumerLaunch($this->object->getRefId());
96 $launchContext = $ilLTIConsumerLaunch->getContext();
97
98 $launchContextType = ilLTIConsumerLaunch::getLTIContextType($launchContext["type"]);
99 $launchContextId = $launchContext["id"];
100 $launchContextTitle = $launchContext["title"];
101
103 $DIC->user()->getId(),
104 $this->object->getRefId(),
105 $this->object->getId()
106 );
107
108 return $this->object->buildLaunchParameters(
109 $this->cmixUser,
110 $token,
111 $launchContextType,
112 $launchContextId,
113 $launchContextTitle
114 );
115 }
static fillToken($usrId, $refId, $objId, $lrsTypeId=0)
$token
Definition: xapitoken.php:57

References $DIC, $token, ilCmiXapiAuthToken\fillToken(), and ilLTIConsumerLaunch\getLTIContextType().

Referenced by showEmbedded().

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

◆ initCmixUser()

ilLTIConsumerEmbeddedContentGUI::initCmixUser ( )
protected

Definition at line 132 of file class.ilLTIConsumerEmbeddedContentGUI.php.

133 {
134 global $DIC; /* @var \ILIAS\DI\Container $DIC */
135
136 $this->cmixUser = new ilCmiXapiUser($this->object->getId(), $DIC->user()->getId(), $this->object->getProvider()->getPrivacyIdent());
137 $user_ident = $this->cmixUser->getUsrIdent();
138 if ($user_ident == '' || $user_ident == null) {
139 $user_ident = ilCmiXapiUser::getIdent($this->object->getProvider()->getPrivacyIdent(), $DIC->user());
140 $this->cmixUser->setUsrIdent($user_ident);
141 $this->cmixUser->save();
142 }
143 }
static getIdent($userIdentMode, ilObjUser $user)

References $DIC, and ilCmiXapiUser\getIdent().

Referenced by showEmbedded().

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

◆ isEmbeddedLaunchRequest()

static ilLTIConsumerEmbeddedContentGUI::isEmbeddedLaunchRequest ( )
static

Definition at line 117 of file class.ilLTIConsumerEmbeddedContentGUI.php.

118 {
119 global $DIC; /* @var \ILIAS\DI\Container $DIC */
120
121 if ($DIC->ctrl()->getNextClass() != strtolower(self::class)) {
122 return false;
123 }
124
125 if ($DIC->ctrl()->getCmd() != self::CMD_SHOW_EMBEDDED) {
126 return false;
127 }
128
129 return true;
130 }

References $DIC.

Referenced by ilObjLTIConsumerGUI\executeCommand().

+ Here is the caller graph for this function:

◆ showEmbedded()

ilLTIConsumerEmbeddedContentGUI::showEmbedded ( )
protected

Definition at line 64 of file class.ilLTIConsumerEmbeddedContentGUI.php.

65 {
66 $this->initCmixUser();
67
68 $tpl = new ilTemplate('tpl.lti_embedded.html', true, true, 'Modules/LTIConsumer');
69
70 foreach ($this->getLaunchParameters() as $field => $value) {
71 $tpl->setCurrentBlock('launch_parameter');
72 $tpl->setVariable('LAUNCH_PARAMETER', $field);
73 $tpl->setVariable('LAUNCH_PARAM_VALUE', $value);
74 $tpl->parseCurrentBlock();
75 }
76
77 $v = DEVMODE ? '?vers=' . time() : '?vers=' . ILIAS_VERSION_NUMERIC;
78 $tpl->setVariable("DELOS_CSS_HREF", 'templates/default/delos.css' . $v);
79 $tpl->setVariable("JQUERY_SRC", 'libs/bower/bower_components/jquery/dist/jquery.js' . $v);
80
81 $tpl->setVariable("LOADER_ICON_SRC", ilUtil::getImagePath("loader.svg"));
82 $tpl->setVariable('LAUNCH_URL', $this->object->getProvider()->getProviderUrl());
83
84 #$DIC->ui()->mainTemplate()->getStandardTemplate();
85 #$DIC->ui()->mainTemplate()->setContent($tpl->get());
86
87 echo $tpl->get();
88 exit;
89 }
special template class to simplify handling of ITX/PEAR
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
const ILIAS_VERSION_NUMERIC
exit
Definition: login.php:29
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl

References $tpl, exit, ilUtil\getImagePath(), getLaunchParameters(), ILIAS_VERSION_NUMERIC, and initCmixUser().

+ Here is the call graph for this function:

◆ showPage()

ilLTIConsumerEmbeddedContentGUI::showPage ( )
protected

Definition at line 50 of file class.ilLTIConsumerEmbeddedContentGUI.php.

51 {
52 global $DIC; /* @var \ILIAS\DI\Container $DIC */
53
54 $tpl = new ilTemplate('tpl.lti_content.html', true, true, 'Modules/LTIConsumer');
55
56 $tpl->setVariable("EMBEDDED_IFRAME_SRC", $DIC->ctrl()->getLinkTarget(
57 $this,
58 self::CMD_SHOW_EMBEDDED
59 ));
60
61 $DIC->ui()->mainTemplate()->setContent($tpl->get());
62 }

References $DIC, and $tpl.

Field Documentation

◆ $cmixUser

ilLTIConsumerEmbeddedContentGUI::$cmixUser
protected

Definition at line 27 of file class.ilLTIConsumerEmbeddedContentGUI.php.

◆ $object

ilLTIConsumerEmbeddedContentGUI::$object
protected

Definition at line 22 of file class.ilLTIConsumerEmbeddedContentGUI.php.

Referenced by __construct().

◆ CMD_SHOW_EMBEDDED

const ilLTIConsumerEmbeddedContentGUI::CMD_SHOW_EMBEDDED = 'showEmbedded'

Definition at line 17 of file class.ilLTIConsumerEmbeddedContentGUI.php.

◆ CMD_SHOW_PAGE

const ilLTIConsumerEmbeddedContentGUI::CMD_SHOW_PAGE = 'showPage'

Definition at line 16 of file class.ilLTIConsumerEmbeddedContentGUI.php.


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