ILIAS
release_6 Revision v6.24-5-g0c8bfefb3b8
◀ ilDoc Overview
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
12
class
ResourcesInjector
13
{
17
protected
$collector
;
18
23
public
function
__construct
(
ResourcesCollector
$collector
)
24
{
25
$this->collector =
$collector
;
26
}
27
32
public
function
inject
(\
ilGlobalTemplateInterface
$tpl
)
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
}
$tpl
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
Definition:
imagemanager.php:90
ILIAS\COPage\ResourcesInjector\inject
inject(\ilGlobalTemplateInterface $tpl)
Inject into template.
Definition:
ResourcesInjector.php:32
ilGlobalTemplateInterface\addOnLoadCode
addOnLoadCode($a_code, $a_batch=2)
Add on load code.
ILIAS\COPage\ResourcesInjector\$collector
$collector
Definition:
ResourcesInjector.php:17
ilGlobalTemplateInterface\addJavaScript
addJavaScript($a_js_file, $a_add_version_parameter=true, $a_batch=2)
Add a javascript file that should be included in the header.
ILIAS\COPage\ResourcesInjector
Injects resources into a template.
Definition:
ResourcesInjector.php:12
ilGlobalTemplateInterface
Created by PhpStorm.
Definition:
interface.ilGlobalTemplateInterface.php:16
ILIAS\COPage\ResourcesCollector
Collects all js/css/onload resources necessary for page rendering.
Definition:
ResourcesCollector.php:12
ILIAS\COPage\ResourcesInjector\__construct
__construct(ResourcesCollector $collector)
ResourcesInjector constructor.
Definition:
ResourcesInjector.php:23
ilGlobalTemplateInterface\addCss
addCss($a_css_file, $media="screen")
Add a css file that should be included in the header.
ILIAS\COPage
Definition:
PageLinker.php:5
Services
COPage
Resources
ResourcesInjector.php
Generated on Wed Sep 3 2025 20:01:13 for ILIAS by
1.8.13 (using
Doxyfile
)