ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ItemManager.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
28{
29 protected \ILIAS\Container\StandardGUIRequest $request;
30 protected array $force_details = [];
32 protected \ilContainer $container;
34
35 public function __construct(
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) {
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}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
__construct(\ilContainer $container, ItemSessionRepository $item_repo, ModeManager $mode_manager, \ILIAS\Container\StandardGUIRequest $request)
ILIAS Container StandardGUIRequest $request
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
Class ilContainer.
static lookupNextSessionByCourse(int $a_ref_id)
static lookupLastSessionByCourse(int $a_ref_id)
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.