ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ItemManager.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 namespace ILIAS\Container\Content;
22 
28 {
29  protected \ILIAS\Container\StandardGUIRequest $request;
30  protected array $force_details = [];
32  protected \ilContainer $container;
34 
35  public function __construct(
36  \ilContainer $container,
37  ItemSessionRepository $item_repo,
38  ModeManager $mode_manager,
39  \ILIAS\Container\StandardGUIRequest $request
40  ) {
41  $this->item_repo = $item_repo;
42  $this->container = $container;
43  $this->mode_manager = $mode_manager;
44  $this->request = $request;
45  $this->init();
46  }
47 
51  protected function handleSessionExpand(): void
52  {
53  $expand = $this->request->getExpand();
54  if ($expand > 0) {
55  $this->setExpanded(abs($expand), \ilContainerContentGUI::DETAILS_ALL);
56  } elseif ($expand < 0) {
58  }
59  }
60 
61  protected function init(): void
62  {
63  $this->handleSessionExpand();
64 
65  if ($this->container->getType() === 'crs') {
66  if ($session = \ilSessionAppointment::lookupNextSessionByCourse($this->container->getRefId())) {
67  $this->force_details = $session;
68  } elseif ($session = \ilSessionAppointment::lookupLastSessionByCourse($this->container->getRefId())) {
69  $this->force_details = [$session];
70  }
71  }
72  }
73 
74  public function setExpanded(int $id, int $val): void
75  {
76  $this->item_repo->setExpanded($id, $val);
77  }
78 
79  public function getExpanded(int $id): ?int
80  {
81  return $this->item_repo->getExpanded($id);
82  }
83 
84  protected function getDetailsLevel(int $a_item_id): int
85  {
86  if ($this->mode_manager->isAdminMode()) {
87  return \ilContainerContentGUI::DETAILS_DEACTIVATED;
88  }
89  if ($this->getExpanded($a_item_id) !== null) {
90  return $this->getExpanded($a_item_id);
91  }
92  if (in_array($a_item_id, $this->force_details)) {
93  return \ilContainerContentGUI::DETAILS_ALL;
94  }
95  return \ilContainerContentGUI::DETAILS_TITLE;
96  }
97 }
ILIAS Container StandardGUIRequest $request
Interface Observer Contains several chained tasks and infos about them.
__construct(\ilContainer $container, ItemSessionRepository $item_repo, ModeManager $mode_manager, \ILIAS\Container\StandardGUIRequest $request)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static lookupNextSessionByCourse(int $a_ref_id)
static lookupLastSessionByCourse(int $a_ref_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23