ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilSAHSPresentationGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 
22 {
23  var $ilias;
24  var $tpl;
25  var $lng;
26 
28  {
29  global $ilias, $tpl, $lng, $ilCtrl;
30 
31  $this->ilias =& $ilias;
32  $this->tpl =& $tpl;
33  $this->lng =& $lng;
34  $this->ctrl =& $ilCtrl;
35 
36  $this->ctrl->saveParameter($this, "ref_id");
37  }
38 
42  function &executeCommand()
43  {
44  global $lng,$ilAccess, $ilNavigationHistory, $ilCtrl, $ilLocator, $ilObjDataCache;
45 
46  include_once "./Services/Object/classes/class.ilObjectGUI.php";
47  include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php";
48 
49  $lng->loadLanguageModule("content");
50  $obj_id = ilObject::_lookupObjectId($_GET['ref_id']);
51 
52  // add entry to navigation history
53  if ($ilAccess->checkAccess("read", "", $_GET["ref_id"]))
54  {
55  include_once("./Modules/ScormAicc/classes/class.ilObjSAHSLearningModuleAccess.php");
56  $this->offline_mode = ilObjSAHSLearningModuleAccess::_lookupUserIsOfflineMode($obj_id);
57 
59  {
60  $ilNavigationHistory->addItem($_GET["ref_id"],
61  "ilias.php?cmd=infoScreen&baseClass=ilSAHSPresentationGUI&ref_id=".$_GET["ref_id"], "lm");
62  }
63  }
64 
65  include_once 'Services/Payment/classes/class.ilPaymentObject.php';
66  if(ilPaymentObject::_requiresPurchaseToAccess($_GET['ref_id'], $type = (isset($_GET['purchasetype']) ? $_GET['purchasetype'] : NULL) ))
67  {
68  $ilLocator->addRepositoryItems();
69  $ilLocator->addItem($ilObjDataCache->lookupTitle($ilObjDataCache->lookupObjId($_GET['ref_id'])),
70  'ilias.php?baseClass=ilSAHSPresentationGUI&amp;ref_id='.$_GET['ref_id'],
71  '',
72  $_GET['ref_id'],
73  'sahs');
74  $this->tpl->setLocator();
75  $this->tpl->getStandardTemplate();
76 
77  include_once 'Services/Payment/classes/class.ilShopPurchaseGUI.php';
78  $this->ctrl->setReturn($this, '');
79  $pp_gui = new ilShopPurchaseGUI($_GET['ref_id']);
80  $this->ctrl->forwardCommand($pp_gui);
81  $this->tpl->show();
82  exit();
83  }
84 
85  $next_class = $this->ctrl->getNextClass($this);
86  $cmd = $this->ctrl->getCmd();
87 
89 
90  if ($cmd == "downloadCertificate")
91  {
92  require_once "./Modules/ScormAicc/classes/SCORM/class.ilSCORMPresentationGUI.php";
93  $scorm_gui = new ilSCORMPresentationGUI();
94  $ret =& $this->ctrl->forwardCommand($scorm_gui);
95  }
96 
97  if (substr($cmd,0,11) == "offlineMode" || $this->offline_mode) $next_class = "ilscormofflinemodegui";
98 
99  switch($type)
100  {
101 
102  case "scorm2004":
103  include_once("./Modules/ScormAicc/classes/class.ilObjSCORMLearningModuleGUI.php");
104  $this->slm_gui = new ilObjSCORMLearningModuleGUI("", $_GET["ref_id"],true,false);
105  break;
106 
107  case "scorm":
108  include_once("./Modules/ScormAicc/classes/class.ilObjSCORMLearningModuleGUI.php");
109  $this->slm_gui = new ilObjSCORMLearningModuleGUI("", $_GET["ref_id"],true,false);
110  break;
111 
112  case "aicc":
113  include_once("./Modules/ScormAicc/classes/class.ilObjAICCLearningModuleGUI.php");
114  $this->slm_gui = new ilObjAICCLearningModuleGUI("", $_GET["ref_id"],true,false);
115  break;
116 
117  case "hacp":
118  include_once("./Modules/ScormAicc/classes/class.ilObjHACPLearningModuleGUI.php");
119  $this->slm_gui = new ilObjHACPLearningModuleGUI("", $_GET["ref_id"],true,false);
120  break;
121  }
122 
123  if ($next_class != "ilinfoscreengui" &&
124  $cmd != "infoScreen" &&
125  $next_class != "ilobjscorm2004learningmodulegui" &&
126  $next_class != "ilobjscormlearningmodulegui" &&
127  $next_class != "ilscormofflinemodegui" &&
128  $next_class != "illearningprogressgui")
129  {
130  include_once("./Services/License/classes/class.ilLicense.php");
131  ilLicense::_noteAccess($obj_id, "sahs", $_GET["ref_id"]);
132  switch($type)
133  {
134  case "scorm2004":
135  $this->ctrl->setCmdClass("ilscorm13player");
136  $this->slm_gui = new ilObjSCORMLearningModuleGUI("", $_GET["ref_id"],true,false);
137  break;
138 
139  case "scorm":
140  $this->ctrl->setCmdClass("ilscormpresentationgui");
141  $this->slm_gui = new ilObjSCORMLearningModuleGUI("", $_GET["ref_id"],true,false);
142  break;
143 
144  case "aicc":
145  $this->ctrl->setCmdClass("ilaiccpresentationgui");
146  break;
147 
148  case "hacp":
149  $this->ctrl->setCmdClass("ilhacppresentationgui");
150  break;
151  }
152  $next_class = $this->ctrl->getNextClass($this);
153  }
154 
155  switch($next_class)
156  {
157  case "ilinfoscreengui":
158  $ret =& $this->outputInfoScreen();
159  break;
160 
161  case "ilscorm13player":
162  require_once "./Modules/Scorm2004/classes/ilSCORM13Player.php";
163  $scorm_gui = new ilSCORM13Player();
164  $ret =& $this->ctrl->forwardCommand($scorm_gui);
165  break;
166 
167  case "ilscormpresentationgui":
168  require_once "./Modules/ScormAicc/classes/SCORM/class.ilSCORMPresentationGUI.php";
169  $scorm_gui = new ilSCORMPresentationGUI();
170  $ret =& $this->ctrl->forwardCommand($scorm_gui);
171  break;
172 
173  case "ilaiccpresentationgui":
174  require_once "./Modules/ScormAicc/classes/AICC/class.ilAICCPresentationGUI.php";
175  $aicc_gui = new ilAICCPresentationGUI();
176  $ret =& $this->ctrl->forwardCommand($aicc_gui);
177  break;
178 
179  case "ilhacppresentationgui":
180  require_once "./Modules/ScormAicc/classes/HACP/class.ilHACPPresentationGUI.php";
181  $hacp_gui = new ilHACPPresentationGUI();
182  $ret =& $this->ctrl->forwardCommand($hacp_gui);
183  break;
184 
185  case "illearningprogressgui":
186  $this->setInfoTabs("learning_progress");
187  include_once "./Services/Tracking/classes/class.ilLearningProgressGUI.php";
189  $this->ctrl->forwardCommand($new_gui);
190  $this->tpl->show();
191  break;
192 
193  case "ilscormofflinemodegui":
194  include_once "./Modules/ScormAicc/classes/class.ilSCORMOfflineModeGUI.php";
195  $new_gui =& new ilSCORMOfflineModeGUI($type);
196  $this->ctrl->forwardCommand($new_gui);
197  break;
198 
199  case "ilobjscorm2004learningmodulegui":
200  include_once './Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModuleGUI.php';
201  $new_gui =& new ilObjSCORM2004LearningModuleGUI("", $_GET["ref_id"],true,false);
202  $this->ctrl->forwardCommand($new_gui);
203  $this->setInfoTabs("cont_tracking_data");
204  $this->tpl->show();
205  break;
206 
207  case "ilobjscormlearningmodulegui":
208  include_once './Modules/ScormAicc/classes/class.ilObjSCORMLearningModuleGUI.php';
209  $new_gui =& new ilObjSCORMLearningModuleGUI("", $_GET["ref_id"],true,false);
210  $this->ctrl->forwardCommand($new_gui);
211  $this->setInfoTabs("cont_tracking_data");
212  $this->tpl->show();
213  break;
214 
215  default:
216  $this->$cmd();
217  }
218  }
219 
220  function attrib2arr(&$a_attributes)
221  {
222  $attr = array();
223 
224  if(!is_array($a_attributes))
225  {
226  return $attr;
227  }
228  foreach ($a_attributes as $attribute)
229  {
230  $attr[$attribute->name()] = $attribute->value();
231  }
232 
233 
234  return $attr;
235  }
236 
237 
241  function frameset()
242  {
243  $this->tpl = new ilTemplate("tpl.sahs_pres_frameset.html", false, false, "Modules/ScormAicc");
244  $this->tpl->setVariable("REF_ID",$this->slm->getRefId());
245  $this->tpl->show("DEFAULT", false);
246  exit;
247  }
248 
249 
253  function explorer($a_target = "sahs_content")
254  {
255  global $ilBench;
256 
257  $ilBench->start("SAHSExplorer", "initExplorer");
258 
259  $this->tpl = new ilTemplate("tpl.sahs_exp_main.html", true, true, "Modules/ScormAicc");
260 
261  require_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMExplorer.php");
262  $exp = new ilSCORMExplorer("ilias.php?baseClass=ilSAHSPresentationGUI&cmd=view&ref_id=".$this->slm->getRefId(), $this->slm);
263  $exp->setTargetGet("obj_id");
264  $exp->setFrameTarget($a_target);
265 
266  //$exp->setFiltered(true);
267 
268  if ($_GET["scexpand"] == "")
269  {
270  $mtree = new ilSCORMTree($this->slm->getId());
271  $expanded = $mtree->readRootId();
272  }
273  else
274  {
275  $expanded = $_GET["scexpand"];
276  }
277  $exp->setExpand($expanded);
278 
279  $exp->forceExpandAll(true, false);
280 
281  // build html-output
282  //666$exp->setOutput(0);
283  $ilBench->stop("SAHSExplorer", "initExplorer");
284 
285  // set output
286  $ilBench->start("SAHSExplorer", "setOutput");
287  $exp->setOutput(0);
288  $ilBench->stop("SAHSExplorer", "setOutput");
289 
290  $ilBench->start("SAHSExplorer", "getOutput");
291  $output = $exp->getOutput();
292  $ilBench->stop("SAHSExplorer", "getOutput");
293 
294  $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
295  $this->tpl->addBlockFile("CONTENT", "content", "tpl.sahs_explorer.html", "Modules/ScormAicc");
296  //$this->tpl->setVariable("TXT_EXPLORER_HEADER", $this->lng->txt("cont_content"));
297  $this->tpl->setVariable("EXP_REFRESH", $this->lng->txt("refresh"));
298  $this->tpl->setVariable("EXPLORER",$output);
299  $this->tpl->setVariable("ACTION", "ilias.php?baseClass=ilSAHSPresentationGUI&cmd=".$_GET["cmd"]."&frame=".$_GET["frame"].
300  "&ref_id=".$this->slm->getRefId()."&scexpand=".$_GET["scexpand"]);
301  $this->tpl->parseCurrentBlock();
302  $this->tpl->show();
303  }
304 
305 
306  function view()
307  {
308  $sc_gui_object =& ilSCORMObjectGUI::getInstance($_GET["obj_id"]);
309 
310  if(is_object($sc_gui_object))
311  {
312  $sc_gui_object->view();
313  }
314 
315  $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
316  $this->tpl->show();
317  }
318 
319  function api()
320  {
321  global $ilias;
322 
323  $slm_obj =& new ilObjSCORMLearningModule($_GET["ref_id"]);
324 
325  $this->tpl = new ilTemplate("tpl.sahs_api.html", true, true, "Modules/ScormAicc");
326  $this->tpl->setVariable("USER_ID",$ilias->account->getId());
327  $this->tpl->setVariable("USER_FIRSTNAME",$ilias->account->getFirstname());
328  $this->tpl->setVariable("USER_LASTNAME",$ilias->account->getLastname());
329  $this->tpl->setVariable("REF_ID",$_GET["ref_id"]);
330  $this->tpl->setVariable("SESSION_ID",session_id());
331 
332  $this->tpl->setVariable("CODE_BASE", "http://".$_SERVER['SERVER_NAME'].substr($_SERVER['PHP_SELF'], 0, strpos ($_SERVER['PHP_SELF'], "/ilias.php")));
333  $this->tpl->parseCurrentBlock();
334 
335  $this->tpl->show(false);
336  exit;
337  }
338 
339  function launchSahs()
340  {
341 
342  global $ilUser, $ilDB;
343 
344  $sco_id = ($_GET["sahs_id"] == "")
345  ? $_POST["sahs_id"]
346  : $_GET["sahs_id"];
347  $ref_id = ($_GET["ref_id"] == "")
348  ? $_POST["ref_id"]
349  : $_GET["ref_id"];
350 
351  $this->slm =& new ilObjSCORMLearningModule($ref_id, true);
352 
353  include_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMItem.php");
354  include_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMResource.php");
355  $item =& new ilSCORMItem($sco_id);
356 
357  $id_ref = $item->getIdentifierRef();
358  $resource =& new ilSCORMResource();
359  $resource->readByIdRef($id_ref, $item->getSLMId());
360  //$slm_obj =& new ilObjSCORMLearningModule($_GET["ref_id"]);
361  $href = $resource->getHref();
362  $this->tpl = new ilTemplate("tpl.sahs_launch_cbt.html", true, true, "Modules/ScormAicc");
363  $this->tpl->setVariable("HREF", $this->slm->getDataDirectory("output")."/".$href);
364 
365  // set item data
366  $this->tpl->setVariable("LAUNCH_DATA", $item->getDataFromLms());
367  $this->tpl->setVariable("MAST_SCORE", $item->getMasteryScore());
368  $this->tpl->setVariable("MAX_TIME", $item->getMaxTimeAllowed());
369  $this->tpl->setVariable("LIMIT_ACT", $item->getTimeLimitAction());
370 
371  // set alternative API name
372  if ($this->slm->getAPIAdapterName() != "API")
373  {
374  $this->tpl->setCurrentBlock("alt_api_ref");
375  $this->tpl->setVariable("API_NAME", $this->slm->getAPIAdapterName());
376  $this->tpl->parseCurrentBlock();
377  }
378 
379  $val_set = $ilDB->queryF('
380  SELECT * FROM scorm_tracking
381  WHERE user_id = %s
382  AND sco_id = %s
383  AND obj_id = %s',
384  array('integer','integer','integer'),
385  array($ilUser->getId(),$sco_id,$this->slm->getId()));
386 
387  $re_value = array();
388 
389  while($val_rec = $ilDB->fetchAssoc($val_set))
390  {
391  $val_rec["rvalue"] = str_replace("\r\n", "\n", $val_rec["rvalue"]);
392  $val_rec["rvalue"] = str_replace("\r", "\n", $val_rec["rvalue"]);
393  $val_rec["rvalue"] = str_replace("\n", "\\n", $val_rec["rvalue"]);
394  $re_value[$val_rec["lvalue"]] = $val_rec["rvalue"];
395  }
396 
397  foreach($re_value as $var => $value)
398  {
399  switch ($var)
400  {
401  case "cmi.core.lesson_location":
402  case "cmi.core.lesson_status":
403  case "cmi.core.entry":
404  case "cmi.core.score.raw":
405  case "cmi.core.score.max":
406  case "cmi.core.score.min":
407  case "cmi.core.total_time":
408  case "cmi.core.exit":
409  case "cmi.suspend_data":
410  case "cmi.comments":
411  case "cmi.student_preference.audio":
412  case "cmi.student_preference.language":
413  case "cmi.student_preference.speed":
414  case "cmi.student_preference.text":
415  $this->setSingleVariable($var, $value);
416  break;
417 
418  case "cmi.objectives._count":
419  $this->setSingleVariable($var, $value);
420  $this->setArray("cmi.objectives", $value, "id", $re_value);
421  $this->setArray("cmi.objectives", $value, "score.raw", $re_value);
422  $this->setArray("cmi.objectives", $value, "score.max", $re_value);
423  $this->setArray("cmi.objectives", $value, "score.min", $re_value);
424  $this->setArray("cmi.objectives", $value, "status", $re_value);
425  break;
426 
427  case "cmi.interactions._count":
428  $this->setSingleVariable($var, $value);
429  $this->setArray("cmi.interactions", $value, "id", $re_value);
430  for($i=0; $i<$value; $i++)
431  {
432  $var2 = "cmi.interactions.".$i.".objectives._count";
433  if (isset($v_array[$var2]))
434  {
435  $cnt = $v_array[$var2];
436  $this->setArray("cmi.interactions.".$i.".objectives",
437  $cnt, "id", $re_value);
438  /*
439  $this->setArray("cmi.interactions.".$i.".objectives",
440  $cnt, "score.raw", $re_value);
441  $this->setArray("cmi.interactions.".$i.".objectives",
442  $cnt, "score.max", $re_value);
443  $this->setArray("cmi.interactions.".$i.".objectives",
444  $cnt, "score.min", $re_value);
445  $this->setArray("cmi.interactions.".$i.".objectives",
446  $cnt, "status", $re_value);*/
447  }
448  }
449  $this->setArray("cmi.interactions", $value, "time", $re_value);
450  $this->setArray("cmi.interactions", $value, "type", $re_value);
451  for($i=0; $i<$value; $i++)
452  {
453  $var2 = "cmi.interactions.".$i.".correct_responses._count";
454  if (isset($v_array[$var2]))
455  {
456  $cnt = $v_array[$var2];
457  $this->setArray("cmi.interactions.".$i.".correct_responses",
458  $cnt, "pattern", $re_value);
459  $this->setArray("cmi.interactions.".$i.".correct_responses",
460  $cnt, "weighting", $re_value);
461  }
462  }
463  $this->setArray("cmi.interactions", $value, "student_response", $re_value);
464  $this->setArray("cmi.interactions", $value, "result", $re_value);
465  $this->setArray("cmi.interactions", $value, "latency", $re_value);
466  break;
467  }
468  }
469 
470  global $lng;
471  $this->tpl->setCurrentBlock("switch_icon");
472  $this->tpl->setVariable("SCO_ID", $_GET["sahs_id"]);
473  $this->tpl->setVariable("SCO_ICO", ilUtil::getImagePath("scorm/running.svg"));
474  $this->tpl->setVariable("SCO_ALT",
475  $lng->txt("cont_status").": "
476  .$lng->txt("cont_sc_stat_running")
477  );
478  $this->tpl->parseCurrentBlock();
479 
480  // lesson mode
481  $lesson_mode = $this->slm->getDefaultLessonMode();
482  if ($this->slm->getAutoReview())
483  {
484  if ($re_value["cmi.core.lesson_status"] == "completed" ||
485  $re_value["cmi.core.lesson_status"] == "passed" ||
486  $re_value["cmi.core.lesson_status"] == "failed")
487  {
488  $lesson_mode = "review";
489  }
490  }
491  $this->tpl->setVariable("LESSON_MODE", $lesson_mode);
492 
493  // credit mode
494  if ($lesson_mode == "normal")
495  {
496  $this->tpl->setVariable("CREDIT_MODE",
497  str_replace("_", "-", $this->slm->getCreditMode()));
498  }
499  else
500  {
501  $this->tpl->setVariable("CREDIT_MODE", "no-credit");
502  }
503 
504  // init cmi.core.total_time, cmi.core.lesson_status and cmi.core.entry
505  $sahs_obj_id = ilObject::_lookupObjId($_GET["ref_id"]);
506  if (!isset($re_value["cmi.core.total_time"]))
507  {
508  $item->insertTrackData("cmi.core.total_time", "0000:00:00", $sahs_obj_id);
509  }
510  if (!isset($re_value["cmi.core.lesson_status"]))
511  {
512  $item->insertTrackData("cmi.core.lesson_status", "not attempted", $sahs_obj_id);
513  }
514  if (!isset($re_value["cmi.core.entry"]))
515  {
516  $item->insertTrackData("cmi.core.entry", "", $sahs_obj_id);
517  }
518 
519  $this->tpl->show();
520  }
521 
522  function finishSahs ()
523  {
524  global $lng;
525  $this->tpl = new ilTemplate("tpl.sahs_finish_cbt.html", true, true, "Modules/ScormAicc");
526  $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
527 
528  $this->tpl->setCurrentBlock("switch_icon");
529  $this->tpl->setVariable("SCO_ID", $_GET["sahs_id"]);
530  $this->tpl->setVariable("SCO_ICO", ilUtil::getImagePath(
531  "scorm/".str_replace(" ", "_", $_GET["status"]).'.svg')
532  );
533  $this->tpl->setVariable("SCO_ALT",
534  $lng->txt("cont_status").": "
535  .$lng->txt("cont_sc_stat_".str_replace(" ", "_", $_GET["status"])).", "
536  .$lng->txt("cont_total_time"). ": "
537  .$_GET["totime"]
538  );
539  $this->tpl->setVariable("SCO_LAUNCH_ID", $_GET["launch"]);
540  $this->tpl->parseCurrentBlock();
541  $this->tpl->show();
542  }
543 
544  function unloadSahs ()
545  {
546  $this->tpl = new ilTemplate("tpl.sahs_unload_cbt.html", true, true, "Modules/ScormAicc");
547  $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
548  $this->tpl->setVariable("SCO_ID", $_GET["sahs_id"]);
549  $this->tpl->show();
550  }
551 
552 
553  function launchAsset()
554  {
555  global $ilUser, $ilDB;
556 
557  $sco_id = ($_GET["asset_id"] == "")
558  ? $_POST["asset_id"]
559  : $_GET["asset_id"];
560  $ref_id = ($_GET["ref_id"] == "")
561  ? $_POST["ref_id"]
562  : $_GET["ref_id"];
563 
564  $this->slm =& new ilObjSCORMLearningModule($ref_id, true);
565 
566  include_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMItem.php");
567  include_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMResource.php");
568  $item =& new ilSCORMItem($sco_id);
569 
570  $id_ref = $item->getIdentifierRef();
571  $resource =& new ilSCORMResource();
572  $resource->readByIdRef($id_ref, $item->getSLMId());
573  $href = $resource->getHref();
574  $this->tpl->setVariable("HREF", $this->slm->getDataDirectory("output")."/".$href);
575  $this->tpl = new ilTemplate("tpl.scorm_launch_asset.html", true, true, "Modules/ScormAicc");
576  $this->tpl->setVariable("HREF", $this->slm->getDataDirectory("output")."/".$href);
577  $this->tpl->show();
578  }
579 
580 
584  function setSingleVariable($a_var, $a_value)
585  {
586  $this->tpl->setCurrentBlock("set_value");
587  $this->tpl->setVariable("VAR", $a_var);
588  $this->tpl->setVariable("VALUE", $a_value);
589  $this->tpl->parseCurrentBlock();
590  }
591 
595  function setArray($a_left, $a_value, $a_name, &$v_array)
596  {
597  for($i=0; $i<$a_value; $i++)
598  {
599  $var = $a_left.".".$i.".".$a_name;
600  if (isset($v_array[$var]))
601  {
602  $this->tpl->setCurrentBlock("set_value");
603  $this->tpl->setVariable("VAR", $var);
604  $this->tpl->setVariable("VALUE", $v_array[$var]);
605  $this->tpl->parseCurrentBlock();
606  }
607  }
608  }
609 
615  function infoScreen()
616  {
617  $this->ctrl->setCmd("showSummary");
618  $this->ctrl->setCmdClass("ilinfoscreengui");
619  $this->outputInfoScreen();
620  }
621 
622  function setInfoTabs($a_active)
623  {
624  global $ilTabs, $ilLocator, $ilAccess;
625  // $ilTabs->clearTargets();
626  // #9658 / #11753
627  include_once "Services/Tracking/classes/class.ilLearningProgressAccess.php";
629  ((!$ilAccess->checkAccess("edit_learning_progress", "", $_GET["ref_id"]) &&
630  !$ilAccess->checkAccess("read_learning_progress", "", $_GET["ref_id"])) ||
631  !$ilAccess->checkAccess("write", "", $_GET["ref_id"])))
632  {
633  $ilTabs->addTab("info_short", $this->lng->txt("info_short"),
634  $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary"));
635 
636  $ilTabs->addTab("learning_progress", $this->lng->txt("learning_progress"),
637  $this->ctrl->getLinkTargetByClass('illearningprogressgui',''));
638  }
639  if($ilAccess->checkAccess("edit_learning_progress", "", $_GET["ref_id"]) || $ilAccess->checkAccess("read_learning_progress", "", $_GET["ref_id"]))
640  {
641  include_once('./Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
642  $privacy = ilPrivacySettings::_getInstance();
643  if($privacy->enabledSahsProtocolData()) {
644  include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php";
645  $obj_id = ilObject::_lookupObjectId($_GET['ref_id']);
647  if($type == "scorm2004") {
648  $ilTabs->addTab("cont_tracking_data", $this->lng->txt("cont_tracking_data"),
649  $this->ctrl->getLinkTargetByClass('ilobjscorm2004learningmodulegui','showTrackingItems'));
650  }
651  else if($type == "scorm") {
652  $ilTabs->addTab("cont_tracking_data", $this->lng->txt("cont_tracking_data"),
653  $this->ctrl->getLinkTargetByClass('ilobjscormlearningmodulegui','showTrackingItems'));
654  }
655  }
656  }
657  $ilTabs->activateTab($a_active);
658  $this->tpl->getStandardTemplate();
659  $this->tpl->setTitle($this->slm_gui->object->getTitle());
660  $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_lm.svg"));
661  $ilLocator->addRepositoryItems();
662  $ilLocator->addItem($this->slm_gui->object->getTitle(),
663  $this->ctrl->getLinkTarget($this, "infoScreen"), "", $_GET["ref_id"]);
664  $this->tpl->setLocator();
665  }
666 
670  function outputInfoScreen()
671  {
672  global $ilAccess;
673 
674  //$this->tpl->setHeaderPageTitle("PAGETITLE", " - ".$this->lm->getTitle());
675 
676  // set style sheets
677  /*
678  if (!$this->offlineMode())
679  {
680  $this->tpl->setStyleSheetLocation(ilUtil::getStyleSheetLocation());
681  }
682  else
683  {
684  $style_name = $this->ilias->account->prefs["style"].".css";;
685  $this->tpl->setStyleSheetLocation("./".$style_name);
686  }*/
687 
688  $this->setInfoTabs("info_short");
689 
690  $this->lng->loadLanguageModule("meta");
691 
692  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
693 
694  $info = new ilInfoScreenGUI($this->slm_gui);
695  $info->enablePrivateNotes();
696  //$info->enableLearningProgress();
697 
698  $info->enableNews();
699  if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]))
700  {
701  $info->enableNewsEditing();
702  $news_set = new ilSetting("news");
703  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
704  if ($enable_internal_rss)
705  {
706  $info->setBlockProperty("news", "settings", true);
707  }
708  }
709 
710  // add read / back button
711  if ($ilAccess->checkAccess("read", "", $_GET["ref_id"]))
712  {
713  include_once './Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php';
714  $sahs_obj = new ilObjSAHSLearningModule($_GET["ref_id"]);
715  $om = $sahs_obj->getOpenMode();
716  $width = $sahs_obj->getWidth();
717  $height = $sahs_obj->getHeight();
718  if ($om != 0)
719  {
720  $info->addButton($this->lng->txt("view"),
721  "javascript:void(0); onclick=startSAHS('".$this->ctrl->getLinkTarget($this, "")."','ilContObj".$this->slm_gui->object->getId()."',".$om.",".$width.",".$height.");",
722  '', 'top', true);
723  }
724  else
725  {
726  $info->addButton($this->lng->txt("view"),
727  $this->ctrl->getLinkTarget($this, ""),
728  ' target="ilContObj'.$this->slm_gui->object->getId().'" ',
729  'top', true);
730  }
731  }
732 
733  // show standard meta data section
734  $info->addMetaDataSections($this->slm_gui->object->getId(),0,
735  $this->slm_gui->object->getType());
736 
737  /*
738  if ($this->offlineMode())
739  {
740  $this->tpl->setContent($info->getHTML());
741  return $this->tpl->get();
742  }
743  else
744  {*/
745  // forward the command
746  $this->ctrl->forwardCommand($info);
747  //$this->tpl->setContent("aa");
748  $this->tpl->show();
749  //}
750  }
751 
752 }
753 ?>