ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.DomainService.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
28
33{
34 protected \ILIAS\COPage\PC\Resources\ResourcesManager $copage_resources;
35 protected \ILIAS\Repository\Clipboard\ClipboardManager $repo_clipboard;
39
45 protected static array $mode_managers = [];
46
50 protected static array $flat_item_set_managers = [];
51
55 protected static array $tree_item_set_managers = [];
56
57 public function __construct(
61 ) {
62 global $DIC;
63
64 $this->repo_clipboard = $DIC
65 ->repository()
66 ->internal()
67 ->domain()
68 ->clipboard();
69
70 $this->repo_service = $repo_service;
71 $this->data_service = $data_service;
72 $this->domain_service = $domain_service;
73 $this->item_repo = $this->repo_service->content()->item();
74 $this->mode_repo = $this->repo_service->content()->mode();
75 $this->copage_resources = $DIC->copage()->internal()->domain()->pc()->resources();
76 }
77
82 {
83 // @todo get rid of $DIC/request call here -> move to gui
84 global $DIC;
85
86 return new ItemManager(
88 $this->item_repo,
89 $this->mode($container),
90 $DIC->container()->internal()->gui()->standardRequest()
91 );
92 }
93
97 public function itemPresentation(
99 ?\ilContainerUserFilter $container_user_filter,
100 bool $include_empty_blocks = true,
101 ?string $lang = null
104 $this->domain_service,
106 $container_user_filter,
107 $this->repo_clipboard,
108 $include_empty_blocks,
109 $lang
110 );
111 }
112
116 public function itemSetFlat(
117 int $ref_id,
118 ?\ilContainerUserFilter $user_filter,
119 bool $force_session_order_by_date = true,
120 bool $include_objective_items = false
121 ): ItemSetManager {
122 if (!isset(self::$flat_item_set_managers[$ref_id])) {
123 self::$flat_item_set_managers[$ref_id] = new ItemSetManager(
124 $this->domain_service,
126 $ref_id,
127 $user_filter,
128 0,
129 false,
130 $force_session_order_by_date,
131 $include_objective_items
132 );
133 }
134 return self::$flat_item_set_managers[$ref_id];
135 }
136
140 public function itemSetTree(
141 int $ref_id,
142 ?\ilContainerUserFilter $user_filter
143 ): ItemSetManager {
144 if (!isset(self::$tree_item_set_managers[$ref_id])) {
145 self::$tree_item_set_managers[$ref_id] = new ItemSetManager(
146 $this->domain_service,
147 ItemSetManager::TREE,
148 $ref_id,
149 $user_filter
150 );
151 }
152 return self::$tree_item_set_managers[$ref_id];
153 }
154
158 public function itemSetSingle(int $ref_id, int $single_ref_id): ItemSetManager
159 {
160 return new ItemSetManager(
161 $this->domain_service,
162 ItemSetManager::SINGLE,
163 $ref_id,
164 null,
165 $single_ref_id
166 );
167 }
168
170 {
171 $view_mode = $container->getViewMode();
172 if ($container->filteredSubtree()) {
173 $view_mode = \ilContainer::VIEW_SIMPLE;
174 }
175 switch ($view_mode) {
176 case \ilContainer::VIEW_SIMPLE:
177 $container_view = new SimpleViewManager(
178 $this->data_service->content(),
179 $this->domain_service,
181 );
182 break;
183
184 case \ilContainer::VIEW_OBJECTIVE:
185 $container_view = new ObjectiveViewManager(
186 $this->data_service->content(),
187 $this->domain_service,
189 );
190 break;
191
192 // all items in one block
193 case \ilContainer::VIEW_SESSIONS:
194 case \ilCourseConstants::IL_CRS_VIEW_TIMING: // not nice this workaround
195 $container_view = new SessionsViewManager(
196 $this->data_service->content(),
197 $this->domain_service,
199 );
200 break;
201
202 // all items in one block
203 case \ilContainer::VIEW_BY_TYPE:
204 default:
205 $container_view = new ByTypeViewManager(
206 $this->data_service->content(),
207 $this->domain_service,
209 );
210 break;
211 }
212
213 return $container_view;
214 }
215
224 {
225 if (!isset(self::$mode_managers[$container->getId()])) {
226 self::$mode_managers[$container->getId()] = new ModeManager(
228 $this->mode_repo,
229 $this->repo_clipboard,
230 $this->domain_service->user()->getId()
231 );
232 }
233 return self::$mode_managers[$container->getId()];
234 }
235
239 public function filter(
240 array $objects,
241 ?\ilContainerUserFilter $container_user_filter,
242 bool $results_on_filter_only = false
243 ): FilterManager {
245 $this,
246 $this->repo_service->content(),
247 $this->domain_service->metadata(),
248 $objects,
249 $container_user_filter,
250 $results_on_filter_only
251 );
252 }
253
256 BlockSequence $block_sequence,
257 ItemSetManager $item_set_manager,
258 bool $include_empty_blocks = true,
259 ?string $lang = null
262 $this->data_service->content(),
263 $this->domain_service,
264 $this->copage_resources,
266 $block_sequence,
267 $item_set_manager,
268 $include_empty_blocks,
269 $lang
270 );
271 }
272}
itemPresentation(\ilContainer $container, ?\ilContainerUserFilter $container_user_filter, bool $include_empty_blocks=true, ?string $lang=null)
Manages item retrieval, filtering, grouping and sorting.
itemSetTree(int $ref_id, ?\ilContainerUserFilter $user_filter)
Manages set of conatiner items (flat version)
itemSetSingle(int $ref_id, int $single_ref_id)
Manages set of conatiner items (single item version)
ILIAS Repository Clipboard ClipboardManager $repo_clipboard
ILIAS COPage PC Resources ResourcesManager $copage_resources
items(\ilContainer $container)
Controls item state (e.g.
mode(\ilContainer $container)
Controls admin/content view state Note: The node manager currently holds "state".
__construct(InternalRepoService $repo_service, InternalDataService $data_service, InternalDomainService $domain_service)
filter(array $objects, ?\ilContainerUserFilter $container_user_filter, bool $results_on_filter_only=false)
itemSetFlat(int $ref_id, ?\ilContainerUserFilter $user_filter, bool $force_session_order_by_date=true, bool $include_objective_items=false)
Manages set of conatiner items (flat version)
itemBlockSequenceGenerator(\ilContainer $container, BlockSequence $block_sequence, ItemSetManager $item_set_manager, bool $include_empty_blocks=true, ?string $lang=null)
Repository internal data service.
Repository internal repo service.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilContainer.
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ref_id
Definition: ltiauth.php:66
if(!file_exists('../ilias.ini.php'))
global $DIC
Definition: shib_login.php:26
$container
@noRector
Definition: wac.php:37
$lang
Definition: xapiexit.php:25