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();
637 if ($this->
ctrl->isAsynch()) {
650 $ctrl->
setParameter($this->container_gui,
"type", $a_block_id);
651 $url = $ctrl->
getLinkTarget($this->container_gui,
"renderBlockAsynch",
"",
true);
654 $f = $this->
ui->factory();
656 $button =
$f->button()->standard($this->
lng->txt(
"cont_show_more"),
"")
658 ->withOnLoadCode(
function (
$id) use ($a_block_id,
$url) {
659 return "il.Container.initShowMore('$id', '$a_block_id', '" .
$url .
"');";
680 return new ilTemplate(
"tpl.container_list_block.html",
true,
true,
"components/ILIAS/Container");
692 array $a_types_in_block = null,
693 string $a_commands_html =
"",
694 string $a_order_id =
"",
701 $a_tpl->
setVariable(
"CB_ID",
' id="bl_cntr_' . (++$this->bl_cnt) .
'"');
703 if ($this->enable_manage_select_all) {
705 } elseif ($this->enable_multi_download) {
707 $a_types_in_block = [$a_type];
709 foreach ($a_types_in_block as $type) {
717 if ($a_text ===
"" && $a_type !==
"") {
718 if (!$objDefinition->isPlugin($a_type)) {
719 $title = $lng->
txt(
"objs_" . $a_type);
722 $title = $pl->txt(
"objs_" . $a_type);
728 if (is_array($a_data)) {
729 foreach ($a_data as $k => $v) {
741 if ($a_type !==
"" &&
$ilSetting->get(
"icon_position_in_lists") !==
"item_rows") {
751 if ($a_order_id !==
"") {
758 $presentation_title = $title;
760 if (trim($title) ===
"") {
761 $presentation_title = $this->
lng->txt(
"cont_no_title");
762 $sr_only =
"sr-only";
764 $a_tpl->
setVariable(
"BLOCK_HEADER_CONTENT", $presentation_title);
766 $a_tpl->
setVariable(
"CHR_COMMANDS", $a_commands_html);
773 string $a_item_id = null
777 $a_tpl->
setVariable(
"ROW_ID",
'id="item_row_' . $a_item_id .
'"');
798 $a_tpl->
setVariable(
"CHECKBOXNAME",
"bl_cb_" . $this->bl_cnt);
799 $a_tpl->
setVariable(
"SEL_ALL_PARENT",
"bl_cntr_" . $this->bl_cnt);
800 $a_tpl->
setVariable(
"SEL_ALL_PARENT",
"bl_cntr_" . $this->bl_cnt);
816 return [
"fold",
"file"];
823 if (count($this->details)) {
841 return $this->container_gui->getContainerPageHTML();
846 if ($this->container_gui->isActiveAdministrationPanel()) {
849 if ($this->item_manager->getExpanded($a_item_id) !== null) {
850 return $this->item_manager->getExpanded($a_item_id);
859 \
ILIAS\Container\Content\ItemBlock\ItemBlockSequence $sequence
867 foreach ($this->item_presentation->getAllRefIds() as
$ref_id) {
868 $rd = $this->item_presentation->getRawDataByRefId(
$ref_id);
869 $preloader->addItem($rd[
"obj_id"], $rd[
"type"],
$ref_id);
870 if ($rd[
"type"] ===
"sess") {
872 foreach ($ev_items as $ev_item) {
873 $preloader->addItem((
int) $ev_item[
"obj_id"], $ev_item[
"type"], $ev_item[
"ref_id"]);
877 $preloader->preload();
879 $embedded_block_ids = $this->item_presentation->getPageEmbeddedBlockIds();
880 foreach ($sequence->getBlocks() as $block) {
882 $force_item_even_if_already_rendered =
false;
883 if ($block->getBlock() instanceof \ILIAS\Container\Content\ItemGroupBlock) {
884 $block_id = (string) $block->getBlock()->getRefId();
885 $force_item_even_if_already_rendered =
true;
887 if ($block->getBlock() instanceof \ILIAS\Container\Content\TypeBlock) {
888 $block_id = $block->getBlock()->getType();
889 if ($block->getPageEmbedded()) {
890 $force_item_even_if_already_rendered =
true;
893 if ($block->getBlock() instanceof \ILIAS\Container\Content\SessionBlock) {
896 if ($block->getBlock() instanceof \ILIAS\Container\Content\OtherBlock) {
897 $block_id =
"_other";
899 if ($block->getBlock() instanceof \ILIAS\Container\Content\ObjectivesBlock) {
907 if ($block->getBlock() instanceof \ILIAS\Container\Content\ItemGroupBlock) {
911 if ($block->getBlock() instanceof \ILIAS\Container\Content\OtherBlock) {
912 $title = $this->item_presentation->filteredSubtree()
913 ? $this->
lng->txt(
"cont_found_objects")
914 : $this->
lng->txt(
"content");
917 if ($block->getBlock() instanceof \ILIAS\Container\Content\TypeBlock ||
918 $block->getBlock() instanceof \ILIAS\Container\Content\SessionBlock) {
927 foreach ($block->getItemRefIds() as
$ref_id) {
935 $item_data = $this->item_presentation->getRawDataByRefId(
$ref_id);
937 if ($this->container_gui->isActiveAdministrationPanel()) {
939 } elseif ($this->container_gui->isMultiDownloadEnabled()) {
942 $item_group_list_presentation =
"";
943 if ($block->getBlock() instanceof \ILIAS\Container\Content\ItemGroupBlock) {
945 if (!$this->admin_panel && !$this->active_block_ordering) {
946 $item_group_list_presentation =
"tile";
950 if (!$this->admin_panel && !$this->active_block_ordering) {
951 $item_group_list_presentation =
"list";
955 $html = $this->item_renderer->renderItem(
960 $item_group_list_presentation,
962 $this->item_presentation->isActiveItemOrdering($item_data[
"type"]),
971 $force_item_even_if_already_rendered
977 if ($block->getPageEmbedded()) {
978 if ($block->getBlock() instanceof \ILIAS\Container\Content\TypeBlock ||
979 $block->getBlock() instanceof \ILIAS\Container\Content\SessionBlock) {
980 $page_html = preg_replace(
981 '~\[list-' . $block->getId() .
'\]~i',
986 } elseif ($block->getBlock() instanceof \ILIAS\Container\Content\ItemGroupBlock) {
987 $page_html = preg_replace(
988 '~\[item-group-' . $block->getId() .
'\]~i',
993 } elseif ($block->getBlock() instanceof \ILIAS\Container\Content\OtherBlock) {
994 $page_html = preg_replace(
995 '~\[list-_other\]~i',
1000 } elseif ($block->getBlock() instanceof \ILIAS\Container\Content\ObjectivesBlock) {
1001 $page_html = preg_replace(
1002 '~\[list-_lobj\]~i',
1003 $this->objective_renderer->renderObjectives(),
1009 if ($block->getBlock() instanceof \ILIAS\Container\Content\ItemGroupBlock ||
1010 $block->getBlock() instanceof \ILIAS\Container\Content\OtherBlock) {
1016 if ($block->getBlock() instanceof \ILIAS\Container\Content\TypeBlock ||
1017 $block->getBlock() instanceof \ILIAS\Container\Content\SessionBlock) {
1023 if ($block->getBlock() instanceof \ILIAS\Container\Content\ObjectivesBlock) {
1024 $this->objective_renderer->renderObjectives();
1025 $block_tpl->setVariable(
1027 $this->objective_renderer->getContent()
1036 foreach ($this->item_presentation->getPageEmbeddedBlockIds() as
$id) {
1037 if (is_numeric(
$id)) {
1038 $page_html = preg_replace(
1039 '~\[item-group-' .
$id .
'\]~i',
1044 $page_html = preg_replace(
1045 '~\[list-' .
$id .
'\]~i',
1054 return $page_html . $block_tpl->get();
1064 $item_data = $this->item_presentation->getRawDataByRefId((
int) $block_id);
1065 $item_list_gui = $this->item_renderer->getItemGUI($item_data);
1098 $item_list_gui->enableNotes(
false);
1099 $item_list_gui->enableTags(
false);
1100 $item_list_gui->enableComments(
false);
1101 $item_list_gui->enableTimings(
false);
1102 $item_list_gui->initItem(
1103 (
int) $item_data[
"ref_id"],
1104 (
int) $item_data[
"obj_id"],
1106 $item_data[
"title"],
1107 $item_data[
"description"]
1109 $commands_html = $item_list_gui->getCommandsHTML();
1113 $beh = $item_group->getBehaviour();
1114 $stored_val = $this->block_repo->getProperty(
1115 "itgr_" . $item_data[
"ref_id"],
1116 $this->
user->getId(),
1120 $beh = ($stored_val ===
"1")
1126 "behaviour" => $beh,
1127 "store-url" =>
"./ilias.php?baseClass=ilcontainerblockpropertiesstoragegui&cmd=store" .
1128 "&cont_block_id=itgr_" . $item_data[
'ref_id']
1131 !$this->container_gui->isActiveAdministrationPanel()) {
1140 if ($this->block_prefix_closure instanceof
Closure) {
1142 return (
string)
$c($block_id);
1149 if ($this->block_postfix_closure instanceof
Closure) {
1151 return (
string)
$c($block_id);
1158 if ($this->item_hidden_closure instanceof
Closure) {
1160 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
addCustomBlock( $a_id, string $a_caption, string $a_actions=null, array $a_data=[])
Add custom block.
ILIAS Containter Content ItemRenderer $item_renderer
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)
ILIAS Container Content ItemPresentationManager $item_presentation
static _lookupContainerSetting(int $a_id, string $a_keyword, string $a_default_value=null)
static _lookupObjId(int $ref_id)
hasItem($a_id)
Item with id exists?
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
bool $active_block_ordering
touchBlock(string $block)
renderDetails(ilTemplate $a_tpl)
ILIAS Container Content ItemManager $item_manager
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.
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?
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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.
getLinkTarget(object $a_gui_obj, string $a_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
ilContainerGUI $container_gui
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
__construct(Container $dic, ilPlugin $plugin)
removeItem($a_id)
Remove item (from any block)
Class ilContainerGUI This is a base GUI class for all container objects in ILIAS: root folder...
setBlockPosition( $a_block_id, int $a_pos)
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)
addTypeBlock(string $a_type, string $a_prefix=null, string $a_postfix=null)
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)
getBlockPostfix($block_id)
renderHelperTypeBlock(ilTemplate $a_block_tpl, string $a_type, bool $a_is_single=false, bool $is_exhausted=false)