3 declare(strict_types=1);
    36     public function __construct(
int $a_id = 0, 
bool $a_call_by_reference = 
true)
    58         foreach ($childs as $child) {
    59             if ($child[
"c_type"] === 
"sit") {
    61                 if ($sc_item->getIdentifierRef() != 
"") {
    79         $needs_convert = 
false;
    86         $check_for_manifest_file = is_file($manifest_file);
    89         if (!$check_for_manifest_file) {
    90             $ilErr->raiseError($this->
lng->txt(
"Manifestfile $manifest_file not found!"), 
$ilErr->MESSAGE);
    94         if ($check_for_manifest_file) {
    95             $manifest_file_array = file($manifest_file);
    96             foreach ($manifest_file_array as $mfa) {
    98                 if (@iconv(
'UTF-8', 
'UTF-8', $mfa) != $mfa) {
    99                     $needs_convert = 
true;
   105             $estimated_manifest_filesize = filesize($manifest_file) * 2;
   109             $check_disc_free = 2;
   113         if ($needs_convert) {
   115             if ($check_for_manifest_file && ($check_disc_free > 1)) {
   117                 if (!copy($manifest_file, $manifest_file . 
".old")) {
   118                     echo 
"Failed to copy $manifest_file...<br>\n";
   123                 $f_write_handler = fopen($manifest_file . 
".new", 
"w");
   124                 $f_read_handler = fopen($manifest_file . 
".old", 
"r");
   125                 while (!feof($f_read_handler)) {
   126                     $zeile = fgets($f_read_handler);
   128                     fwrite($f_write_handler, utf8_encode($zeile));
   130                 fclose($f_read_handler);
   131                 fclose($f_write_handler);
   134                 if (!copy($manifest_file . 
".new", $manifest_file)) {
   135                     echo 
"Failed to copy $manifest_file...<br>\n";
   138                 if (!@is_file($manifest_file)) {
   139                     $ilErr->raiseError($this->
lng->txt(
"cont_no_manifest"), 
$ilErr->WARNING);
   144                 if (!($check_disc_free > 1)) {
   145                     $ilErr->raiseError($this->
lng->txt(
"Not enough space left on device!"), 
$ilErr->MESSAGE);
   151             $hmani = fopen($manifest_file, 
"r");
   152             $start = fread($hmani, 3);
   153             if (strtolower(bin2hex($start)) === 
"efbbbf") {
   154                 $f_write_handler = fopen($manifest_file . 
".new", 
"w");
   155                 while (!feof($hmani)) {
   156                     $n = fread($hmani, 900);
   157                     fwrite($f_write_handler, $n);
   159                 fclose($f_write_handler);
   163                 if (!copy($manifest_file . 
".new", $manifest_file)) {
   164                     echo 
"Failed to copy $manifest_file...<br>\n";
   173         $slmParser->startParsing();
   174         return (
string) $slmParser->getPackageTitle();
   186         if (
$lm_set->get(
'scorm_lp_auto_activate') != 1) {
   197         foreach ($collection->getPossibleItems() as $sco_id => $item) {
   200         $collection->activateEntries($scos);
   209         $ilDB = $DIC->database();
   210         $ilUser = $DIC->user();
   212         $sco_set = 
$ilDB->queryF(
   214                 SELECT DISTINCT sco_id FROM scorm_tracking WHERE obj_id = %s',
   216             array($this->
getId())
   220         while ($sco_rec = 
$ilDB->fetchAssoc($sco_set)) {
   221             $sc_item = 
new ilSCORMItem((
int) $sco_rec[
"sco_id"]);
   222             if ($sc_item->getIdentifierRef() != 
"") {
   261         $ilDB = $DIC->database();
   262         $ilUser = $DIC->user();
   265         $query = 
'SELECT user_id, last_access, lastname, firstname FROM sahs_user st ' .
   266             'JOIN usr_data ud ON st.user_id = ud.usr_id ' .
   267             'WHERE obj_id = ' . 
$ilDB->quote($this->
getId(), 
'integer');
   270             $query .= 
' AND ' . 
$ilDB->like(
'lastname', 
'text', 
'%' . $a_search . 
'%');
   272         $query .= 
' GROUP BY user_id, lastname, firstname, last_access';
   273         $sco_set = 
$ilDB->query($query);
   276         while ($sco_rec = 
$ilDB->fetchAssoc($sco_set)) {
   291         $ilDB = $DIC->database();
   292         $query = 
'SELECT user_id, package_attempts FROM sahs_user WHERE obj_id = ' . 
$ilDB->quote($this->
getId(), 
'integer') . 
' ';
   297             $attempts[$row[
'user_id']] = (
int) $row[
'package_attempts'];
   310         $ilDB = $DIC->database();
   311         $val_set = 
$ilDB->queryF(
   312             'SELECT package_attempts FROM sahs_user WHERE obj_id = %s AND user_id = %s',
   313             array(
'integer',
'integer'),
   314             array($this->
getId(),$a_user_id)
   317         $val_rec = 
$ilDB->fetchAssoc($val_set);
   319         if ($val_rec[
"package_attempts"] == null) {
   320             $val_rec[
"package_attempts"] = 0;
   322         return (
int) $val_rec[
"package_attempts"];
   331         $ilDB = $DIC->database();
   332         $query = 
'SELECT user_id, module_version FROM sahs_user WHERE obj_id = ' . 
$ilDB->quote($this->
getId(), 
'integer') . 
' ';
   337             $versions[$row[
'user_id']] = (
int) $row[
'module_version'];
   348         $ilDB = $DIC->database();
   349         $val_set = 
$ilDB->queryF(
   350             'SELECT module_version FROM sahs_user WHERE obj_id = %s AND user_id = %s',
   351             array(
'integer',
'integer'),
   352             array($this->
getId(),$a_user_id,0)
   355         $val_rec = 
$ilDB->fetchAssoc($val_set);
   357         if ($val_rec[
"module_version"] == null) {
   358             $val_rec[
"module_version"] = 
"";
   360         return $val_rec[
"module_version"];
   369         $ilDB = $DIC->database();
   371         $data_set = 
$ilDB->queryF(
   373                 SELECT * FROM scorm_tracking    378             array(
'integer',
'integer',
'integer'),
   379             array($a_user_id,$a_sco_id,$this->
getId())
   383         while ($data_rec = 
$ilDB->fetchAssoc($data_set)) {
   393         $ilDB = $DIC->database();
   396         $sco_set = 
$ilDB->queryF(
   398                 SELECT DISTINCT sco_id FROM scorm_tracking    402             array(
'integer',
'integer',
'integer'),
   403             array($this->
getId(),$a_user_id,0)
   407         while ($sco_rec = 
$ilDB->fetchAssoc($sco_set)) {
   408             $data_set = 
$ilDB->queryF(
   410                         SELECT * FROM scorm_tracking    418                 array(
'integer',
'integer',
'integer',
'text',
'text',
'text',
'text'),
   419                 array($this->
getId(),
   423                 "cmi.core.lesson_status",
   424                 "cmi.core.total_time",
   425                 "cmi.core.score.raw")
   428             $score = $time = $status = 
"";
   430             while ($data_rec = 
$ilDB->fetchAssoc($data_set)) {
   431                 switch ($data_rec[
"lvalue"]) {
   432                     case "cmi.core.lesson_status":
   433                         $status = $data_rec[
"rvalue"];
   436                     case "cmi.core.total_time":
   437                         $time = $data_rec[
"rvalue"];
   440                     case "cmi.core.score.raw":
   441                         $score = $data_rec[
"rvalue"];
   445             $sc_item = 
new ilSCORMItem((
int) $sco_rec[
"sco_id"]);
   446             $data[] = array(
"sco_id" => (
int) $sco_rec[
"sco_id"], 
"title" => $sc_item->getTitle(),
   447             "score" => $score, 
"time" => $time, 
"status" => $status);
   449         return (array) 
$data;
   455         $ilDB = $DIC->database();
   458         $user_set = 
$ilDB->queryF(
   460                 SELECT DISTINCT user_id FROM scorm_tracking    463             array(
'integer',
'integer'),
   464             array($this->
getId(),$a_sco_id)
   468         while ($user_rec = 
$ilDB->fetchAssoc($user_set)) {
   469             $data_set = 
$ilDB->queryF(
   471                     SELECT * FROM scorm_tracking    478                 array(
'integer',
'integer',
'integer',
'text',
'text',
'text'),
   479                 array($this->
getId(),
   481                     $user_rec[
"user_id"],
   482                     "cmi.core.lesson_status",
   483                     "cmi.core.total_time",
   484                     "cmi.core.score.raw")
   487             $score = $time = $status = 
"";
   489             while ($data_rec = 
$ilDB->fetchAssoc($data_set)) {
   490                 switch ($data_rec[
"lvalue"]) {
   491                     case "cmi.core.lesson_status":
   492                         $status = $data_rec[
"rvalue"];
   495                     case "cmi.core.total_time":
   496                         $time = $data_rec[
"rvalue"];
   499                     case "cmi.core.score.raw":
   500                         $score = $data_rec[
"rvalue"];
   505             $data[] = array(
"user_id" => $user_rec[
"user_id"],
   506                     "score" => $score, 
"time" => $time, 
"status" => $status);
   519         $ilDB = $DIC->database();
   520         $ilUser = $DIC->user();
   522         $allowExportPrivacy = $privacy->enabledExportSCORM();
   525         $query = 
'SELECT * FROM sahs_user WHERE obj_id = %s';
   526         if (count($a_users) > 0) {
   527             $query .= 
' AND ' . 
$ilDB->in(
'user_id', $a_users, 
false, 
'integer');
   532             array($this->
getId())
   535             $csv = $csv . 
$data[
"obj_id"]
   537                 . 
";" . 
$data[
"module_version"]
   539                 . 
";\"" . $data[
"last_access"] . 
"\""   541                 . 
";" . $data[
"package_attempts"]
   542                 . 
";" . $data[
"percentage_completed"]
   543                 . 
";" . $data[
"sco_total_time_sec"]
   548         $header = 
"LearningModuleId;LearningModuleTitle;LearningModuleVersion;" . str_replace(
',', 
';', $udh[
"cols"]) . 
";"   549                 . 
"LastAccess;Status;Attempts;percentageCompletedSCOs;SumTotal_timeSeconds\n";
   557         $ilDB = $DIC->database();
   558         $ilUser = $DIC->user();
   565         $fhandle = fopen($a_file, 
"r");
   568         $fields = fgetcsv($fhandle, 2 ** 16, 
';');
   572         switch ($fields[0]) {
   574             case "SCO-Identifier":
   578             case "LearningModuleId":
   590         $ilDB = $DIC->database();
   591         $ilUser = $DIC->user();
   594         $collection = $olp->getCollectionInstance();
   596             $scos = $collection->getItems();
   599         $fhandle = fopen($a_file, 
"r");
   601         $obj_id = $this->getID();
   602         $fields = fgetcsv($fhandle, 2 ** 16, 
';');
   604         $usersToDelete = array();
   605         while (($csv_rows = fgetcsv($fhandle, 2 ** 16, 
";")) !== 
false) {
   607             $data = array_combine($fields, $csv_rows);
   609             if (isset(
$data[
"Login"])) {
   612             if (isset(
$data[
"login"])) {
   616             if (isset(
$data[
"user"]) && is_numeric(
$data[
"user"])) {
   622                 if (isset(
$data[
'LastAccess']) && 
$data[
'LastAccess']) {
   624                 } elseif (isset(
$data[
'Date']) && 
$data[
'Date']) {
   630                 if (isset(
$data[
"Status"])) {
   631                     if (is_int(
$data[
"Status"])) {
   632                         $status = 
$data[
"Status"];
   633                     } elseif (
$data[
"Status"] == 
"0" || 
$data[
"Status"] == 
"1" || 
$data[
"Status"] == 
"2" || 
$data[
"Status"] == 
"3") {
   645                 if (isset(
$data[
"Attempts"])) {
   646                     $attempts = (
int) 
$data[
"Attempts"];
   649                 $percentage_completed = 0;
   651                     $percentage_completed = 100;
   653                 if (isset(
$data[
'percentageCompletedSCOs'])) {
   654                     $percentage_completed = (
int) 
$data[
'percentageCompletedSCOs'];
   657                 $sco_total_time_sec = null;
   658                 if (isset(
$data[
'SumTotal_timeSeconds'])) {
   659                     $sco_total_time_sec = (
int) 
$data[
'SumTotal_timeSeconds'];
   670                     foreach ($scos as $sco_id) {
   671                         $statement = 
$ilDB->queryF(
   673                                                         SELECT * FROM scorm_tracking    678                             array(
'integer',
'integer',
'text',
'integer'),
   679                             array(
$user_id, $sco_id, 
'cmi.core.lesson_status',$obj_id)
   681                         if (
$ilDB->numRows($statement) > 0) {
   685                                     'rvalue' => array(
'clob', 
'completed'),
   686                                     'c_timestamp' => array(
'timestamp', $last_access?->format(
'Y-m-d H:i:s'))
   689                                     'user_id' => array(
'integer', 
$user_id),
   690                                     'sco_id' => array(
'integer', $sco_id),
   691                                     'lvalue' => array(
'text', 
'cmi.core.lesson_status'),
   692                                     'obj_id' => array(
'integer', $obj_id)
   696                             $ilDB->insert(
'scorm_tracking', array(
   697                                 'obj_id' => array(
'integer', $obj_id),
   698                                 'user_id' => array(
'integer', 
$user_id),
   699                                 'sco_id' => array(
'integer', $sco_id),
   700                                 'lvalue' => array(
'text', 
'cmi.core.lesson_status'),
   701                                 'rvalue' => array(
'clob', 
'completed'),
   702                                 'c_timestamp' => array(
'timestamp', $last_access?->format(
'Y-m-d H:i:s'))
   712         if (count($usersToDelete) > 0) {
   723         string $maybe_datetime,
   728         if ($maybe_datetime === 
'0000-00-00 00:00:00' || $maybe_datetime === 
'0000-00-00') {
   733             $parsed_date = DateTimeImmutable::createFromFormat($format, $maybe_datetime);
   734             if ($parsed_date !== 
false) {
   748         ?
int $attempts = null,
   749         ?
int $percentage_completed = null,
   750         ?
int $sco_total_time_sec = null
   753         $ilDB = $DIC->database();
   754         $statement = 
$ilDB->queryF(
   755             'SELECT * FROM sahs_user WHERE obj_id = %s AND user_id = %s',
   756             array(
'integer',
'integer'),
   757             array($this->getID(),$user_id)
   759         if (
$ilDB->numRows($statement) > 0) {
   763                     'last_access' => array(
'timestamp', $last_access?->format(
'Y-m-d H:i:s')),
   764                     'status' => array(
'integer', $status),
   765                     'package_attempts' => array(
'integer', $attempts),
   766                     'percentage_completed' => array(
'integer', $percentage_completed),
   767                     'sco_total_time_sec' => array(
'integer', $sco_total_time_sec)
   770                     'obj_id' => array(
'integer', $this->getID()),
   771                     'user_id' => array(
'integer', $user_id)
   775             $ilDB->insert(
'sahs_user', array(
   776                 'obj_id' => array(
'integer', $this->getID()),
   777                 'user_id' => array(
'integer', $user_id),
   778                 'last_access' => array(
'timestamp', $last_access?->format(
'Y-m-d H:i:s')),
   779                 'status' => array(
'integer', $status),
   780                 'package_attempts' => array(
'integer', $attempts),
   781                 'percentage_completed' => array(
'integer', $percentage_completed),
   782                 'sco_total_time_sec' => array(
'integer', $sco_total_time_sec)
   790         ilChangeEvent::_recordReadEvent(
"sahs", $DIC->http()->wrapper()->query()->retrieve(
'ref_id', $DIC->refinery()->kindlyTo()->int()), $this->getID(), 
$user_id, 
false, $attempts, $sco_total_time_sec);
   801         $parts = explode(
'_', $il_id);
   803         if (!count((array) 
$parts)) {
   806         if (!isset($parts[2]) or !isset($parts[3])) {
   809         if ($parts[2] != 
$ilSetting->get(
'inst_id', $parts[2])) {
   812         return (
int) $parts[3];
   821         $ilDB = $DIC->database();
   822         $ilUser = $DIC->user();
   823         $lng = $DIC->language();
   826         $fhandle = fopen($a_file, 
"r");
   828         $fields = fgetcsv($fhandle, 2 ** 16, 
';');
   830         $a_last_access = array();
   832         $a_package_attempts = array();
   833         $a_module_version = array();
   834         while (($csv_rows = fgetcsv($fhandle, 2 ** 16, 
";")) !== 
false) {
   835             $data = array_combine($fields, $csv_rows);
   836             if (
$data[
'Userid']) {
   850             if (
$data[
'Scoid']) {
   861             foreach ([
$lng->
txt(
"c_timestamp"), 
'Timestamp'] as $key) {
   862                 if (!empty(
$data[$key])) {
   869             if (!isset($a_last_access[
$user_id]) || $a_last_access[$user_id] < $c_timestamp) {
   870                 $a_last_access[
$user_id] = $c_timestamp;
   876             if (!
$data[
'Value']) {
   880             if (
$data[
'Key'] === 
"cmi.core.total_time" && 
$data[
'Value'] != 
"") {
   881                 $tarr = explode(
":", 
$data[
'Value']);
   882                 $sec = (
int) $tarr[2] + (
int) $tarr[1] * 60 +
   883                     (
int) substr($tarr[0], strlen($tarr[0]) - 3) * 60 * 60;
   884                 if ($a_time[$user_id]) {
   891             if ($il_sco_id > 0) {
   892                 $statement = 
$ilDB->queryF(
   894                                         SELECT * FROM scorm_tracking    899                     array(
'integer', 
'integer', 
'text', 
'integer'),
   900                     array($user_id, $il_sco_id, 
$data[
'Key'], $this->getID())
   902                 if (
$ilDB->numRows($statement) > 0) {
   906                             'rvalue' => array(
'clob', 
$data[
'Value']),
   907                             'c_timestamp' => array(
'timestamp', $c_timestamp)
   910                             'user_id' => array(
'integer', $user_id),
   911                             'sco_id' => array(
'integer', $il_sco_id),
   912                             'lvalue' => array(
'text', 
$data[
'Key']),
   913                             'obj_id' => array(
'integer', $this->
getId())
   917                     $ilDB->insert(
'scorm_tracking', array(
   918                         'obj_id' => array(
'integer', $this->
getId()),
   919                         'user_id' => array(
'integer', $user_id),
   920                         'sco_id' => array(
'integer', $il_sco_id),
   921                         'lvalue' => array(
'text', 
$data[
'Key']),
   922                         'rvalue' => array(
'clob', 
$data[
'Value']),
   923                         'c_timestamp' => array(
'timestamp', 
$data[
'Timestamp'])
   928             if ($il_sco_id == 0) {
   929                 if (
$data[
'Key'] === 
"package_attempts") {
   934             if (!in_array($user_id, $users)) {
   942             if ($a_package_attempts[$user_id]) {
   943                 $attempts = $a_package_attempts[
$user_id];
   947             $sco_total_time_sec = null;
   948             if ($a_time[$user_id]) {
   949                 $sco_total_time_sec = $a_time[
$user_id];
   952             if (isset($a_last_access[$user_id])) {
   953                 $last_access = $a_last_access[
$user_id];
   960             $this->
importSuccessForSahsUser($user_id, $last_access, $status, $attempts, $percentage_completed, $sco_total_time_sec);
   973         $ilDB = $DIC->database();
   974         $ilUser = $DIC->user();
   976         $val_set = 
$ilDB->queryF(
   977             'SELECT * FROM usr_data WHERE(login=%s)',
   981         $val_rec = 
$ilDB->fetchAssoc($val_set);
   983         if (count($val_rec) > 0) {
   984             return (
int) $val_rec[
'usr_id'];
   996         $ilDB = $DIC->database();
   997         $ilUser = $DIC->user();
  1000         if ($a_referrer == 
"0") {
  1004         $val_set = 
$ilDB->queryF(
  1006                 SELECT obj_id FROM sc_item,scorm_tree   1007                 WHERE (obj_id = child   1008                 AND identifierref = %s   1010             array(
'text',
'integer'),
  1011             array($a_referrer,$this->getID())
  1013         $val_rec = 
$ilDB->fetchAssoc($val_set);
  1015         return (
int) $val_rec[
"obj_id"];
  1024         $ilDB = $DIC->database();
  1025         $ilUser = $DIC->user();
  1027         $val_set = 
$ilDB->queryF(
  1028             'SELECT usr_id FROM usr_data WHERE(email=%s)',
  1032         $val_rec = 
$ilDB->fetchAssoc($val_set);
  1035         return (
int) $val_rec[
"usr_id"];
  1059         $ilDB = $DIC->database();
  1063         $val_set = 
$ilDB->queryF(
  1065                 SELECT scorm_object.obj_id,  1067                                 scorm_object.c_type,  1068                                 scorm_object.slm_id,  1069                                 scorm_object.obj_id scoid   1070                 FROM scorm_object,sc_item,sc_resource   1071                 WHERE(scorm_object.slm_id = %s  1072                 AND scorm_object.obj_id = sc_item.obj_id   1073                 AND sc_item.identifierref = sc_resource.import_id   1074                 AND sc_resource.scormtype = %s)  1075                 GROUP BY scorm_object.obj_id,  1077                                 scorm_object.c_type,  1078                                 scorm_object.slm_id,  1079                                 scorm_object.obj_id ',
  1080             array(
'integer', 
'text'),
  1084         while ($val_rec = 
$ilDB->fetchAssoc($val_set)) {
  1085             $scos[] = $val_rec[
'scoid'];
  1098     public static function _getStatusForUser(
int $a_id, 
int $a_user, array $a_allScoIds, 
bool $a_numerical = 
false): bool
  1101         $ilDB = $DIC->database();
  1102         $lng = $DIC->language();
  1104         $scos = $a_allScoIds;
  1106         $scos_c = implode(
',', $scos);
  1108         $val_set = 
$ilDB->queryF(
  1110                 SELECT * FROM scorm_tracking   1113                 AND ' . 
$ilDB->in(
'sco_id', $scos, 
false, 
'integer') . 
'  1114                 AND ((lvalue = %s AND ' . 
$ilDB->like(
'rvalue', 
'clob', 
'completed') . 
')   1115                         OR (lvalue = %s AND ' . 
$ilDB->like(
'rvalue', 
'clob', 
'passed') . 
')))',
  1116             array(
'integer',
'integer',
'text',
'text'),
  1117             array($a_user,$a_id,
'cmi.core.lesson_status', 
'cmi.core.lesson_status')
  1119         while ($val_rec = 
$ilDB->fetchAssoc($val_set)) {
  1120             $key = array_search($val_rec[
'sco_id'], $scos);
  1123         $completion = 
false;
  1125         if (count($scos) == 0) {
  1126             $completion = ($a_numerical === 
true) ? 
true : 
$lng->
txt(
"cont_complete");
  1128         if (count($scos) > 0) {
  1129             $completion = ($a_numerical === 
true) ? 
false : 
$lng->
txt(
"cont_incomplete");
  1151         $ilDB = $DIC->database();
  1155         $val_set = 
$ilDB->queryF(
  1157                 SELECT scorm_object.obj_id,  1159                                 scorm_object.c_type,  1160                                 scorm_object.slm_id,  1161                                 scorm_object.obj_id scoid   1162                 FROM scorm_object, sc_item,sc_resource   1163                 WHERE(scorm_object.slm_id = %s   1164                         AND scorm_object.obj_id = sc_item.obj_id   1165                         AND sc_item.identifierref = sc_resource.import_id   1166                         AND sc_resource.scormtype = %s )  1167                 GROUP BY scorm_object.obj_id,  1169                 scorm_object.c_type,  1170                 scorm_object.slm_id,  1171                 scorm_object.obj_id',
  1172             array(
'integer',
'text'),
  1173             array($this->
getId(),
'sco')
  1176         while ($val_rec = 
$ilDB->fetchAssoc($val_set)) {
  1177             $scos[] = $val_rec[
'scoid'];
  1182     public function getStatusForUser(
int $a_user, array $a_allScoIds, 
bool $a_numerical = 
false): bool
  1185         $ilDB = $DIC->database();
  1186         $scos = $a_allScoIds;
  1189         $scos_c = implode(
',', $scos);
  1191         $val_set = 
$ilDB->queryF(
  1193                 SELECT sco_id FROM scorm_tracking   1196                         AND ' . 
$ilDB->in(
'sco_id', $scos, 
false, 
'integer') . 
'  1197                  AND ((lvalue = %s AND ' . 
$ilDB->like(
'rvalue', 
'clob', 
'completed') . 
') OR (lvalue =  %s AND ' . 
$ilDB->like(
'rvalue', 
'clob', 
'passed') . 
') ) )',
  1198             array(
'integer',
'integer',
'text',
'text',),
  1199             array($a_user,$this->getID(),
'cmi.core.lesson_status',
'cmi.core.lesson_status')
  1201         while ($val_rec = 
$ilDB->fetchAssoc($val_set)) {
  1202             $key = array_search($val_rec[
'sco_id'], $scos);
  1206         if (count($scos) == 0) {
  1207             $completion = ($a_numerical === 
true) ? 
true : $this->
lng->txt(
"cont_complete");
  1209         if (count($scos) > 0) {
  1210             $completion = ($a_numerical === 
true) ? 
false : $this->
lng->txt(
"cont_incomplete");
  1226         $ilDB = $DIC->database();
  1229             'DELETE FROM scorm_tracking WHERE user_id = %s',
  1234             'DELETE FROM sahs_user WHERE user_id = %s',
  1243         $ilDB = $DIC->database();
  1245         $retAr = array(
"raw" => null, 
"max" => null, 
"scaled" => null);
  1246         $val_set = 
$ilDB->queryF(
  1248                         SELECT lvalue, rvalue FROM scorm_tracking   1251                         AND (lvalue = 'cmi.core.score.raw' OR lvalue = 'cmi.core.score.max')",
  1252             array(
'integer', 
'integer'),
  1253             array($a_item_id, $a_user_id)
  1255         while ($val_rec = 
$ilDB->fetchAssoc($val_set)) {
  1256             if ($val_rec[
'lvalue'] === 
"cmi.core.score.raw") {
  1257                 $retAr[
"raw"] = $val_rec[
"rvalue"];
  1259             if ($val_rec[
'lvalue'] === 
"cmi.core.score.max") {
  1260                 $retAr[
"max"] = $val_rec[
"rvalue"];
  1263         if ($retAr[
"raw"] != null && $retAr[
"max"] != null) {
  1264             $retAr[
"scaled"] = ($retAr[
"raw"] / $retAr[
"max"]);
  1273         $ilDB = $DIC->database();
  1274         $val_set = 
$ilDB->queryF(
  1275             'SELECT last_visited FROM sahs_user WHERE obj_id = %s AND user_id = %s',
  1276             array(
'integer',
'integer'),
  1277             array($this->getID(),$user_id)
  1279         while ($val_rec = 
$ilDB->fetchAssoc($val_set)) {
  1280             if ($val_rec[
"last_visited"] != null) {
  1281                 return "" . $val_rec[
"last_visited"];
  1290         $ilDB = $DIC->database();
  1294         foreach ($a_users as $usr) {
  1298                                 DELETE FROM scorm_tracking  1301                 array(
'integer', 
'integer'),
  1302                 array(
$user, $this->getID())
  1307                                 DELETE FROM sahs_user  1310                 array(
'integer', 
'integer'),
  1311                 array(
$user, $this->getID())
 const LP_STATUS_COMPLETED_NUM
 
static _getStatusForUser(int $a_id, int $a_user, array $a_allScoIds, bool $a_numerical=false)
Get the status of a SCORM module for a given user. 
 
importSuccess(string $a_file)
 
static _getCourseCompletionForUser(int $a_id, int $a_user)
Get the completion of a SCORM module for a given user. 
 
getNodeData(int $a_node_id, ?int $a_tree_pk=null)
get all information of a node. 
 
get_user_id(string $a_login)
 
getUserIdEmail(string $a_mail)
assumes that only one account exists for a mailadress 
 
getAttemptsForUsers()
Get attempts for all users. 
 
deleteTrackingDataOfUsers(array $a_users)
 
__construct(int $a_id=0, bool $a_call_by_reference=true)
Constructor. 
 
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
 
importTrackingData(string $a_file)
 
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
 
kindlyToDateTime(string $format, string $maybe_datetime, ?DateTimeImmutable $default=null)
 
const LP_STATUS_NOT_ATTEMPTED
 
static _removeTrackingDataForUser(int $user_id)
to be called from IlObjUser 
 
getTrackedItems()
get all tracked items of current user 
 
static _lookupPercentage(int $a_obj_id, int $a_user_id)
Lookup percentage. 
 
const LP_STATUS_IN_PROGRESS_NUM
 
getCourseCompletionForUser(int $a_user)
 
loadLanguageModule(string $a_module)
Load language module. 
 
static deliverData(string $a_data, string $a_filename, string $mime="application/octet-stream")
 
static _getTrackingItems(int $a_obj_id)
get all tracking items of scorm object 
 
getModuleVersionForUser(int $a_user_id)
get module version that tracking data for a user was recorded on 
 
const LP_STATUS_IN_PROGRESS
 
getStatusForUser(int $a_user, array $a_allScoIds, bool $a_numerical=false)
 
static _getScoresForUser(int $a_item_id, int $a_user_id)
 
static _enabledLearningProgress()
 
lookupSCOId(string $a_referrer)
resolves manifest SCOID to internal ILIAS SCO ID 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static userDataArrayForExport(int $user, bool $b_allowExportPrivacy=false)
 
static _recordReadEvent(string $a_type, int $a_ref_id, int $obj_id, int $usr_id, bool $isCatchupWriteEvents=true, $a_ext_rc=null, $a_ext_time=null)
 
static userDataHeaderForExport()
 
getTrackingDataAgg(int $a_user_id)
 
static _refreshStatus(int $a_obj_id, ?array $a_users=null)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
sendExportFile(string $a_header, string $a_content)
send export file to browser 
 
getLastVisited(int $user_id)
 
getTrackingDataPerUser(int $a_sco_id, int $a_user_id)
Get tracking data per user. 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static _lookupStatus(int $a_obj_id, int $a_user_id, bool $a_create=true)
Lookup status. 
 
static _lookupReadEvents($obj_id, $usr_id=null)
Reads all read events which occured on the object. 
 
importRaw(string $a_file)
Import raw data. 
 
getModuleVersionForUsers()
Get module version for users. 
 
foreach($mandatory_scripts as $file) $timestamp
 
const LP_STATUS_NOT_ATTEMPTED_NUM
 
getDataDirectory(?string $mode="filesystem")
get data directory of lm 
 
static __readStatus(int $a_obj_id, int $user_id)
PhpInconsistentReturnPointsInspection 
 
exportSelected(bool $a_all, array $a_users=array())
Export selected user tracking data  ilObjUser $ilUser. 
 
setLearningProgressSettingsAtUpload()
set settings for learning progress determination per default at upload 
 
__construct(Container $dic, ilPlugin $plugin)
 
getTrackingDataAggSco(int $a_sco_id)
 
readObject()
read manifest file 
 
getTrackedUsers(string $a_search)
Return the last access timestamp for a given user. 
 
static _deleteReadEventsForUsers(int $a_obj_id, array $a_user_ids)
 
importSuccessForSahsUser(int $user_id, ?DateTimeImmutable $last_access, int $status, ?int $attempts=null, ?int $percentage_completed=null, ?int $sco_total_time_sec=null)
 
getSubTree(array $a_node, bool $a_with_data=true, array $a_type=[])
get all nodes in the subtree under specified node 
 
getAttemptsForUser(int $a_user_id)
get number of attempts for a certain user and package 
 
static getInstance(int $obj_id)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static _getAllScoIds(int $a_id)
Get an array of id's for all Sco's in the module. 
 
parseUserId(string $il_id)
Parse il_usr_123_6 id. 
 
Class ilObjSCORMLearningModule. 
 
const LP_STATUS_FAILED_NUM
 
static _updateStatus(int $a_obj_id, int $a_usr_id, ?object $a_obj=null, bool $a_percentage=false, bool $a_force_raise=false)