ILIAS
trunk Revision v11.0_alpha-2658-ge2404539063
◀ ilDoc Overview
JsCollection.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
21
namespace
ILIAS\GlobalScreen\Scope\Layout\MetaContent\Media
;
22
26
class
JsCollection
extends
AbstractCollection
27
{
28
protected
array
$path_storage
= [];
29
30
31
public
function
addItem
(
Js
$item): void
32
{
33
$basename = $this->
stripPath
($item->
getContent
());
34
if
(!array_key_exists($basename, $this->items)) {
35
$this->
storeItem
($item);
36
}
else
{
37
$existing = $this->items[$basename];
38
if
(($existing instanceof
Js
) && $existing->getBatch() > $item->
getBatch
()) {
39
$this->
storeItem
($item);
40
}
41
}
42
}
43
44
private
function
storeItem
(
45
js $item
46
): void {
47
$strip_path = $this->
stripPath
($item->getContent());
48
$this->items[$strip_path] = $item;
49
$this->path_storage[$strip_path] = $item->getBatch();
50
}
51
52
#[\Override]
53
public
function
getItemsInOrderOfDelivery
(): array
54
{
55
$ordered = [];
56
foreach
($this->
getItems
() as
$js
) {
57
$ordered[
'pos_'
. (string) $js->getBatch()][] =
$js
;
58
}
59
ksort($ordered);
60
$ordered_all = [];
61
foreach
($ordered as $item) {
62
foreach
($item as $js) {
63
$ordered_all[] =
$js
;
64
}
65
}
66
67
return
$ordered_all;
68
}
69
}
ILIAS\GlobalScreen\Scope\Layout\MetaContent\Media\JsCollection\addItem
addItem(Js $item)
Definition:
JsCollection.php:31
ILIAS\GlobalScreen\Scope\Layout\MetaContent\Media\JsCollection\$path_storage
array $path_storage
Definition:
JsCollection.php:28
ILIAS\GlobalScreen\Scope\Layout\MetaContent\Media\AbstractCollection
Definition:
AbstractCollection.php:29
ILIAS\GlobalScreen\Scope\Layout\MetaContent\Media\Js
Definition:
Js.php:26
ILIAS\GlobalScreen\Scope\Layout\MetaContent\Media\JsCollection
Definition:
JsCollection.php:26
ILIAS\GlobalScreen\Scope\Layout\MetaContent\Media\Js\getBatch
getBatch()
Definition:
Js.php:44
ILIAS\GlobalScreen\Scope\Layout\MetaContent\Media\AbstractCollection\stripPath
stripPath(string $path)
Definition:
AbstractCollection.php:146
ILIAS\GlobalScreen\Scope\Layout\MetaContent\Media\JsCollection\getItemsInOrderOfDelivery
getItemsInOrderOfDelivery()
Definition:
JsCollection.php:53
ILIAS\GlobalScreen\Scope\Layout\MetaContent\Media\AbstractCollection\getItems
getItems()
Definition:
AbstractCollection.php:84
ILIAS\GlobalScreen\Scope\Layout\MetaContent\MetaContent\$js
JsCollection $js
Definition:
MetaContent.php:47
ILIAS\GlobalScreen\Scope\Layout\MetaContent\Media\JsCollection\storeItem
storeItem(js $item)
Definition:
JsCollection.php:44
ILIAS\GlobalScreen\Scope\Layout\MetaContent\Media
Definition:
AbstractCollection.php:21
ILIAS\GlobalScreen\Scope\Layout\MetaContent\Media\AbstractMedia\getContent
getContent()
Definition:
AbstractMedia.php:32
components
ILIAS
GlobalScreen
src
Scope
Layout
MetaContent
Media
JsCollection.php
Generated on Tue Sep 2 2025 23:03:08 for ILIAS by
1.8.13 (using
Doxyfile
)