ILIAS  release_8 Revision v8.24
class.ilSAHSPresentationGUI.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
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 !== "illearningprogressgui") {
99 switch ($type) {
100 case "scorm2004":
101 $this->ctrl->setCmdClass("ilscorm13playergui");
102 $this->slm_gui = new ilObjSCORMLearningModuleGUI("", $this->refId, true, false);
103 break;
104
105 case "scorm":
106 $this->ctrl->setCmdClass("ilscormpresentationgui");
107 $this->slm_gui = new ilObjSCORMLearningModuleGUI("", $this->refId, true, false);
108 break;
109 }
110 $next_class = $this->ctrl->getNextClass($this);
111 }
112
113 switch ($next_class) {
114 case "ilinfoscreengui":
115 $this->outputInfoScreen();
116 break;
117
118 case "ilscorm13playergui":
119 $scorm_gui = new ilSCORM13PlayerGUI();
120 $ret = $this->ctrl->forwardCommand($scorm_gui);
121 break;
122
123 case "ilscormpresentationgui":
124 $scorm_gui = new ilSCORMPresentationGUI();
125 $ret = $this->ctrl->forwardCommand($scorm_gui);
126 break;
127
128 case "illearningprogressgui":
129 $this->setInfoTabs("learning_progress");
131 $this->ctrl->forwardCommand($new_gui);
132 $this->tpl->printToStdout();
133 break;
134
135 case "ilobjscorm2004learningmodulegui":
136 $new_gui = new ilObjSCORM2004LearningModuleGUI([], $this->refId, true, false);
137 $this->ctrl->forwardCommand($new_gui);
138 $this->setInfoTabs("cont_tracking_data");
139 $this->tpl->printToStdout();
140 break;
141
142 case "ilobjscormlearningmodulegui":
143 $new_gui = new ilObjSCORMLearningModuleGUI("", $this->refId, true, false);
144 $this->ctrl->forwardCommand($new_gui);
145 $this->setInfoTabs("cont_tracking_data");
146 $this->tpl->printToStdout();
147 break;
148
149 default:
150 $this->$cmd();
151 }
152 }
153
154
155 public function view(): void
156 {
157 $sc_gui_object = ilSCORMObjectGUI::getInstance($this->refId);
158
159 if (is_object($sc_gui_object)) {
160 $sc_gui_object->view();
161 }
162
163 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
164 $this->tpl->printToStdout();
165 }
166
173 public function infoScreen(): void
174 {
175 $this->ctrl->setCmd("showSummary");
176 $this->ctrl->setCmdClass("ilinfoscreengui");
177 $this->outputInfoScreen();
178 }
179
183 public function setInfoTabs(string $a_active): void
184 {
185 global $DIC;
186
188
189 if (
190 !$DIC->access()->checkAccess('visible', '', $refId) &&
191 !$DIC->access()->checkAccess('read', '', $refId)
192 ) {
193 $DIC['ilErr']->raiseError($this->lng->txt('msg_no_perm_read'), $DIC['ilErr']->MESSAGE); //todo
194 }
196 $DIC->tabs()->addTab(
197 "info_short",
198 $this->lng->txt("info_short"),
199 $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary")
200 );
201
202 $DIC->tabs()->addTab(
203 "learning_progress",
204 $this->lng->txt("learning_progress"),
205 $this->ctrl->getLinkTargetByClass('illearningprogressgui', '')
206 );
207 }
208 if ($DIC->access()->checkAccess("edit_learning_progress", "", $refId) || $DIC->access()->checkAccess("read_learning_progress", "", $refId)) {
210 if ($privacy->enabledSahsProtocolData()) {
213 if ($type === "scorm2004") {
214 $DIC->tabs()->addTab(
215 "cont_tracking_data",
216 $this->lng->txt("cont_tracking_data"),
217 $this->ctrl->getLinkTargetByClass('ilobjscorm2004learningmodulegui', 'showTrackingItems')
218 );
219 } elseif ($type === "scorm") {
220 $DIC->tabs()->addTab(
221 "cont_tracking_data",
222 $this->lng->txt("cont_tracking_data"),
223 $this->ctrl->getLinkTargetByClass('ilobjscormlearningmodulegui', 'showTrackingItems')
224 );
225 }
226 }
227 }
228 $DIC->tabs()->activateTab($a_active);
229 $this->tpl->loadStandardTemplate();
230 $this->tpl->setTitle($this->slm_gui->getObject()->getTitle());
231 $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_lm.svg"));
232 $DIC['ilLocator']->addRepositoryItems();
233 $DIC['ilLocator']->addItem(
234 $this->slm_gui->getObject()->getTitle(),
235 $this->ctrl->getLinkTarget($this, "infoScreen"),
236 "",
237 $refId
238 );
239 $this->tpl->setLocator();
240 }
241
246 public function outputInfoScreen(): void
247 {
248 global $DIC;
249 $ilAccess = $DIC->access();
250 $refId = $this->refId;//$this->slm_gui->object->getRefId();
251
252 //$this->tpl->setHeaderPageTitle("PAGETITLE", " - ".$this->lm->getTitle());
253
254 // set style sheets
255 // $this->tpl->setStyleSheetLocation(ilUtil::getStyleSheetLocation());
256
257 $this->setInfoTabs("info_short");
258
259 $this->lng->loadLanguageModule("meta");
260
261 $info = new ilInfoScreenGUI($this->slm_gui);
262 $info->enablePrivateNotes();
263 //$info->enableLearningProgress();
264
265 $info->enableNews();
266 if ($ilAccess->checkAccess("write", "", $refId)) {
267 $info->enableNewsEditing();
268 $news_set = new ilSetting("news");
269 $enable_internal_rss = $news_set->get("enable_rss_for_internal");
270 if ($enable_internal_rss) {
271 $info->setBlockProperty("news", "settings", "");
272 }
273 }
274
275 // add read / back button
276 if ($ilAccess->checkAccess("read", "", $refId)) {
277 $ilToolbar = $GLOBALS['DIC']->toolbar();
278 $ilToolbar->addButtonInstance($this->slm_gui->getObject()->getViewButton());
279 }
280
281 // show standard meta data section
282 $info->addMetaDataSections(
283 $this->slm_gui->getObject()->getId(),
284 0,
285 $this->slm_gui->getObject()->getType()
286 );
287
288 // forward the command
289 $this->ctrl->forwardCommand($info);
290 $this->tpl->printToStdout();
291 }
292}
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
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
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupSubType(int $a_obj_id)
lookup subtype id (scorm, )
Class ilObjSCORMLearningModuleGUI.
static _lookupObjectId(int $ref_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilObjSCORMLearningModuleGUI $slm_gui
infoScreen()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually,...
@noinspection ForgottenDebugOutputInspection
Class ilSCORMPresentationGUI.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getStyleSheetLocation(string $mode="output", string $a_css_name="", string $a_css_location="")
get full style sheet file name (path inclusive) of current user
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
global $DIC
Definition: feed.php:28
Interface ilCtrlBaseClassInterface describes ilCtrl base classes.
$type