4require_once 
'./Modules/Test/classes/inc.AssessmentConstants.php';
 
    5require_once 
'Modules/TestQuestionPool/classes/class.assQuestion.php';
 
   48        $this->test_obj =&$a_test_obj;
 
   53        $this->mode = $a_mode;
 
   56        $this->inst_id = IL_INST_ID;
 
   59        $this->export_dir = $this->test_obj->getExportDirectory();
 
   60        switch ($this->mode) {
 
   62                $this->subdir = $date . 
"__" . $this->inst_id . 
"__" .
 
   63                    "tst__results_" . $this->test_obj->getId();
 
   66                $this->subdir = $date . 
"__" . $this->inst_id . 
"__" .
 
   67                    "test__aggregated__results_" . $this->test_obj->getId();
 
   70                $this->subdir = $date . 
"__" . $this->inst_id . 
"__" .
 
   71                    "tst" . 
"_" . $this->test_obj->getId();
 
   72                $this->filename = $this->subdir . 
".xml";
 
   73                $this->resultsfile = $date . 
"__" . $this->inst_id . 
"__" .
 
   74                    "results" . 
"_" . $this->test_obj->getId() . 
".xml";
 
   75                $this->qti_filename = $date . 
"__" . $this->inst_id . 
"__" .
 
   76                    "qti" . 
"_" . $this->test_obj->getId() . 
".xml";
 
   79        $this->filename = $this->subdir . 
"." . $this->
getExtension();
 
   95        $this->resultExportingEnabledForTestExport = $resultExprtingEnabledForTestExport;
 
  100        switch ($this->mode) {
 
  122        switch ($this->mode) {
 
  141        $expDir = $this->test_obj->getExportDirectory();
 
  144        $this->test_obj->createExportDirectory();
 
  145        include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  148        include_once 
'./Services/Logging/classes/class.ilLog.php';
 
  149        $expLog = 
new ilLog($expDir, 
"export.log");
 
  151        $expLog->setLogFormat(
"");
 
  152        $expLog->write(
date(
"[y-m-d H:i:s] ") . 
"Start Export Of Results");
 
  155        $file = fopen($this->export_dir . 
"/" . $this->filename, 
"w");
 
  160        @copy($excelfile, $this->export_dir . 
"/" . str_replace($this->
getExtension(), 
"xlsx", $this->filename));
 
  163        $expLog->write(
date(
"[y-m-d H:i:s] ") . 
"Finished Export of Results");
 
  175        $data = $this->test_obj->getAggregatedResultsData();
 
  177        require_once 
'Modules/TestQuestionPool/classes/class.ilAssExcelFormatHelper.php';
 
  179        $worksheet->addSheet($this->lng->txt(
'tst_results_aggregated'));
 
  189        foreach (
$data[
'overview'] as 
$key => $value) {
 
  199        $worksheet->setCell(
$row, $col++, $this->lng->txt(
'question_id'));
 
  200        $worksheet->setCell(
$row, $col++, $this->lng->txt(
'question_title'));
 
  201        $worksheet->setCell(
$row, $col++, $this->lng->txt(
'average_reached_points'));
 
  204        $worksheet->setCell(
$row, $col++, $this->lng->txt(
'number_of_answers'));
 
  209        foreach (
$data[
'questions'] as 
$key => $value) {
 
  227            return $excelfile . 
'.xlsx';
 
  238        $data = $this->test_obj->getAggregatedResultsData();
 
  240        array_push(
$rows, array(
 
  241            $this->lng->txt(
"result"),
 
  242            $this->lng->txt(
"value")
 
  244        foreach (
$data[
"overview"] as 
$key => $value) {
 
  245            array_push(
$rows, array(
 
  250        array_push(
$rows, array(
 
  251            $this->lng->txt(
"question_id"),
 
  252            $this->lng->txt(
"question_title"),
 
  253            $this->lng->txt(
"average_reached_points"),
 
  254            $this->lng->txt(
"points"),
 
  255            $this->lng->txt(
"percentage"),
 
  256            $this->lng->txt(
"number_of_answers")
 
  258        foreach (
$data[
"questions"] as 
$key => $value) {
 
  259            array_push(
$rows, array(
 
  270        foreach (
$rows as $evalrow) {
 
  271            $csvrow =&$this->test_obj->processCSVRow($evalrow, 
true, $separator);
 
  272            $csv .= join($csvrow, $separator) . 
"\n";
 
  292    public function exportToExcel($deliver = 
true, $filterby = 
"", $filtertext = 
"", $passedonly = 
false)
 
  294        if (strcmp($this->mode, 
"aggregated") == 0) {
 
  298        require_once 
'Modules/TestQuestionPool/classes/class.ilAssExcelFormatHelper.php';
 
  301        $worksheet->addSheet($this->lng->txt(
'tst_results'));
 
  303        $additionalFields = $this->test_obj->getEvaluationAdditionalFields();
 
  308        if ($this->test_obj->getAnonymity()) {
 
  315        if (count($additionalFields)) {
 
  316            foreach ($additionalFields as $fieldname) {
 
  321        $worksheet->setFormattedExcelTitle(
$worksheet->getColumnCoord($col++) . 
$row, $this->lng->txt(
'tst_stat_result_resultspoints'));
 
  323        $worksheet->setFormattedExcelTitle(
$worksheet->getColumnCoord($col++) . 
$row, $this->lng->txt(
'tst_stat_result_resultsmarks'));
 
  325        if ($this->test_obj->getECTSOutput()) {
 
  329        $worksheet->setFormattedExcelTitle(
$worksheet->getColumnCoord($col++) . 
$row, $this->lng->txt(
'tst_stat_result_qworkedthrough'));
 
  330        $worksheet->setFormattedExcelTitle(
$worksheet->getColumnCoord($col++) . 
$row, $this->lng->txt(
'tst_stat_result_qmax'));
 
  331        $worksheet->setFormattedExcelTitle(
$worksheet->getColumnCoord($col++) . 
$row, $this->lng->txt(
'tst_stat_result_pworkedthrough'));
 
  332        $worksheet->setFormattedExcelTitle(
$worksheet->getColumnCoord($col++) . 
$row, $this->lng->txt(
'tst_stat_result_timeofwork'));
 
  333        $worksheet->setFormattedExcelTitle(
$worksheet->getColumnCoord($col++) . 
$row, $this->lng->txt(
'tst_stat_result_atimeofwork'));
 
  334        $worksheet->setFormattedExcelTitle(
$worksheet->getColumnCoord($col++) . 
$row, $this->lng->txt(
'tst_stat_result_firstvisit'));
 
  335        $worksheet->setFormattedExcelTitle(
$worksheet->getColumnCoord($col++) . 
$row, $this->lng->txt(
'tst_stat_result_lastvisit'));
 
  336        $worksheet->setFormattedExcelTitle(
$worksheet->getColumnCoord($col++) . 
$row, $this->lng->txt(
'tst_stat_result_mark_median'));
 
  337        $worksheet->setFormattedExcelTitle(
$worksheet->getColumnCoord($col++) . 
$row, $this->lng->txt(
'tst_stat_result_rank_participant'));
 
  338        $worksheet->setFormattedExcelTitle(
$worksheet->getColumnCoord($col++) . 
$row, $this->lng->txt(
'tst_stat_result_rank_median'));
 
  339        $worksheet->setFormattedExcelTitle(
$worksheet->getColumnCoord($col++) . 
$row, $this->lng->txt(
'tst_stat_result_total_participants'));
 
  340        $worksheet->setFormattedExcelTitle(
$worksheet->getColumnCoord($col++) . 
$row, $this->lng->txt(
'tst_stat_result_median'));
 
  347        $data = $this->test_obj->getCompleteEvaluationData(
true, $filterby, $filtertext);
 
  348        $firstrowwritten = 
false;
 
  350            if ($passedonly && 
$data->getParticipant($active_id)->getPassed() == 
false) {
 
  358            if ($this->test_obj->isRandomTest()) {
 
  362            if ($this->test_obj->getAnonymity()) {
 
  369            if (count($additionalFields)) {
 
  371                foreach ($additionalFields as $fieldname) {
 
  372                    if (strcmp($fieldname, 
'gender') == 0) {
 
  373                        $worksheet->setCell(
$row, $col++, $this->lng->txt(
'gender_' . $userfields[$fieldname]));
 
  384            if ($this->test_obj->getECTSOutput()) {
 
  388            $worksheet->setCell(
$row, $col++, 
$data->getParticipant($active_id)->getQuestionsWorkedThrough());
 
  389            $worksheet->setCell(
$row, $col++, 
$data->getParticipant($active_id)->getNumberOfQuestions());
 
  390            $worksheet->setCell(
$row, $col++, 
$data->getParticipant($active_id)->getQuestionsWorkedThroughInPercent() . 
'%');
 
  392            $time = 
$data->getParticipant($active_id)->getTimeOfWork();
 
  393            $time_seconds = 
$time;
 
  394            $time_hours    = floor($time_seconds/3600);
 
  395            $time_seconds -= $time_hours   * 3600;
 
  396            $time_minutes  = floor($time_seconds/60);
 
  397            $time_seconds -= $time_minutes * 60;
 
  398            $worksheet->setCell(
$row, $col++, 
sprintf(
"%02d:%02d:%02d", $time_hours, $time_minutes, $time_seconds));
 
  399            $time = 
$data->getParticipant($active_id)->getQuestionsWorkedThrough() ? 
$data->getParticipant($active_id)->getTimeOfWork() / 
$data->getParticipant($active_id)->getQuestionsWorkedThrough() : 0;
 
  400            $time_seconds = 
$time;
 
  401            $time_hours    = floor($time_seconds/3600);
 
  402            $time_seconds -= $time_hours   * 3600;
 
  403            $time_minutes  = floor($time_seconds/60);
 
  404            $time_seconds -= $time_minutes * 60;
 
  405            $worksheet->setCell(
$row, $col++, 
sprintf(
"%02d:%02d:%02d", $time_hours, $time_minutes, $time_seconds));
 
  409            $median = 
$data->getStatistics()->getStatistics()->median();
 
  410            $pct = 
$data->getParticipant($active_id)->getMaxpoints() ? $median / 
$data->getParticipant($active_id)->getMaxpoints() * 100.0 : 0;
 
  411            $mark = $this->test_obj->mark_schema->getMatchingMark($pct);
 
  412            $mark_short_name = 
"";
 
  414            if (is_object($mark)) {
 
  415                $mark_short_name = $mark->getShortName();
 
  419            $worksheet->setCell(
$row, $col++, 
$data->getStatistics()->getStatistics()->rank(
$data->getParticipant($active_id)->getReached()));
 
  435                if ($finishdate > 0) {
 
  438                        if ($this->test_obj->isRandomTest()) {
 
  443                    if (is_object(
$data->getParticipant($active_id)) && is_array(
$data->getParticipant($active_id)->getQuestions(
$pass))) {
 
  444                        $evaluatedQuestions = 
$data->getParticipant($active_id)->getQuestions(
$pass);
 
  446                        if ($this->test_obj->getShuffleQuestions()) {
 
  449                            $questions = array();
 
  450                            foreach ($this->test_obj->getQuestions() as $qId) {
 
  451                                foreach ($evaluatedQuestions as $evaledQst) {
 
  452                                    if ($evaledQst[
'id'] != $qId) {
 
  456                                    $questions[] = $evaledQst;
 
  460                            $questions = $evaluatedQuestions;
 
  463                        foreach ($questions as $question) {
 
  464                            $question_data = 
$data->getParticipant($active_id)->getPass(
$pass)->getAnsweredQuestionByQuestionId($question[
"id"]);
 
  466                            if ($this->test_obj->isRandomTest()) {
 
  469                                $worksheet->setFormattedExcelTitle(
$worksheet->getColumnCoord($col) . (
$row - 1), preg_replace(
"/<.*?>/", 
"", 
$data->getQuestionTitle($question[
"id"])));
 
  471                                if (
$pass == 0 && !$firstrowwritten) {
 
  477                        $firstrowwritten = 
true;
 
  484        if ($this->test_obj->getExportSettingsSingleChoiceShort() && !$this->test_obj->isRandomTest() && $this->test_obj->hasSingleChoiceQuestions()) {
 
  486            $titles = $this->test_obj->getQuestionTitlesAndIndexes();
 
  487            $positions = array();
 
  491                $positions[
$id] = $pos;
 
  495            $usernames = array();
 
  496            $participantcount = count(
$data->getParticipants());
 
  497            $allusersheet = 
false;
 
  500            $worksheet->addSheet($this->lng->txt(
'eval_all_users'));
 
  505            if (count($additionalFields)) {
 
  506                foreach ($additionalFields as $fieldname) {
 
  507                    if (strcmp($fieldname, 
"matriculation") == 0) {
 
  513            foreach ($titles as 
$title) {
 
  521                if (array_key_exists($username, $usernames)) {
 
  522                    $usernames[$username]++;
 
  523                    $username .= 
" ($usernames[$username])";
 
  525                    $usernames[$username] = 1;
 
  530                if (count($additionalFields)) {
 
  532                    foreach ($additionalFields as $fieldname) {
 
  533                        if (strcmp($fieldname, 
"matriculation") == 0) {
 
  534                            if (strlen($userfields[$fieldname])) {
 
  547                        if (is_object($objQuestion) && strcmp($objQuestion->getQuestionType(), 
'assSingleChoice') == 0) {
 
  548                            $solution = $objQuestion->getSolutionValues($active_id, 
$pass);
 
  549                            $pos = $positions[$question[
"id"]];
 
  550                            $selectedanswer = 
"x";
 
  551                            foreach ($objQuestion->getAnswers() as 
$id => $answer) {
 
  552                                if (strlen($solution[0][
"value1"]) && 
$id == $solution[0][
"value1"]) {
 
  553                                    $selectedanswer = $answer->getAnswertext();
 
  563            if ($this->test_obj->isSingleChoiceTestWithoutShuffle()) {
 
  567                $usernames = array();
 
  568                $allusersheet = 
false;
 
  571                $worksheet->addSheet($this->lng->txt(
'eval_all_users') . 
' (2)');
 
  576                if (count($additionalFields)) {
 
  577                    foreach ($additionalFields as $fieldname) {
 
  578                        if (strcmp($fieldname, 
"matriculation") == 0) {
 
  584                foreach ($titles as 
$title) {
 
  592                    if (array_key_exists($username, $usernames)) {
 
  593                        $usernames[$username]++;
 
  594                        $username .= 
" ($usernames[$username])";
 
  596                        $usernames[$username] = 1;
 
  601                    if (count($additionalFields)) {
 
  603                        foreach ($additionalFields as $fieldname) {
 
  604                            if (strcmp($fieldname, 
"matriculation") == 0) {
 
  605                                if (strlen($userfields[$fieldname])) {
 
  618                            if (is_object($objQuestion) && strcmp($objQuestion->getQuestionType(), 
'assSingleChoice') == 0) {
 
  619                                $solution = $objQuestion->getSolutionValues($active_id, 
$pass);
 
  620                                $pos = $positions[$question[
"aid"]];
 
  621                                $selectedanswer = chr(65+$solution[0][
"value1"]);
 
  631            $usernames = array();
 
  632            $participantcount = count(
$data->getParticipants());
 
  633            $allusersheet = 
false;
 
  640                if (array_key_exists($username, $usernames)) {
 
  641                    $usernames[$username]++;
 
  642                    $username .= 
" ($i)";
 
  644                    $usernames[$username] = 1;
 
  647                if ($participantcount > 250) {
 
  648                    if (!$allusersheet || ($pages-1) < floor(
$row / 64000)) {
 
  649                        $worksheet->addSheet($this->lng->txt(
"eval_all_users") . (($pages > 0) ? 
" (" . ($pages+1) . 
")" : 
""));
 
  650                        $allusersheet = 
true;
 
  655                    $resultsheet = 
$worksheet->addSheet($username);
 
  665                        require_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
  667                        if (is_object($question)) {
 
  676            $testname = $this->test_obj->getTitle();
 
  677            switch ($this->mode) {
 
  679                    $testname .= 
'_results';
 
  687            return $excelfile . 
'.xlsx';
 
  702    public function exportToCSV($deliver = 
true, $filterby = 
"", $filtertext = 
"", $passedonly = 
false)
 
  706        if (strcmp($this->mode, 
"aggregated") == 0) {
 
  713        if ($this->test_obj->getAnonymity()) {
 
  714            array_push($datarow, $this->lng->txt(
"counter"));
 
  717            array_push($datarow, $this->lng->txt(
"name"));
 
  719            array_push($datarow, $this->lng->txt(
"login"));
 
  722        $additionalFields = $this->test_obj->getEvaluationAdditionalFields();
 
  723        if (count($additionalFields)) {
 
  724            foreach ($additionalFields as $fieldname) {
 
  725                array_push($datarow, $this->lng->txt($fieldname));
 
  729        array_push($datarow, $this->lng->txt(
"tst_stat_result_resultspoints"));
 
  731        array_push($datarow, $this->lng->txt(
"maximum_points"));
 
  733        array_push($datarow, $this->lng->txt(
"tst_stat_result_resultsmarks"));
 
  735        if ($this->test_obj->getECTSOutput()) {
 
  736            array_push($datarow, $this->lng->txt(
"ects_grade"));
 
  739        array_push($datarow, $this->lng->txt(
"tst_stat_result_qworkedthrough"));
 
  741        array_push($datarow, $this->lng->txt(
"tst_stat_result_qmax"));
 
  743        array_push($datarow, $this->lng->txt(
"tst_stat_result_pworkedthrough"));
 
  745        array_push($datarow, $this->lng->txt(
"tst_stat_result_timeofwork"));
 
  747        array_push($datarow, $this->lng->txt(
"tst_stat_result_atimeofwork"));
 
  749        array_push($datarow, $this->lng->txt(
"tst_stat_result_firstvisit"));
 
  751        array_push($datarow, $this->lng->txt(
"tst_stat_result_lastvisit"));
 
  754        array_push($datarow, $this->lng->txt(
"tst_stat_result_mark_median"));
 
  756        array_push($datarow, $this->lng->txt(
"tst_stat_result_rank_participant"));
 
  758        array_push($datarow, $this->lng->txt(
"tst_stat_result_rank_median"));
 
  760        array_push($datarow, $this->lng->txt(
"tst_stat_result_total_participants"));
 
  762        array_push($datarow, $this->lng->txt(
"tst_stat_result_median"));
 
  764        array_push($datarow, $this->lng->txt(
"scored_pass"));
 
  767        array_push($datarow, $this->lng->txt(
"pass"));
 
  770        $data =&$this->test_obj->getCompleteEvaluationData(
true, $filterby, $filtertext);
 
  771        $headerrow = $datarow;
 
  774            $datarow = $headerrow;
 
  777                if (
$data->getParticipant($active_id)->getPassed() == 
false) {
 
  783                if ($this->test_obj->getAnonymity()) {
 
  786                    array_push($datarow2, 
$data->getParticipant($active_id)->getName());
 
  787                    array_push($datarow2, 
$data->getParticipant($active_id)->getLogin());
 
  789                if (count($additionalFields)) {
 
  791                    foreach ($additionalFields as $fieldname) {
 
  792                        if (strcmp($fieldname, 
"gender") == 0) {
 
  793                            array_push($datarow2, $this->lng->txt(
"gender_" . $userfields[$fieldname]));
 
  795                            array_push($datarow2, $userfields[$fieldname]);
 
  799                array_push($datarow2, 
$data->getParticipant($active_id)->getReached());
 
  800                array_push($datarow2, 
$data->getParticipant($active_id)->getMaxpoints());
 
  801                array_push($datarow2, 
$data->getParticipant($active_id)->getMark());
 
  802                if ($this->test_obj->getECTSOutput()) {
 
  803                    array_push($datarow2, 
$data->getParticipant($active_id)->getECTSMark());
 
  805                array_push($datarow2, 
$data->getParticipant($active_id)->getQuestionsWorkedThrough());
 
  806                array_push($datarow2, 
$data->getParticipant($active_id)->getNumberOfQuestions());
 
  807                array_push($datarow2, 
$data->getParticipant($active_id)->getQuestionsWorkedThroughInPercent() / 100.0);
 
  808                $time = 
$data->getParticipant($active_id)->getTimeOfWork();
 
  809                $time_seconds = 
$time;
 
  810                $time_hours    = floor($time_seconds/3600);
 
  811                $time_seconds -= $time_hours   * 3600;
 
  812                $time_minutes  = floor($time_seconds/60);
 
  813                $time_seconds -= $time_minutes * 60;
 
  814                array_push($datarow2, 
sprintf(
"%02d:%02d:%02d", $time_hours, $time_minutes, $time_seconds));
 
  815                $time = 
$data->getParticipant($active_id)->getQuestionsWorkedThrough() ? 
$data->getParticipant($active_id)->getTimeOfWork() / 
$data->getParticipant($active_id)->getQuestionsWorkedThrough() : 0;
 
  816                $time_seconds = 
$time;
 
  817                $time_hours    = floor($time_seconds/3600);
 
  818                $time_seconds -= $time_hours   * 3600;
 
  819                $time_minutes  = floor($time_seconds/60);
 
  820                $time_seconds -= $time_minutes * 60;
 
  821                array_push($datarow2, 
sprintf(
"%02d:%02d:%02d", $time_hours, $time_minutes, $time_seconds));
 
  823                $fv = 
$data->getParticipant($active_id)->getFirstVisit();
 
  824                $lv = 
$data->getParticipant($active_id)->getLastVisit();
 
  825                foreach (array($fv, $lv) as $ts) {
 
  828                        array_push($datarow2, $visit);
 
  830                        array_push($datarow2, 
"");
 
  834                $median = 
$data->getStatistics()->getStatistics()->median();
 
  835                $pct = 
$data->getParticipant($active_id)->getMaxpoints() ? $median / 
$data->getParticipant($active_id)->getMaxpoints() * 100.0 : 0;
 
  836                $mark = $this->test_obj->mark_schema->getMatchingMark($pct);
 
  837                $mark_short_name = 
"";
 
  838                if (is_object($mark)) {
 
  839                    $mark_short_name = $mark->getShortName();
 
  841                array_push($datarow2, $mark_short_name);
 
  842                array_push($datarow2, 
$data->getStatistics()->getStatistics()->rank(
$data->getParticipant($active_id)->getReached()));
 
  843                array_push($datarow2, 
$data->getStatistics()->getStatistics()->rank_median());
 
  844                array_push($datarow2, 
$data->getStatistics()->getStatistics()->count());
 
  845                array_push($datarow2, $median);
 
  847                    array_push($datarow2, 
$data->getParticipant($active_id)->getBestPass() + 1);
 
  849                    array_push($datarow2, 
$data->getParticipant($active_id)->getLastPass() + 1);
 
  853                    if ($finishdate > 0) {
 
  855                            for (
$i = 1; 
$i < $col-1; 
$i++) {
 
  856                                array_push($datarow2, 
"");
 
  857                                array_push($datarow, 
"");
 
  859                            array_push($datarow, 
"");
 
  861                        array_push($datarow2, 
$pass+1);
 
  862                        if (is_object(
$data->getParticipant($active_id)) && is_array(
$data->getParticipant($active_id)->getQuestions(
$pass))) {
 
  863                            foreach (
$data->getParticipant($active_id)->getQuestions(
$pass) as $question) {
 
  864                                $question_data = 
$data->getParticipant($active_id)->getPass(
$pass)->getAnsweredQuestionByQuestionId($question[
"id"]);
 
  865                                array_push($datarow2, $question_data[
"reached"]);
 
  866                                array_push($datarow, preg_replace(
"/<.*?>/", 
"", 
$data->getQuestionTitle($question[
"id"])));
 
  869                        if ($this->test_obj->isRandomTest() || $this->test_obj->getShuffleQuestions() || (
$counter == 1 && 
$pass == 0)) {
 
  870                            array_push(
$rows, $datarow);
 
  873                        array_push(
$rows, $datarow2);
 
  882        foreach (
$rows as $evalrow) {
 
  883            $csvrow =&$this->test_obj->processCSVRow($evalrow, 
true, $separator);
 
  884            $csv .= join($csvrow, $separator) . 
"\n";
 
  905        $ilBench->start(
"TestExport", 
"buildExportFile");
 
  909        include_once(
"./Services/Xml/classes/class.ilXmlWriter.php");
 
  913        $this->xml->
xmlSetDtdDef(
"<!DOCTYPE Test SYSTEM \"http://www.ilias.uni-koeln.de/download/dtd/ilias_co.dtd\">");
 
  916        $this->xml->xmlSetGenCmt(
"Export of ILIAS Test " .
 
  917            $this->test_obj->getId() . 
" of installation " . $this->inst . 
".");
 
  920        $this->xml->xmlHeader();
 
  922        $this->xml->xmlStartTag(
"ContentObject", array(
'Type' => 
'Test'));
 
  925        $this->test_obj->createExportDirectory();
 
  926        include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  931        $expDir = $this->test_obj->getExportDirectory();
 
  932        include_once 
"./Services/Logging/classes/class.ilLog.php";
 
  933        $expLog = 
new ilLog($expDir, 
"export.log");
 
  935        $expLog->setLogFormat(
"");
 
  936        $expLog->write(
date(
"[y-m-d H:i:s] ") . 
"Start Export");
 
  939        $qti_file = fopen($this->export_dir . 
"/" . $this->subdir . 
"/" . $this->qti_filename, 
"w");
 
  944        $ilBench->start(
"TestExport", 
"buildExportFile_getXML");
 
  945        $this->test_obj->exportPagesXML(
 
  948            $this->export_dir . 
"/" . $this->subdir,
 
  951        $ilBench->stop(
"TestExport", 
"buildExportFile_getXML");
 
  959        $this->xml->xmlEndTag(
"ContentObject");
 
  969        $ilBench->start(
"TestExport", 
"buildExportFile_dumpToFile");
 
  970        $this->xml->xmlDumpFile($this->export_dir . 
"/" . $this->subdir . 
"/" . $this->filename, 
false);
 
  971        $ilBench->stop(
"TestExport", 
"buildExportFile_dumpToFile");
 
  975            include_once 
"./Modules/Test/classes/class.ilTestResultsToXML.php";
 
  976            $resultwriter = 
new ilTestResultsToXML($this->test_obj->getTestId(), $this->test_obj->getAnonymity());
 
  977            $resultwriter->setIncludeRandomTestQuestionsEnabled($this->test_obj->isRandomTest());
 
  978            $ilBench->start(
"TestExport", 
"buildExportFile_results");
 
  979            $resultwriter->xmlDumpFile($this->export_dir . 
"/" . $this->subdir . 
"/" . $this->resultsfile, 
false);
 
  980            $ilBench->stop(
"TestExport", 
"buildExportFile_results");
 
  984        $ilBench->start(
"QuestionpoolExport", 
"buildExportFile_saveAdditionalMobs");
 
  986        $ilBench->stop(
"QuestionpoolExport", 
"buildExportFile_saveAdditionalMobs");
 
  989        $ilBench->start(
"TestExport", 
"buildExportFile_zipFile");
 
  991            $this->export_dir . 
"/" . $this->subdir,
 
  992            $this->export_dir . 
"/" . $this->subdir . 
".zip" 
  994        $ilBench->stop(
"TestExport", 
"buildExportFile_zipFile");
 
  997        $this->xml->_XmlWriter;
 
  999        $expLog->write(
date(
"[y-m-d H:i:s] ") . 
"Finished Export");
 
 1000        $ilBench->stop(
"TestExport", 
"buildExportFile");
 
 1002        return $this->export_dir . 
"/" . $this->subdir . 
".zip";
 
 1009        $tstQtiXml = $this->test_obj->toXML();
 
 1012        if (strpos($tstQtiXml, 
"</section>") !== 
false) {
 
 1013            $qtiXml = str_replace(
"</section>", 
"$qstQtiXml</section>", $tstQtiXml);
 
 1015            $qtiXml = str_replace(
"<section ident=\"1\"/>", 
"<section ident=\"1\">\n$qstQtiXml</section>", $tstQtiXml);
 
 1025        include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
 1027        $xml = $questionOBJ->toXML(
false);
 
 1030        $xml = preg_replace(
"/<questestinterop>/", 
"", 
$xml);
 
 1031        $xml = preg_replace(
"/<\/questestinterop>/", 
"", 
$xml);
 
 1038        include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
 
 1041        foreach (
$mobs as $mob) {
 
 1044                $mob_obj->exportFiles($a_export_dir);
 
 1050            foreach (
$mobs as $mob) {
 
 1053                    $mob_obj->exportFiles($a_export_dir);
 
 1066        require_once 
'Modules/TestQuestionPool/classes/questions/class.ilAssQuestionSkillAssignmentExporter.php';
 
 1068        $skillQuestionAssignmentExporter->setXmlWriter($a_xml_writer);
 
 1069        $skillQuestionAssignmentExporter->setQuestionIds($questions);
 
 1070        $skillQuestionAssignmentExporter->setAssignmentList($assignmentList);
 
 1071        $skillQuestionAssignmentExporter->export();
 
 1078        require_once 
'Modules/Test/classes/class.ilTestSkillLevelThresholdList.php';
 
 1080        $thresholdList->setTestId($this->test_obj->getTestId());
 
 1081        $thresholdList->loadFromDb();
 
 1083        require_once 
'Modules/Test/classes/class.ilTestSkillLevelThresholdExporter.php';
 
 1085        $skillLevelThresholdExporter->setXmlWriter($a_xml_writer);
 
 1086        $skillLevelThresholdExporter->setAssignmentList($assignmentList);
 
 1087        $skillLevelThresholdExporter->setThresholdList($thresholdList);
 
 1088        $skillLevelThresholdExporter->export();
 
 1098        require_once 
'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentList.php';
 
 1100        $assignmentList->setParentObjId($this->test_obj->getId());
 
 1101        $assignmentList->loadFromDb();
 
 1102        $assignmentList->loadAdditionalSkillData();
 
 1104        return $assignmentList;
 
sprintf('%.4f', $callTime)
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
An exception for terminatinating execution or to throw for unit testing.
static _instantiateQuestion($question_id)
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date @access public.
@classDescription Date and time handling
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
static lookupPassResultsUpdateTimestamp($active_id, $pass)
static _lookupFields($a_user_id)
lookup fields (deprecated; use more specific methods instead)
__construct(&$a_test_obj, $a_mode="xml")
Constructor.
populateQuestionSetConfigXml(ilXmlWriter $xmlWriter)
exportXHTMLMediaObjects($a_export_dir)
buildExportResultFile()
build xml export file
buildExportFile()
build export file (complete zip file)
exportToCSV($deliver=true, $filterby="", $filtertext="", $passedonly=false)
Exports the evaluation data to the CSV file format.
getQuestionQtiXml($questionId)
aggregatedResultsToCSV($deliver=true)
Exports the aggregated results to CSV.
isResultExportingEnabledForTestExport()
buildExportFileXML()
build xml export file
aggregatedResultsToExcel($deliver=true)
Exports the aggregated results to the Microsoft Excel file format.
buildQuestionSkillAssignmentList()
populateSkillLevelThresholdsXml(ilXmlWriter $a_xml_writer, ilAssQuestionSkillAssignmentList $assignmentList)
$resultExportingEnabledForTestExport
populateQuestionSkillAssignmentsXml(ilXmlWriter $a_xml_writer, ilAssQuestionSkillAssignmentList $assignmentList, $questions)
exportToExcel($deliver=true, $filterby="", $filtertext="", $passedonly=false)
Exports the evaluation data to the Microsoft Excel file format.
setResultExportingEnabledForTestExport($resultExprtingEnabledForTestExport)
Test results to XML class.
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
static zip($a_dir, $a_file, $compress_content=false)
zips given directory/file into given zip.file
static ilTempnam($a_temp_path=null)
Create a temporary file in an ILIAS writable directory.
static getASCIIFilename($a_filename)
convert utf8 to ascii filename
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
xmlSetDtdDef($dtdDef)
Sets dtd definition.
if(!array_key_exists('StateId', $_REQUEST)) $id
redirection script todo: (a better solution should control the processing via a xml file)
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file