public function persistCMIData($userId = null, $packageId, $defaultLessonMode, $comments, $interactions, $objectives, $data = null)
 {
     global $ilLog;
     if ($defaultLessonMode == "browse") {
         return;
     }
     $jsMode = strpos($_SERVER['HTTP_ACCEPT'], 'text/javascript') !== false;
     $data = json_decode(is_string($data) ? $data : file_get_contents('php://input'));
     $ilLog->write("dataTo_setCMIData: " . file_get_contents('php://input'));
     if (!$data) {
         return;
     }
     if ($userId == null) {
         $userId = (int) $data->p;
         self::checkIfAllowed($packageId, $userId, $data->hash);
         //			header('Access-Control-Allow-Origin: http://localhost:50012');//just for tests - not for release UK
     }
     $return = array();
     $return = ilSCORM2004StoreData::setCMIData($userId, $packageId, $data, $comments, $interactions, $objectives);
     //$new_global_status=ilSCORM2004StoreData::setGlobalObjectivesAndGetGlobalStatus($userId, $packageId, $data);
     ilSCORM2004StoreData::setGlobalObjectives($userId, $packageId, $data);
     $new_global_status = $data->now_global_status;
     $return["new_global_status"] = $new_global_status;
     ilSCORM2004StoreData::syncGlobalStatus($userId, $packageId, $data, $new_global_status);
     $ilLog->write("SCORM: return of persistCMIData: " . json_encode($return));
     if ($jsMode) {
         header('Content-Type: text/javascript; charset=UTF-8');
         print json_encode($return);
     } else {
         header('Content-Type: text/html; charset=UTF-8');
         print var_export($return, true);
     }
 }