19 static function addTooltip($a_el_id, $a_text, $a_container =
"",
20 $a_my =
"bottom center", $a_at =
"top center", $a_use_htmlspecialchars =
true)
24 if (!self::$initialized)
28 $tpl->addCss(
"./Services/UIComponent/Tooltip/lib/qtip_2_0_nightly/jquery.qtip.min.css");
29 $tpl->addJavascript(
"./Services/UIComponent/Tooltip/lib/qtip_2_0_nightly/jquery.qtip.min.js");
30 $tpl->addJavascript(
"./Services/UIComponent/Tooltip/js/ilTooltip.js");
31 $tpl->addOnLoadCode(
'il.Tooltip.init();', 3);
32 self::$initialized =
true;
35 $code = self::getTooltip($a_el_id, $a_text, $a_container, $a_my, $a_at,
36 $a_use_htmlspecialchars);
37 $tpl->addOnLoadCode($code);
47 static function getToolTip($a_el_id, $a_text, $a_container =
"",
48 $a_my =
"bottom center", $a_at =
"top center", $a_use_htmlspecialchars =
true)
51 if ($a_container !=
"")
53 $addstr.=
", container: '".$a_container.
"'";
56 if ($a_use_htmlspecialchars)
58 $a_text = htmlspecialchars(str_replace(array(
"\n",
"\r"),
"", $a_text));
62 $a_text = str_replace(array(
"\n",
"\r",
"'",
'"'), array(
"",
"",
"\'",
'\"'), $a_text);
64 return 'il.Tooltip.add("'.$a_el_id.
'", {'.
65 ' context:"'.$a_el_id.
'",'.
68 ' text:"'.$a_text.
'" '.$addstr.
'} );';