ILIAS  trunk Revision v13.0_alpha-52-g21c366bbdd4
class.InternalDomainService.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21namespace ILIAS\Blog;
22
30use ILIAS\Notes;
36
41{
42 use GlobalDICDomainServices;
43
44 protected static array $instance = [];
45 protected Container $dic;
46
47 public function __construct(
49 protected InternalRepoService $repo,
50 protected InternalDataService $data,
51 protected PageManagerInterface $page_manager
52 ) {
53 $this->initDomainServices($DIC);
54 $this->dic = $DIC;
55 }
56
57 public function export(): DomainService
58 {
59 return self::$instance["export"] ??= new DomainService(
60 $this->data,
61 $this->repo,
62 $this
63 );
64 }
65
66 public function exercise(int $a_node_id): BlogExercise
67 {
68 return new BlogExercise(
69 $a_node_id,
70 $this->repositoryTree(),
71 $this->user()
72 );
73 }
74
76 {
77 switch ($id_type) {
78 case \ilObjBlogGUI::REPOSITORY_NODE_ID:
79 return $this->access();
80
81 case \ilObjBlogGUI::WORKSPACE_NODE_ID:
82 $tree = new \ilWorkspaceTree($this->user()->getId());
83 return new \ilWorkspaceAccessHandler($tree);
84 }
85 throw new \RuntimeException("Invalid id type ($id_type).");
86 }
87
88 public function getObjectIdForWspId(int $wsp_id): int
89 {
90 $tree = new \ilWorkspaceTree($this->user()->getId());
91 return (int) $tree->lookupObjectId($wsp_id);
92 }
93
94 public function perm(
95 ?int $node_id,
96 int $id_type,
97 int $user_id,
98 int $owner
100 $access_handler = $this->getBlogAccessHandler($id_type);
101 return new PermissionManager(
102 $this,
103 $access_handler,
104 $node_id,
105 $id_type,
106 $user_id,
107 $owner
108 );
109 }
110
112 {
113 return new ReadingTimeManager();
114 }
115
117 {
118 return $this->page_manager;
119 }
120
121 public function notes(): Notes\DomainService
122 {
123 return $this->dic->notes()->domain();
124 }
125
126 public function blogSettings(): SettingsManager
127 {
128 return self::$instance["settings"] ??
129 self::$instance["settings"] = new SettingsManager(
130 $this->data,
131 $this->repo,
132 $this
133 );
134 }
135
136 public function posting(): PostingManager
137 {
138 return self::$instance["posting"] ??= new PostingManager(
139 $this->data,
140 $this->repo,
141 $this
142 );
143 }
144
145 public function postingList(
146 int $obj_id,
147 bool $include_inactive = true
148 ): Posting\PostingList {
149 $settings = $this->blogSettings()->getByObjId($obj_id);
150 return new Posting\PostingList(
151 $obj_id,
152 $this->posting(),
153 $settings,
154 $this->page_manager,
155 $include_inactive
156 );
157 }
158
159 public function news(): NewsManager
160 {
161 return self::$instance["news"] ??= new NewsManager(
162 $this->data,
163 $this->repo,
164 $this,
165 $this->dic->blog()->internal()->gui(),
166 $this->page_manager
167 );
168 }
169
171 {
172 return self::$instance["notification"] ??= new NotificationManager(
173 $this
174 );
175 }
176
177 public function keywords(): KeywordManager
178 {
179 return self::$instance["keywords"] ??= new KeywordManager(
180 $this
181 );
182 }
183
184}
$settings
Definition: index.php:44
perm(?int $node_id, int $id_type, int $user_id, int $owner)
__construct(Container $DIC, protected InternalRepoService $repo, protected InternalDataService $data, protected PageManagerInterface $page_manager)
postingList(int $obj_id, bool $include_inactive=true)
Domain class for handling news items of blog postings.
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:38
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Combines all available interfaces which can be called via global $ilAccess.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
initDomainServices(\ILIAS\DI\Container $DIC)
global $DIC
Definition: shib_login.php:26
$data
Definition: storeScorm.php:45