19declare(strict_types=1);
71 $this->
access = $domain_service->access();
78 $this->mode_manager = $this->domain_service->content()->mode(
$container);
80 $this->block_limit = 0;
82 if (!$this->mode_manager->isActiveItemOrdering()) {
90 if (is_null($this->sequence)) {
96 foreach ($this->block_sequence->getParts() as $part) {
104 $other_is_page_embedded =
false;
105 foreach ($embedded_ids as
$id) {
106 if (isset($item_blocks[
$id])) {
107 $item_blocks[
$id]->setPageEmbedded(
true);
108 $sorted_blocks[] = $item_blocks[
$id];
109 unset($item_blocks[
$id]);
110 } elseif (!is_numeric(
$id)) {
112 if (
$id ===
"_other") {
113 $this->has_other_block =
true;
114 $other_is_page_embedded =
true;
116 $ref_ids = $this->item_set_manager->getRefIdsOfType(
$id);
122 if ($this->include_empty_blocks || count($block_items->getRefIds()) > 0) {
123 $block = $this->data_service->itemBlock(
125 $this->data_service->typeBlock(
$id),
126 $block_items->getRefIds(),
127 $block_items->getLimitExhausted()
129 $block->setPageEmbedded(
true);
130 $sorted_blocks[] =
$block;
141 if (!is_null($other_block)) {
142 if ($other_is_page_embedded) {
143 $other_block->setPageEmbedded(
true);
145 $item_blocks[
"_other"] = $other_block;
151 foreach ($sorting->getBlockPositions() as
$id) {
152 if (isset($item_blocks[
$id])) {
153 $item_blocks[
$id]->setPosition(
$pos);
154 $sorted_blocks[] = $item_blocks[
$id];
155 unset($item_blocks[
$id]);
161 foreach ($item_blocks as
$block) {
163 $sorted_blocks[] =
$block;
173 foreach ($this->block_sequence->getParts() as $part) {
191 $this->all_item_group_item_ref_ids = array_unique(array_merge($this->all_item_group_item_ref_ids,
$item_ref_ids));
195 foreach ($this->item_set_manager->getRefIdsOfType(
"itgr") as $item_group_ref_id) {
197 $this->all_item_group_item_ref_ids = array_unique(array_merge($this->all_item_group_item_ref_ids,
$item_ref_ids));
211 $ref_ids = $this->item_set_manager->getRefIdsOfType($type);
214 if ($type !==
"itgr" && count($block_items->getRefIds()) > 0) {
215 yield $this->data_service->itemBlock(
217 $this->data_service->typeBlock($type),
218 $block_items->getRefIds(),
219 $block_items->getLimitExhausted()
225 if ($part instanceof Content\
TypeBlock) {
226 $ref_ids = $this->item_set_manager->getRefIdsOfType($part->getType());
229 if (count($block_items->getRefIds()) > 0) {
230 yield $this->data_service->itemBlock(
232 $this->data_service->typeBlock($part->getType()),
233 $block_items->getRefIds(),
234 $block_items->getLimitExhausted()
240 $ref_ids = $this->item_set_manager->getRefIdsOfType(
"sess");
243 if (count($block_items->getRefIds()) > 0) {
244 yield $this->data_service->itemBlock(
246 $this->data_service->sessionBlock(),
247 $block_items->getRefIds(),
248 $block_items->getLimitExhausted()
263 if (!$this->mode_manager->isAdminMode()) {
280 yield $this->data_service->itemBlock(
291 foreach ($this->item_set_manager->getRefIdsOfType(
"itgr") as $item_group_ref_id) {
300 $this->has_other_block =
true;
306 $filter_session_and_item_group_items =
false,
307 bool $prevent_duplicats =
false
310 $accessible_ref_ids = [];
311 foreach ($ref_ids as
$ref_id) {
312 if ($prevent_duplicats && in_array(
$ref_id, $this->all_ref_ids)) {
318 $this->all_ref_ids[] =
$ref_id;
322 if ($this->
access->checkAccess(
'visible',
'', $ref_id)) {
323 if ($this->block_limit > 0 && count($accessible_ref_ids) >= $this->block_limit) {
325 } elseif (!$filter_session_and_item_group_items || !in_array(
$ref_id, $this->all_item_group_item_ref_ids)) {
326 $accessible_ref_ids[] =
$ref_id;
330 return $this->data_service->blockItemsInfo(
338 foreach ($ref_ids as
$ref_id) {
345 if (!$this->has_other_block) {
349 $remaining_ref_ids = array_filter(
350 $this->item_set_manager->getAllRefIds(),
351 fn($i) => (!isset($this->accumulated_ref_ids[$i]) && !$this->item_set_manager->isSideBlockItem($i))
353 $block_items = $this->determineBlockItems($remaining_ref_ids,
true,
true);
357 if ($this->include_empty_blocks || count($block_items->getRefIds()) > 0) {
358 return $this->data_service->itemBlock(
360 $this->data_service->otherBlock(),
361 $block_items->getRefIds(),
362 $block_items->getLimitExhausted()
381 if (!isset(self::$item_group_ref_ids[$item_group_ref_id])) {
383 $this->container->getId()
386 self::$item_group_ref_ids[$item_group_ref_id] = array_map(
static function ($i) {
387 return (
int) $i[
"child"];
390 return self::$item_group_ref_ids[$item_group_ref_id];
395 $ref_ids = $this->getItemGroupItemRefIds($item_group_ref_id);
396 $this->accumulateRefIds($ref_ids);
397 $block_items = $this->determineBlockItems($ref_ids);
399 if (!$this->
access->checkAccess(
"visible",
"", $item_group_ref_id) ||
400 !$this->access->checkAccess(
"read",
"", $item_group_ref_id)) {
404 if (count($block_items->getRefIds()) > 0 || $this->access->checkAccess(
'write',
'', $item_group_ref_id)) {
405 return $this->data_service->itemBlock(
406 (
string) $item_group_ref_id,
407 $this->data_service->itemGroupBlock($item_group_ref_id),
408 $block_items->getRefIds(),
409 $block_items->getLimitExhausted()
420 $page = $this->domain_service->page(
424 $dom = $page->getDom();
429 $ids = $this->copage_resources->getResourceIds($dom);
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Generates concrete blocks with items for the view.
ItemSetManager $item_set_manager
preloadSessionandItemGroupItemData()
array $accumulated_ref_ids
determineBlockItems(array $ref_ids, $filter_session_and_item_group_items=false, bool $prevent_duplicats=false)
getItemGroupItemRefIds(int $item_group_ref_id)
getBlocksForPart(BlockSequencePart $part)
accumulateRefIds(array $ref_ids)
BlockSequence $block_sequence
__construct(DataService $data_service, InternalDomainService $domain_service, ResourcesManager $copage_resources, \ilContainer $container, BlockSequence $block_sequence, ItemSetManager $item_set_manager, bool $include_empty_blocks=true, ?string $lang=null)
ilLOTestAssignments $test_assignments
static array $item_group_ref_ids
getGroupedObjTypes()
Get grouped repository object types.
getItemGroupBlock(int $item_group_ref_id)
getPageEmbeddedBlockIds()
InternalDomainService $domain_service
bool $include_empty_blocks
ItemBlockSequence $sequence
Content ModeManager $mode_manager
array $all_item_group_item_ref_ids
DataService $data_service
ResourcesManager $copage_resources
A block that holds a single item group.
Represents all item groups of a container.
Manages container subitems set.
A block that holds all objectives and their items.
A block that holds all other "remaining" items.
A block that holds session in a special presentation.
A single block containing items of a (grouped) repo type.
Represents all "by type" blocks of a container.
static _getInstance(int $a_obj_id)
static _lookupContainerSetting(int $a_id, string $a_keyword, ?string $a_default_value=null)
static _getObjectiveIds(int $course_id, bool $a_activated_only=false)
const TYPE_TEST_QUALIFIED
static getInstance(int $a_container_id)
static getItemsByObjective(int $objective_id)
Get objective items.
static getItemsByItemGroup(int $item_group_ref_id)
Get materials of item group.
static getGroupedRepositoryObjectTypes($parent_obj_type)
static _lookupType(int $id, bool $reference=false)
static _lookupObjId(int $ref_id)