ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
class.ilSAHSPresentationGUI.php
Go to the documentation of this file.
1 <?php
2 
3 declare(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  # AXH: DEBUGGING!
95  $DIC->logger()->root()->info( '===== $next_class: ' . $next_class . ' =====' );
96  $DIC->logger()->root()->info( '===== $cmd: ' . $cmd . ' =====' );
97 
98  if ($next_class !== "ilinfoscreengui" &&
99  $cmd !== "infoScreen" &&
100  $next_class !== "ilobjscorm2004learningmodulegui" &&
101  $next_class !== "ilobjscormlearningmodulegui" &&
102  $next_class !== "ilscorm13playergui" &&
103  $next_class !== "ilscormpresentationgui" &&
104  $next_class !== "illearningprogressgui") {
105  switch ($type) {
106  case "scorm2004":
107  // @todo: removed deprecated ilCtrl methods, this needs inspection by a maintainer.
108  // $this->ctrl->setCmdClass("ilscorm13playergui");
109 
110  $this->ctrl->saveParameterByClass(ilSCORM13PlayerGUI::class, "ref_id");
111  $this->ctrl->redirectByClass(ilSCORM13PlayerGUI::class, $this->ctrl->getCmd());
112 
113  # AXH: Verwendung unklar!
114  $this->slm_gui = new ilObjSCORMLearningModuleGUI("", $this->refId, true, false);
115  break;
116 
117  case "scorm":
118  // @todo: removed deprecated ilCtrl methods, this needs inspection by a maintainer.
119  // $this->ctrl->setCmdClass("ilscormpresentationgui");
120 
121  $this->ctrl->saveParameterByClass(ilSCORMPresentationGUI::class, "ref_id");
122  $this->ctrl->redirectByClass(ilSCORMPresentationGUI::class, $this->ctrl->getCmd());
123 
124  # AXH: Verwendung unklar!
125  $this->slm_gui = new ilObjSCORMLearningModuleGUI("", $this->refId, true, false);
126  break;
127  }
128  # AXH: Verwendung unklar!
129  $next_class = $this->ctrl->getNextClass($this);
130  }
131 
132  switch ($next_class) {
133  case "ilinfoscreengui":
134  $this->outputInfoScreen();
135  break;
136 
137  case "ilscorm13playergui":
138  $scorm_gui = new ilSCORM13PlayerGUI();
139  $ret = $this->ctrl->forwardCommand($scorm_gui);
140  break;
141 
142  case "ilscormpresentationgui":
143  $scorm_gui = new ilSCORMPresentationGUI();
144  $ret = $this->ctrl->forwardCommand($scorm_gui);
145  break;
146 
147  case "illearningprogressgui":
148  $this->setInfoTabs("learning_progress");
150  $this->ctrl->forwardCommand($new_gui);
151  $this->tpl->printToStdout();
152  break;
153 
154  case "ilobjscorm2004learningmodulegui":
155  $new_gui = new ilObjSCORM2004LearningModuleGUI([], $this->refId, true, false);
156  $this->ctrl->forwardCommand($new_gui);
157  $this->setInfoTabs("cont_tracking_data");
158  $this->tpl->printToStdout();
159  break;
160 
161  case "ilobjscormlearningmodulegui":
162  $new_gui = new ilObjSCORMLearningModuleGUI("", $this->refId, true, false);
163  $this->ctrl->forwardCommand($new_gui);
164  $this->setInfoTabs("cont_tracking_data");
165  $this->tpl->printToStdout();
166  break;
167 
168  default:
169  $this->$cmd();
170  }
171  }
172 
173 
174  public function view(): void
175  {
176  $sc_gui_object = ilSCORMObjectGUI::getInstance($this->refId);
177 
178  if (is_object($sc_gui_object)) {
179  $sc_gui_object->view();
180  }
181 
182  $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
183  $this->tpl->printToStdout();
184  }
185 
192  public function infoScreen(): void
193  {
194  if (strtolower($this->ctrl->getCmd() ?? '') === 'infoscreen') {
195  $this->ctrl->redirectByClass(ilInfoScreenGUI::class, 'showSummary');
196  }
197 
198  $this->outputInfoScreen();
199  }
200 
204  public function setInfoTabs(string $a_active): void
205  {
206  global $DIC;
207 
208  $refId = $this->refId;
209 
210  if (
211  !$DIC->access()->checkAccess('visible', '', $refId) &&
212  !$DIC->access()->checkAccess('read', '', $refId)
213  ) {
214  $DIC['ilErr']->raiseError($this->lng->txt('msg_no_perm_read'), $DIC['ilErr']->MESSAGE); //todo
215  }
217  $DIC->tabs()->addTab(
218  "info_short",
219  $this->lng->txt("info_short"),
220  $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary")
221  );
222 
223  $DIC->tabs()->addTab(
224  "learning_progress",
225  $this->lng->txt("learning_progress"),
226  $this->ctrl->getLinkTargetByClass('illearningprogressgui', '')
227  );
228  }
229  if ($DIC->access()->checkAccess("edit_learning_progress", "", $refId) || $DIC->access()->checkAccess("read_learning_progress", "", $refId)) {
230  $privacy = ilPrivacySettings::getInstance();
231  if ($privacy->enabledSahsProtocolData()) {
232  $obj_id = ilObject::_lookupObjectId($refId);
234  if ($type === "scorm2004") {
235  $DIC->tabs()->addTab(
236  "cont_tracking_data",
237  $this->lng->txt("cont_tracking_data"),
238  $this->ctrl->getLinkTargetByClass('ilobjscorm2004learningmodulegui', 'showTrackingItems')
239  );
240  } elseif ($type === "scorm") {
241  $DIC->tabs()->addTab(
242  "cont_tracking_data",
243  $this->lng->txt("cont_tracking_data"),
244  $this->ctrl->getLinkTargetByClass('ilobjscormlearningmodulegui', 'showTrackingItems')
245  );
246  }
247  }
248  }
249  $DIC->tabs()->activateTab($a_active);
250  $this->tpl->loadStandardTemplate();
251  $this->tpl->setTitle($this->slm_gui->getObject()->getTitle());
252  $this->tpl->setTitleIcon(ilUtil::getImagePath("standard/icon_lm.svg"));
253  $DIC['ilLocator']->addRepositoryItems();
254  $DIC['ilLocator']->addItem(
255  $this->slm_gui->getObject()->getTitle(),
256  $this->ctrl->getLinkTarget($this, "infoScreen"),
257  "",
258  $refId
259  );
260  $this->tpl->setLocator();
261  }
262 
267  public function outputInfoScreen(): void
268  {
269  global $DIC;
270  $ilAccess = $DIC->access();
271  $refId = $this->refId;
272 
273  $this->setInfoTabs("info_short");
274 
275  $this->lng->loadLanguageModule("meta");
276 
277  $info = new ilInfoScreenGUI($this->slm_gui);
278  $info->enablePrivateNotes();
279 
280  $info->enableNews();
281  if ($ilAccess->checkAccess("write", "", $refId)) {
282  $info->enableNewsEditing();
283  $news_set = new ilSetting("news");
284  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
285  if ($enable_internal_rss) {
286  $info->setBlockProperty("news", "settings", "");
287  }
288  }
289 
290  // add read / back button
291  if ($ilAccess->checkAccess("read", "", $refId)) {
292  $ilToolbar = $GLOBALS['DIC']->toolbar();
293  $ilToolbar->addButtonInstance($this->slm_gui->getObject()->getViewButton());
294  }
295 
296  // show standard meta data section
297  $info->addMetaDataSections(
298  $this->slm_gui->getObject()->getId(),
299  0,
300  $this->slm_gui->getObject()->getType()
301  );
302 
303  $this->ctrl->forwardCommand($info);
304  $this->tpl->printToStdout();
305  }
306 }
static getStyleSheetLocation(string $mode="output", string $a_css_name="")
get full style sheet file name (path inclusive) of current user
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
infoScreen()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually...
loadLanguageModule(string $a_module)
Load language module.
static checkAccess(int $a_ref_id, bool $a_allow_only_read=true)
check access to learning progress
static _lookupSubType(int $a_obj_id)
lookup subtype id (scorm, )
Interface ilCtrlBaseClassInterface describes ilCtrl base classes.
ilObjSCORMLearningModuleGUI $slm_gui
$GLOBALS["DIC"]
Definition: wac.php:30
global $DIC
Definition: shib_login.php:25
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 _lookupObjectId(int $ref_id)
Class ilSCORMPresentationGUI.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...