87 $this->link_dir = (
defined(
"ILIAS_MODULE"))
118 return (strpos($this->
user->getAuthMode(),
'lti_') === 0);
144 $this->
log(
"lti view activated");
154 $this->
log(
"lti view deactivated");
163 return (isset(
$_SESSION[
'il_lti_mode']));
174 $this->
log(
"initGUI");
175 $lng->loadLanguageModule(
"lti");
176 $baseclass = strtolower(
$_GET[
'baseClass']);
177 $cmdclass = strtolower(
$_GET[
'cmdClass']);
180 if ($this->home_id ===
'') {
181 $this->home_id =
$_SESSION[
'lti_context_id'];
183 if ($this->home_obj_id ===
'') {
186 if ($this->home_type ===
'') {
188 $this->show_locator = $this->
showLocator($this->home_type);
190 if ($this->home_url ===
'') {
193 if ($this->home_title ===
'') {
197 switch ($baseclass) {
198 case 'illtiroutergui':
207 $lng->loadLanguageModule(
"lti");
208 $f =
$DIC->ui()->factory();
209 $renderer =
$DIC->ui()->renderer();
211 case 'top_bar_header':
212 if (!$this->member_view) {
213 if (!
$tpl->blockExists(
"header_top_title")) {
214 $tpl->addBlockFile(
"HEADER_TOP_TITLE",
"header_top_title",
"tpl.header_top_title.html",
"Services/LTI");
216 $tpl->setVariable(
"TXT_HEADER_TITLE",
$lng->txt(
"lti_session"));
218 if (!
$tpl->blockExists(
"header_back_bl")) {
219 $tpl->addBlockFile(
"HEADER_BACK_BL",
"header_back_bl",
"tpl.header_back_bl.html",
"Services/LTI");
221 $tpl->setVariable(
"URL_HEADER_BACK", $this->member_view_url);
223 $tpl->setVariable(
"TXT_HEADER_BACK", $this->member_view_close_txt);
227 $tpl->setVariable(
"TXT_VIEW_NAV",
$lng->txt(
"lti_navigation"));
229 $tpl->setVariable(
"VIEW_NAV_EN", $nav_entries);
232 case 'user_logged_in':
233 if (!
$tpl->blockExists(
"userisloggedin")) {
234 $tpl->addBlockFile(
"USERLOGGEDIN",
"userisloggedin",
"tpl.user_logged_in.html",
"Services/LTI");
237 $tpl->setVariable(
"TXT_LTI_EXIT", $lng->txt(
"lti_exit"));
238 $btn = $f->button()->close();
239 $btnHtml = $renderer->render($btn);
240 $tpl->setVariable(
"EXIT_BUTTON", $btnHtml);
248 include_once(
"./Services/UIComponent/GroupedList/classes/class.ilGroupedListGUI.php");
250 $gl->setAsDropDown(
true);
252 include_once(
"./Services/Link/classes/class.ilLink.php");
263 $items = $ilNavigationHistory->getItems();
268 foreach ($items as $k => $item) {
273 if (!isset($item[
"ref_id"]) || !isset(
$_GET[
"ref_id"]) ||
274 ($item[
"ref_id"] !=
$_GET[
"ref_id"] || !$first) && $this->home_id != $item[
"ref_id"]) {
276 $gl->addGroupHeader(
$lng->txt(
"last_visited"),
"ilLVNavEnt");
282 $gl->addEntry($icon .
" " . $ititle, $item[
"link"],
"_self",
"",
"ilLVNavEnt");
289 "ยป " .
$lng->txt(
"remove_entries"),
292 "return il.MainMenu.removeLastVisitedItems('" .
293 $ilCtrl->getLinkTargetByClass(
"ilnavigationhistorygui",
"removeEntries",
"",
true) .
"');",
298 return $gl->getHTML();
317 $arr[] =
"./Services/LTI/templates/default/lti.css";
319 if (isset(
$_SESSION[
'lti_launch_css_url']) &&
$_SESSION[
'lti_launch_css_url'] !=
"") {
320 $arr[] =
$_SESSION[
'lti_launch_css_url'];
330 return $this->link_dir .
"goto.php?target=" . $this->home_type .
"_" .
$this->home_id;
345 $lng->loadLanguageModule(
"lti");
346 $this->
log(
"exitLti");
347 if ($this->
getSessionValue(
'lti_launch_presentation_return_url') ===
'') {
348 $tplExit =
new ilTemplate(
"tpl.lti_exit.html",
true,
true,
"Services/LTI");
349 $tplExit->setVariable(
'TXT_LTI_EXITED',
$lng->txt(
'lti_exited'));
350 $tplExit->setVariable(
'LTI_EXITED_INFO',
$lng->txt(
'lti_exited_info'));
351 $html = $tplExit->get();
357 header(
'Location: ' .
$_SESSION[
'lti_launch_presentation_return_url']);
371 $GLOBALS[
'DIC'][
'ilAuthSession']->logout();
382 if ((
int)
$_GET[
'ref_id']) {
384 return $this->current_ref_id = (int)
$_GET[
'ref_id'];
391 return $this->current_ref_id = (int)
$target_arr[1];
401 return preg_match(
"/(crs|grp|cat|root|fold|lm)/", $obj_type);
410 $targetScript = (
$ilCtrl->getTargetScript() !==
'ilias.php') ?
"ilias.php" :
"";
411 return $this->link_dir . $targetScript .
$ilCtrl->getLinkTargetByClass(array(
'illtiroutergui',strtolower(get_class($this))), $cmd) .
"&baseClass=illtiroutergui";
432 if (self::LTI_DEBUG) {
An exception for terminatinating execution or to throw for unit testing.
static hasUser()
Based on user authentication?
@classDescription class for ILIAS ViewLTI
$show_locator
public variables
initGUI()
Set the environment backend for GUI (tree and locator behaviour, home link, ....) it is also possible...
getCmdLink($cmd)
helper function for cmd link creation
deactivate()
deactivate LTI GUI
executeCommand()
for ctrl commands
addCss()
add css files to the header
appendInlineCss()
append css styles just before </body>
__construct(\ilObjUser $user)
Constructor.
isLTIUser()
get LTI Mode from Users->getAuthMode
getHomeLink()
helper function for home link creation
init()
Init LTI mode for lit authenticated users.
static getInstance()
for compatiblity with ilLTIRouterGUI
exitLti()
exit LTI session and if defined redirecting to returnUrl ToDo: Standard Template with delos ....
const MSG_ERROR
messsage codes
activate()
activate LTI GUI
findEffectiveRefId()
Find effective ref_id for request.
logout()
logout ILIAS and destroys Session and ilClientId cookie
getSessionValue($sess_key)
get session value != ''
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
static _lookupObjectId($a_ref_id)
lookup object id
static _getIcon( $a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
static _lookupType($a_id, $a_reference=false)
lookup object type
static setClosingContext($a_context)
set closing context (for statistics)
special template class to simplify handling of ITX/PEAR
static setCookie($a_cookie_name, $a_cookie_value='', $a_also_set_super_global=true, $a_set_cookie_invalid=false)
static img($a_src, $a_alt="", $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
static shortenText( $a_str, $a_len, $a_dots=false, $a_next_blank=false, $a_keep_extension=false)
shorten a string to given length.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'