/**
  * Export selected user tracking data
  * @global ilDB $ilDB
  * @global ilObjUser $ilUser
  * @param bool $a_all
  * @param array $a_users
  */
 public function exportSelected($a_all, $a_users = array())
 {
     global $ilDB, $ilUser;
     include_once './Modules/ScormAicc/classes/class.ilSCORMTrackingItems.php';
     include_once "./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php";
     include_once './Services/PrivacySecurity/classes/class.ilPrivacySettings.php';
     $privacy = ilPrivacySettings::_getInstance();
     $allowExportPrivacy = $privacy->enabledExportSCORM();
     $csv = "";
     $query = 'SELECT * FROM sahs_user WHERE obj_id = %s';
     if (count($a_users) > 0) {
         $query .= ' AND ' . $ilDB->in('user_id', $a_users, false, 'integer');
     }
     $res = $ilDB->queryF($query, array('integer'), array($this->getId()));
     while ($data = $ilDB->fetchAssoc($res)) {
         $csv = $csv . $data["obj_id"] . ";\"" . $this->getTitle() . "\"" . ";" . $data["module_version"] . ";\"" . implode("\";\"", ilSCORMTrackingItems::userDataArrayForExport($data["user_id"], $allowExportPrivacy)) . "\"" . ";\"" . $data["last_access"] . "\"" . ";\"" . ilLearningProgressBaseGUI::__readStatus($data["obj_id"], $data["user_id"]) . "\"" . ";" . $data["package_attempts"] . ";" . $data["percentage_completed"] . ";" . $data["sco_total_time_sec"] . "\n";
     }
     $udh = ilSCORMTrackingItems::userDataHeaderForExport();
     $header = "LearningModuleId;LearningModuleTitle;LearningModuleVersion;" . str_replace(',', ';', $udh["cols"]) . ";" . "LastAccess;Status;Attempts;percentageCompletedSCOs;SumTotal_timeSeconds\n";
     $this->sendExportFile($header, $csv);
 }
 function getItems()
 {
     global $lng;
     $this->determineOffsetAndOrder();
     switch ($this->report) {
         case "exportSelectedCore":
             $tr_data = ilSCORMTrackingItems::exportSelectedCore($this->userSelected, $this->scosSelected, $this->bySCO, $this->allowExportPrivacy);
             break;
         case "exportSelectedRaw":
             $tr_data = ilSCORMTrackingItems::exportSelectedRaw($this->userSelected, $this->scosSelected, $this->bySCO, $this->allowExportPrivacy);
             break;
         case "exportSelectedInteractions":
             $tr_data = ilSCORMTrackingItems::exportSelectedInteractions($this->userSelected, $this->scosSelected, $this->bySCO, $this->allowExportPrivacy);
             break;
         case "exportSelectedObjectives":
             $tr_data = ilSCORMTrackingItems::exportSelectedObjectives($this->userSelected, $this->scosSelected, $this->bySCO, $this->allowExportPrivacy);
             break;
         case "tracInteractionItem":
             $tr_data = ilSCORMTrackingItems::tracInteractionItem($this->userSelected, $this->scosSelected, $this->bySCO, $this->allowExportPrivacy);
             break;
         case "tracInteractionUser":
             $tr_data = ilSCORMTrackingItems::tracInteractionUser($this->userSelected, $this->scosSelected, $this->bySCO, $this->allowExportPrivacy);
             break;
         case "tracInteractionUserAnswers":
             $tr_data = ilSCORMTrackingItems::tracInteractionUserAnswers($this->userSelected, $this->scosSelected, $this->bySCO, $this->allowExportPrivacy);
             break;
         case "exportSelectedSuccess":
             $tr_data = ilSCORMTrackingItems::exportSelectedSuccess($this->userSelected, $this->allowExportPrivacy);
             break;
     }
     $this->setMaxCount($tr_data["cnt"]);
     if (ilUtil::stripSlashes($this->getOrderField()) != "") {
         include_once "Services/Utilities/classes/class.ilStr.php";
         $tr_data = ilUtil::stableSortArray($tr_data, ilUtil::stripSlashes($this->getOrderField()), ilUtil::stripSlashes($this->getOrderDirection()));
     }
     $this->setData($tr_data);
 }