ILIAS
trunk Revision v12.0_alpha-413-g215742c0453
◀ ilDoc Overview
SubtreeAggregationStrategy.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
21
namespace
ILIAS\News\Aggregation
;
22
23
use
ILIAS\News\Data\NewsContext
;
24
28
class
SubtreeAggregationStrategy
implements
NewsAggregationStrategy
29
{
30
public
function
__construct
(
protected
readonly \
ilTree
$tree)
31
{
32
}
33
37
public
function
aggregate
(
NewsContext
$base_context): array
38
{
39
$aggregated = [];
40
41
foreach
($this->tree->getChilds($base_context->
getRefId
()) as $node) {
42
$aggregated[] =
new
NewsContext
(
43
$node[
'child'
],
44
$node[
'obj_id'
],
45
$node[
'type'
],
46
$base_context->
getRefId
(),
47
$base_context->
getLevel
() + 1
48
);
49
}
50
51
return
$aggregated;
52
}
53
54
public
function
isRecursive
(): bool
55
{
56
return
false
;
57
}
58
59
public
function
shouldSkip
(
NewsContext
$context
): bool
60
{
61
// see #31471, #30687, and ilMembershipNotification
62
return
!
\ilContainer::_lookupContainerSetting
(
$context
->getObjId(),
'cont_use_news'
,
'1'
)
63
|| (!
\ilContainer::_lookupContainerSetting
(
$context
->getObjId(),
'cont_show_news'
,
'1'
)
64
&& !
\ilContainer::_lookupContainerSetting
(
$context
->getObjId(),
'news_timeline'
));
65
}
66
}
ILIAS\News\Aggregation\SubtreeAggregationStrategy
Subtree Aggregation Strategy aggregates related contexts for groups and courses.
Definition:
SubtreeAggregationStrategy.php:29
ILIAS\News\Aggregation\SubtreeAggregationStrategy\aggregate
aggregate(NewsContext $base_context)
@ineritDoc
Definition:
SubtreeAggregationStrategy.php:37
ILIAS\News\Aggregation\SubtreeAggregationStrategy\isRecursive
isRecursive()
Returns true if the strategy already resolves contexts recursively (which is more performant in some ...
Definition:
SubtreeAggregationStrategy.php:54
ILIAS\News\Aggregation\SubtreeAggregationStrategy\shouldSkip
shouldSkip(NewsContext $context)
Returns true if the provided context should not be aggregated.
Definition:
SubtreeAggregationStrategy.php:59
ILIAS\News\Aggregation\SubtreeAggregationStrategy\__construct
__construct(protected readonly \ilTree $tree)
Definition:
SubtreeAggregationStrategy.php:30
ILIAS\News\Data\NewsContext
News Context DTO represents a context where news items can be associated with.
Definition:
NewsContext.php:29
ILIAS\News\Data\NewsContext\getLevel
getLevel()
Definition:
NewsContext.php:91
ILIAS\News\Data\NewsContext\getRefId
getRefId()
Definition:
NewsContext.php:43
ilContainer\_lookupContainerSetting
static _lookupContainerSetting(int $a_id, string $a_keyword, ?string $a_default_value=null)
Definition:
class.ilContainer.php:253
ilTree
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
Definition:
class.ilTree.php:30
ILIAS\News\Aggregation\NewsAggregationStrategy
News Aggregation Strategy Interface defines the contract for news aggregation strategies.
Definition:
NewsAggregationStrategy.php:30
ILIAS\News\Aggregation
Definition:
CategoryAggregationStrategy.php:21
$context
$context
Definition:
webdav.php:31
components
ILIAS
News
src
Aggregation
SubtreeAggregationStrategy.php
Generated on Tue Dec 16 2025 23:02:49 for ILIAS by
1.9.4 (using
Doxyfile
)