ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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.

22 {
23 global $tpl;
24
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 }
global $tpl
Definition: ilias.php:8
static initLibrary()
Initializes the needed tooltip libraries.
$code
Definition: example_050.php:99

References $code, $tpl, and initLibrary().

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

+ 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 45 of file class.ilTooltipGUI.php.

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 }

◆ initLibrary()

static ilTooltipGUI::initLibrary ( )
static

Initializes the needed tooltip libraries.

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

77 {
78 global $tpl;
79
80 if (self::$library_initialized)
81 return;
82
83 // include_once("./Services/YUI/classes/class.ilYuiUtil.php");
84 // ilYuiUtil::initTooltip();
85 $tpl->addCss("./Services/UIComponent/Tooltip/lib/qtip_2_2_1/jquery.qtip.min.css");
86 $tpl->addJavascript("./Services/UIComponent/Tooltip/lib/qtip_2_2_1/jquery.qtip.min.js");
87
88 self::$library_initialized = true;
89 }

References $tpl.

Referenced by addTooltip(), and ilPreviewGUI\initPreview().

+ 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: