ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilYuiUtil.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2005 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
24 
31 class ilYuiUtil
32 {
36  static function initConnection()
37  {
38  global $tpl;
39 
40  $tpl->addJavaScript("./Services/YUI/js/2_5_0/yahoo/yahoo-min.js");
41  $tpl->addJavaScript("./Services/YUI/js/2_5_0/event/event-min.js");
42  $tpl->addJavaScript("./Services/YUI/js/2_5_0/connection/connection-min.js");
43  }
44 
48  static function initDragDrop()
49  {
50  global $tpl;
51 
52  $tpl->addJavaScript("./Services/YUI/js/2_5_0/yahoo-dom-event/yahoo-dom-event.js");
53  $tpl->addJavaScript("./Services/YUI/js/2_5_0/dragdrop/dragdrop-min.js");
54  }
55 
59  static function initDomEvent()
60  {
61  global $tpl;
62 
63  $tpl->addJavaScript("./Services/YUI/js/2_5_0/yahoo/yahoo-min.js");
64  $tpl->addJavaScript("./Services/YUI/js/2_5_0/yahoo-dom-event/yahoo-dom-event.js");
65  }
66 
74  public function initPanel()
75  {
76  global $tpl;
77 
78  $tpl->addJavaScript('./Services/YUI/js/2_5_0/yahoo-dom-event/yahoo-dom-event.js');
79  // optional
80  //$tpl->addJavaScript('./Services/YUI/js/2_5_0/animation/animation-min.js');
81  // optional
82  //$tpl->addJavaScript('./Services/YUI/js/2_5_0/dragdrop/dragdrop-min.js');
83  $tpl->addJavaScript('./Services/YUI/js/2_5_0/container/container-min.js');
84  $tpl->addCss("./Services/YUI/js/2_5_0/container/assets/skins/sam/container.css");
85  #$tpl->addCss("./Services/YUI/js/2_5_0/container/assets/container-core.css");
86  $tpl->addCss('./Services/Calendar/css/panel_min.css');
87 
88  }
89 
90 
94  static function initConnectionWithAnimation()
95  {
96  global $tpl;
97 
98  $tpl->addJavaScript("./Services/YUI/js/2_5_0/yahoo/yahoo-min.js");
99  $tpl->addJavaScript("./Services/YUI/js/2_5_0/animation/animation-min.js");
100  $tpl->addJavaScript("./Services/YUI/js/2_5_0/yahoo-dom-event/yahoo-dom-event.js");
101  $tpl->addJavaScript("./Services/YUI/js/2_5_0/connection/connection-min.js");
102  }
103 
107  static function initMenu()
108  {
109  global $tpl;
110 
111  $tpl->addJavaScript("./Services/YUI/js/2_5_0/yahoo/yahoo-min.js");
112  $tpl->addJavaScript("./Services/YUI/js/2_5_0/event/event.js");
113  $tpl->addJavaScript("./Services/YUI/js/2_5_0/dom/dom.js");
114  $tpl->addJavaScript("./Services/YUI/js/2_5_0/container/container_core.js");
115  $tpl->addJavaScript("./Services/YUI/js/2_5_0/menu/menu.js");
116  $tpl->addCss("./Services/YUI/js/2_5_0/menu/assets/menu.css");
117  }
118 
122  static function initOverlay()
123  {
124  global $tpl;
125 
126  $tpl->addJavaScript("./Services/YUI/js/2_5_0/yahoo/yahoo-min.js");
127  $tpl->addJavaScript("./Services/YUI/js/2_5_0/event/event.js");
128  $tpl->addJavaScript("./Services/YUI/js/2_5_0/dom/dom.js");
129  $tpl->addJavaScript("./Services/YUI/js/2_5_0/container/container_core.js");
130  }
131 
135  static function initSimpleDialog()
136  {
137  global $tpl;
138 
139  $tpl->addJavaScript("./Services/YUI/js/2_5_0/yahoo/yahoo-min.js");
140  $tpl->addJavaScript("./Services/YUI/js/2_5_0/event/event.js");
141  $tpl->addJavaScript("./Services/YUI/js/2_5_0/dom/dom.js");
142  $tpl->addJavaScript("./Services/YUI/js/2_5_0/container/container.js");
143  $tpl->addJavaScript("./Services/YUI/js/2_5_0/dragdrop/dragdrop.js");
144  $tpl->addCss("./Services/YUI/js/2_5_0/container/assets/container.css");
145  $tpl->addCss("./Services/YUI/templates/default/tpl.simpledialog.css");
146  }
147 
151  static function initDragDropList()
152  {
153  global $tpl;
154 
155  $tpl->addJavaScript("./Services/YUI/js/2_5_0/yahoo-dom-event/yahoo-dom-event.js");
156  $tpl->addJavaScript("./Services/YUI/js/2_5_0/animation/animation-min.js");
157  $tpl->addJavaScript("./Services/YUI/js/2_5_0/dragdrop/dragdrop-min.js");
158  $tpl->addCss("./Services/YUI/templates/default/DragDropList.css");
159  }
160 
164  static function getDragDropList($id_source, $title_source, $source, $id_dest, $title_dest, $dest)
165  {
167 
168  $template = new ilTemplate("tpl.dragdroplist.html", TRUE, TRUE, "Services/YUI");
169  foreach ($source as $id => $name)
170  {
171  $template->setCurrentBlock("source_element");
172  $template->setVariable("ELEMENT_ID", $id);
173  $template->setVariable("ELEMENT_NAME", $name);
174  $template->parseCurrentBlock();
175  $template->setCurrentBlock("element");
176  $template->setVariable("ELEMENT_ID", $id);
177  $template->parseCurrentBlock();
178  }
179  foreach ($dest as $id => $name)
180  {
181  $template->setCurrentBlock("dest_element");
182  $template->setVariable("ELEMENT_ID", $id);
183  $template->setVariable("ELEMENT_NAME", $name);
184  $template->parseCurrentBlock();
185  $template->setCurrentBlock("element");
186  $template->setVariable("ELEMENT_ID", $id);
187  $template->parseCurrentBlock();
188  }
189  $template->setVariable("TITLE_LIST_1", $title_source);
190  $template->setVariable("TITLE_LIST_2", $title_dest);
191  $template->setVariable("LIST_1", $id_source);
192  $template->setVariable("LIST_2", $id_dest);
193  return $template->get();
194  }
195 
196  static function addYesNoDialog($dialogname, $headertext, $message, $yesaction, $noaction, $defaultyes, $icon = "help")
197  {
198  global $tpl, $lng;
199 
201 
202  $template = new ilTemplate("tpl.yes_no_dialog.js", TRUE, TRUE, "Services/YUI");
203  $template->setVariable("DIALOGNAME", $dialogname);
204  $template->setVariable("YES_ACTION", $yesaction);
205  $template->setVariable("NO_ACTION", $noaction);
206  $template->setVariable("DIALOG_HEADER", $headertext);
207  $template->setVariable("DIALOG_MESSAGE", $message);
208  $template->setVariable("TEXT_YES", $lng->txt("yes"));
209  $template->setVariable("TEXT_NO", $lng->txt("no"));
210  switch ($icon)
211  {
212  case "warn":
213  $template->setVariable("ICON", "YAHOO.widget.SimpleDialog.ICON_WARN");
214  break;
215  case "tip":
216  $template->setVariable("ICON", "YAHOO.widget.SimpleDialog.ICON_TIP");
217  break;
218  case "info":
219  $template->setVariable("ICON", "YAHOO.widget.SimpleDialog.ICON_INFO");
220  break;
221  case "block":
222  $template->setVariable("ICON", "YAHOO.widget.SimpleDialog.ICON_BLOCK");
223  break;
224  case "alarm":
225  $template->setVariable("ICON", "YAHOO.widget.SimpleDialog.ICON_ALARM");
226  break;
227  case "help":
228  default:
229  $template->setVariable("ICON", "YAHOO.widget.SimpleDialog.ICON_HELP");
230  break;
231  }
232  if ($defaultyes)
233  {
234  $template->touchBlock("isDefaultYes");
235  }
236  else
237  {
238  $template->touchBlock("isDefaultNo");
239  }
240  $tpl->setCurrentBlock("HeadContent");
241  $tpl->setVariable("CONTENT_BLOCK", $template->get());
242  $tpl->parseCurrentBlock();
243  }
244 
252  public static function initCalendar()
253  {
254  global $tpl;
255 
256  $tpl->addJavaScript('./Services/YUI/js/2_5_0/yahoo/yahoo.js');
257  $tpl->addJavaScript('./Services/YUI/js/2_5_0/event/event.js');
258  $tpl->addJavaScript('./Services/YUI/js/2_5_0/dom/dom.js');
259  $tpl->addJavaScript('./Services/YUI/js/2_5_0/calendar/calendar.js');
260 
261  $tpl->addCss('./Services/YUI/js/2_5_0/calendar/assets/skins/sam/calendar.css');
262  $tpl->addCss('./Services/Calendar/css/calendar.css');
263  }
264 
273  public static function initButtonControl()
274  {
275  global $tpl;
276 
277  $tpl->addJavaScript("./Services/YUI/js/2_5_0/yahoo-dom-event/yahoo-dom-event.js");
278  $tpl->addJavaScript("./Services/YUI/js/2_5_0/element/element-beta-min.js");
279 
280  $tpl->addJavaScript('./Services/YUI/js/2_5_0/container/container_core-min.js');
281  $tpl->addJavaScript('./Services/YUI/js/2_5_0/menu/menu-min.js');
282 
283  $tpl->addJavaScript('./Services/YUI/js/2_5_0/button/button-min.js');
284 
285  $tpl->addCss("./Services/YUI/js/2_5_0/button/assets/skins/sam/button.css");
286  $tpl->addCss("./Services/YUI/js/2_5_0/menu/assets/skins/sam/menu.css");
287  }
288 
296  public static function initColorPicker()
297  {
298  global $tpl;
299 
301 
302  $tpl->addJavaScript('./Services/YUI/js/2_5_0/dragdrop/dragdrop-min.js');
303  $tpl->addJavaScript('./Services/YUI/js/2_5_0/slider/slider-min.js');
304  $tpl->addJavaScript('./Services/YUI/js/2_5_0/colorpicker/colorpicker-min.js');
305 
306  $tpl->addCss('./Services/Form/css/color_picker.css');
307  $tpl->addCss("./Services/YUI/js/2_5_0/colorpicker/assets/skins/sam/colorpicker.css");
308  }
309 
313  public static function initTabView()
314  {
315  global $tpl;
316 
317  $tpl->addCss("./Services/YUI/js/2_5_0/tabview/assets/skins/sam/tabview.css");
318  $tpl->addJavaScript('./Services/YUI/js/2_5_0/yahoo-dom-event/yahoo-dom-event.js');
319  $tpl->addJavaScript('./Services/YUI/js/2_5_0/element/element-beta-min.js');
320  $tpl->addJavaScript('./Services/YUI/js/2_5_0/tabview/tabview-min.js');
321 
322  //<script type="text/javascript" src="http://yui.yahooapis.com/2.5.1/build/tabview/tabview-min.js"></script>
323  }
324 
325 } // END class.ilUtil
326 ?>