ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ResourcesInjector.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2020 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 namespace ILIAS\COPage;
6 
13 {
17  protected $collector;
18 
24  {
25  $this->collector = $collector;
26  }
27 
33  {
34  $resource_collector = $this->collector;
35 
36  foreach ($resource_collector->getCssFiles() as $css) {
37  $tpl->addCss($css);
38  }
39 
40  foreach ($resource_collector->getJavascriptFiles() as $js) {
41  $batch = 3;
42  if (is_int(strpos($js, "jquery"))) {
43  $batch = 1;
44  }
45  if (is_int(strpos($js, "Basic.js"))) {
46  $batch = 2;
47  }
48  $tpl->addJavaScript($js, false, $batch);
49  }
50 
51  foreach ($resource_collector->getOnloadCode() as $code) {
52  $tpl->addOnLoadCode($code);
53  }
54  }
55 }
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
inject(\ilGlobalTemplateInterface $tpl)
Inject into template.
addOnLoadCode($a_code, $a_batch=2)
Add on load code.
addJavaScript($a_js_file, $a_add_version_parameter=true, $a_batch=2)
Add a javascript file that should be included in the header.
Injects resources into a template.
Collects all js/css/onload resources necessary for page rendering.
__construct(ResourcesCollector $collector)
ResourcesInjector constructor.
addCss($a_css_file, $media="screen")
Add a css file that should be included in the header.