ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
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.

Deprecated:
10

Definition at line 25 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 30 of file class.ilTooltipGUI.php.

References $GLOBALS, and init().

Referenced by ilTable2GUI\fillHeader(), ilGroupedListGUI\getHTML(), and ilAdvancedSelectionListGUI\getHTML().

37  : void {
38  // to get rid of globals here, we need to change the
39  // process in learning modules, e.g. which does not work with $DIC (since it does not
40  // use the standard template)
41  $tpl = $GLOBALS["tpl"];
42 
43  self::init();
44 
45  $code = self::getToolTip(
46  $a_el_id,
47  $a_text,
48  $a_container,
49  $a_my,
50  $a_at,
51  $a_use_htmlspecialchars
52  );
53  $tpl->addOnLoadCode($code);
54  }
$GLOBALS["DIC"]
Definition: wac.php:30
+ Here is the call graph for this function:
+ 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 59 of file class.ilTooltipGUI.php.

Referenced by ilGroupedListGUI\getHTML().

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

◆ init()

static ilTooltipGUI::init ( )
static

Initializes the needed tooltip libraries.

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

References $GLOBALS.

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

Field Documentation

◆ $initialized

bool ilTooltipGUI::$initialized = false
staticprotected

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

◆ $library_initialized

bool ilTooltipGUI::$library_initialized = false
staticprotected

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


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