ILIAS  release_8 Revision v8.24
ilTooltipGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilTooltipGUI:

Static Public Member Functions

static addTooltip (string $a_el_id, string $a_text, string $a_container="", string $a_my="bottom center", string $a_at="top center", bool $a_use_htmlspecialchars=true)
 
static getToolTip (string $a_el_id, string $a_text, string $a_container="", string $a_my="bottom center", string $a_at="top center", bool $a_use_htmlspecialchars=true)
 Get tooltip js code. More...
 
static init ()
 Initializes the needed tooltip libraries. More...
 

Static Protected Attributes

static bool $initialized = false
 
static bool $library_initialized = false
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning This is a utility class for the yui tooltips. this only works, if a parent has class="yui-skin-sam" attached.

Definition at line 23 of file class.ilTooltipGUI.php.

Member Function Documentation

◆ addTooltip()

static ilTooltipGUI::addTooltip ( string  $a_el_id,
string  $a_text,
string  $a_container = "",
string  $a_my = "bottom center",
string  $a_at = "top center",
bool  $a_use_htmlspecialchars = true 
)
static

Definition at line 28 of file class.ilTooltipGUI.php.

35 : void {
36 // to get rid of globals here, we need to change the
37 // process in learning modules, e.g. which does not work with $DIC (since it does not
38 // use the standard template)
39 $tpl = $GLOBALS["tpl"];
40
41 self::init();
42
43 $code = self::getToolTip(
44 $a_el_id,
45 $a_text,
46 $a_container,
47 $a_my,
48 $a_at,
49 $a_use_htmlspecialchars
50 );
51 $tpl->addOnLoadCode($code);
52 }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
static getToolTip(string $a_el_id, string $a_text, string $a_container="", string $a_my="bottom center", string $a_at="top center", bool $a_use_htmlspecialchars=true)
Get tooltip js code.
static init()
Initializes the needed tooltip libraries.
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41

Referenced by ilTable2GUI\fillHeader(), ilObjectListGUI\getHeaderAction(), ilGroupedListGUI\getHTML(), ilAdvancedSelectionListGUI\getHTML(), and ilBadgeManagementGUI\listBadges().

+ Here is the caller graph for this function:

◆ getToolTip()

static ilTooltipGUI::getToolTip ( string  $a_el_id,
string  $a_text,
string  $a_container = "",
string  $a_my = "bottom center",
string  $a_at = "top center",
bool  $a_use_htmlspecialchars = true 
)
static

Get tooltip js code.

Definition at line 57 of file class.ilTooltipGUI.php.

64 : string {
65 $addstr = "";
66
67 // not needed, just make sure the position plugin is included
68 // $addstr.= ", position: {viewport: $('#fixed_content')}";
69
70 if ($a_container !== "") {
71 $addstr .= ", container: '" . $a_container . "'";
72 }
73
74 if ($a_use_htmlspecialchars) {
75 $a_text = htmlspecialchars(str_replace(array("\n", "\r"), "", $a_text));
76 } else {
77 $a_text = str_replace(array("\n", "\r", "'", '"'), array("", "", "\'", '\"'), $a_text);
78 }
79 return 'il.Tooltip.add("' . $a_el_id . '", {' .
80 ' context:"' . $a_el_id . '",' .
81 ' my:"' . $a_my . '",' .
82 ' at:"' . $a_at . '",' .
83 ' text:"' . $a_text . '" ' . $addstr . '} );';
84 }

Referenced by ilGroupedListGUI\getHTML().

+ Here is the caller graph for this function:

◆ init()

static ilTooltipGUI::init ( )
static

Initializes the needed tooltip libraries.

Definition at line 89 of file class.ilTooltipGUI.php.

89 : void
90 {
91 // for globals use, see comment above
92 $tpl = $GLOBALS["tpl"];
93
94 if (!self::$initialized) {
95 $tpl->addCss("./node_modules/qtip2/dist/jquery.qtip.min.css");
96 $tpl->addJavascript("./node_modules/qtip2/dist/jquery.qtip.min.js");
97 $tpl->addJavascript("./Services/UIComponent/Tooltip/js/ilTooltip.js");
98
99 // use setTimeout as a workaround, since the last parameter is ignored
100 $tpl->addOnLoadCode('setTimeout(function() {il.Tooltip.init();}, 500);', 3);
101 self::$initialized = true;
102 }
103 }

References $GLOBALS, and $tpl.

Referenced by ilPreviewGUI\initPreview().

+ Here is the caller graph for this function:

Field Documentation

◆ $initialized

bool ilTooltipGUI::$initialized = false
staticprotected

Definition at line 25 of file class.ilTooltipGUI.php.

◆ $library_initialized

bool ilTooltipGUI::$library_initialized = false
staticprotected

Definition at line 26 of file class.ilTooltipGUI.php.


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