ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilSAHSPresentationGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
37{
39 protected ilLanguage $lng;
40 protected ilCtrl $ctrl;
42 protected int $refId;
43
47 public function __construct()
48 {
49 global $DIC;
50 $this->tpl = $DIC['tpl'];
51 $this->lng = $DIC->language();
52 $this->ctrl = $DIC->ctrl();
53 $this->ctrl->saveParameter($this, "ref_id");
54 $this->refId = $DIC->http()->wrapper()->query()->retrieve('ref_id', $DIC->refinery()->kindlyTo()->int());
55 }
56
60 public function executeCommand(): void
61 {
62 global $DIC;
63 $lng = $DIC->language();
64 $ilAccess = $DIC->access();
65 $ilNavigationHistory = $DIC['ilNavigationHistory'];
66 $ilCtrl = $DIC->ctrl();
67 $ilLocator = $DIC['ilLocator'];
68 $ilObjDataCache = $DIC['ilObjDataCache'];
69
70 $lng->loadLanguageModule("content");
71 $obj_id = ilObject::_lookupObjectId($this->refId);
72
73 // add entry to navigation history
74 if ($ilAccess->checkAccess("read", "", $this->refId)) {
75 $ilNavigationHistory->addItem(
76 $this->refId,
77 "ilias.php?cmd=infoScreen&baseClass=ilSAHSPresentationGUI&ref_id=" . $this->refId,
78 "lm"
79 );
80 }
81
82 $next_class = $this->ctrl->getNextClass($this);
83 $cmd = $this->ctrl->getCmd();
84
86
87 if ($cmd === "downloadCertificate") {
88 $scorm_gui = new ilSCORMPresentationGUI();
89 $ret = $this->ctrl->forwardCommand($scorm_gui);
90 }
91
92 $this->slm_gui = new ilObjSCORMLearningModuleGUI("", $this->refId, true, false);
93
94 if ($next_class !== "ilinfoscreengui" &&
95 $cmd !== "infoScreen" &&
96 $next_class !== "ilobjscorm2004learningmodulegui" &&
97 $next_class !== "ilobjscormlearningmodulegui" &&
98 $next_class !== "ilscorm13playergui" &&
99 $next_class !== "ilscormpresentationgui" &&
100 $next_class !== "illearningprogressgui") {
101 switch ($type) {
102 case "scorm2004":
103
104 $this->ctrl->saveParameterByClass(ilSCORM13PlayerGUI::class, "ref_id");
105 $this->ctrl->redirectByClass(ilSCORM13PlayerGUI::class, $this->ctrl->getCmd());
106
107 # AXH: Verwendung unklar!
108 $this->slm_gui = new ilObjSCORMLearningModuleGUI("", $this->refId, true, false);
109 break;
110
111 case "scorm":
112
113 $this->ctrl->saveParameterByClass(ilSCORMPresentationGUI::class, "ref_id");
114 $this->ctrl->redirectByClass(ilSCORMPresentationGUI::class, $this->ctrl->getCmd());
115
116 # AXH: Verwendung unklar!
117 $this->slm_gui = new ilObjSCORMLearningModuleGUI("", $this->refId, true, false);
118 break;
119 }
120 # AXH: Verwendung unklar!
121 $next_class = $this->ctrl->getNextClass($this);
122 }
123
124 switch ($next_class) {
125 case "ilinfoscreengui":
126 $this->outputInfoScreen();
127 break;
128
129 case "ilscorm13playergui":
130 $scorm_gui = new ilSCORM13PlayerGUI();
131 $ret = $this->ctrl->forwardCommand($scorm_gui);
132 break;
133
134 case "ilscormpresentationgui":
135 $scorm_gui = new ilSCORMPresentationGUI();
136 $ret = $this->ctrl->forwardCommand($scorm_gui);
137 break;
138
139 case "illearningprogressgui":
140 $this->setInfoTabs("learning_progress");
142 $this->ctrl->forwardCommand($new_gui);
143 $this->tpl->printToStdout();
144 break;
145
146 case "ilobjscorm2004learningmodulegui":
147 $new_gui = new ilObjSCORM2004LearningModuleGUI([], $this->refId, true, false);
148 $this->ctrl->forwardCommand($new_gui);
149 $this->setInfoTabs("cont_tracking_data");
150 $this->tpl->printToStdout();
151 break;
152
153 case "ilobjscormlearningmodulegui":
154 $new_gui = new ilObjSCORMLearningModuleGUI("", $this->refId, true, false);
155 $this->ctrl->forwardCommand($new_gui);
156 $this->setInfoTabs("cont_tracking_data");
157 $this->tpl->printToStdout();
158 break;
159
160 default:
161 $this->$cmd();
162 }
163 }
164
165
166 public function view(): void
167 {
168 $sc_gui_object = ilSCORMObjectGUI::getInstance($this->refId);
169
170 if (is_object($sc_gui_object)) {
171 $sc_gui_object->view();
172 }
173
174 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
175 $this->tpl->printToStdout();
176 }
177
184 public function infoScreen(): void
185 {
186 if (strtolower($this->ctrl->getCmd() ?? '') === 'infoscreen') {
187 $this->ctrl->redirectByClass(ilInfoScreenGUI::class, 'showSummary');
188 }
189
190 $this->outputInfoScreen();
191 }
192
196 public function setInfoTabs(string $a_active): void
197 {
198 global $DIC;
199
201
202 if (
203 !$DIC->access()->checkAccess('visible', '', $refId) &&
204 !$DIC->access()->checkAccess('read', '', $refId)
205 ) {
206 $DIC['ilErr']->raiseError($this->lng->txt('msg_no_perm_read'), $DIC['ilErr']->MESSAGE); //todo
207 }
209 $DIC->tabs()->addTab(
210 "info_short",
211 $this->lng->txt("info_short"),
212 $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary")
213 );
214
215 $DIC->tabs()->addTab(
216 "learning_progress",
217 $this->lng->txt("learning_progress"),
218 $this->ctrl->getLinkTargetByClass('illearningprogressgui', '')
219 );
220 }
221 if ($DIC->access()->checkAccess("edit_learning_progress", "", $refId) || $DIC->access()->checkAccess("read_learning_progress", "", $refId)) {
223 if ($privacy->enabledSahsProtocolData()) {
226 if ($type === "scorm2004") {
227 $DIC->tabs()->addTab(
228 "cont_tracking_data",
229 $this->lng->txt("cont_tracking_data"),
230 $this->ctrl->getLinkTargetByClass('ilobjscorm2004learningmodulegui', 'showTrackingItems')
231 );
232 } elseif ($type === "scorm") {
233 $DIC->tabs()->addTab(
234 "cont_tracking_data",
235 $this->lng->txt("cont_tracking_data"),
236 $this->ctrl->getLinkTargetByClass('ilobjscormlearningmodulegui', 'showTrackingItems')
237 );
238 }
239 }
240 }
241 $DIC->tabs()->activateTab($a_active);
242 $this->tpl->loadStandardTemplate();
243 $this->tpl->setTitle($this->slm_gui->getObject()->getTitle());
244 $this->tpl->setTitleIcon(ilUtil::getImagePath("standard/icon_lm.svg"));
245 $DIC['ilLocator']->addRepositoryItems();
246 $DIC['ilLocator']->addItem(
247 $this->slm_gui->getObject()->getTitle(),
248 $this->ctrl->getLinkTarget($this, "infoScreen"),
249 "",
250 $refId
251 );
252 $this->tpl->setLocator();
253 }
254
259 public function outputInfoScreen(): void
260 {
261 global $DIC;
262 $ilAccess = $DIC->access();
264
265 $this->setInfoTabs("info_short");
266
267 $this->lng->loadLanguageModule("meta");
268
269 $info = new ilInfoScreenGUI($this->slm_gui);
270 $info->enablePrivateNotes();
271
272 $info->enableNews();
273 if ($ilAccess->checkAccess("write", "", $refId)) {
274 $info->enableNewsEditing();
275 $news_set = new ilSetting("news");
276 $enable_internal_rss = $news_set->get("enable_rss_for_internal");
277 if ($enable_internal_rss) {
278 $info->setBlockProperty("news", "settings", "");
279 }
280 }
281
282 // add read / back button
283 if ($ilAccess->checkAccess("read", "", $refId)) {
284 $ilToolbar = $GLOBALS['DIC']->toolbar();
285 $ilToolbar->addButtonInstance($this->slm_gui->getObject()->getViewButton());
286 }
287
288 // show standard meta data section
289 $info->addMetaDataSections(
290 $this->slm_gui->getObject()->getId(),
291 0,
292 $this->slm_gui->getObject()->getType()
293 );
294
295 $this->ctrl->forwardCommand($info);
296 $this->tpl->printToStdout();
297 }
298}
Class ilCtrl provides processing control methods.
Class ilInfoScreenGUI.
language handling
loadLanguageModule(string $a_module)
Load language module.
static checkAccess(int $a_ref_id, bool $a_allow_only_read=true)
check access to learning progress
Class ilObjUserTrackingGUI.
static _lookupSubType(int $a_obj_id)
lookup subtype id (scorm, )
Class ilObjSCORMLearningModuleGUI.
static _lookupObjectId(int $ref_id)
Class ilSAHSPresentationGUI.
ilObjSCORMLearningModuleGUI $slm_gui
infoScreen()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually,...
Class ilSCORMPresentationGUI.
ILIAS Setting Class.
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static getStyleSheetLocation(string $mode="output", string $a_css_name="")
get full style sheet file name (path inclusive) of current user
$info
Definition: entry_point.php:21
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: shib_login.php:26
$GLOBALS["DIC"]
Definition: wac.php:54