20 static function addTooltip($a_el_id, $a_text, $a_container =
"",
21 $a_my =
"bottom center", $a_at =
"top center", $a_use_htmlspecialchars =
true)
26 if (!self::$initialized)
28 $tpl->addJavascript(
"./Services/UIComponent/Tooltip/js/ilTooltip.js");
29 $tpl->addOnLoadCode(
'il.Tooltip.init();', 3);
30 self::$initialized =
true;
33 $code = self::getTooltip($a_el_id, $a_text, $a_container, $a_my, $a_at,
34 $a_use_htmlspecialchars);
35 $tpl->addOnLoadCode($code);
45 static function getToolTip($a_el_id, $a_text, $a_container =
"",
46 $a_my =
"bottom center", $a_at =
"top center", $a_use_htmlspecialchars =
true)
53 if ($a_container !=
"")
55 $addstr.=
", container: '".$a_container.
"'";
58 if ($a_use_htmlspecialchars)
60 $a_text = htmlspecialchars(str_replace(array(
"\n",
"\r"),
"", $a_text));
64 $a_text = str_replace(array(
"\n",
"\r",
"'",
'"'), array(
"",
"",
"\'",
'\"'), $a_text);
66 return 'il.Tooltip.add("'.$a_el_id.
'", {'.
67 ' context:"'.$a_el_id.
'",'.
70 ' text:"'.$a_text.
'" '.$addstr.
'} );';
80 if (self::$library_initialized)
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");
88 self::$library_initialized =
true;