5 require_once
"./Services/Object/classes/class.ilObject.php";
6 require_once
"./Modules/ScormAicc/classes/class.ilObjSCORMValidator.php";
7 require_once
"./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php";
27 public function __construct($a_id = 0, $a_call_by_reference =
true)
30 parent::__construct($a_id, $a_call_by_reference);
43 $returnValue = $this->validator->validate();
49 if (is_object($this->validator)) {
50 return $this->validator->getSummary();
67 include_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMTree.php");
69 $root_id =
$tree->readRootId();
72 $childs =
$tree->getSubTree(
$tree->getNodeData($root_id));
74 foreach ($childs as $child) {
75 if ($child[
"c_type"] ==
"sit") {
76 include_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMItem.php");
78 if ($sc_item->getIdentifierRef() !=
"") {
79 $items[count($items)] = $sc_item;
96 $needs_convert =
false;
103 $check_for_manifest_file = is_file($manifest_file);
106 if (!$check_for_manifest_file) {
107 $this->
ilias->raiseError($this->lng->txt(
"Manifestfile $manifest_file not found!"), $this->
ilias->error_obj->MESSAGE);
111 if ($check_for_manifest_file) {
112 $manifest_file_array = file($manifest_file);
113 foreach ($manifest_file_array as $mfa) {
115 if (@iconv(
'UTF-8',
'UTF-8', $mfa) != $mfa) {
116 $needs_convert =
true;
122 $estimated_manifest_filesize = filesize($manifest_file) * 2;
126 $check_disc_free = 2;
130 if ($needs_convert) {
132 if ($check_for_manifest_file && ($check_disc_free > 1)) {
135 if (!copy($manifest_file, $manifest_file .
".old")) {
136 echo "Failed to copy $manifest_file...<br>\n";
141 $f_write_handler =
fopen($manifest_file .
".new",
"w");
142 $f_read_handler =
fopen($manifest_file .
".old",
"r");
143 while (!feof($f_read_handler)) {
144 $zeile = fgets($f_read_handler);
146 fputs($f_write_handler, utf8_encode($zeile));
148 fclose($f_read_handler);
149 fclose($f_write_handler);
152 if (!copy($manifest_file .
".new", $manifest_file)) {
153 echo "Failed to copy $manifest_file...<br>\n";
156 if (!@is_file($manifest_file)) {
157 $this->
ilias->raiseError(
158 $this->lng->txt(
"cont_no_manifest"),
159 $this->
ilias->error_obj->WARNING
165 if (!($check_disc_free > 1)) {
166 $this->
ilias->raiseError($this->lng->txt(
"Not enough space left on device!"), $this->
ilias->error_obj->MESSAGE);
172 $hmani =
fopen($manifest_file,
"r");
173 $start = fread($hmani, 3);
174 if (strtolower(bin2hex(
$start)) ==
"efbbbf") {
175 $f_write_handler =
fopen($manifest_file .
".new",
"w");
176 while (!feof($hmani)) {
177 $n = fread($hmani, 900);
178 fputs($f_write_handler,
$n);
180 fclose($f_write_handler);
184 if (!copy($manifest_file .
".new", $manifest_file)) {
185 echo "Failed to copy $manifest_file...<br>\n";
193 if (
$_POST[
"validate"] ==
"y") {
200 include_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMPackageParser.php");
203 $slmParser->startParsing();
204 return $slmParser->getPackageTitle();
216 if (
$lm_set->get(
'scorm_lp_auto_activate') != 1) {
220 include_once(
"./Services/Tracking/classes/class.ilObjUserTracking.php");
226 include_once(
"./Services/Tracking/classes/class.ilLPObjSettings.php");
232 include_once(
"Services/Tracking/classes/collection/class.ilLPCollectionOfSCOs.php");
235 foreach ($collection->getPossibleItems() as $sco_id => $item) {
238 $collection->activateEntries($scos);
246 $ilDB = $DIC[
'ilDB'];
249 $sco_set =
$ilDB->queryF(
251 SELECT DISTINCT sco_id FROM scorm_tracking WHERE obj_id = %s',
253 array($this->
getId())
257 while ($sco_rec =
$ilDB->fetchAssoc($sco_set)) {
258 include_once(
"./Modules/ScormAicc/classes/SCORM/class.ilSCORMItem.php");
260 if ($sc_item->getIdentifierRef() !=
"") {
261 $items[count($items)] = $sc_item;
278 $ilDB = $DIC[
'ilDB'];
282 SELECT last_access FROM sahs_user 285 array(
'integer',
'integer'),
286 array($a_obj_id,$a_usr_id)
291 return $row[
"last_access"];
299 $ilDB = $DIC[
'ilDB'];
303 $query =
'SELECT user_id, last_access, lastname, firstname FROM sahs_user st ' .
304 'JOIN usr_data ud ON st.user_id = ud.usr_id ' .
305 'WHERE obj_id = ' .
$ilDB->quote($this->
getId(),
'integer');
308 $query .=
' AND ' .
$ilDB->like(
'lastname',
'text',
'%' . $a_search .
'%');
310 $query .=
' GROUP BY user_id, lastname, firstname, last_access';
314 while ($sco_rec =
$ilDB->fetchAssoc($sco_set)) {
329 $ilDB = $DIC[
'ilDB'];
330 $query =
'SELECT user_id, package_attempts FROM sahs_user WHERE obj_id = ' .
$ilDB->quote($this->
getId(),
'integer') .
' ';
335 $attempts[
$row[
'user_id']] = (int) $row[
'package_attempts'];
347 $ilDB = $DIC[
'ilDB'];
348 $val_set =
$ilDB->queryF(
349 'SELECT package_attempts FROM sahs_user WHERE obj_id = %s AND user_id = %s',
350 array(
'integer',
'integer'),
351 array($this->
getId(),$a_user_id)
354 $val_rec =
$ilDB->fetchAssoc($val_set);
356 if ($val_rec[
"package_attempts"] == null) {
357 $val_rec[
"package_attempts"] =
"";
359 return $val_rec[
"package_attempts"];
370 $ilDB = $DIC[
'ilDB'];
371 $query =
'SELECT user_id, module_version FROM sahs_user WHERE obj_id = ' .
$ilDB->quote($this->
getId(),
'integer') .
' ';
376 $versions[
$row[
'user_id']] = (int) $row[
'module_version'];
388 $ilDB = $DIC[
'ilDB'];
389 $val_set =
$ilDB->queryF(
390 'SELECT module_version FROM sahs_user WHERE obj_id = %s AND user_id = %s',
391 array(
'integer',
'integer'),
392 array($this->
getId(),$a_user_id,0)
395 $val_rec =
$ilDB->fetchAssoc($val_set);
397 if ($val_rec[
"module_version"] == null) {
398 $val_rec[
"module_version"] =
"";
400 return $val_rec[
"module_version"];
413 $ilDB = $DIC[
'ilDB'];
415 $data_set =
$ilDB->queryF(
417 SELECT * FROM scorm_tracking 422 array(
'integer',
'integer',
'integer'),
423 array($a_user_id,$a_sco_id,$this->
getId())
427 while ($data_rec =
$ilDB->fetchAssoc($data_set)) {
437 $ilDB = $DIC[
'ilDB'];
440 $sco_set =
$ilDB->queryF(
442 SELECT DISTINCT sco_id FROM scorm_tracking 446 array(
'integer',
'integer',
'integer'),
447 array($this->
getId(),$a_user_id,0)
451 while ($sco_rec =
$ilDB->fetchAssoc($sco_set)) {
452 $data_set =
$ilDB->queryF(
454 SELECT * FROM scorm_tracking 462 array(
'integer',
'integer',
'integer',
'text',
'text',
'text',
'text'),
463 array($this->
getId(),
467 "cmi.core.lesson_status",
468 "cmi.core.total_time",
469 "cmi.core.score.raw")
472 $score =
$time = $status =
"";
474 while ($data_rec =
$ilDB->fetchAssoc($data_set)) {
475 switch ($data_rec[
"lvalue"]) {
476 case "cmi.core.lesson_status":
477 $status = $data_rec[
"rvalue"];
480 case "cmi.core.total_time":
481 $time = $data_rec[
"rvalue"];
484 case "cmi.core.score.raw":
485 $score = $data_rec[
"rvalue"];
490 include_once
'./Modules/ScormAicc/classes/SCORM/class.ilSCORMItem.php';
492 $data[] = array(
"sco_id" => $sco_rec[
"sco_id"],
"title" => $sc_item->getTitle(),
493 "score" => $score,
"time" =>
$time,
"status" => $status);
495 return (array)
$data;
501 $ilDB = $DIC[
'ilDB'];
504 $user_set =
$ilDB->queryF(
506 SELECT DISTINCT user_id FROM scorm_tracking 509 array(
'integer',
'integer'),
510 array($this->
getId(),$a_sco_id)
514 while ($user_rec =
$ilDB->fetchAssoc($user_set)) {
515 $data_set =
$ilDB->queryF(
517 SELECT * FROM scorm_tracking 524 array(
'integer',
'integer',
'integer',
'text',
'text',
'text'),
525 array($this->
getId(),
527 $user_rec[
"user_id"],
528 "cmi.core.lesson_status",
529 "cmi.core.total_time",
530 "cmi.core.score.raw")
533 $score =
$time = $status =
"";
535 while ($data_rec =
$ilDB->fetchAssoc($data_set)) {
536 switch ($data_rec[
"lvalue"]) {
537 case "cmi.core.lesson_status":
538 $status = $data_rec[
"rvalue"];
541 case "cmi.core.total_time":
542 $time = $data_rec[
"rvalue"];
545 case "cmi.core.score.raw":
546 $score = $data_rec[
"rvalue"];
551 $data[] = array(
"user_id" => $user_rec[
"user_id"],
552 "score" => $score,
"time" =>
$time,
"status" => $status);
570 $ilDB = $DIC[
'ilDB'];
572 include_once(
'./Modules/ScormAicc/classes/class.ilSCORMTrackingItems.php');
573 include_once(
"./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php");
574 include_once(
'./Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
576 $allowExportPrivacy = $privacy->enabledExportSCORM();
579 $query =
'SELECT * FROM sahs_user WHERE obj_id = %s';
580 if (count($a_users) > 0) {
581 $query .=
' AND ' .
$ilDB->in(
'user_id', $a_users,
false,
'integer');
586 array($this->
getId())
589 $csv = $csv .
$data[
"obj_id"]
591 .
";" .
$data[
"module_version"]
593 .
";\"" .
$data[
"last_access"] .
"\"" 595 .
";" .
$data[
"package_attempts"]
596 .
";" .
$data[
"percentage_completed"]
597 .
";" .
$data[
"sco_total_time_sec"]
602 $header =
"LearningModuleId;LearningModuleTitle;LearningModuleVersion;" . str_replace(
',',
';', $udh[
"cols"]) .
";" 603 .
"LastAccess;Status;Attempts;percentageCompletedSCOs;SumTotal_timeSeconds\n";
612 $ilDB = $DIC[
'ilDB'];
620 $fhandle =
fopen($a_file,
"r");
623 $fields = fgetcsv($fhandle, pow(2, 16),
';');
627 switch ($fields[0]) {
629 case "SCO-Identifier":
633 case "LearningModuleId":
646 $ilDB = $DIC[
'ilDB'];
648 include_once(
"./Services/Tracking/classes/class.ilLPStatus.php");
651 include_once
'./Services/Object/classes/class.ilObjectLP.php';
653 $collection = $olp->getCollectionInstance();
655 $scos = $collection->getItems();
658 $fhandle =
fopen($a_file,
"r");
660 $obj_id = $this->getID();
661 $fields = fgetcsv($fhandle, pow(2, 16),
';');
663 $usersToDelete = array();
664 while (($csv_rows = fgetcsv($fhandle, pow(2, 16),
";")) !==
false) {
665 $data = array_combine($fields, $csv_rows);
667 if (
$data[
"Login"]) {
670 if (
$data[
"login"]) {
674 if (
$data[
"user"] && is_numeric(
$data[
"user"])) {
675 $user_id = (int)
$data[
"user"];
681 $date_ex = explode(
'.',
$data[
'Date']);
682 $last_access = implode(
'-', array($date_ex[2], $date_ex[1], $date_ex[0]));
684 if (
$data[
'LastAccess']) {
685 $last_access =
$data[
'LastAccess'];
690 if (
$data[
"Status"]) {
691 if (is_int(
$data[
"Status"])) {
692 $status =
$data[
"Status"];
693 } elseif (
$data[
"Status"] ==
"0" ||
$data[
"Status"] ==
"1" ||
$data[
"Status"] ==
"2" ||
$data[
"Status"] ==
"3") {
694 $status = (int)
$data[
"Status"];
705 if (
$data[
"Attempts"]) {
706 $attempts =
$data[
"Attempts"];
709 $percentage_completed = 0;
711 $percentage_completed = 100;
713 if (
$data[
'percentageCompletedSCOs']) {
714 $percentage_completed =
$data[
'percentageCompletedSCOs'];
717 $sco_total_time_sec = null;
718 if (
$data[
'SumTotal_timeSeconds']) {
719 $sco_total_time_sec =
$data[
'SumTotal_timeSeconds'];
723 $usersToDelete[] = $user_id;
725 $this->
importSuccessForSahsUser($user_id, $last_access, $status, $attempts, $percentage_completed, $sco_total_time_sec);
730 foreach ($scos as $sco_id) {
731 $statement =
$ilDB->queryF(
733 SELECT * FROM scorm_tracking 738 array(
'integer',
'integer',
'text',
'integer'),
739 array($user_id, $sco_id,
'cmi.core.lesson_status',$obj_id)
741 if (
$ilDB->numRows($statement) > 0) {
745 'rvalue' => array(
'clob',
'completed'),
746 'c_timestamp' => array(
'timestamp', $last_access)
749 'user_id' => array(
'integer', $user_id),
750 'sco_id' => array(
'integer', $sco_id),
751 'lvalue' => array(
'text',
'cmi.core.lesson_status'),
752 'obj_id' => array(
'integer', $obj_id)
756 $ilDB->insert(
'scorm_tracking', array(
757 'obj_id' => array(
'integer', $obj_id),
758 'user_id' => array(
'integer', $user_id),
759 'sco_id' => array(
'integer', $sco_id),
760 'lvalue' => array(
'text',
'cmi.core.lesson_status'),
761 'rvalue' => array(
'clob',
'completed'),
762 'c_timestamp' => array(
'timestamp', $last_access)
771 if (count($usersToDelete) > 0) {
776 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
781 public function importSuccessForSahsUser($user_id, $last_access, $status, $attempts = null, $percentage_completed = null, $sco_total_time_sec = null)
784 $ilDB = $DIC[
'ilDB'];
785 $statement =
$ilDB->queryF(
786 'SELECT * FROM sahs_user WHERE obj_id = %s AND user_id = %s',
787 array(
'integer',
'integer'),
788 array($this->getID(),$user_id)
790 if (
$ilDB->numRows($statement) > 0) {
794 'last_access' => array(
'timestamp', $last_access),
795 'status' => array(
'integer', $status),
796 'package_attempts' => array(
'integer', $attempts),
797 'percentage_completed' => array(
'integer', $percentage_completed),
798 'sco_total_time_sec' => array(
'integer', $sco_total_time_sec)
801 'obj_id' => array(
'integer', $this->getID()),
802 'user_id' => array(
'integer', $user_id)
806 $ilDB->insert(
'sahs_user', array(
807 'obj_id' => array(
'integer', $this->getID()),
808 'user_id' => array(
'integer', $user_id),
809 'last_access' => array(
'timestamp', $last_access),
810 'status' => array(
'integer', $status),
811 'package_attempts' => array(
'integer', $attempts),
812 'percentage_completed' => array(
'integer', $percentage_completed),
813 'sco_total_time_sec' => array(
'integer', $sco_total_time_sec)
817 include_once(
"./Services/Tracking/classes/class.ilChangeEvent.php");
831 $parts = explode(
'_', $il_id);
833 if (!count((array) $parts)) {
836 if (!isset($parts[2])
or !isset($parts[3])) {
839 if ($parts[2] !=
$ilSetting->get(
'inst_id', $parts[2])) {
855 $ilDB = $DIC[
'ilDB'];
858 $lng->loadLanguageModule(
"scormtrac");
860 $fhandle =
fopen($a_file,
"r");
862 $fields = fgetcsv($fhandle, pow(2, 16),
';');
864 $a_last_access = array();
866 $a_package_attempts = array();
867 $a_module_version = array();
868 while (($csv_rows = fgetcsv($fhandle, pow(2, 16),
";")) !==
false) {
869 $data = array_combine($fields, $csv_rows);
870 if (
$data[
'Userid']) {
884 if (
$data[
'Scoid']) {
895 if (
$data[
'Timestamp']) {
896 $c_timestamp =
$data[
'Timestamp'];
899 $c_timestamp =
$data[
$lng->txt(
"c_timestamp")];
901 if ($c_timestamp ==
"") {
903 $c_timestamp = $date->getTimestamp();
905 if ($a_last_access[$user_id]) {
906 if ($a_last_access[$user_id] < $c_timestamp) {
907 $a_last_access[$user_id] = $c_timestamp;
910 $a_last_access[$user_id] = $c_timestamp;
917 if (!
$data[
'Value']) {
921 if (
$data[
'Key'] ==
"cmi.core.total_time" &&
$data[
'Value'] !=
"") {
922 $tarr = explode(
":",
$data[
'Value']);
923 $sec = (int) $tarr[2] + (
int) $tarr[1] * 60 +
924 (int) substr($tarr[0], strlen($tarr[0]) - 3) * 60 * 60;
925 if ($a_time[$user_id]) {
926 $a_time[$user_id] += $sec;
928 $a_time[$user_id] = $sec;
932 if ($il_sco_id > 0) {
933 $statement =
$ilDB->queryF(
935 SELECT * FROM scorm_tracking 940 array(
'integer',
'integer',
'text',
'integer'),
941 array($user_id, $il_sco_id,
$data[
'Key'], $this->getID())
943 if (
$ilDB->numRows($statement) > 0) {
947 'rvalue' => array(
'clob',
$data[
'Value']),
948 'c_timestamp' => array(
'timestamp', $c_timestamp)
951 'user_id' => array(
'integer', $user_id),
952 'sco_id' => array(
'integer', $il_sco_id),
953 'lvalue' => array(
'text',
$data[
'Key']),
954 'obj_id' => array(
'integer', $this->
getId())
958 $ilDB->insert(
'scorm_tracking', array(
959 'obj_id' => array(
'integer', $this->
getId()),
960 'user_id' => array(
'integer', $user_id),
961 'sco_id' => array(
'integer', $il_sco_id),
962 'lvalue' => array(
'text',
$data[
'Key']),
963 'rvalue' => array(
'clob',
$data[
'Value']),
964 'c_timestamp' => array(
'timestamp',
$data[
'Timestamp'])
969 if ($il_sco_id == 0) {
970 if (
$data[
'Key'] ==
"package_attempts") {
971 $a_package_attempts[$user_id] =
$data[
'Value'];
975 if (!in_array($user_id,
$users)) {
982 include_once
'./Services/Tracking/classes/class.ilLPStatusWrapper.php';
986 include_once
'./Services/Tracking/classes/class.ilLPStatus.php';
987 foreach (
$users as $user_id) {
989 if ($a_package_attempts[$user_id]) {
990 $attempts = $a_package_attempts[$user_id];
994 $sco_total_time_sec = null;
995 if ($a_time[$user_id]) {
996 $sco_total_time_sec = $a_time[$user_id];
999 if ($a_last_access[$user_id]) {
1000 $last_access = $a_last_access[$user_id];
1007 $this->
importSuccessForSahsUser($user_id, $last_access, $status, $attempts, $percentage_completed, $sco_total_time_sec);
1022 $ilDB = $DIC[
'ilDB'];
1024 foreach ($a_user_id as
$user) {
1026 $val_set =
$ilDB->queryF(
1027 'SELECT package_attempts FROM sahs_user WHERE user_id = %s AND obj_id = %s',
1028 array(
'integer',
'integer'),
1029 array($user,$this->getID())
1032 $val_rec =
$ilDB->fetchAssoc($val_set);
1034 if ($val_rec[
"package_attempts"] != null && $val_rec[
"package_attempts"] != 0) {
1037 if ((
int) $val_rec[
"package_attempts"] > 0) {
1038 $new_rec = (int) $val_rec[
"package_attempts"] - 1;
1041 'UPDATE sahs_user SET package_attempts = %s WHERE user_id = %s AND obj_id = %s',
1042 array(
'integer',
'integer',
'integer'),
1043 array($new_rec,$user,$this->getID())
1047 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
1058 $ilDB = $DIC[
'ilDB'];
1061 $val_set =
$ilDB->queryF(
1062 'SELECT * FROM usr_data WHERE(login=%s)',
1066 $val_rec =
$ilDB->fetchAssoc($val_set);
1068 if (count($val_rec) > 0) {
1069 return $val_rec[
'usr_id'];
1082 $ilDB = $DIC[
'ilDB'];
1086 if ($a_referrer ==
"0") {
1090 $val_set =
$ilDB->queryF(
1092 SELECT obj_id FROM sc_item,scorm_tree 1093 WHERE (obj_id = child 1094 AND identifierref = %s 1096 array(
'text',
'integer'),
1097 array($a_referrer,$this->getID())
1099 $val_rec =
$ilDB->fetchAssoc($val_set);
1101 return $val_rec[
"obj_id"];
1110 $ilDB = $DIC[
'ilDB'];
1113 $val_set =
$ilDB->queryF(
1114 'SELECT usr_id FROM usr_data WHERE(email=%s)',
1118 $val_rec =
$ilDB->fetchAssoc($val_set);
1121 return $val_rec[
"usr_id"];
1145 $ilDB = $DIC[
'ilDB'];
1149 $val_set =
$ilDB->queryF(
1151 SELECT scorm_object.obj_id, 1153 scorm_object.c_type, 1154 scorm_object.slm_id, 1155 scorm_object.obj_id scoid 1156 FROM scorm_object,sc_item,sc_resource 1157 WHERE(scorm_object.slm_id = %s 1158 AND scorm_object.obj_id = sc_item.obj_id 1159 AND sc_item.identifierref = sc_resource.import_id 1160 AND sc_resource.scormtype = %s) 1161 GROUP BY scorm_object.obj_id, 1163 scorm_object.c_type, 1164 scorm_object.slm_id, 1165 scorm_object.obj_id ',
1166 array(
'integer',
'text'),
1170 while ($val_rec =
$ilDB->fetchAssoc($val_set)) {
1171 array_push($scos, $val_rec[
'scoid']);
1187 $ilDB = $DIC[
'ilDB'];
1190 $scos = $a_allScoIds;
1192 $scos_c = implode(
',', $scos);
1194 $val_set =
$ilDB->queryF(
1196 SELECT * FROM scorm_tracking 1199 AND ' .
$ilDB->in(
'sco_id', $scos,
false,
'integer') .
' 1200 AND ((lvalue = %s AND ' .
$ilDB->like(
'rvalue',
'clob',
'completed') .
') 1201 OR (lvalue = %s AND ' .
$ilDB->like(
'rvalue',
'clob',
'passed') .
')))',
1202 array(
'integer',
'integer',
'text',
'text'),
1203 array($a_user,$a_id,
'cmi.core.lesson_status',
'cmi.core.lesson_status')
1205 while ($val_rec =
$ilDB->fetchAssoc($val_set)) {
1206 $key = array_search($val_rec[
'sco_id'], $scos);
1210 if (count($scos) == 0) {
1211 $completion = ($a_numerical ===
true) ?
true:
$lng->txt(
"cont_complete");
1213 if (count($scos) > 0) {
1214 $completion = ($a_numerical ===
true) ?
false:
$lng->txt(
"cont_incomplete");
1233 $ilDB = $DIC[
'ilDB'];
1237 $val_set =
$ilDB->queryF(
1239 SELECT scorm_object.obj_id, 1241 scorm_object.c_type, 1242 scorm_object.slm_id, 1243 scorm_object.obj_id scoid 1244 FROM scorm_object, sc_item,sc_resource 1245 WHERE(scorm_object.slm_id = %s 1246 AND scorm_object.obj_id = sc_item.obj_id 1247 AND sc_item.identifierref = sc_resource.import_id 1248 AND sc_resource.scormtype = %s ) 1249 GROUP BY scorm_object.obj_id, 1251 scorm_object.c_type, 1252 scorm_object.slm_id, 1253 scorm_object.obj_id',
1254 array(
'integer',
'text'),
1255 array($this->
getId(),
'sco')
1258 while ($val_rec =
$ilDB->fetchAssoc($val_set)) {
1259 array_push($scos, $val_rec[
'scoid']);
1267 $ilDB = $DIC[
'ilDB'];
1268 $scos = $a_allScoIds;
1271 $scos_c = implode(
',', $scos);
1273 $val_set =
$ilDB->queryF(
1275 SELECT sco_id FROM scorm_tracking 1278 AND ' .
$ilDB->in(
'sco_id', $scos,
false,
'integer') .
' 1279 AND ((lvalue = %s AND ' .
$ilDB->like(
'rvalue',
'clob',
'completed') .
') OR (lvalue = %s AND ' .
$ilDB->like(
'rvalue',
'clob',
'passed') .
') ) )',
1280 array(
'integer',
'integer',
'text',
'text',),
1281 array($a_user,$this->getID(),
'cmi.core.lesson_status',
'cmi.core.lesson_status')
1283 while ($val_rec =
$ilDB->fetchAssoc($val_set)) {
1284 $key = array_search($val_rec[
'sco_id'], $scos);
1288 if (count($scos) == 0) {
1289 $completion = ($a_numerical ===
true) ?
true: $this->lng->txt(
"cont_complete");
1291 if (count($scos) > 0) {
1292 $completion = ($a_numerical ===
true) ?
false: $this->lng->txt(
"cont_incomplete");
1306 $ilDB = $DIC[
'ilDB'];
1309 'DELETE FROM scorm_tracking WHERE user_id = %s',
1314 'DELETE FROM sahs_user WHERE user_id = %s',
1323 $ilDB = $DIC[
'ilDB'];
1325 $retAr = array(
"raw" => null,
"max" => null,
"scaled" => null);
1326 $val_set =
$ilDB->queryF(
1328 SELECT lvalue, rvalue FROM scorm_tracking 1331 AND (lvalue = 'cmi.core.score.raw' OR lvalue = 'cmi.core.score.max')",
1332 array(
'integer',
'integer'),
1333 array($a_item_id, $a_user_id)
1335 while ($val_rec =
$ilDB->fetchAssoc($val_set)) {
1336 if ($val_rec[
'lvalue'] ==
"cmi.core.score.raw") {
1337 $retAr[
"raw"] = $val_rec[
"rvalue"];
1339 if ($val_rec[
'lvalue'] ==
"cmi.core.score.max") {
1340 $retAr[
"max"] = $val_rec[
"rvalue"];
1343 if ($retAr[
"raw"] != null && $retAr[
"max"] != null) {
1344 $retAr[
"scaled"] = ($retAr[
"raw"] / $retAr[
"max"]);
1354 $ilDB = $DIC[
'ilDB'];
1355 $val_set =
$ilDB->queryF(
1356 'SELECT last_visited FROM sahs_user WHERE obj_id = %s AND user_id = %s',
1357 array(
'integer',
'integer'),
1358 array($this->getID(),$user_id)
1360 while ($val_rec =
$ilDB->fetchAssoc($val_set)) {
1361 if ($val_rec[
"last_visited"] != null) {
1362 return "" . $val_rec[
"last_visited"];
1371 $ilDB = $DIC[
'ilDB'];
1372 include_once(
"./Services/Tracking/classes/class.ilChangeEvent.php");
1373 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
1377 foreach ($a_users as
$user) {
1380 DELETE FROM scorm_tracking 1383 array(
'integer',
'integer'),
1384 array($user, $this->getID())
1389 DELETE FROM sahs_user 1392 array(
'integer',
'integer'),
1393 array($user, $this->getID())
const LP_STATUS_COMPLETED_NUM
static _getAllScoIds($a_id)
Get an array of id's for all Sco's in the module.
static _recordReadEvent( $a_type, $a_ref_id, $obj_id, $usr_id, $isCatchupWriteEvents=true, $a_ext_rc=false, $a_ext_time=false)
Records a read event and catches up with write events.
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
importRaw($a_file)
Import raw data ilDB $ilDB ilObjUser $ilUser.
parseUserId($il_id)
Parse il_usr_123_6 id.
getAttemptsForUsers()
Get attempts for all users ilDB $ilDB.
importTrackingData($a_file)
static _getCourseCompletionForUser($a_id, $a_user)
Get the completion of a SCORM module for a given user.
const LP_STATUS_NOT_ATTEMPTED
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_force_raise=false)
Update status.
getTrackedItems()
get all tracked items of current user
static _lookupPercentage($a_obj_id, $a_user_id)
Lookup percentage.
sendExportFile($a_header, $a_content)
send export file to browser
const LP_STATUS_IN_PROGRESS_NUM
decreaseAttemptsForUser($a_user_id)
Decrease attempts for user ilDB $ilDB.
getUserIdEmail($a_mail)
assumes that only one account exists for a mailadress
getAttemptsForUser($a_user_id)
get number of attempts for a certain user and package
__construct($a_id=0, $a_call_by_reference=true)
Constructor public.
static _refreshStatus($a_obj_id, $a_users=null)
Set dirty.
static now()
Return current timestamp in Y-m-d H:i:s format.
static _lookupLastAccess($a_obj_id, $a_usr_id)
Return the last access timestamp for a given user.
deleteTrackingDataOfUsers($a_users)
const LP_STATUS_IN_PROGRESS
getTrackingDataPerUser($a_sco_id, $a_user_id)
Get tracking data per user ilDB $ilDB.
validate($directory)
Validate all XML-Files in a SCOM-Directory.
static _removeTrackingDataForUser($user_id)
getDataDirectory($mode="filesystem")
get data directory of lm
static _enabledLearningProgress()
check wether learing progress is enabled or not
foreach($_POST as $key=> $value) $res
getId()
get object id public
static userDataHeaderForExport()
getTitle()
get object title public
redirection script todo: (a better solution should control the processing via a xml file) ...
getModuleVersionForUser($a_user_id)
get module version that tracking data for a user was recorded on
Validation of SCORM-XML Files.
getTrackedUsers($a_search)
getTrackingDataAgg($a_user_id)
importSuccessForSahsUser($user_id, $last_access, $status, $attempts=null, $percentage_completed=null, $sco_total_time_sec=null)
exportSelected($a_all, $a_users=array())
Export selected user tracking data ilDB $ilDB ilObjUser $ilUser.
getModuleVersionForUsers()
Get module version for users.
lookupSCOId($a_referrer)
resolves manifest SCOID to internal ILIAS SCO ID
static _getTrackingItems($a_obj_id)
get all tracking items of scorm object static
getStatusForUser($a_user, $a_allScoIds, $a_numerical=false)
foreach($mandatory_scripts as $file) $timestamp
const LP_STATUS_NOT_ATTEMPTED_NUM
static __readStatus($a_obj_id, $user_id)
static _getStatusForUser($a_id, $a_user, $a_allScoIds, $a_numerical=false)
Get the status of a SCORM module for a given user.
setLearningProgressSettingsAtUpload()
set settings for learning progress determination per default at upload
static _deleteReadEventsForUsers($a_obj_id, array $a_user_ids)
readObject()
read manifest file public
getRefId()
get reference id public
static _getInstance()
Get instance of ilPrivacySettings.
static _getScoresForUser($a_item_id, $a_user_id)
static userDataArrayForExport($user, $b_allowExportPrivacy=false)
static getInstance($a_obj_id)
Class ilObjSCORMLearningModule.
static _lookupStatus($a_obj_id, $a_user_id, $a_create=true)
Lookup status.
Class ilObjSCORMLearningModule.
const LP_STATUS_FAILED_NUM
getCourseCompletionForUser($a_user)
getTrackingDataAggSco($a_sco_id)