ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilObjSAHSLearningModule.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2011 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 require_once "./Services/Object/classes/class.ilObject.php";
6 require_once "./Modules/ScormAicc/classes/class.ilObjSCORMValidator.php";
7 //require_once "Services/MetaData/classes/class.ilMDLanguageItem.php";
8 
21 {
23 // var $meta_data;
24 
31  function ilObjSAHSLearningModule($a_id = 0, $a_call_by_reference = true)
32  {
33  $this->type = "sahs";
34  parent::ilObject($a_id,$a_call_by_reference);
35  }
36 
40  function create($upload=false)
41  {
42  global $ilDB;
43 
45  if(!$upload)
46  $this->createMetaData();
47 
48  $this->createDataDirectory();
49 
50  $ilDB->manipulateF('
51  INSERT INTO sahs_lm (id, c_online, api_adapter, c_type, editable, seq_exp_mode,localization)
52  VALUES (%s,%s,%s,%s,%s,%s,%s)',
53  array('integer', 'text', 'text', 'text', 'integer','integer','text'),
54  array($this->getId(),'n','API', $this->getSubType(),(int)$this->getEditable(),
55  (int)$this->getSequencingExpertMode(), $this->getLocalization()
56  ));
57  }
58 
62  function read()
63  {
64  global $ilDB;
65 
66  parent::read();
67 
68  $lm_set = $ilDB->queryF('SELECT * FROM sahs_lm WHERE id = %s',
69  array('integer'),array($this->getId()));
70 
71  while($lm_rec = $ilDB->fetchAssoc($lm_set))
72  {
73  $this->setOnline(ilUtil::yn2tf($lm_rec["c_online"]));
74  $this->setAutoReview(ilUtil::yn2tf($lm_rec["auto_review"]));
75  $this->setAPIAdapterName($lm_rec["api_adapter"]);
76  $this->setDefaultLessonMode($lm_rec["default_lesson_mode"]);
77  $this->setAPIFunctionsPrefix($lm_rec["api_func_prefix"]);
78  $this->setCreditMode($lm_rec["credit"]);
79  $this->setSubType($lm_rec["c_type"]);
80  $this->setEditable($lm_rec["editable"]);
81  $this->setStyleSheetId($lm_rec["stylesheet"]);
82  $this->setMaxAttempt($lm_rec["max_attempt"]);
83  $this->setModuleVersion($lm_rec["module_version"]);
84  $this->setAssignedGlossary($lm_rec["glossary"]);
85  $this->setTries($lm_rec["question_tries"]);
86  $this->setLocalization($lm_rec["localization"]);
87  $this->setSession(ilUtil::yn2tf($lm_rec["unlimited_session"]));
88  $this->setNoMenu(ilUtil::yn2tf($lm_rec["no_menu"]));
89  $this->setHideNavig(ilUtil::yn2tf($lm_rec["hide_navig"]));
90  $this->setSequencing(ilUtil::yn2tf($lm_rec["sequencing"]));
91  $this->setInteractions(ilUtil::yn2tf($lm_rec["interactions"]));
92  $this->setObjectives(ilUtil::yn2tf($lm_rec["objectives"]));
93  $this->setComments(ilUtil::yn2tf($lm_rec["comments"]));
94  $this->setTime_from_lms(ilUtil::yn2tf($lm_rec["time_from_lms"]));
95  $this->setDebug(ilUtil::yn2tf($lm_rec["debug"]));
96  $this->setDebugPw($lm_rec["debugpw"]);
97  $this->setSequencingExpertMode($lm_rec["seq_exp_mode"]);
98  $this->setOpenMode($lm_rec["open_mode"]);
99  $this->setWidth($lm_rec["width"]);
100  $this->setHeight($lm_rec["height"]);
101  $this->setAutoContinue(ilUtil::yn2tf($lm_rec["auto_continue"]));
102  $this->setAuto_last_visited(ilUtil::yn2tf($lm_rec["auto_last_visited"]));
103  $this->setCheck_values(ilUtil::yn2tf($lm_rec["check_values"]));
104 
105  include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
106  if (ilObject::_lookupType($this->getStyleSheetId()) != "sty")
107  {
108  $this->setStyleSheetId(0);
109  }
110  }
111  }
112 
116  function _lookupOnline($a_id)
117  {
118  global $ilDB;
119 
120  $lm_set = $ilDB->queryF('SELECT c_online FROM sahs_lm WHERE id = %s',
121  array('integer'), array($a_id));
122  $lm_rec = $ilDB->fetchAssoc($lm_set);
123 
124  return ilUtil::yn2tf($lm_rec["c_online"]);
125  }
126 
132  function getAffectiveLocalization($a_id)
133  {
134  global $ilDB, $lng;
135 
136  $lm_set = $ilDB->queryF('SELECT localization FROM sahs_lm WHERE id = %s',
137  array('integer'), array($a_id));
138  $lm_rec = $ilDB->fetchAssoc($lm_set);
139  $inst_lang = $lng->getInstalledLanguages();
140  if ($lm_rec["localization"] != "" && in_array($lm_rec["localization"], $inst_lang))
141  {
142  return $lm_rec["localization"];
143  }
144  return $lng->getLangKey();
145  }
146 
152  function _lookupSubType($a_obj_id)
153  {
154  global $ilDB;
155 
156  $obj_set = $ilDB->queryF('SELECT c_type FROM sahs_lm WHERE id = %s',
157  array('integer'), array($a_obj_id));
158  $obj_rec = $ilDB->fetchAssoc($obj_set);
159 
160  return $obj_rec["c_type"];
161  }
162 
168  function setEditable($a_editable)
169  {
170  $this->editable = $a_editable;
171  }
172 
178  function getEditable()
179  {
180  return $this->editable;
181  }
182 
183 
189  function setTries($a_tries)
190  {
191  $this->tries = $a_tries;
192  }
193 
199  function getTries()
200  {
201  return $this->tries;
202  }
203 
209  function setLocalization($a_val)
210  {
211  $this->localization = $a_val;
212  }
213 
219  function getLocalization()
220  {
221  return $this->localization;
222  }
223 
224  static function _getTries($a_id)
225  {
226  global $ilDB;
227 
228  $lm_set = $ilDB->queryF('SELECT question_tries FROM sahs_lm WHERE id = %s',
229  array('integer'), array($a_id));
230  $lm_rec = $ilDB->fetchAssoc($lm_set);
231 
232  return $lm_rec['question_tries'];
233  }
240  function getDiskUsage()
241  {
242  require_once("./Modules/ScormAicc/classes/class.ilObjSAHSLearningModuleAccess.php");
244  }
245 
246 
252  {
253  $lm_data_dir = ilUtil::getWebspaceDir()."/lm_data";
254  ilUtil::makeDir($lm_data_dir);
256  }
257 
261  function getDataDirectory($mode = "filesystem")
262  {
263  $lm_data_dir = ilUtil::getWebspaceDir($mode)."/lm_data";
264  $lm_dir = $lm_data_dir."/lm_".$this->getId();
265 
266  return $lm_dir;
267  }
268 
272  function getAPIAdapterName()
273  {
274  return $this->api_adapter;
275  }
276 
280  function setAPIAdapterName($a_api)
281  {
282  $this->api_adapter = $a_api;
283  }
284 
289  {
290  return $this->api_func_prefix;
291  }
292 
296  function setAPIFunctionsPrefix($a_prefix)
297  {
298  $this->api_func_prefix = $a_prefix;
299  }
300 
304  function getCreditMode()
305  {
306  return $this->credit_mode;
307  }
308 
312  function setCreditMode($a_credit_mode)
313  {
314  $this->credit_mode = $a_credit_mode;
315  }
316 
320  function setDefaultLessonMode($a_lesson_mode)
321  {
322  $this->lesson_mode = $a_lesson_mode;
323  }
324 
329  {
330  return $this->lesson_mode;
331  }
335  function getStyleSheetId()
336  {
337  return $this->style_id;
338  }
339 
343  function setStyleSheetId($a_style_id)
344  {
345  $this->style_id = $a_style_id;
346  }
347 
348 
352  function setAutoReview($a_auto_review)
353  {
354  $this->auto_review = $a_auto_review;
355  }
359  function getAutoReview()
360  {
361  return $this->auto_review;
362  }
363 
364 
368  function getMaxAttempt()
369  {
370  return $this->max_attempt;
371  }
372 
373 
377  function setMaxAttempt($a_max_attempt)
378  {
379  $this->max_attempt = $a_max_attempt;
380  }
381 
385  function getModuleVersion()
386  {
387  return $this->module_version;
388  }
389 
394  {
395  return $this->assigned_glossary;
396  }
397 
401  function setAssignedGlossary($a_assigned_glossary)
402  {
403  $this->assigned_glossary = $a_assigned_glossary;
404  }
408  function setModuleVersion($a_module_version)
409  {
410  $this->module_version = $a_module_version;
411  }
412 
416  function getSession()
417  {
418  return $this->session;
419  }
420 
424  function setSession($a_session)
425  {
426  $this->session = $a_session;
427  }
428 
432  function getNoMenu()
433  {
434  return $this->no_menu;
435  }
436 
440  function setNoMenu($a_no_menu)
441  {
442  $this->no_menu = $a_no_menu;
443  }
444 
448  function getHideNavig()
449  {
450  return $this->hide_navig;
451  }
452 
456  function setHideNavig($a_hide_navig)
457  {
458  $this->hide_navig = $a_hide_navig;
459  }
460 
465  {
466  global $ilSetting;
467  $lm_set = new ilSetting("lm");
468  if ($lm_set->get("scormdebug_disable_cache") == "1") return true;
469  return false;
470  }
471 
475  function getDebugActivated()
476  {
477  global $ilSetting;
478  $lm_set = new ilSetting("lm");
479  if ($lm_set->get("scormdebug_global_activate") == "1") return true;
480  return false;
481  }
482 
486  function getSequencing()
487  {
488  return $this->sequencing;
489  }
490 
491  function setSequencing($a_sequencing)
492  {
493  $this->sequencing = $a_sequencing;
494  }
495 
499  function getInteractions()
500  {
501  return $this->interactions;
502  }
503 
504  function setInteractions($a_interactions)
505  {
506  $this->interactions = $a_interactions;
507  }
508 
512  function getObjectives()
513  {
514  return $this->objectives;
515  }
516 
517  function setObjectives($a_objectives)
518  {
519  $this->objectives = $a_objectives;
520  }
521 
525  function getComments()
526  {
527  return $this->comments;
528  }
529 
530  function setComments($a_comments)
531  {
532  $this->comments = $a_comments;
533  }
534 
538  function getTime_from_lms()
539  {
540  return $this->time_from_lms;
541  }
542 
543  function setTime_from_lms($a_time_from_lms)
544  {
545  $this->time_from_lms = $a_time_from_lms;
546  }
547 
551  function getCheck_values()
552  {
553  return $this->check_values;
554  }
555 
556  function setCheck_values($a_check_values)
557  {
558  $this->check_values = $a_check_values;
559  }
560 
564  function getDebug()
565  {
566  return $this->debug;
567  }
568 
572  function setDebug($a_debug)
573  {
574  $this->debug = $a_debug;
575  }
576 
580  function getDebugPw()
581  {
582  return $this->debug_pw;
583  }
584 
588  function setDebugPw($a_debug_pw)
589  {
590  $this->debug_pw = $a_debug_pw;
591  }
592 
596  function setAutoContinue($a_auto_continue)
597  {
598  $this->auto_continue = $a_auto_continue;
599  }
603  function getAutoContinue()
604  {
605  return $this->auto_continue;
606  }
607 
612  {
613  return $this->auto_last_visited;
614  }
615 
616  function setAuto_last_visited($a_auto_last_visited)
617  {
618  $this->auto_last_visited = $a_auto_last_visited;
619  }
620 
621 
627  function setSequencingExpertMode($a_val)
628  {
629  $this->seq_exp_mode = $a_val;
630  }
631 
638  {
639  return $this->seq_exp_mode;
640  }
641 
642 
653  function getOpenMode()
654  {
655  return $this->open_mode;
656  }
657  function setOpenMode($a_open_mode)
658  {
659  $this->open_mode = $a_open_mode;
660  }
661 
665  function getWidth()
666  {
667  return $this->width;
668  }
669  function setWidth($a_width)
670  {
671  $this->width = $a_width;
672  }
673 
677  function getHeight()
678  {
679  return $this->height;
680  }
681  function setHeight($a_height)
682  {
683  $this->height = $a_height;
684  }
685 
686 
690 /*
691  function updateMetaData()
692  {
693  $this->meta_data->update();
694  if ($this->meta_data->section != "General")
695  {
696  $meta = $this->meta_data->getElement("Title", "General");
697  $this->meta_data->setTitle($meta[0]["value"]);
698  $meta = $this->meta_data->getElement("Description", "General");
699  $this->meta_data->setDescription($meta[0]["value"]);
700  }
701  else
702  {
703  $this->setTitle($this->meta_data->getTitle());
704  $this->setDescription($this->meta_data->getDescription());
705  }
706  parent::update();
707 
708  }
709 */
710 
711 
718  function update()
719  {
720  global $ilDB;
721 
722  $this->updateMetaData();
723  parent::update();
724 
725  $statement = $ilDB->manipulateF('
726  UPDATE sahs_lm
727  SET c_online = %s,
728  api_adapter = %s,
729  api_func_prefix = %s,
730  auto_review = %s,
731  default_lesson_mode = %s,
732  c_type = %s,
733  stylesheet = %s,
734  editable = %s,
735  max_attempt = %s,
736  module_version = %s,
737  credit = %s,
738  glossary = %s,
739  question_tries = %s,
740  unlimited_session = %s,
741  no_menu = %s,
742  hide_navig = %s,
743  sequencing = %s,
744  interactions = %s,
745  objectives = %s,
746  comments = %s,
747  time_from_lms = %s,
748  debug = %s,
749  localization = %s,
750  seq_exp_mode = %s,
751  debugpw = %s,
752  open_mode = %s,
753  width = %s,
754  height = %s,
755  auto_continue = %s,
756  auto_last_visited = %s,
757  check_values = %s
758  WHERE id = %s',
759  array( 'text',
760  'text',
761  'text',
762  'text',
763  'text',
764  'text',
765  'integer',
766  'integer',
767  'integer',
768  'integer',
769  'text',
770  'integer',
771  'integer',
772  'text',
773  'text',
774  'text',
775  'text',
776  'text',
777  'text',
778  'text',
779  'text',
780  'text',
781  'text',
782  'integer',
783  'text',
784  'integer',
785  'integer',
786  'integer',
787  'text',
788  'text',
789  'text',
790  'integer'
791  ),
792  array( ilUtil::tf2yn($this->getOnline()),
793  $this->getAPIAdapterName(),
794  $this->getAPIFunctionsPrefix(),
795  ilUtil::tf2yn($this->getAutoReview()),
796  $this->getDefaultLessonMode(),
797  $this->getSubType(),
798  $this->getStyleSheetId(),
799  $this->getEditable(),
800  $this->getMaxAttempt(),
801  $this->getModuleVersion(),
802  $this->getCreditMode(),
803  $this->getAssignedGlossary(),
804  $this->getTries(),
805  ilUtil::tf2yn($this->getSession()),
806  ilUtil::tf2yn($this->getNoMenu()),
807  ilUtil::tf2yn($this->getHideNavig()),
808  ilUtil::tf2yn($this->getSequencing()),
809  ilUtil::tf2yn($this->getInteractions()),
810  ilUtil::tf2yn($this->getObjectives()),
811  ilUtil::tf2yn($this->getComments()),
813  ilUtil::tf2yn($this->getDebug()),
814  $this->getLocalization(),
815  $this->getSequencingExpertMode(),
816  $this->getDebugPw(),
817  $this->getOpenMode(),
818  $this->getWidth(),
819  $this->getHeight(),
820  ilUtil::tf2yn($this->getAutoContinue()),
822  ilUtil::tf2yn($this->getCheck_values()),
823  $this->getId())
824  );
825 
826  return true;
827  }
828 
835  static function getScormModulesForGlossary($a_glo_id)
836  {
837  global $ilDB;
838 
839  $set = $ilDB->query("SELECT DISTINCT id FROM sahs_lm WHERE ".
840  " glossary = ".$ilDB->quote($a_glo_id, "integer"));
841  $sms = array();
842  while ($rec = $ilDB->fetchAssoc($set))
843  {
844  if (ilObject::_hasUntrashedReference($rec["id"]))
845  {
846  $sms[] = $rec["id"];
847  }
848  }
849  return $sms;
850  }
851 
855  function setOnline($a_online)
856  {
857  $this->online = $a_online;
858  }
859 
863  function getOnline()
864  {
865  return $this->online;
866  }
867 
871  function setSubType($a_sub_type)
872  {
873  $this->sub_type = $a_sub_type;
874  }
875 
879  function getSubType()
880  {
881  return $this->sub_type;
882  }
883 
895  function delete()
896  {
897  global $ilDB, $ilLog;
898 
899  // always call parent delete function first!!
900  if (!parent::delete())
901  {
902  return false;
903  }
904 
905  // delete meta data of scorm content object
906 /*
907  $nested = new ilNestedSetXML();
908  $nested->init($this->getId(), $this->getType());
909  $nested->deleteAllDBData();
910 */
911  $this->deleteMetaData();
912 
913  // delete data directory
915 
916  // delete scorm learning module record
917  $ilDB->manipulateF('DELETE FROM sahs_lm WHERE id = %s',
918  array('integer'), array($this->getId()));
919 
920  $ilLog->write("SAHS Delete(SAHSLM), Subtype: ".$this->getSubType());
921 
922  if ($this->getSubType() == "scorm")
923  {
924  // remove all scorm objects and scorm tree
925  include_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMTree.php");
926  include_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMObject.php");
927  $sc_tree = new ilSCORMTree($this->getId());
928  $r_id = $sc_tree->readRootId();
929  if ($r_id > 0)
930  {
931  $items = $sc_tree->getSubTree($sc_tree->getNodeData($r_id));
932  foreach($items as $item)
933  {
934  $sc_object =& ilSCORMObject::_getInstance($item["obj_id"], $this->getId());
935  if (is_object($sc_object))
936  {
937  $sc_object->delete();
938  }
939  }
940  $sc_tree->removeTree($sc_tree->getTreeId());
941  }
942  }
943 
944  if ($this->getSubType() != "scorm")
945  {
946  // delete aicc data
947  $res = $ilDB->queryF('
948  SELECT aicc_object.obj_id FROM aicc_object, aicc_units
949  WHERE aicc_object.obj_id = aicc_units.obj_id
950  AND aicc_object.slm_id = %s',
951  array('integer'), array($this->getId()));
952 
953  while($row = $ilDB->fetchAssoc($res))
954  {
955  $obj_id = $row['obj_id'];
956  $ilDB->manipulateF('
957  DELETE FROM aicc_units WHERE obj_id = %s',
958  array('integer'), array($obj_id));
959  }
960 
961  $res = $ilDB->queryF('
962  SELECT aicc_object.obj_id FROM aicc_object, aicc_course
963  WHERE aicc_object.obj_id = aicc_course.obj_id
964  AND aicc_object.slm_id = %s',
965  array('integer'), array($this->getId()));
966 
967  while($row = $ilDB->fetchAssoc($res))
968  {
969  $obj_id = $row['obj_id'];
970  $ilDB->manipulateF('
971  DELETE FROM aicc_course WHERE obj_id = %s',
972  array('integer'), array($obj_id));
973  }
974 
975  $ilDB->manipulateF('
976  DELETE FROM aicc_object WHERE slm_id = %s',
977  array('integer'), array($this->getId()));
978  }
979 
980  $q_log = "DELETE FROM scorm_tracking WHERE obj_id = ".$ilDB->quote($this->getId());
981  $ilLog->write("SAHS Delete(SAHSLM): ".$q_log);
982 
983  $ilDB->manipulateF('DELETE FROM scorm_tracking WHERE obj_id = %s',
984  array('integer'), array($this->getId()));
985 
986  // always call parent delete function at the end!!
987  return true;
988  }
989 
1000  function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
1001  {
1002  global $tree;
1003 
1004  switch ($a_event)
1005  {
1006  case "link":
1007 
1008  //var_dump("<pre>",$a_params,"</pre>");
1009  //echo "SCORMLearningModule ".$this->getRefId()." triggered by link event. Objects linked into target object ref_id: ".$a_ref_id;
1010  //exit;
1011  break;
1012 
1013  case "cut":
1014 
1015  //echo "SCORMLearningModule ".$this->getRefId()." triggered by cut event. Objects are removed from target object ref_id: ".$a_ref_id;
1016  //exit;
1017  break;
1018 
1019  case "copy":
1020 
1021  //var_dump("<pre>",$a_params,"</pre>");
1022  //echo "SCORMLearningModule ".$this->getRefId()." triggered by copy event. Objects are copied into target object ref_id: ".$a_ref_id;
1023  //exit;
1024  break;
1025 
1026  case "paste":
1027 
1028  //echo "SCORMLearningModule ".$this->getRefId()." triggered by paste (cut) event. Objects are pasted into target object ref_id: ".$a_ref_id;
1029  //exit;
1030  break;
1031 
1032  case "new":
1033 
1034  //echo "SCORMLearningModule ".$this->getRefId()." triggered by paste (new) event. Objects are applied to target object ref_id: ".$a_ref_id;
1035  //exit;
1036  break;
1037  }
1038 
1039  // At the beginning of the recursive process it avoids second call of the notify function with the same parameter
1040  if ($a_node_id==$_GET["ref_id"])
1041  {
1042  $parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id);
1043  $parent_type = $parent_obj->getType();
1044  if($parent_type == $this->getType())
1045  {
1046  $a_node_id = (int) $tree->getParentId($a_node_id);
1047  }
1048  }
1049 
1050  parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
1051  }
1052 
1058  public function getPointsInPercent()
1059  {
1060  global $ilUser;
1061  if (strcmp($this->getSubType(), "scorm2004") == 0)
1062  {
1064  if (!is_null($res))
1065  {
1066  return $res * 100.0;
1067  }
1068  else
1069  {
1070  return $res;
1071  }
1072  }
1073  else
1074  {
1075  return null;
1076  }
1077  }
1078 
1089  public function getMaxPoints()
1090  {
1091  global $ilUser;
1092 
1093  if(strcmp($this->getSubType(), 'scorm2004') == 0)
1094  {
1095  $res = ilObjSCORM2004LearningModule::_getMaxScoreForUser($this->getId(), $ilUser->getId());
1096  return $res;
1097  }
1098  else
1099  {
1100  return null;
1101  }
1102  }
1103 
1113  function populateByDirectoy($a_dir, $a_filename = "")
1114  {
1115  /*preg_match("/.*sahs_([0-9]*)\.zip/", $a_filename, $match);
1116  if (is_dir($a_dir."/sahs_".$match[1]))
1117  {
1118  $a_dir = $a_dir."/sahs_".$match[1];
1119  }*/
1120  ilUtil::rCopy($a_dir, $this->getDataDirectory());
1122  }
1123 
1124 
1131  public function cloneObject($a_target_id,$a_copy_id = 0)
1132  {
1133  global $ilDB, $ilUser, $ilias;
1134 
1135  $new_obj = parent::cloneObject($a_target_id,$a_copy_id);
1136  $this->cloneMetaData($new_obj);
1137 
1138  // copy properties
1139  $new_obj->setTitle($this->getTitle());
1140  $new_obj->setDescription($this->getDescription());
1141  $new_obj->setSubType($this->getSubType());
1142  $new_obj->setAPIAdapterName($this->getAPIAdapterName());
1143  $new_obj->setAPIFunctionsPrefix($this->getAPIFunctionsPrefix());
1144  $new_obj->setAutoReview($this->getAutoReview());
1145  $new_obj->setDefaultLessonMode($this->getDefaultLessonMode());
1146  $new_obj->setEditable($this->getEditable());
1147  $new_obj->setMaxAttempt($this->getMaxAttempt());
1148 // $new_obj->getModuleVersion($this->getModuleVersion()); ??
1149  $new_obj->setModuleVersion(1);
1150  $new_obj->setCreditMode($this->getCreditMode());
1151  $new_obj->setAssignedGlossary($this->getAssignedGlossary());
1152  $new_obj->setTries($this->getTries());
1153  $new_obj->setSession($this->getSession());
1154  $new_obj->setNoMenu($this->getNoMenu());
1155  $new_obj->setHideNavig($this->getHideNavig());
1156  $new_obj->setSequencing($this->getSequencing());
1157  $new_obj->setInteractions($this->getInteractions());
1158  $new_obj->setObjectives($this->getObjectives());
1159  $new_obj->setComments($this->getComments());
1160  $new_obj->setTime_from_lms($this->getTime_from_lms());
1161  $new_obj->setDebug($this->getDebug());
1162  $new_obj->setLocalization($this->getLocalization());
1163  $new_obj->setSequencingExpertMode($this->getSequencingExpertMode());
1164  $new_obj->setDebugPw($this->getDebugPw());
1165  $new_obj->setOpenMode($this->getOpenMode());
1166  $new_obj->setWidth($this->getWidth());
1167  $new_obj->setHeight($this->getHeight());
1168  $new_obj->setAutoContinue($this->getAutoContinue());
1169  $new_obj->setAuto_last_visited($this->getAuto_last_visited());
1170  $new_obj->setCheck_values($this->getCheck_values());
1171  $new_obj->update();
1172 
1173 
1174  // set/copy stylesheet
1175 /* include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
1176  $style_id = $this->getStyleSheetId();
1177  if ($style_id > 0 && !ilObjStyleSheet::_lookupStandard($style_id))
1178  {
1179  $style_obj = $ilias->obj_factory->getInstanceByObjId($style_id);
1180  $new_id = $style_obj->ilClone();
1181  $new_obj->setStyleSheetId($new_id);
1182  $new_obj->update();
1183  }*/
1184 
1185  // up to this point $new_obj is of type ilobjsahslearning module
1186 
1187  // create instance of correct subtype and call forward it to
1188  // cloneIntoNewObject method
1189  switch ($this->getSubType())
1190  {
1191  case "scorm":
1192  include_once("./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php");
1193  $source_obj = new ilObjSCORMLearningModule($this->getRefId());
1194  $new_obj = new ilObjSCORMLearningModule($new_obj->getRefId());
1195  break;
1196 
1197  case "scorm2004":
1198  include_once("./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php");
1199  $source_obj = new ilObjSCORM2004LearningModule($this->getRefId());
1200  $new_obj = new ilObjSCORM2004LearningModule($new_obj->getRefId());
1201  break;
1202 
1203  case "aicc":
1204  include_once("./Modules/ScormAicc/classes/class.ilObjAICCLearningModule.php");
1205  $source_obj = new ilObjAICCLearningModule($this->getRefId());
1206  $new_obj = new ilObjAICCLearningModule($new_obj->getRefId());
1207  break;
1208 
1209  case "hacp":
1210  include_once("./Modules/ScormAicc/classes/class.ilObjHACPLearningModule.php");
1211  $source_obj = new ilObjHACPLearningModule($this->getRefId());
1212  $new_obj = new ilObjHACPLearningModule($new_obj->getRefId());
1213  break;
1214 
1215  }
1216 
1217  // copy data directory
1218  $new_obj->populateByDirectoy($source_obj->getDataDirectory());
1219 
1220  // copy authored content ...
1221  if ($new_obj->getEditable())
1222  {
1223  $source_obj->copyAuthoredContent($new_obj);
1224  }
1225  else
1226  {
1227  // ... or read manifest file
1228  $new_obj->readObject();
1229  }
1230 
1231  return $new_obj;
1232  }
1233 
1234 }
1235 ?>