public function scormPlayerUnload()
 {
     global $ilUser;
     $data = json_decode(is_string($data) ? $data : file_get_contents('php://input'));
     if ($data && is_string($data) && $data != "") {
         $this->set_last_visited($this->packageId, $this->userId, $data);
     }
     include_once "./Modules/Scorm2004/classes/class.ilSCORM2004Tracking.php";
     ilSCORM2004Tracking::_syncReadEvent($this->packageId, $this->userId, "sahs", $this->ref_id);
     header('Content-Type: text/plain; charset=UTF-8');
     print "";
 }
 public function syncGlobalStatus($userId, $packageId, $data, $new_global_status, $time_from_lms)
 {
     global $ilDB, $ilLog;
     $saved_global_status = $data->saved_global_status;
     $ilLog->write("saved_global_status=" . $saved_global_status);
     //update percentage_completed, sco_total_time_sec,status in sahs_user
     $totalTime = (int) $data->totalTimeCentisec;
     $totalTime = round($totalTime / 100);
     $ilDB->queryF('UPDATE sahs_user SET sco_total_time_sec=%s, status=%s, percentage_completed=%s WHERE obj_id = %s AND user_id = %s', array('integer', 'integer', 'integer', 'integer', 'integer'), array($totalTime, $new_global_status, $data->percentageCompleted, $packageId, $userId));
     self::ensureObjectDataCacheExistence();
     global $ilObjDataCache;
     // update learning progress
     if ($new_global_status != null) {
         //could only happen when synchronising from SCORM Offline Player
         include_once "./Services/Tracking/classes/class.ilObjUserTracking.php";
         include_once "./Services/Tracking/classes/class.ilLPStatus.php";
         ilLPStatus::writeStatus($packageId, $userId, $new_global_status, $data->percentageCompleted);
         //			here put code for soap to MaxCMS e.g. when if($saved_global_status != $new_global_status)
     }
     // sync access number and time in read event table
     if ($time_from_lms == false) {
         include_once "./Modules/Scorm2004/classes/class.ilSCORM2004Tracking.php";
         ilSCORM2004Tracking::_syncReadEvent($packageId, $userId, "sahs", (int) $_GET['ref_id'], $time_from_lms);
     }
     //end sync access number and time in read event table
     return true;
 }