ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ILIAS\COPage\ResourcesInjector Class Reference

Injects resources into a template. More...

+ Collaboration diagram for ILIAS\COPage\ResourcesInjector:

Public Member Functions

 __construct (ResourcesCollector $collector)
 
 inject (\ilGlobalTemplateInterface $tpl)
 Inject into template. More...
 

Protected Attributes

ResourcesCollector $collector
 

Detailed Description

Injects resources into a template.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 26 of file ResourcesInjector.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\COPage\ResourcesInjector::__construct ( ResourcesCollector  $collector)

Definition at line 30 of file ResourcesInjector.php.

References ILIAS\COPage\ResourcesInjector\$collector.

31  {
32  $this->collector = $collector;
33  }

Member Function Documentation

◆ inject()

ILIAS\COPage\ResourcesInjector::inject ( \ilGlobalTemplateInterface  $tpl)

Inject into template.

Definition at line 38 of file ResourcesInjector.php.

References ILIAS\COPage\ResourcesInjector\$collector, ilGlobalTemplateInterface\addCss(), ilGlobalTemplateInterface\addJavaScript(), and ilGlobalTemplateInterface\addOnLoadCode().

38  : void
39  {
40  $resource_collector = $this->collector;
41 
42  foreach ($resource_collector->getCssFiles() as $css) {
43  $tpl->addCss($css);
44  }
45 
46  foreach ($resource_collector->getJavascriptFiles() as $js) {
47  $batch = 3;
48  if (is_int(strpos($js, "jquery"))) {
49  $batch = 1;
50  }
51  if (is_int(strpos($js, "Basic.js"))) {
52  $batch = 2;
53  }
54  $tpl->addJavaScript($js, false, $batch);
55  }
56 
57  foreach ($resource_collector->getOnloadCode() as $code) {
58  $tpl->addOnLoadCode($code);
59  }
60  }
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
+ Here is the call graph for this function:

Field Documentation

◆ $collector

ResourcesCollector ILIAS\COPage\ResourcesInjector::$collector
protected

The documentation for this class was generated from the following file: