ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 initLibrary ()
 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, and $tpl.

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

22  {
23  global $tpl;
24 
25  self::initLibrary();
26  if (!self::$initialized)
27  {
28  $tpl->addJavascript("./Services/UIComponent/Tooltip/js/ilTooltip.js");
29  $tpl->addOnLoadCode('il.Tooltip.init();', 3);
30  self::$initialized = true;
31  }
32 
33  $code = self::getTooltip($a_el_id, $a_text, $a_container, $a_my, $a_at,
34  $a_use_htmlspecialchars);
35  $tpl->addOnLoadCode($code);
36  }
$code
Definition: example_050.php:99
global $tpl
Definition: ilias.php:8
+ 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 45 of file class.ilTooltipGUI.php.

References array.

47  {
48  $addstr = "";
49 
50  // not needed, just make sure the position plugin is included
51 // $addstr.= ", position: {viewport: $('#fixed_content')}";
52 
53  if ($a_container != "")
54  {
55  $addstr.= ", container: '".$a_container."'";
56  }
57 
58  if ($a_use_htmlspecialchars)
59  {
60  $a_text = htmlspecialchars(str_replace(array("\n", "\r"), "", $a_text));
61  }
62  else
63  {
64  $a_text = str_replace(array("\n", "\r", "'", '"'), array("", "", "\'", '\"'), $a_text);
65  }
66  return 'il.Tooltip.add("'.$a_el_id.'", {'.
67  ' context:"'.$a_el_id.'",'.
68  ' my:"'.$a_my.'",'.
69  ' at:"'.$a_at.'",'.
70  ' text:"'.$a_text.'" '.$addstr.'} );';
71  }
Create styles array
The data for the language used.

◆ initLibrary()

static ilTooltipGUI::initLibrary ( )
static

Initializes the needed tooltip libraries.

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

References $tpl.

Referenced by ilPreviewGUI\initPreview().

77  {
78  global $tpl;
79 
80  if (self::$library_initialized)
81  return;
82 
83  $tpl->addCss("./Services/UIComponent/Tooltip/lib/qtip_3_0_3/jquery.qtip.min.css");
84  $tpl->addJavascript("./Services/UIComponent/Tooltip/lib/qtip_3_0_3/jquery.qtip.min.js");
85 
86  self::$library_initialized = true;
87  }
global $tpl
Definition: ilias.php:8
+ 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: