65 protected \ILIAS\DI\UIServices
$ui;
71 protected \ILIAS\Container\Content\BlockSessionRepository
$block_repo;
74 \
ILIAS\Container\Content\ItemPresentationManager $item_presentation,
75 bool $a_enable_manage_select_all =
false,
76 bool $a_enable_multi_download =
false,
77 bool $a_active_block_ordering =
false,
78 array $a_block_custom_positions = [],
81 bool $admin_panel =
false 87 $this->
lng = $DIC->language();
89 $this->
ui = $DIC->ui();
90 $this->obj_definition = $DIC[
"objDefinition"];
91 $this->enable_manage_select_all = $a_enable_manage_select_all;
92 $this->enable_multi_download = $a_enable_multi_download;
93 $this->active_block_ordering = $a_active_block_ordering;
94 $this->block_custom_pos = $a_block_custom_positions;
95 $this->view_mode = $a_view_mode;
97 $obj = $container_gui_obj;
98 $this->container_gui = $obj;
99 $this->
ctrl = $DIC->ctrl();
100 $this->
user = $DIC->user();
101 $this->
access = $DIC->access();
103 $this->item_renderer = $DIC->container()
108 $this->container_gui,
111 $this->objective_renderer = $DIC->container()
116 $this->container_gui,
120 $this->block_repo = $DIC
126 $this->item_manager = $DIC
131 ->items($this->container_gui->getObject());
136 $this->block_prefix_closure =
$f;
141 $this->block_postfix_closure =
$f;
146 $this->item_hidden_closure =
$f;
151 $this->item_renderer->setItemModifierClosure($f);
152 $this->item_modifier_closure =
$f;
166 ?
string $a_prefix =
null,
167 ?
string $a_postfix =
null 169 if ($a_type !==
"itgr" &&
171 $this->type_blocks[$a_type] = [
172 "prefix" => $a_prefix
173 ,
"postfix" => $a_postfix
182 return array_key_exists($a_type, $this->type_blocks);
192 ?
string $a_actions =
null,
196 $this->custom_blocks[$a_id] = [
197 "caption" => $a_caption
198 ,
"actions" => $a_actions
212 return array_key_exists($a_id, $this->custom_blocks);
238 $this->hidden_items[$a_id] =
true;
254 unset($this->item_ids[$a_id], $this->hidden_items[$a_id]);
256 foreach (array_keys($this->items) as $item_id) {
257 $parts = explode(self::UNIQUE_SEPARATOR, $item_id);
258 if (array_pop(
$parts) == $a_id) {
259 unset($this->items[$item_id]);
263 foreach ($this->block_items as $block_id => $items) {
264 foreach ($items as $idx => $item_id) {
265 $parts = explode(self::UNIQUE_SEPARATOR, $item_id);
266 if (array_pop(
$parts) == $a_id) {
267 unset($this->block_items[$block_id][$idx]);
268 if (!count($this->block_items[$block_id])) {
269 unset($this->block_items[$block_id]);
284 return (array_key_exists($a_id, $this->item_ids) ||
285 array_key_exists($a_id, $this->hidden_items));
300 bool $a_force =
false 302 if ($a_item_type !==
"itgr" &&
304 (!$this->
hasItem($a_item_id) || $a_force)) {
305 if (is_string($a_item_html) && trim($a_item_html) ===
"") {
314 $uniq_id = $a_block_id . self::UNIQUE_SEPARATOR . $a_item_id;
316 $this->items[$uniq_id] = [
317 "type" => $a_item_type
318 ,
"html" => $a_item_html
323 $this->block_items[$a_block_id][] = $uniq_id;
334 $this->item_ids[$a_item_id] =
true;
343 $this->show_more[] = $a_block_id;
349 bool $a_active =
false 351 $this->details[$a_level] = [
353 ,
"active" => $a_active
375 $this->block_pos[$a_block_id] = $a_pos;
405 return $block_tpl->get();
414 return $block_tpl->get();
427 return $block_tpl->get();
440 if (is_array($this->block_custom_pos) && count($this->block_custom_pos)) {
442 $this->block_pos = [];
443 foreach ($this->block_custom_pos as $idx => $block_id) {
445 $this->block_pos[$block_id] = $idx;
450 if (count($this->block_pos)) {
452 $last = max($this->block_pos);
453 foreach (array_keys($tmp) as $block_id) {
454 if (!array_key_exists($block_id, $this->block_pos)) {
455 $this->block_pos[$block_id] = ++$last;
461 $this->block_pos = $tmp;
466 $last = count($this->block_pos)
467 ? max($this->block_pos)
469 foreach (array_keys($this->custom_blocks) as $block_id) {
470 if (!array_key_exists($block_id, $this->block_pos)) {
471 $this->block_pos[$block_id] = ++$last;
474 foreach (array_keys($this->type_blocks) as $block_id) {
475 if (!array_key_exists($block_id, $this->block_pos)) {
476 $this->block_pos[$block_id] = ++$last;
480 asort($this->block_pos);
481 return array_keys($this->block_pos);
490 bool $a_is_single =
false,
491 bool $is_exhausted =
false 494 return $this->
renderHelperGeneric($a_block_tpl, $a_block_id, $this->custom_blocks[$a_block_id], $a_is_single, $is_exhausted);
502 bool $a_is_single =
false,
503 bool $is_exhausted =
false 506 $block = $this->type_blocks[$a_type];
507 $block[
"type"] = $a_type;
508 return $this->
renderHelperGeneric($a_block_tpl, $a_type, $block, $a_is_single, $is_exhausted);
517 if ($item_group->getListPresentation() !==
"") {
518 $view_mode = ($item_group->getListPresentation() ===
"tile")
528 return $item_group->getListPresentation();
538 bool $a_is_single =
false,
539 bool $is_exhausted =
false 542 if (!in_array($a_block_id, $this->rendered_blocks)) {
543 $this->rendered_blocks[] = $a_block_id;
545 if (isset($this->block_items[$a_block_id]) && is_array($this->block_items[$a_block_id])) {
546 foreach ($this->block_items[$a_block_id] as $item_id) {
547 if (isset($this->items[$item_id][
"type"])) {
548 $block_types[] = $this->items[$item_id][
"type"];
559 if (is_numeric($a_block_id)) {
561 if ($item_group->getListPresentation() !==
"") {
562 $view_mode = ($item_group->getListPresentation() ===
"tile" && !$this->active_block_ordering && !
$this->admin_panel)
565 $tile_size = $item_group->getTileSize();
571 if ((isset($this->block_items[$a_block_id]) && is_array($this->block_items[$a_block_id])) ||
572 is_numeric($a_block_id)) {
580 $a_block[
"type"] ??
'',
581 $a_block[
"caption"] ??
'',
582 array_unique($block_types),
583 $a_block[
"actions"] ??
'',
585 $a_block[
"data"] ?? []
589 if (isset($a_block[
"prefix"]) && $a_block[
"prefix"]) {
594 if (isset($this->block_items[$a_block_id])) {
595 foreach ($this->block_items[$a_block_id] as $item_id) {
597 $this->
addStandardRow($a_block_tpl, $this->items[$item_id][
"html"], $item_id);
599 $cards[] = $this->items[$item_id][
"html"];
605 if (isset($a_block[
"postfix"]) && $a_block[
"postfix"]) {
611 $f = $this->
ui->factory();
615 switch ($tile_size) {
617 $deck =
$f->deck($cards)->withSmallCardsSize();
621 $deck =
$f->deck($cards)->withLargeCardsSize();
625 $deck =
$f->deck($cards)->withExtraLargeCardsSize();
629 $deck =
$f->deck($cards)->withFullSizedCardsSize();
633 $deck =
$f->deck($cards)->withNormalCardsSize();
646 $ctrl->
setParameter($this->container_gui,
"type", $a_block_id);
647 $url = $ctrl->
getLinkTarget($this->container_gui,
"renderBlockAsynch",
"",
true);
650 $f = $this->
ui->factory();
652 $button =
$f->button()->standard($this->
lng->txt(
"cont_show_more"),
"")
654 ->withOnLoadCode(
function (
$id) use ($a_block_id,
$url) {
655 return "il.Container.initShowMore('$id', '$a_block_id', '" .
$url .
"');";
676 return new ilTemplate(
"tpl.container_list_block.html",
true,
true,
"components/ILIAS/Container");
688 ?array $a_types_in_block =
null,
689 string $a_commands_html =
"",
690 string $a_order_id =
"",
697 $a_tpl->
setVariable(
"CB_ID",
' id="bl_cntr_' . (++$this->bl_cnt) .
'"');
699 if ($this->enable_manage_select_all) {
701 } elseif ($this->enable_multi_download) {
703 $a_types_in_block = [$a_type];
705 foreach ($a_types_in_block as $type) {
713 if ($a_text ===
"" && $a_type !==
"") {
714 if (!$objDefinition->isPlugin($a_type)) {
715 $title = $lng->
txt(
"objs_" . $a_type);
718 $title = $pl->txt(
"objs_" . $a_type);
724 if (is_array($a_data)) {
725 foreach ($a_data as $k => $v) {
737 if ($a_type !==
"" &&
$ilSetting->get(
"icon_position_in_lists") !==
"item_rows") {
747 if ($a_order_id !==
"") {
754 $presentation_title = $title;
756 if (trim($title) ===
"") {
757 $presentation_title = $this->
lng->txt(
"cont_no_title");
758 $sr_only =
"sr-only";
760 $a_tpl->
setVariable(
"BLOCK_HEADER_CONTENT", $presentation_title);
762 $a_tpl->
setVariable(
"CHR_COMMANDS", $a_commands_html);
769 string $a_item_id =
null 773 $a_tpl->
setVariable(
"ROW_ID",
'id="item_row_' . $a_item_id .
'"');
794 $a_tpl->
setVariable(
"CHECKBOXNAME",
"bl_cb_" . $this->bl_cnt);
795 $a_tpl->
setVariable(
"SEL_ALL_PARENT",
"bl_cntr_" . $this->bl_cnt);
796 $a_tpl->
setVariable(
"SEL_ALL_PARENT",
"bl_cntr_" . $this->bl_cnt);
812 return [
"fold",
"file"];
819 if (count($this->details)) {
837 return $this->container_gui->getContainerPageHTML();
842 if ($this->container_gui->isActiveAdministrationPanel()) {
845 if ($this->item_manager->getExpanded($a_item_id) !==
null) {
846 return $this->item_manager->getExpanded($a_item_id);
855 \
ILIAS\Container\Content\ItemBlock\ItemBlockSequence $sequence
863 foreach ($this->item_presentation->getAllRefIds() as
$ref_id) {
864 $rd = $this->item_presentation->getRawDataByRefId(
$ref_id);
865 $preloader->addItem($rd[
"obj_id"], $rd[
"type"],
$ref_id);
866 if ($rd[
"type"] ===
"sess") {
868 foreach ($ev_items as $ev_item) {
869 $preloader->addItem((
int) $ev_item[
"obj_id"], $ev_item[
"type"], $ev_item[
"ref_id"]);
873 $preloader->preload();
875 $embedded_block_ids = $this->item_presentation->getPageEmbeddedBlockIds();
876 foreach ($sequence->getBlocks() as $block) {
878 $force_item_even_if_already_rendered =
false;
879 if ($block->getBlock() instanceof \ILIAS\Container\Content\ItemGroupBlock) {
880 $block_id = (string) $block->getBlock()->getRefId();
881 $force_item_even_if_already_rendered =
true;
883 if ($block->getBlock() instanceof \ILIAS\Container\Content\TypeBlock) {
884 $block_id = $block->getBlock()->getType();
885 if ($block->getPageEmbedded()) {
886 $force_item_even_if_already_rendered =
true;
889 if ($block->getBlock() instanceof \ILIAS\Container\Content\SessionBlock) {
892 if ($block->getBlock() instanceof \ILIAS\Container\Content\OtherBlock) {
893 $block_id =
"_other";
895 if ($block->getBlock() instanceof \ILIAS\Container\Content\ObjectivesBlock) {
903 if ($block->getBlock() instanceof \ILIAS\Container\Content\ItemGroupBlock) {
907 if ($block->getBlock() instanceof \ILIAS\Container\Content\OtherBlock) {
908 $title = $this->item_presentation->filteredSubtree()
909 ? $this->
lng->txt(
"cont_found_objects")
910 : $this->
lng->txt(
"content");
913 if ($block->getBlock() instanceof \ILIAS\Container\Content\TypeBlock ||
914 $block->getBlock() instanceof \ILIAS\Container\Content\SessionBlock) {
923 foreach ($block->getItemRefIds() as
$ref_id) {
931 $item_data = $this->item_presentation->getRawDataByRefId(
$ref_id);
933 if ($this->container_gui->isActiveAdministrationPanel()) {
935 } elseif ($this->container_gui->isMultiDownloadEnabled()) {
938 $item_group_list_presentation =
"";
939 if ($block->getBlock() instanceof \ILIAS\Container\Content\ItemGroupBlock) {
941 if (!$this->admin_panel && !$this->active_block_ordering) {
942 $item_group_list_presentation =
"tile";
946 if (!$this->admin_panel && !$this->active_block_ordering) {
947 $item_group_list_presentation =
"list";
951 $html = $this->item_renderer->renderItem(
956 $item_group_list_presentation,
958 $this->item_presentation->isActiveItemOrdering($item_data[
"type"]),
967 $force_item_even_if_already_rendered
973 if ($block->getPageEmbedded()) {
974 if ($block->getBlock() instanceof \ILIAS\Container\Content\TypeBlock ||
975 $block->getBlock() instanceof \ILIAS\Container\Content\SessionBlock) {
976 $page_html = preg_replace(
977 '~\[list-' . $block->getId() .
'\]~i',
982 } elseif ($block->getBlock() instanceof \ILIAS\Container\Content\ItemGroupBlock) {
983 $page_html = preg_replace(
984 '~\[item-group-' . $block->getId() .
'\]~i',
989 } elseif ($block->getBlock() instanceof \ILIAS\Container\Content\OtherBlock) {
990 $page_html = preg_replace(
991 '~\[list-_other\]~i',
996 } elseif ($block->getBlock() instanceof \ILIAS\Container\Content\ObjectivesBlock) {
997 $page_html = preg_replace(
999 $this->objective_renderer->renderObjectives(),
1005 if ($block->getBlock() instanceof \ILIAS\Container\Content\ItemGroupBlock ||
1006 $block->getBlock() instanceof \ILIAS\Container\Content\OtherBlock) {
1012 if ($block->getBlock() instanceof \ILIAS\Container\Content\TypeBlock ||
1013 $block->getBlock() instanceof \ILIAS\Container\Content\SessionBlock) {
1019 if ($block->getBlock() instanceof \ILIAS\Container\Content\ObjectivesBlock) {
1020 $this->objective_renderer->renderObjectives();
1021 $block_tpl->setVariable(
1023 $this->objective_renderer->getContent()
1032 foreach ($this->item_presentation->getPageEmbeddedBlockIds() as
$id) {
1033 if (is_numeric(
$id)) {
1034 $page_html = preg_replace(
1035 '~\[item-group-' .
$id .
'\]~i',
1040 $page_html = preg_replace(
1041 '~\[list-' .
$id .
'\]~i',
1050 return $page_html . $block_tpl->get();
1060 $item_data = $this->item_presentation->getRawDataByRefId((
int) $block_id);
1061 $item_list_gui = $this->item_renderer->getItemGUI($item_data);
1094 $item_list_gui->enableNotes(
false);
1095 $item_list_gui->enableTags(
false);
1096 $item_list_gui->enableComments(
false);
1097 $item_list_gui->enableTimings(
false);
1098 $item_list_gui->initItem(
1099 (
int) $item_data[
"ref_id"],
1100 (
int) $item_data[
"obj_id"],
1102 $item_data[
"title"],
1103 $item_data[
"description"]
1105 $commands_html = $item_list_gui->getCommandsHTML();
1109 $beh = $item_group->getBehaviour();
1110 $stored_val = $this->block_repo->getProperty(
1111 "itgr_" . $item_data[
"ref_id"],
1112 $this->
user->getId(),
1116 $beh = ($stored_val ===
"1")
1122 "behaviour" => $beh,
1123 "store-url" =>
"./ilias.php?baseClass=ilcontainerblockpropertiesstoragegui&cmd=store" .
1124 "&cont_block_id=itgr_" . $item_data[
'ref_id']
1127 !$this->container_gui->isActiveAdministrationPanel()) {
1136 if ($this->block_prefix_closure instanceof
Closure) {
1138 return (
string)
$c($block_id);
1145 if ($this->block_postfix_closure instanceof
Closure) {
1147 return (
string)
$c($block_id);
1154 if ($this->item_hidden_closure instanceof
Closure) {
1156 return (
bool)
$c($block_id, $ref_id);
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
getItemRenderer()
Render Item Block Sequence.
bool $enable_multi_download
ILIAS Containter Content ObjectiveRenderer $objective_renderer
setBlockPrefixClosure(Closure $f)
Closure $item_hidden_closure
bool $enable_manage_select_all
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
hasTypeBlock(string $a_type)
renderSingleTypeBlock(string $a_type, bool $exhausted=false)
static getItemsByEvent(int $event_id)
Get session material / event items.
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
getDownloadableTypes()
Get downloadable repository object types.
renderSingleCustomBlock($a_id)
Interface Observer Contains several chained tasks and infos about them.
ILIAS Container Content BlockSessionRepository $block_repo
ILIAS Containter Content ItemRenderer $item_renderer
getLinkTarget(object $a_gui_obj, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
addSeparatorRow(ilTemplate $a_tpl)
setItemHiddenClosure(Closure $f)
static lookupHideTitle(int $a_id)
renderHelperGeneric(ilTemplate $a_block_tpl, $a_block_id, array $a_block, bool $a_is_single=false, bool $is_exhausted=false)
Closure $item_modifier_closure
addDetailsLevel(int $a_level, string $a_url, bool $a_active=false)
renderHelperCustomBlock(ilTemplate $a_block_tpl, $a_block_id, bool $a_is_single=false, bool $is_exhausted=false)
getDetailsLevel(int $a_item_id)
renderItemBlockSequence(\ILIAS\Container\Content\ItemBlock\ItemBlockSequence $sequence)
addTypeBlock(string $a_type, ?string $a_prefix=null, ?string $a_postfix=null)
ILIAS Container Content ItemPresentationManager $item_presentation
static _lookupObjId(int $ref_id)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
hasItem($a_id)
Item with id exists?
bool $active_block_ordering
touchBlock(string $block)
renderDetails(ilTemplate $a_tpl)
ILIAS Container Content ItemManager $item_manager
setVariable($variable, $value='')
Sets a variable value.
addShowMoreButton($a_block_id)
Add show more button to a block.
isItemHidden(string $block_id, int $ref_id)
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
addStandardRow(ilTemplate $a_tpl, string $a_html, string $a_item_id=null)
getViewModeOfItemGroup(int $ref_id)
setBlockPostfixClosure(Closure $f)
addItemToBlock( $a_block_id, string $a_item_type, $a_item_id, $a_item_html, bool $a_force=false)
Add item to existing block.
isValidBlock($a_id)
Any block with id exists?
ilObjectDefinition $obj_definition
static getPluginObjectByType(string $type)
Return either a repoObject plugin or a orgunit extension plugin or null if the type is not a plugin...
hasCustomBlock($a_id)
Custom block already exists?
Closure $block_prefix_closure
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
getBlockPrefix($block_id)
hideItem($a_id)
Mark item id as used, but do not render.
ilContainerGUI $container_gui
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
__construct(Container $dic, ilPlugin $plugin)
removeItem($a_id)
Remove item (from any block)
addCustomBlock( $a_id, string $a_caption, ?string $a_actions=null, array $a_data=[])
Add custom block.
setBlockPosition( $a_block_id, int $a_pos)
static _lookupContainerSetting(int $a_id, string $a_keyword, ?string $a_default_value=null)
addItemGroupBlock(string $block_id, int $block_pos=0)
replaces ilContainerContentGUI::renderItemGroup
setParameter(object $a_gui_obj, string $a_parameter, $a_value)
getListPresentationOfItemGroup(int $ref_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const DETAILS_DEACTIVATED
Closure $block_postfix_closure
renderSelectAllBlock(ilTemplate $a_tpl)
Render "select all".
setItemModifierClosure(Closure $f)
addHeaderRow(ilTemplate $a_tpl, string $a_type="", string $a_text="", ?array $a_types_in_block=null, string $a_commands_html="", string $a_order_id="", array $a_data=[])
Render block header.
getBlockPostfix($block_id)
renderHelperTypeBlock(ilTemplate $a_block_tpl, string $a_type, bool $a_is_single=false, bool $is_exhausted=false)