• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

Services/YUI/classes/class.ilYuiUtil.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2005 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
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 } // END class.ilUtil
00137 ?>

Generated on Fri Dec 13 2013 17:57:03 for ILIAS Release_3_9_x_branch .rev 46835 by  doxygen 1.7.1