ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilTooltipGUI Class Reference

This is a utility class for the yui tooltips. More...

+ Collaboration diagram for ilTooltipGUI:

Static Public Member Functions

static addTooltip ( $a_el_id, $a_text, $a_container="", $a_my="bottom center", $a_at="top center", $a_use_htmlspecialchars=true)
 Adds a tooltip to an HTML element. More...
 
static getToolTip ( $a_el_id, $a_text, $a_container="", $a_my="bottom center", $a_at="top center", $a_use_htmlspecialchars=true)
 Get tooltip js code. More...
 
static init ()
 Initializes the needed tooltip libraries. More...
 

Static Protected Attributes

static $initialized = false
 
static $library_initialized = false
 

Detailed Description

This is a utility class for the yui tooltips.

this only works, if a parent has class="yui-skin-sam" attached.

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

Member Function Documentation

◆ addTooltip()

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

Adds a tooltip to an HTML element.

Parameters
string$a_el_idelement id
string$a_el_idtooltip text
string$a_el_idelement id of container the tooltip should be added to

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

References $code, $GLOBALS, $tpl, and init().

Referenced by ilTabsGUI\__getHTML(), ilMainMenuGUI\addToolbarTooltip(), ilTable2GUI\fillHeader(), ilObjectListGUI\getHeaderAction(), ilGroupedListGUI\getHTML(), ilRatingGUI\getHTML(), ilAdvancedSelectionListGUI\getHTML(), ilPageObjectGUI\getTinyMenu(), ilBadgeManagementGUI\listBadges(), ilMainMenuGUI\renderHelpButtons(), ilContainerObjectiveGUI\renderProgressBar(), and ilContainerObjectiveGUI\renderProgressMeter().

27  {
28  // to get rid of globals here, we need to change the
29  // process in learning modules, e.g. which does not work with $DIC (since it does not
30  // use the standard template)
31  $tpl = $GLOBALS["tpl"];
32 
33  self::init();
34 
35  $code = self::getTooltip(
36  $a_el_id,
37  $a_text,
38  $a_container,
39  $a_my,
40  $a_at,
41  $a_use_htmlspecialchars
42  );
43  $tpl->addOnLoadCode($code);
44  }
$tpl
Definition: ilias.php:10
$code
Definition: example_050.php:99
while(count($oldTaskList) > 0) foreach(array_keys($newTaskList) as $task) init()
Definition: build.php:77
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getToolTip()

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

Get tooltip js code.

Parameters
string$a_el_idelement id
string$a_el_idtooltip text
string$a_el_idelement id of container the tooltip should be added to

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

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

◆ init()

static ilTooltipGUI::init ( )
static

Initializes the needed tooltip libraries.

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

References $GLOBALS, and $tpl.

Referenced by ilPreviewGUI\initPreview().

86  {
87  // for globals use, see comment above
88  $tpl = $GLOBALS["tpl"];
89 
90  if (!self::$initialized) {
91  $tpl->addCss("./libs/bower/bower_components/qtip2/dist/jquery.qtip.min.css");
92  $tpl->addJavascript("./libs/bower/bower_components/qtip2/dist/jquery.qtip.min.js");
93  $tpl->addJavascript("./Services/UIComponent/Tooltip/js/ilTooltip.js");
94  $tpl->addOnLoadCode('il.Tooltip.init();', 3);
95  self::$initialized = true;
96  }
97  }
$tpl
Definition: ilias.php:10
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
+ Here is the caller graph for this function:

Field Documentation

◆ $initialized

ilTooltipGUI::$initialized = false
staticprotected

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

◆ $library_initialized

ilTooltipGUI::$library_initialized = false
staticprotected

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


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