ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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
5require_once "./Services/Object/classes/class.ilObject.php";
6require_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
44 parent::create();
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->setAutoReviewChar($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->setFourth_edition(ilUtil::yn2tf($lm_rec["fourth_edition"]));
91 $this->setSequencing(ilUtil::yn2tf($lm_rec["sequencing"]));
92 $this->setInteractions(ilUtil::yn2tf($lm_rec["interactions"]));
93 $this->setObjectives(ilUtil::yn2tf($lm_rec["objectives"]));
94 $this->setComments(ilUtil::yn2tf($lm_rec["comments"]));
95 $this->setTime_from_lms(ilUtil::yn2tf($lm_rec["time_from_lms"]));
96 $this->setDebug(ilUtil::yn2tf($lm_rec["debug"]));
97 $this->setDebugPw($lm_rec["debugpw"]);
98 $this->setSequencingExpertMode($lm_rec["seq_exp_mode"]);
99 $this->setOpenMode($lm_rec["open_mode"]);
100 $this->setWidth($lm_rec["width"]);
101 $this->setHeight($lm_rec["height"]);
102 $this->setAutoContinue(ilUtil::yn2tf($lm_rec["auto_continue"]));
103 $this->setAuto_last_visited(ilUtil::yn2tf($lm_rec["auto_last_visited"]));
104 $this->setCheck_values(ilUtil::yn2tf($lm_rec["check_values"]));
105 $this->setOfflineMode(ilUtil::yn2tf($lm_rec["offline_mode"]));
106 $this->setAutoSuspend(ilUtil::yn2tf($lm_rec["auto_suspend"]));
107 $this->setIe_compatibility(ilUtil::yn2tf($lm_rec["ie_compatibility"]));
108 $this->setIe_force_render(ilUtil::yn2tf($lm_rec["ie_force_render"]));
109
110 include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
111 if (ilObject::_lookupType($this->getStyleSheetId()) != "sty")
112 {
113 $this->setStyleSheetId(0);
114 }
115 }
116 }
117
121 function _lookupOnline($a_id)
122 {
123 global $ilDB;
124
125 $lm_set = $ilDB->queryF('SELECT c_online FROM sahs_lm WHERE id = %s',
126 array('integer'), array($a_id));
127 $lm_rec = $ilDB->fetchAssoc($lm_set);
128
129 return ilUtil::yn2tf($lm_rec["c_online"]);
130 }
131
138 {
139 global $ilDB, $lng;
140
141 $lm_set = $ilDB->queryF('SELECT localization FROM sahs_lm WHERE id = %s',
142 array('integer'), array($a_id));
143 $lm_rec = $ilDB->fetchAssoc($lm_set);
144 $inst_lang = $lng->getInstalledLanguages();
145 if ($lm_rec["localization"] != "" && in_array($lm_rec["localization"], $inst_lang))
146 {
147 return $lm_rec["localization"];
148 }
149 return $lng->getLangKey();
150 }
151
157 function _lookupSubType($a_obj_id)
158 {
159 global $ilDB;
160
161 $obj_set = $ilDB->queryF('SELECT c_type FROM sahs_lm WHERE id = %s',
162 array('integer'), array($a_obj_id));
163 $obj_rec = $ilDB->fetchAssoc($obj_set);
164
165 return $obj_rec["c_type"];
166 }
167
173 function setEditable($a_editable)
174 {
175 $this->editable = $a_editable;
176 }
177
183 function getEditable()
184 {
185 return $this->editable;
186 }
187
188
194 function setTries($a_tries)
195 {
196 $this->tries = $a_tries;
197 }
198
204 function getTries()
205 {
206 return $this->tries;
207 }
208
214 function setLocalization($a_val)
215 {
216 $this->localization = $a_val;
217 }
218
225 {
226 return $this->localization;
227 }
228
229 static function _getTries($a_id)
230 {
231 global $ilDB;
232
233 $lm_set = $ilDB->queryF('SELECT question_tries FROM sahs_lm WHERE id = %s',
234 array('integer'), array($a_id));
235 $lm_rec = $ilDB->fetchAssoc($lm_set);
236
237 return $lm_rec['question_tries'];
238 }
245 function getDiskUsage()
246 {
247 require_once("./Modules/ScormAicc/classes/class.ilObjSAHSLearningModuleAccess.php");
249 }
250
251
257 {
258 $lm_data_dir = ilUtil::getWebspaceDir()."/lm_data";
259 ilUtil::makeDir($lm_data_dir);
261 }
262
266 function getDataDirectory($mode = "filesystem")
267 {
268 $lm_data_dir = ilUtil::getWebspaceDir($mode)."/lm_data";
269 $lm_dir = $lm_data_dir."/lm_".$this->getId();
270
271 return $lm_dir;
272 }
273
278 {
279 return $this->api_adapter;
280 }
281
285 function setAPIAdapterName($a_api)
286 {
287 $this->api_adapter = $a_api;
288 }
289
294 {
295 return $this->api_func_prefix;
296 }
297
301 function setAPIFunctionsPrefix($a_prefix)
302 {
303 $this->api_func_prefix = $a_prefix;
304 }
305
309 function getCreditMode()
310 {
311 return $this->credit_mode;
312 }
313
317 function setCreditMode($a_credit_mode)
318 {
319 $this->credit_mode = $a_credit_mode;
320 }
321
325 function setDefaultLessonMode($a_lesson_mode)
326 {
327 $this->lesson_mode = $a_lesson_mode;
328 }
329
334 {
335 return $this->lesson_mode;
336 }
341 {
342 return $this->style_id;
343 }
344
348 function setStyleSheetId($a_style_id)
349 {
350 $this->style_id = $a_style_id;
351 }
352
353
357 function setAutoReview($a_auto_review)
358 {
359 $this->auto_review = ilUtil::tf2yn($a_auto_review);
360 }
364 function getAutoReview()
365 {
366 return ilUtil::yn2tf($this->auto_review);
367 }
368
372 function setAutoReviewChar($a_auto_review)
373 {
374 $this->auto_review = $a_auto_review;
375 }
380 {
381 return $this->auto_review;
382 }
383
387 function getMaxAttempt()
388 {
389 return $this->max_attempt;
390 }
391
392
396 function setMaxAttempt($a_max_attempt)
397 {
398 $this->max_attempt = $a_max_attempt;
399 }
400
405 {
406 return $this->module_version;
407 }
408
413 {
414 return $this->assigned_glossary;
415 }
416
420 function setAssignedGlossary($a_assigned_glossary)
421 {
422 $this->assigned_glossary = $a_assigned_glossary;
423 }
427 function setModuleVersion($a_module_version)
428 {
429 $this->module_version = $a_module_version;
430 }
431
435 function getSession()
436 {
437 return $this->session;
438 }
439
443 function setSession($a_session)
444 {
445 $this->session = $a_session;
446 }
447
451 function getNoMenu()
452 {
453 return $this->no_menu;
454 }
455
459 function setNoMenu($a_no_menu)
460 {
461 $this->no_menu = $a_no_menu;
462 }
463
467 function getHideNavig()
468 {
469 return $this->hide_navig;
470 }
471
475 function setHideNavig($a_hide_navig)
476 {
477 $this->hide_navig = $a_hide_navig;
478 }
479
484 {
485 global $ilSetting;
486 $lm_set = new ilSetting("lm");
487 if ($lm_set->get("scormdebug_disable_cache") == "1") return true;
488 return false;
489 }
490
495 {
496 global $ilSetting;
497 $lm_set = new ilSetting("lm");
498 if ($lm_set->get("scorm_without_session") == "1") return true;
499 return false;
500 }
501
506 {
507 global $ilSetting;
508 $lm_set = new ilSetting("lm");
509 if ($lm_set->get("scormdebug_global_activate") == "1") return true;
510 return false;
511 }
512
517 {
518 return $this->ie_compatibility;
519 }
520
521 function setIe_compatibility($a_ie_compatibility)
522 {
523 $this->ie_compatibility = $a_ie_compatibility;
524 }
525
530 {
531 return $this->ie_force_render;
532 }
533
534 function setIe_force_render($a_ie_force_render)
535 {
536 $this->ie_force_render = $a_ie_force_render;
537 }
538
543 {
544 return $this->fourth_edition;
545 }
546
547 function setFourth_edition($a_fourth_edition)
548 {
549 $this->fourth_edition = $a_fourth_edition;
550 }
551
555 function getSequencing()
556 {
557 return $this->sequencing;
558 }
559
560 function setSequencing($a_sequencing)
561 {
562 $this->sequencing = $a_sequencing;
563 }
564
569 {
570 return $this->interactions;
571 }
572
573 function setInteractions($a_interactions)
574 {
575 $this->interactions = $a_interactions;
576 }
577
581 function getObjectives()
582 {
583 return $this->objectives;
584 }
585
586 function setObjectives($a_objectives)
587 {
588 $this->objectives = $a_objectives;
589 }
590
594 function getComments()
595 {
596 return $this->comments;
597 }
598
599 function setComments($a_comments)
600 {
601 $this->comments = $a_comments;
602 }
603
608 {
609 return $this->time_from_lms;
610 }
611
612 function setTime_from_lms($a_time_from_lms)
613 {
614 $this->time_from_lms = $a_time_from_lms;
615 }
616
621 {
622 return $this->check_values;
623 }
624
625 function setCheck_values($a_check_values)
626 {
627 $this->check_values = $a_check_values;
628 }
629
633 function getOfflineMode()
634 {
635 return $this->offline_mode;
636 }
637
638 function setOfflineMode($a_offline_mode)
639 {
640 $this->offline_mode = $a_offline_mode;
641 }
642
643
647 function getDebug()
648 {
649 return $this->debug;
650 }
651
655 function setDebug($a_debug)
656 {
657 $this->debug = $a_debug;
658 }
659
663 function getDebugPw()
664 {
665 return $this->debug_pw;
666 }
667
671 function setDebugPw($a_debug_pw)
672 {
673 $this->debug_pw = $a_debug_pw;
674 }
675
679 function setAutoContinue($a_auto_continue)
680 {
681 $this->auto_continue = $a_auto_continue;
682 }
687 {
688 return $this->auto_continue;
689 }
690
695 {
696 return $this->auto_last_visited;
697 }
698
699 function setAuto_last_visited($a_auto_last_visited)
700 {
701 $this->auto_last_visited = $a_auto_last_visited;
702 }
703
704
710 function setSequencingExpertMode($a_val)
711 {
712 $this->seq_exp_mode = $a_val;
713 }
714
721 {
722 return $this->seq_exp_mode;
723 }
724
728 function setAutoSuspend($a_auto_suspend)
729 {
730 $this->auto_suspend = $a_auto_suspend;
731 }
735 function getAutoSuspend()
736 {
737 return $this->auto_suspend;
738 }
739
740
751 function getOpenMode()
752 {
753 return $this->open_mode;
754 }
755 function setOpenMode($a_open_mode)
756 {
757 $this->open_mode = $a_open_mode;
758 }
759
763 function getWidth()
764 {
765 return $this->width;
766 }
767 function setWidth($a_width)
768 {
769 $this->width = $a_width;
770 }
771
775 function getHeight()
776 {
777 return $this->height;
778 }
779 function setHeight($a_height)
780 {
781 $this->height = $a_height;
782 }
783
784
788/*
789 function updateMetaData()
790 {
791 $this->meta_data->update();
792 if ($this->meta_data->section != "General")
793 {
794 $meta = $this->meta_data->getElement("Title", "General");
795 $this->meta_data->setTitle($meta[0]["value"]);
796 $meta = $this->meta_data->getElement("Description", "General");
797 $this->meta_data->setDescription($meta[0]["value"]);
798 }
799 else
800 {
801 $this->setTitle($this->meta_data->getTitle());
802 $this->setDescription($this->meta_data->getDescription());
803 }
804 parent::update();
805
806 }
807*/
808
809
816 function update()
817 {
818 global $ilDB;
819
820 $this->updateMetaData();
821 parent::update();
822
823 $statement = $ilDB->manipulateF('
824 UPDATE sahs_lm
825 SET c_online = %s,
826 api_adapter = %s,
827 api_func_prefix = %s,
828 auto_review = %s,
829 default_lesson_mode = %s,
830 c_type = %s,
831 stylesheet = %s,
832 editable = %s,
833 max_attempt = %s,
834 module_version = %s,
835 credit = %s,
836 glossary = %s,
837 question_tries = %s,
838 unlimited_session = %s,
839 no_menu = %s,
840 hide_navig = %s,
841 fourth_edition =%s,
842 sequencing = %s,
843 interactions = %s,
844 objectives = %s,
845 comments = %s,
846 time_from_lms = %s,
847 debug = %s,
848 localization = %s,
849 seq_exp_mode = %s,
850 debugpw = %s,
851 open_mode = %s,
852 width = %s,
853 height = %s,
854 auto_continue = %s,
855 auto_last_visited = %s,
856 check_values = %s,
857 offline_mode = %s,
858 auto_suspend = %s,
859 ie_compatibility = %s,
860 ie_force_render = %s
861 WHERE id = %s',
862 array( 'text',
863 'text',
864 'text',
865 'text',
866 'text',
867 'text',
868 'integer',
869 'integer',
870 'integer',
871 'integer',
872 'text',
873 'integer',
874 'integer',
875 'text',
876 'text',
877 'text',
878 'text',
879 'text',
880 'text',
881 'text',
882 'text',
883 'text',
884 'text',
885 'text',
886 'integer',
887 'text',
888 'integer',
889 'integer',
890 'integer',
891 'text',
892 'text',
893 'text',
894 'text',
895 'text',
896 'text',
897 'text',
898 'integer'
899 ),
900 array( ilUtil::tf2yn($this->getOnline()),
901 $this->getAPIAdapterName(),
902 $this->getAPIFunctionsPrefix(),
903 $this->getAutoReviewChar(),
904 $this->getDefaultLessonMode(),
905 $this->getSubType(),
906 $this->getStyleSheetId(),
907 $this->getEditable(),
908 $this->getMaxAttempt(),
909 $this->getModuleVersion(),
910 $this->getCreditMode(),
911 $this->getAssignedGlossary(),
912 $this->getTries(),
913 ilUtil::tf2yn($this->getSession()),
914 ilUtil::tf2yn($this->getNoMenu()),
915 ilUtil::tf2yn($this->getHideNavig()),
916 ilUtil::tf2yn($this->getFourth_edition()),
920 ilUtil::tf2yn($this->getComments()),
922 ilUtil::tf2yn($this->getDebug()),
923 $this->getLocalization(),
925 $this->getDebugPw(),
926 $this->getOpenMode(),
927 $this->getWidth(),
928 $this->getHeight(),
936 $this->getId())
937 );
938
939 return true;
940 }
941
948 static function getScormModulesForGlossary($a_glo_id)
949 {
950 global $ilDB;
951
952 $set = $ilDB->query("SELECT DISTINCT id FROM sahs_lm WHERE ".
953 " glossary = ".$ilDB->quote($a_glo_id, "integer"));
954 $sms = array();
955 while ($rec = $ilDB->fetchAssoc($set))
956 {
957 if (ilObject::_hasUntrashedReference($rec["id"]))
958 {
959 $sms[] = $rec["id"];
960 }
961 }
962 return $sms;
963 }
964
971 static function lookupAssignedGlossary($a_slm_id)
972 {
973 global $ilDB;
974
975 $set = $ilDB->query("SELECT DISTINCT glossary FROM sahs_lm WHERE ".
976 " id = ".$ilDB->quote($a_slm_id, "integer"));
977 $rec = $ilDB->fetchAssoc($set);
978 $glo_id = $rec["glossary"];
979 if (ilObject::_lookupType($glo_id) == "glo")
980 {
981 return $glo_id;
982 }
983 return 0;
984 }
985
989 function setOnline($a_online)
990 {
991 $this->online = $a_online;
992 }
993
997 function getOnline()
998 {
999 return $this->online;
1000 }
1001
1005 function setSubType($a_sub_type)
1006 {
1007 $this->sub_type = $a_sub_type;
1008 }
1009
1013 function getSubType()
1014 {
1015 return $this->sub_type;
1016 }
1017
1029 function delete()
1030 {
1031 global $ilDB, $ilLog;
1032
1033 // always call parent delete function first!!
1034 if (!parent::delete())
1035 {
1036 return false;
1037 }
1038
1039 // delete meta data of scorm content object
1040/*
1041 $nested = new ilNestedSetXML();
1042 $nested->init($this->getId(), $this->getType());
1043 $nested->deleteAllDBData();
1044*/
1045 $this->deleteMetaData();
1046
1047 // delete data directory
1049
1050 // delete scorm learning module record
1051 $ilDB->manipulateF('DELETE FROM sahs_lm WHERE id = %s',
1052 array('integer'), array($this->getId()));
1053
1054 $ilLog->write("SAHS Delete(SAHSLM), Subtype: ".$this->getSubType());
1055
1056 if ($this->getSubType() == "scorm")
1057 {
1058 // remove all scorm objects and scorm tree
1059 include_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMTree.php");
1060 include_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMObject.php");
1061 $sc_tree = new ilSCORMTree($this->getId());
1062 $r_id = $sc_tree->readRootId();
1063 if ($r_id > 0)
1064 {
1065 $items = $sc_tree->getSubTree($sc_tree->getNodeData($r_id));
1066 foreach($items as $item)
1067 {
1068 $sc_object =& ilSCORMObject::_getInstance($item["obj_id"], $this->getId());
1069 if (is_object($sc_object))
1070 {
1071 $sc_object->delete();
1072 }
1073 }
1074 $sc_tree->removeTree($sc_tree->getTreeId());
1075 }
1076 }
1077
1078 if ($this->getSubType() != "scorm")
1079 {
1080 // delete aicc data
1081 $res = $ilDB->queryF('
1082 SELECT aicc_object.obj_id FROM aicc_object, aicc_units
1083 WHERE aicc_object.obj_id = aicc_units.obj_id
1084 AND aicc_object.slm_id = %s',
1085 array('integer'), array($this->getId()));
1086
1087 while($row = $ilDB->fetchAssoc($res))
1088 {
1089 $obj_id = $row['obj_id'];
1090 $ilDB->manipulateF('
1091 DELETE FROM aicc_units WHERE obj_id = %s',
1092 array('integer'), array($obj_id));
1093 }
1094
1095 $res = $ilDB->queryF('
1096 SELECT aicc_object.obj_id FROM aicc_object, aicc_course
1097 WHERE aicc_object.obj_id = aicc_course.obj_id
1098 AND aicc_object.slm_id = %s',
1099 array('integer'), array($this->getId()));
1100
1101 while($row = $ilDB->fetchAssoc($res))
1102 {
1103 $obj_id = $row['obj_id'];
1104 $ilDB->manipulateF('
1105 DELETE FROM aicc_course WHERE obj_id = %s',
1106 array('integer'), array($obj_id));
1107 }
1108
1109 $ilDB->manipulateF('
1110 DELETE FROM aicc_object WHERE slm_id = %s',
1111 array('integer'), array($this->getId()));
1112 }
1113
1114 $q_log = "DELETE FROM scorm_tracking WHERE obj_id = ".$ilDB->quote($this->getId());
1115 $ilLog->write("SAHS Delete(SAHSLM): ".$q_log);
1116
1117 $ilDB->manipulateF('DELETE FROM scorm_tracking WHERE obj_id = %s',
1118 array('integer'), array($this->getId()));
1119
1120 $q_log = "DELETE FROM sahs_user WHERE obj_id = ".$ilDB->quote($this->getId());
1121 $ilLog->write("SAHS Delete(SAHSLM): ".$q_log);
1122
1123 $ilDB->manipulateF('DELETE FROM sahs_user WHERE obj_id = %s',
1124 array('integer'), array($this->getId()));
1125
1126 // always call parent delete function at the end!!
1127 return true;
1128 }
1129
1140 function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
1141 {
1142 global $tree;
1143
1144 switch ($a_event)
1145 {
1146 case "link":
1147
1148 //var_dump("<pre>",$a_params,"</pre>");
1149 //echo "SCORMLearningModule ".$this->getRefId()." triggered by link event. Objects linked into target object ref_id: ".$a_ref_id;
1150 //exit;
1151 break;
1152
1153 case "cut":
1154
1155 //echo "SCORMLearningModule ".$this->getRefId()." triggered by cut event. Objects are removed from target object ref_id: ".$a_ref_id;
1156 //exit;
1157 break;
1158
1159 case "copy":
1160
1161 //var_dump("<pre>",$a_params,"</pre>");
1162 //echo "SCORMLearningModule ".$this->getRefId()." triggered by copy event. Objects are copied into target object ref_id: ".$a_ref_id;
1163 //exit;
1164 break;
1165
1166 case "paste":
1167
1168 //echo "SCORMLearningModule ".$this->getRefId()." triggered by paste (cut) event. Objects are pasted into target object ref_id: ".$a_ref_id;
1169 //exit;
1170 break;
1171
1172 case "new":
1173
1174 //echo "SCORMLearningModule ".$this->getRefId()." triggered by paste (new) event. Objects are applied to target object ref_id: ".$a_ref_id;
1175 //exit;
1176 break;
1177 }
1178
1179 // At the beginning of the recursive process it avoids second call of the notify function with the same parameter
1180 if ($a_node_id==$_GET["ref_id"])
1181 {
1182 $parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id);
1183 $parent_type = $parent_obj->getType();
1184 if($parent_type == $this->getType())
1185 {
1186 $a_node_id = (int) $tree->getParentId($a_node_id);
1187 }
1188 }
1189
1190 parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
1191 }
1192
1198 public function getPointsInPercent()
1199 {
1200 global $ilUser;
1201 if (strcmp($this->getSubType(), "scorm2004") == 0)
1202 {
1204 if (!is_null($res))
1205 {
1206 return $res * 100.0;
1207 }
1208 else
1209 {
1210 return $res;
1211 }
1212 }
1213 else
1214 {
1215 return null;
1216 }
1217 }
1218
1229 public function getMaxPoints()
1230 {
1231 global $ilUser;
1232
1233 if(strcmp($this->getSubType(), 'scorm2004') == 0)
1234 {
1235 $res = ilObjSCORM2004LearningModule::_getMaxScoreForUser($this->getId(), $ilUser->getId());
1236 return $res;
1237 }
1238 else
1239 {
1240 return null;
1241 }
1242 }
1243
1253 function populateByDirectoy($a_dir, $a_filename = "")
1254 {
1255 /*preg_match("/.*sahs_([0-9]*)\.zip/", $a_filename, $match);
1256 if (is_dir($a_dir."/sahs_".$match[1]))
1257 {
1258 $a_dir = $a_dir."/sahs_".$match[1];
1259 }*/
1260 ilUtil::rCopy($a_dir, $this->getDataDirectory());
1262 }
1263
1264
1271 public function cloneObject($a_target_id,$a_copy_id = 0)
1272 {
1273 global $ilDB, $ilUser, $ilias;
1274
1275 $new_obj = parent::cloneObject($a_target_id,$a_copy_id);
1276 $this->cloneMetaData($new_obj);
1277
1278 //copy online status if object is not the root copy object
1279 $cp_options = ilCopyWizardOptions::_getInstance($a_copy_id);
1280
1281 if(!$cp_options->isRootNode($this->getRefId()))
1282 {
1283 $new_obj->setOnline($this->getOnline());
1284 }
1285
1286 // copy properties
1287 $new_obj->setTitle($this->getTitle());
1288 $new_obj->setDescription($this->getDescription());
1289 $new_obj->setSubType($this->getSubType());
1290 $new_obj->setAPIAdapterName($this->getAPIAdapterName());
1291 $new_obj->setAPIFunctionsPrefix($this->getAPIFunctionsPrefix());
1292 $new_obj->setAutoReviewChar($this->getAutoReviewChar());
1293 $new_obj->setDefaultLessonMode($this->getDefaultLessonMode());
1294 $new_obj->setEditable($this->getEditable());
1295 $new_obj->setMaxAttempt($this->getMaxAttempt());
1296 $new_obj->setModuleVersion($this->getModuleVersion());
1297 $new_obj->setModuleVersion(1);
1298 $new_obj->setCreditMode($this->getCreditMode());
1299 $new_obj->setAssignedGlossary($this->getAssignedGlossary());
1300 $new_obj->setTries($this->getTries());
1301 $new_obj->setSession($this->getSession());
1302 $new_obj->setNoMenu($this->getNoMenu());
1303 $new_obj->setHideNavig($this->getHideNavig());
1304 $new_obj->setFourth_edition($this->getFourth_edition());
1305 $new_obj->setSequencing($this->getSequencing());
1306 $new_obj->setInteractions($this->getInteractions());
1307 $new_obj->setObjectives($this->getObjectives());
1308 $new_obj->setComments($this->getComments());
1309 $new_obj->setTime_from_lms($this->getTime_from_lms());
1310 $new_obj->setDebug($this->getDebug());
1311 $new_obj->setLocalization($this->getLocalization());
1312 $new_obj->setSequencingExpertMode($this->getSequencingExpertMode());
1313 $new_obj->setDebugPw($this->getDebugPw());
1314 $new_obj->setOpenMode($this->getOpenMode());
1315 $new_obj->setWidth($this->getWidth());
1316 $new_obj->setHeight($this->getHeight());
1317 $new_obj->setAutoContinue($this->getAutoContinue());
1318 $new_obj->setAuto_last_visited($this->getAuto_last_visited());
1319 $new_obj->setCheck_values($this->getCheck_values());
1320 $new_obj->setOfflineMode($this->getOfflineMode());
1321 $new_obj->setAutoSuspend($this->getAutoSuspend());
1322 $new_obj->setIe_compatibility($this->getIe_compatibility());
1323 $new_obj->setIe_force_render($this->getIe_force_render());
1324 $new_obj->setStyleSheetId($this->getStyleSheetId());
1325 $new_obj->update();
1326
1327
1328 // set/copy stylesheet
1329/* include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
1330 $style_id = $this->getStyleSheetId();
1331 if ($style_id > 0 && !ilObjStyleSheet::_lookupStandard($style_id))
1332 {
1333 $style_obj = $ilias->obj_factory->getInstanceByObjId($style_id);
1334 $new_id = $style_obj->ilClone();
1335 $new_obj->setStyleSheetId($new_id);
1336 $new_obj->update();
1337 }*/
1338
1339 // up to this point $new_obj is of type ilobjsahslearning module
1340
1341 // create instance of correct subtype and call forward it to
1342 // cloneIntoNewObject method
1343 switch ($this->getSubType())
1344 {
1345 case "scorm":
1346 include_once("./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php");
1347 $source_obj = new ilObjSCORMLearningModule($this->getRefId());
1348 $new_obj = new ilObjSCORMLearningModule($new_obj->getRefId());
1349 break;
1350
1351 case "scorm2004":
1352 include_once("./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php");
1353 $source_obj = new ilObjSCORM2004LearningModule($this->getRefId());
1354 $new_obj = new ilObjSCORM2004LearningModule($new_obj->getRefId());
1355 break;
1356
1357 case "aicc":
1358 include_once("./Modules/ScormAicc/classes/class.ilObjAICCLearningModule.php");
1359 $source_obj = new ilObjAICCLearningModule($this->getRefId());
1360 $new_obj = new ilObjAICCLearningModule($new_obj->getRefId());
1361 break;
1362
1363 case "hacp":
1364 include_once("./Modules/ScormAicc/classes/class.ilObjHACPLearningModule.php");
1365 $source_obj = new ilObjHACPLearningModule($this->getRefId());
1366 $new_obj = new ilObjHACPLearningModule($new_obj->getRefId());
1367 break;
1368
1369 }
1370
1371 // copy data directory
1372 $new_obj->populateByDirectoy($source_obj->getDataDirectory());
1373
1374 // copy authored content ...
1375 if ($new_obj->getEditable())
1376 {
1377 $source_obj->copyAuthoredContent($new_obj);
1378 }
1379 else
1380 {
1381 // ... or read manifest file
1382 $new_obj->readObject();
1383 }
1384
1385 return $new_obj;
1386 }
1387
1388 public function zipLmForOfflineMode()
1389 {
1390 $lmDir=ilUtil::getWebspaceDir("filesystem")."/lm_data/lm_".$this->getId();
1391 $zipFile=ilUtil::getDataDir()."/lm_data/lm_".$this->getId();
1392 return ilUtil::zip($lmDir, $zipFile, true);
1393 }
1394
1395}
1396?>
$_GET["client_id"]
static _getInstance($a_copy_id)
Get instance of copy wizard options.
Class ilObjAICCLearningModule.
Class ilObjAICCLearningModule.
_lookupDiskUsage($a_id)
Returns the number of bytes used on the harddisk by the learning module with the specified object id.
Class ilObjSCORMLearningModule.
getAPIFunctionsPrefix()
get api functions prefix
populateByDirectoy($a_dir, $a_filename="")
Populate by directory.
getDefaultLessonMode()
get default lesson mode
setAutoSuspend($a_auto_suspend)
get auto continue
getMaxPoints()
Returns score.max for the learning module, refered to the last sco where score.max is set.
getSequencingExpertMode()
Get sequencing expert mode.
setAutoContinue($a_auto_continue)
get auto continue
setSession($a_session)
set session setting
createDataDirectory()
creates data directory for package files ("./data/lm_data/lm_<id>")
getAffectiveLocalization($a_id)
Get affective localization.
getDiskUsage()
Gets the disk usage of the object in bytes.
setAuto_last_visited($a_auto_last_visited)
setAutoReview($a_auto_review)
set auto review as true/false for SCORM 1.2, HACP, SAHS, AICC
setAssignedGlossary($a_assigned_glossary)
set assigned glossary
getFourth_Edition()
SCORM 2004 4th edition features.
getIe_force_render()
force Internet Explorer to render again after some Milliseconds - useful for learning Modules with a ...
setDefaultLessonMode($a_lesson_mode)
set default lesson mode
setModuleVersion($a_module_version)
set max attempt
static lookupAssignedGlossary($a_slm_id)
Get SCORM modules that assign a certain glossary.
setMaxAttempt($a_max_attempt)
set max attempt
getAutoReviewChar()
get auto review as Char for SCORM 2004
getPointsInPercent()
Returns the points in percent for the learning module This is called by the certificate generator if ...
setEditable($a_editable)
Set Editable.
getOpenMode()
open_mode 0: in Tab/new Window like in previous versions 1: in iFrame with width=100% and heigth=100%...
create($upload=false)
create file based lm
getAssignedGlossary()
get assigned glossary
setStyleSheetId($a_style_id)
set ID of assigned style sheet object
setLocalization($a_val)
Set localization.
getCacheDeactivated()
BrowserCacheDisabled for SCORM 2004 / ENABLE_JS_DEBUG.
setAPIAdapterName($a_api)
set api adapter name
getAutoReview()
get auto review as true/false for SCORM 1.2, HACP, SAHS, AICC
notify($a_event, $a_ref_id, $a_parent_non_rbac_id, $a_node_id, $a_params=0)
notifys an object about an event occured Based on the event happend, each object may decide how it re...
setCreditMode($a_credit_mode)
set credit mode
static getScormModulesForGlossary($a_glo_id)
Get SCORM modules that assign a certain glossary.
_lookupSubType($a_obj_id)
lookup subtype id (scorm, aicc, hacp)
setHideNavig($a_hide_navig)
disable menu
cloneObject($a_target_id, $a_copy_id=0)
Clone scorm object.
_lookupOnline($a_id)
check wether scorm module is online
getStyleSheetId()
get ID of assigned style sheet object
getSessionDeactivated()
sessionDisabled for SCORM 2004
getIe_compatibility()
set compatibility mode for Internet Exlorer manually
setAPIFunctionsPrefix($a_prefix)
set api functions prefix
setSequencingExpertMode($a_val)
Set sequencing expert mode.
ilObjSAHSLearningModule($a_id=0, $a_call_by_reference=true)
Constructor @access public.
setTries($a_tries)
Set default tries for questions.
getDataDirectory($mode="filesystem")
get data directory of lm
setAutoReviewChar($a_auto_review)
set auto review as Char for SCORM 2004
Class ilObjSCORM2004LearningModule.
static _getMaxScoreForUser($a_id, $a_user)
Returns score.max for the learning module, refered to the last sco where score.max is set.
static _getUniqueScaledScoreForUser($a_id, $a_user)
Get the Unique Scaled Score of a course Conditions: Only one SCO may set cmi.score....
Class ilObjSCORMLearningModule.
Class ilObject Basic functions for all objects.
getType()
get object type @access public
deleteMetaData()
delete meta data entry
updateMetaData()
update meta data entry
_hasUntrashedReference($a_obj_id)
checks wether an object has at least one reference that is not in trash
createMetaData()
create meta data entry
getRefId()
get reference id @access public
getDescription()
get object description
cloneMetaData($target_obj)
Copy meta data.
getId()
get object id @access public
static _lookupType($a_id, $a_reference=false)
lookup object type
getTitle()
get object title @access public
& _getInstance($a_id, $a_slm_id)
get instance of specialized GUI class
SCORM Object Tree.
ILIAS Setting Class.
static getDataDir()
get data directory (outside webspace)
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static tf2yn($a_tf)
convert true/false to "y"/"n"
static getWebspaceDir($mode="filesystem")
get webspace directory
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
static zip($a_dir, $a_file, $compress_content=false)
static yn2tf($a_yn)
convert "y"/"n" to true/false
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static renameExecutables($a_dir)
Rename uploaded executables for security reasons.
redirection script todo: (a better solution should control the processing via a xml file)
global $ilSetting
Definition: privfeed.php:40
global $ilDB
$lm_set
global $ilUser
Definition: imgupload.php:15