19declare(strict_types=1);
73 $this->
access = $domain_service->access();
80 $this->mode_manager = $this->domain_service->content()->mode(
$container);
82 $this->block_limit = 0;
84 if (!$this->mode_manager->isActiveItemOrdering()) {
98 if (is_null($this->sequence)) {
104 foreach ($this->block_sequence->getParts() as $part) {
112 $other_is_page_embedded =
false;
113 foreach ($embedded_ids as
$id) {
114 if (isset($item_blocks[
$id])) {
115 $item_blocks[
$id]->setPageEmbedded(
true);
116 $sorted_blocks[] = $item_blocks[
$id];
117 unset($item_blocks[
$id]);
118 } elseif (!is_numeric(
$id)) {
120 if (
$id ===
"_other") {
121 $this->has_other_block =
true;
122 $other_is_page_embedded =
true;
124 $ref_ids = $this->item_set_manager->getRefIdsOfType(
$id);
130 if ($this->include_empty_blocks || count($block_items->getRefIds()) > 0) {
131 $block = $this->data_service->itemBlock(
133 $this->data_service->typeBlock(
$id),
134 $block_items->getRefIds(),
135 $block_items->getLimitExhausted()
137 $block->setPageEmbedded(
true);
138 $sorted_blocks[] =
$block;
149 if (!is_null($other_block)) {
150 if ($other_is_page_embedded) {
151 $other_block->setPageEmbedded(
true);
153 $item_blocks[
"_other"] = $other_block;
159 foreach ($sorting->getBlockPositions() as
$id) {
160 if (isset($item_blocks[
$id])) {
161 $item_blocks[
$id]->setPosition(
$pos);
162 $sorted_blocks[] = $item_blocks[
$id];
163 unset($item_blocks[
$id]);
169 foreach ($item_blocks as
$block) {
171 $sorted_blocks[] =
$block;
181 foreach ($this->block_sequence->getParts() as $part) {
199 $this->all_item_group_item_ref_ids = array_unique(array_merge($this->all_item_group_item_ref_ids,
$item_ref_ids));
203 foreach ($this->item_set_manager->getRefIdsOfType(
"itgr") as $item_group_ref_id) {
205 $this->all_item_group_item_ref_ids = array_unique(array_merge($this->all_item_group_item_ref_ids,
$item_ref_ids));
219 $ref_ids = $this->item_set_manager->getRefIdsOfType($type);
222 if ($type !==
"itgr" && count($block_items->getRefIds()) > 0) {
223 yield $this->data_service->itemBlock(
225 $this->data_service->typeBlock($type),
226 $block_items->getRefIds(),
227 $block_items->getLimitExhausted()
233 if ($part instanceof Content\
TypeBlock) {
234 $ref_ids = $this->item_set_manager->getRefIdsOfType($part->getType());
237 if (count($block_items->getRefIds()) > 0) {
238 yield $this->data_service->itemBlock(
240 $this->data_service->typeBlock($part->getType()),
241 $block_items->getRefIds(),
242 $block_items->getLimitExhausted()
248 $ref_ids = $this->item_set_manager->getRefIdsOfType(
"sess");
251 if (count($block_items->getRefIds()) > 0) {
252 yield $this->data_service->itemBlock(
254 $this->data_service->sessionBlock(),
255 $block_items->getRefIds(),
256 $block_items->getLimitExhausted()
271 if (!$this->mode_manager->isAdminMode()) {
288 yield $this->data_service->itemBlock(
299 foreach ($this->item_set_manager->getRefIdsOfType(
"itgr") as $item_group_ref_id) {
308 $this->has_other_block =
true;
314 $filter_session_and_item_group_items =
false,
315 bool $prevent_duplicats =
false
318 $accessible_ref_ids = [];
319 foreach ($ref_ids as
$ref_id) {
320 if ($prevent_duplicats && in_array(
$ref_id, $this->all_ref_ids)) {
326 $this->all_ref_ids[] =
$ref_id;
330 if ($this->
access->checkAccess(
'visible',
'', $ref_id)) {
331 if ($this->block_limit > 0 && count($accessible_ref_ids) >= $this->block_limit) {
333 } elseif (!$filter_session_and_item_group_items || !in_array(
$ref_id, $this->all_item_group_item_ref_ids)) {
334 if (!in_array(
$ref_id, $this->omit_ref_ids)) {
335 $accessible_ref_ids[] =
$ref_id;
340 return $this->data_service->blockItemsInfo(
348 foreach ($ref_ids as
$ref_id) {
355 if (!$this->has_other_block) {
359 $remaining_ref_ids = array_filter(
360 $this->item_set_manager->getAllRefIds(),
361 fn($i) => (!isset($this->accumulated_ref_ids[$i]) && !$this->item_set_manager->isSideBlockItem($i))
363 $block_items = $this->determineBlockItems($remaining_ref_ids,
true,
true);
367 if ($this->include_empty_blocks || count($block_items->getRefIds()) > 0) {
368 return $this->data_service->itemBlock(
370 $this->data_service->otherBlock(),
371 $block_items->getRefIds(),
372 $block_items->getLimitExhausted()
391 if (!isset(self::$item_group_ref_ids[$item_group_ref_id])) {
393 $this->container->getId()
396 self::$item_group_ref_ids[$item_group_ref_id] = array_map(
static function ($i) {
397 return (
int) $i[
"child"];
400 return self::$item_group_ref_ids[$item_group_ref_id];
405 $ref_ids = $this->getItemGroupItemRefIds($item_group_ref_id);
406 $this->accumulateRefIds($ref_ids);
407 $block_items = $this->determineBlockItems($ref_ids);
409 if (!$this->
access->checkAccess(
"visible",
"", $item_group_ref_id) ||
410 !$this->access->checkAccess(
"read",
"", $item_group_ref_id)) {
414 if (count($block_items->getRefIds()) > 0 || $this->access->checkAccess(
'write',
'', $item_group_ref_id)) {
415 return $this->data_service->itemBlock(
416 (
string) $item_group_ref_id,
417 $this->data_service->itemGroupBlock($item_group_ref_id),
418 $block_items->getRefIds(),
419 $block_items->getLimitExhausted()
430 $page = $this->domain_service->page(
434 $dom = $page->getDom();
439 $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
ilLOTestAssignments $test_assignments
static array $item_group_ref_ids
__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, array $omit_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
setOmitRefIds(array $omit_ref_ids)
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)