ILIAS  trunk Revision v11.0_alpha-1702-gfd3ecb7f852
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilYuiUtil.php
Go to the documentation of this file.
1 <?php
2 
23 class ilYuiUtil
24 {
25  protected const YUI_BASE = "./node_modules/yui2/build";
26 
27  private static function ensureGlobalTemplate(
28  ?ilGlobalTemplateInterface $main_tpl = null
30  global $DIC;
31  return $main_tpl === null ? $DIC->ui()->mainTemplate() : $main_tpl;
32  }
33 
37  public static function initConnection(
38  ?ilGlobalTemplateInterface $a_main_tpl = null
39  ): void {
40  $tpl = self::ensureGlobalTemplate($a_main_tpl);
41  $tpl->addJavaScript("assets/js/yahoo-dom-event.js");
42  $tpl->addJavaScript("assets/js/connection-min.js");
43  }
44 
45 
49  public static function initEvent(
50  ?ilGlobalTemplateInterface $a_main_tpl = null
51  ): void {
52  $tpl = self::ensureGlobalTemplate($a_main_tpl);
53  $tpl->addJavaScript("assets/js/yahoo-dom-event.js");
54  }
55 
56 
60  public static function initDom(
61  ?ilGlobalTemplateInterface $a_main_tpl = null
62  ): void {
63  $tpl = self::ensureGlobalTemplate($a_main_tpl);
64  $tpl->addJavaScript("assets/js/yahoo-dom-event.js");
65  }
66 
67 
73  public static function initDragDrop(
74  ?ilGlobalTemplateInterface $a_main_tpl = null
75  ): void {
76  $tpl = self::ensureGlobalTemplate($a_main_tpl);
77  $tpl->addJavaScript("assets/js/yahoo-dom-event.js");
78  $tpl->addJavaScript("assets/js/dragdrop-min.js");
79  $tpl->addJavaScript("assets/js/element-min.js");
80  }
81 
82 
88  public static function initDomEvent(
89  ?ilGlobalTemplateInterface $a_main_tpl = null
90  ): void {
91  $tpl = self::ensureGlobalTemplate($a_main_tpl);
92  $tpl->addJavaScript("assets/js/yahoo-dom-event.js");
93  }
94 
100  public static function initPanel(
101  bool $a_resize = false,
102  ?ilGlobalTemplateInterface $a_main_tpl = null
103  ): void {
104  $tpl = self::ensureGlobalTemplate($a_main_tpl);
105  $tpl->addJavaScript("assets/js/yahoo-dom-event.js");
106  $tpl->addJavaScript("assets/js/container-min.js");
107  self::addContainerCss($tpl);
108  $tpl->addCss("./components/ILIAS/Calendar/css/panel_min.css");
109 
110  if ($a_resize) {
111  $tpl->addCss(self::YUI_BASE . "/resize/assets/skins/sam/resize.css");
112  $tpl->addJavaScript("assets/js/utilities.js");
113  $tpl->addJavaScript("assets/js/resize-min.js");
114  }
115  }
116 
117 
123  public static function initConnectionWithAnimation(): void
124  {
125  $tpl = self::ensureGlobalTemplate();
126  $tpl->addJavaScript("assets/js/yahoo-dom-event.js");
127  $tpl->addJavaScript("assets/js/animation-min.js");
128  $tpl->addJavaScript("assets/js/connection-min.js");
129  }
130 
131 
132 
138  public static function initOverlay(
139  ?ilGlobalTemplateInterface $a_main_tpl = null
140  ): void {
141  $tpl = self::ensureGlobalTemplate($a_main_tpl);
142  $tpl->addJavaScript("assets/js/yahoo-dom-event.js");
143  $tpl->addJavaScript("assets/js/container_core-min.js");
144  self::addContainerCss($tpl);
145  }
146 
147 
152  public static function initButtonControl(): void
153  {
154  $tpl = self::ensureGlobalTemplate();
155  $tpl->addJavaScript("assets/js/yahoo-dom-event.js");
156  $tpl->addJavaScript("assets/js/element-min.js");
157 
158  $tpl->addJavaScript("assets/js/container_core-min.js");
159  $tpl->addJavaScript("assets/js/menu-min.js");
160 
161  $tpl->addJavaScript("assets/js/button-min.js");
162 
163  $tpl->addCss("assets/css/button.css");
164  $tpl->addCss("assets/css/menu.css");
165  }
166 
171  public static function initCookie(): void
172  {
173  $tpl = self::ensureGlobalTemplate();
174  $tpl->addJavaScript("assets/js/yahoo-min.js", 1);
175  $tpl->addJavaScript("assets/js/cookie.js", 1);
176  }
177 
178 
182  public static function getLocalPath(string $a_name = ""): string
183  {
184  return self::YUI_BASE . "/" . $a_name;
185  }
186 
187 
191  protected static function addContainerCss(
192  ?ilGlobalTemplateInterface $a_main_tpl = null
193  ): void {
194  $tpl = self::ensureGlobalTemplate($a_main_tpl);
195  $tpl->addCss("assets/css/container.css");
196 
197  }
198 }
static getLocalPath(string $a_name="")
Get local path of a YUI js file.
static initDomEvent(?ilGlobalTemplateInterface $a_main_tpl=null)
Init YUI DomEvent used in Services/Calendar, Modules/Session, Modules/Test (Jan 2022) ...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static initDom(?ilGlobalTemplateInterface $a_main_tpl=null)
Init YUI Dom.
static ensureGlobalTemplate(?ilGlobalTemplateInterface $main_tpl=null)
static addContainerCss(?ilGlobalTemplateInterface $a_main_tpl=null)
Add container css.
global $DIC
Definition: shib_login.php:22
static initDragDrop(?ilGlobalTemplateInterface $a_main_tpl=null)
Init YUI Drag and Drop used in Modules/Survey, Services/Calendar, Services/COPage, Services/Form (Jan 2022)
static initButtonControl()
init button control In the moment used for calendar color picker button
static initCookie()
used in Services/Authentication (Session Reminder) Jan 2022
static initEvent(?ilGlobalTemplateInterface $a_main_tpl=null)
Init YUI Event.
static initConnection(?ilGlobalTemplateInterface $a_main_tpl=null)
Init YUI Connection module.
static initConnectionWithAnimation()
Init YUI connection and animation module used in Modules/Test (Jan 2022)
static initPanel(bool $a_resize=false, ?ilGlobalTemplateInterface $a_main_tpl=null)
Init yui panel used in Modules/Test, Services/TermsOfService (Jan 2022)
static initOverlay(?ilGlobalTemplateInterface $a_main_tpl=null)
Init YUI Overlay module used in Modules/Test, Services/TermsOfService, Services/Tracking, Services/UIComponent.