ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilContainerSimpleContentGUI.php
Go to the documentation of this file.
1 <?php
2 
25 {
26  protected ilTabsGUI $tabs;
27  protected int $force_details = 0;
28 
29  public function __construct(
30  ilContainerGUI $container_gui_obj
31  ) {
32  global $DIC;
33 
34  $this->lng = $DIC->language();
35  $this->tabs = $DIC->tabs();
36  $this->access = $DIC->access();
37  $this->user = $DIC->user();
38  parent::__construct($container_gui_obj);
39  $this->initDetails();
40  }
41 
42  public function getMainContent(): string
43  {
44  // see bug #7452
45  // $ilTabs->setSubTabActive($this->getContainerObject()->getType().'_content');
46 
47  $tpl = new ilTemplate(
48  "tpl.container_page.html",
49  true,
50  true,
51  "Services/Container"
52  );
53 
54  // Feedback
55  // @todo
56  // $this->__showFeedBack();
57 
58  $this->showMaterials($tpl);
59 
60  return $tpl->get();
61  }
62 
63  private function showMaterials(
64  ilTemplate $a_tpl
65  ): void {
66  $lng = $this->lng;
67 
68  $this->items = $this->getContainerObject()->getSubItems($this->getContainerGUI()->isActiveAdministrationPanel());
70 
71  $this->initRenderer();
72 
73  $output_html = $this->getContainerGUI()->getContainerPageHTML();
74 
75  // get embedded blocks
76  if ($output_html !== "") {
77  $output_html = $this->insertPageEmbeddedBlocks($output_html);
78  }
79 
80  // item groups
81  $this->getItemGroupsHTML();
82 
83  if (isset($this->items['_all']) && is_array($this->items["_all"])) {
84  $title = $this->getContainerObject()->filteredSubtree()
85  ? $lng->txt("cont_found_objects")
86  : $lng->txt("content");
87  $this->renderer->addCustomBlock("_all", $title);
88 
89  $position = 1;
90  foreach ($this->items["_all"] as $k => $item_data) {
91  if (!$this->renderer->hasItem($item_data["child"])) {
92  $html = $this->renderItem($item_data, $position++, true);
93  if ($html != "") {
94  $this->renderer->addItemToBlock("_all", $item_data["type"], $item_data["child"], $html);
95  }
96  }
97  }
98  }
99 
100  $output_html .= $this->renderer->getHTML();
101 
102  $a_tpl->setVariable("CONTAINER_PAGE_CONTENT", $output_html);
103  }
104 
105  protected function initDetails(): void
106  {
107  $this->handleSessionExpand();
108 
109  if ($this->getContainerObject()->getType() === 'crs') {
111  $this->force_details = (int) $session;
113  $this->force_details = $session;
114  }
115  }
116  }
117 
118  protected function getDetailsLevel(int $a_item_id): int
119  {
120  if ($this->getContainerGUI()->isActiveAdministrationPanel()) {
121  return self::DETAILS_DEACTIVATED;
122  }
123  if ($this->item_manager->getExpanded($a_item_id) !== null) {
124  return $this->item_manager->getExpanded($a_item_id);
125  }
126  if ($a_item_id == $this->force_details) {
127  return self::DETAILS_ALL;
128  }
129 
130  return self::DETAILS_TITLE;
131  }
132 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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...
ilGlobalTemplateInterface $tpl
__construct(ilContainerGUI $container_gui_obj)
$session
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
initRenderer()
Init container renderer.
Parent class of all container content GUIs.
global $DIC
Definition: feed.php:28
static lookupNextSessionByCourse(int $a_ref_id)
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:514
renderItem(array $a_item_data, int $a_position=0, bool $a_force_icon=false, string $a_pos_prefix="", string $item_group_list_presentation="")
Render an item.
static lookupLastSessionByCourse(int $a_ref_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
Class ilContainerGUI This is a base GUI class for all container objects in ILIAS: root folder...
insertPageEmbeddedBlocks(string $a_output_html)
Insert blocks into container page.