ILIAS  trunk Revision v12.0_alpha-399-g579a087ced2
ILIAS\News\Aggregation\SubtreeAggregationStrategy Class Reference

Subtree Aggregation Strategy aggregates related contexts for groups and courses. More...

+ Inheritance diagram for ILIAS\News\Aggregation\SubtreeAggregationStrategy:
+ Collaboration diagram for ILIAS\News\Aggregation\SubtreeAggregationStrategy:

Public Member Functions

 __construct (protected readonly \ilTree $tree)
 
 aggregate (NewsContext $base_context)
 @ineritDoc More...
 
 isRecursive ()
 Returns true if the strategy already resolves contexts recursively (which is more performant in some cases). More...
 
 shouldSkip (NewsContext $context)
 Returns true if the provided context should not be aggregated. More...
 
 aggregate (NewsContext $base_context)
 
 shouldSkip (NewsContext $context)
 Returns true if the provided context should not be aggregated. More...
 
 isRecursive ()
 Returns true if the strategy already resolves contexts recursively (which is more performant in some cases). More...
 

Detailed Description

Subtree Aggregation Strategy aggregates related contexts for groups and courses.

Definition at line 28 of file SubtreeAggregationStrategy.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\News\Aggregation\SubtreeAggregationStrategy::__construct ( protected readonly \ilTree  $tree)

Definition at line 30 of file SubtreeAggregationStrategy.php.

31 {
32 }

Member Function Documentation

◆ aggregate()

ILIAS\News\Aggregation\SubtreeAggregationStrategy::aggregate ( NewsContext  $base_context)

@ineritDoc

Implements ILIAS\News\Aggregation\NewsAggregationStrategy.

Definition at line 37 of file SubtreeAggregationStrategy.php.

37 : 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 }

References ILIAS\News\Data\NewsContext\getLevel(), and ILIAS\News\Data\NewsContext\getRefId().

+ Here is the call graph for this function:

◆ isRecursive()

ILIAS\News\Aggregation\SubtreeAggregationStrategy::isRecursive ( )

Returns true if the strategy already resolves contexts recursively (which is more performant in some cases).

If it returns false, the returned contexts will be enqueued by the aggregator to be resolved iteratively.

Implements ILIAS\News\Aggregation\NewsAggregationStrategy.

Definition at line 54 of file SubtreeAggregationStrategy.php.

54 : bool
55 {
56 return false;
57 }

◆ shouldSkip()

ILIAS\News\Aggregation\SubtreeAggregationStrategy::shouldSkip ( NewsContext  $context)

Returns true if the provided context should not be aggregated.

This method may check criteria or external conditions.

Implements ILIAS\News\Aggregation\NewsAggregationStrategy.

Reimplemented in ILIAS\News\Aggregation\CategoryAggregationStrategy.

Definition at line 59 of file SubtreeAggregationStrategy.php.

59 : 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 }
static _lookupContainerSetting(int $a_id, string $a_keyword, ?string $a_default_value=null)
$context
Definition: webdav.php:31

References $context, and ilContainer\_lookupContainerSetting().

+ Here is the call graph for this function:

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