Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00031 class ilYuiUtil
00032 {
00036 static function initConnection()
00037 {
00038 global $tpl;
00039
00040 $tpl->addJavaScript("./Services/YUI/js/2_2_2/yahoo/yahoo-min.js");
00041 $tpl->addJavaScript("./Services/YUI/js/2_2_2/connection/connection-min.js");
00042 }
00043
00047 static function initMenu()
00048 {
00049 global $tpl;
00050
00051 $tpl->addJavaScript("./Services/YUI/js/2_2_2/yahoo/yahoo-min.js");
00052 $tpl->addJavaScript("./Services/YUI/js/2_2_2/event/event.js");
00053 $tpl->addJavaScript("./Services/YUI/js/2_2_2/dom/dom.js");
00054 $tpl->addJavaScript("./Services/YUI/js/2_2_2/container/container_core.js");
00055 $tpl->addJavaScript("./Services/YUI/js/2_2_2/menu/menu.js");
00056 $tpl->addCss("./Services/YUI/js/2_2_2/menu/assets/menu.css");
00057 }
00058
00062 static function initOverlay()
00063 {
00064 global $tpl;
00065
00066 $tpl->addJavaScript("./Services/YUI/js/2_2_2/yahoo/yahoo-min.js");
00067 $tpl->addJavaScript("./Services/YUI/js/2_2_2/event/event.js");
00068 $tpl->addJavaScript("./Services/YUI/js/2_2_2/dom/dom.js");
00069 $tpl->addJavaScript("./Services/YUI/js/2_2_2/container/container_core.js");
00070 }
00071
00075 static function initSimpleDialog()
00076 {
00077 global $tpl;
00078
00079 $tpl->addJavaScript("./Services/YUI/js/2_2_2/yahoo/yahoo-min.js");
00080 $tpl->addJavaScript("./Services/YUI/js/2_2_2/event/event.js");
00081 $tpl->addJavaScript("./Services/YUI/js/2_2_2/dom/dom.js");
00082 $tpl->addJavaScript("./Services/YUI/js/2_2_2/container/container.js");
00083 $tpl->addJavaScript("./Services/YUI/js/2_2_2/dragdrop/dragdrop.js");
00084 $tpl->addCss("./Services/YUI/js/2_2_2/container/assets/container.css");
00085 $tpl->addCss("./Services/YUI/templates/default/tpl.simpledialog.css");
00086 }
00087
00088 static function addYesNoDialog($dialogname, $headertext, $message, $yesaction, $noaction, $defaultyes, $icon = "help")
00089 {
00090 global $tpl, $lng;
00091
00092 ilYuiUtil::initSimpleDialog();
00093
00094 $template = new ilTemplate("tpl.yes_no_dialog.js", TRUE, TRUE, "Services/YUI");
00095 $template->setVariable("DIALOGNAME", $dialogname);
00096 $template->setVariable("YES_ACTION", $yesaction);
00097 $template->setVariable("NO_ACTION", $noaction);
00098 $template->setVariable("DIALOG_HEADER", $headertext);
00099 $template->setVariable("DIALOG_MESSAGE", $message);
00100 $template->setVariable("TEXT_YES", $lng->txt("yes"));
00101 $template->setVariable("TEXT_NO", $lng->txt("no"));
00102 switch ($icon)
00103 {
00104 case "warn":
00105 $template->setVariable("ICON", "YAHOO.widget.SimpleDialog.ICON_WARN");
00106 break;
00107 case "tip":
00108 $template->setVariable("ICON", "YAHOO.widget.SimpleDialog.ICON_TIP");
00109 break;
00110 case "info":
00111 $template->setVariable("ICON", "YAHOO.widget.SimpleDialog.ICON_INFO");
00112 break;
00113 case "block":
00114 $template->setVariable("ICON", "YAHOO.widget.SimpleDialog.ICON_BLOCK");
00115 break;
00116 case "alarm":
00117 $template->setVariable("ICON", "YAHOO.widget.SimpleDialog.ICON_ALARM");
00118 break;
00119 case "help":
00120 default:
00121 $template->setVariable("ICON", "YAHOO.widget.SimpleDialog.ICON_HELP");
00122 break;
00123 }
00124 if ($defaultyes)
00125 {
00126 $template->touchBlock("isDefaultYes");
00127 }
00128 else
00129 {
00130 $template->touchBlock("isDefaultNo");
00131 }
00132 $tpl->setCurrentBlock("HeadContent");
00133 $tpl->setVariable("CONTENT_BLOCK", $template->get());
00134 $tpl->parseCurrentBlock();
00135 }
00136 }
00137 ?>