Public Member Functions | Data Fields | Private Attributes

ilTestExport Class Reference
[Modules/Test]

Export class for tests. More...

Public Member Functions

 ilTestExport (&$a_test_obj, $a_mode="xml")
 Constructor public.
 getExtension ()
 getInstId ()
 buildExportFile ()
 build export file (complete zip file)
 buildExportResultFile ()
 build xml export file
 exportToExcel ($deliver=TRUE, $filterby="", $filtertext="", $passedonly=FALSE)
 Exports the evaluation data to the Microsoft Excel file format.
 exportToCSV ($deliver=TRUE, $filterby="", $filtertext="", $passedonly=FALSE)
 Exports the evaluation data to the CSV file format.
 buildExportFileXML ()
 build xml export file
 exportXHTMLMediaObjects ($a_export_dir)

Data Fields

 $err
 $db
 $ilias
 $test_obj
 $inst_id
 $mode

Private Attributes

 $lng

Detailed Description

Export class for tests.

Author:
Helmut Schottmüller <helmut.schottmueller@mac.com>
Version:
Id:
class.ilTestExport.php 17255 2008-08-26 14:32:18Z hschottm

Definition at line 34 of file class.ilTestExport.php.


Member Function Documentation

ilTestExport::buildExportFile (  ) 

build export file (complete zip file)

public

Returns:

Definition at line 104 of file class.ilTestExport.php.

References buildExportFileXML(), and buildExportResultFile().

        {
                switch ($this->mode)
                {
                        case "results":
                                return $this->buildExportResultFile();
                                break;
                        default:
                                return $this->buildExportFileXML();
                                break;
                }
        }

Here is the call graph for this function:

ilTestExport::buildExportFileXML (  ) 

build xml export file

Definition at line 581 of file class.ilTestExport.php.

References $ilBench, exportXHTMLMediaObjects(), ilUtil::makeDir(), and ilUtil::zip().

Referenced by buildExportFile().

        {
                global $ilBench;

                $ilBench->start("TestExport", "buildExportFile");

                include_once("./classes/class.ilXmlWriter.php");
                $this->xml = new ilXmlWriter;

                // set dtd definition
                $this->xml->xmlSetDtdDef("<!DOCTYPE Test SYSTEM \"http://www.ilias.uni-koeln.de/download/dtd/ilias_co.dtd\">");

                // set generated comment
                $this->xml->xmlSetGenCmt("Export of ILIAS Test ".
                        $this->test_obj->getId()." of installation ".$this->inst.".");

                // set xml header
                $this->xml->xmlHeader();

                // create directories
                $this->test_obj->createExportDirectory();
                include_once "./Services/Utilities/classes/class.ilUtil.php";
                ilUtil::makeDir($this->export_dir."/".$this->subdir);
                ilUtil::makeDir($this->export_dir."/".$this->subdir."/objects");

                // get Log File
                $expDir = $this->test_obj->getExportDirectory();
                include_once "./Services/Logging/classes/class.ilLog.php";
                $expLog = new ilLog($expDir, "export.log");
                $expLog->delete();
                $expLog->setLogFormat("");
                $expLog->write(date("[y-m-d H:i:s] ")."Start Export");

                // write qti file
                $qti_file = fopen($this->export_dir."/".$this->subdir."/".$this->qti_filename, "w");
                fwrite($qti_file, $this->test_obj->toXML());
                fclose($qti_file);

                // get xml content
                $ilBench->start("TestExport", "buildExportFile_getXML");
                $this->test_obj->exportPagesXML($this->xml, $this->inst_id,
                        $this->export_dir."/".$this->subdir, $expLog);
                $ilBench->stop("TestExport", "buildExportFile_getXML");

                // dump xml document to screen (only for debugging reasons)
                /*
                echo "<PRE>";
                echo htmlentities($this->xml->xmlDumpMem($format));
                echo "</PRE>";
                */

                // dump xml document to file
                $ilBench->start("TestExport", "buildExportFile_dumpToFile");
                $this->xml->xmlDumpFile($this->export_dir."/".$this->subdir."/".$this->filename
                        , false);
                $ilBench->stop("TestExport", "buildExportFile_dumpToFile");

                        // add media objects which were added with tiny mce
                $ilBench->start("QuestionpoolExport", "buildExportFile_saveAdditionalMobs");
                $this->exportXHTMLMediaObjects($this->export_dir."/".$this->subdir);
                $ilBench->stop("QuestionpoolExport", "buildExportFile_saveAdditionalMobs");

                // zip the file
                $ilBench->start("TestExport", "buildExportFile_zipFile");
                ilUtil::zip($this->export_dir."/".$this->subdir,
                        $this->export_dir."/".$this->subdir.".zip");
                $ilBench->stop("TestExport", "buildExportFile_zipFile");

                // destroy writer object
                $this->xml->_XmlWriter;

                $expLog->write(date("[y-m-d H:i:s] ")."Finished Export");
                $ilBench->stop("TestExport", "buildExportFile");

                return $this->export_dir."/".$this->subdir.".zip";
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilTestExport::buildExportResultFile (  ) 

build xml export file

Definition at line 120 of file class.ilTestExport.php.

References $data, $file, $ilBench, $log, exportToCSV(), exportToExcel(), getExtension(), and ilUtil::makeDir().

Referenced by buildExportFile().

        {
                global $ilBench;
                global $log;

                //get Log File
                $expDir = $this->test_obj->getExportDirectory();
                $expLog = &$log;
                $expLog->delete();
                $expLog->setLogFormat("");
                $expLog->write(date("[y-m-d H:i:s] ")."Start Export Of Results");

                // make_directories
                $this->test_obj->createExportDirectory();
                include_once "./Services/Utilities/classes/class.ilUtil.php";
                ilUtil::makeDir($this->export_dir);

                $data = $this->exportToCSV($deliver = FALSE);
                $file = fopen($this->export_dir."/".$this->filename, "w");
                fwrite($file, $data);
                fclose($file);

                $excelfile = $this->exportToExcel($deliver = FALSE);
                @copy($excelfile, $this->export_dir . "/" . str_replace($this->getExtension(), "xls", $this->filename));

                // end
                $expLog->write(date("[y-m-d H:i:s] ")."Finished Export of Results");

                return $this->export_dir."/".$this->filename;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilTestExport::exportToCSV ( deliver = TRUE,
filterby = "",
filtertext = "",
passedonly = FALSE 
)

Exports the evaluation data to the CSV file format.

Exports the evaluation data to the CSV file format

Parameters:
string $filtertext Filter text for the user data
boolean $passedonly TRUE if only passed user datasets should be exported, FALSE otherwise public

Definition at line 376 of file class.ilTestExport.php.

References $data, $separator, ilUtil::deliverData(), ilUtil::excelTime(), exit, and ilUtil::getASCIIFilename().

Referenced by buildExportResultFile().

        {
                $rows = array();
                $datarow = array();
                $col = 1;
                if ($this->test_obj->getAnonymity())
                {
                        array_push($datarow, $this->lng->txt("counter"));
                        $col++;
                }
                else
                {
                        array_push($datarow, $this->lng->txt("name"));
                        $col++;
                        array_push($datarow, $this->lng->txt("login"));
                        $col++;
                }
                array_push($datarow, $this->lng->txt("tst_stat_result_resultspoints"));
                $col++;
                array_push($datarow, $this->lng->txt("maximum_points"));
                $col++;
                array_push($datarow, $this->lng->txt("tst_stat_result_resultsmarks"));
                $col++;
                if ($this->test_obj->ects_output)
                {
                        array_push($datarow, $this->lng->txt("ects_grade"));
                        $col++;
                }
                array_push($datarow, $this->lng->txt("tst_stat_result_qworkedthrough"));
                $col++;
                array_push($datarow, $this->lng->txt("tst_stat_result_qmax"));
                $col++;
                array_push($datarow, $this->lng->txt("tst_stat_result_pworkedthrough"));
                $col++;
                array_push($datarow, $this->lng->txt("tst_stat_result_timeofwork"));
                $col++;
                array_push($datarow, $this->lng->txt("tst_stat_result_atimeofwork"));
                $col++;
                array_push($datarow, $this->lng->txt("tst_stat_result_firstvisit"));
                $col++;
                array_push($datarow, $this->lng->txt("tst_stat_result_lastvisit"));
                $col++;

                array_push($datarow, $this->lng->txt("tst_stat_result_mark_median"));
                $col++;
                array_push($datarow, $this->lng->txt("tst_stat_result_rank_participant"));
                $col++;
                array_push($datarow, $this->lng->txt("tst_stat_result_rank_median"));
                $col++;
                array_push($datarow, $this->lng->txt("tst_stat_result_total_participants"));
                $col++;
                array_push($datarow, $this->lng->txt("tst_stat_result_median"));
                $col++;
                array_push($datarow, $this->lng->txt("scored_pass"));
                $col++;

                array_push($datarow, $this->lng->txt("pass"));
                $col++;

                $data =& $this->test_obj->getCompleteEvaluationData(TRUE, $filterby, $filtertext);
                $headerrow = $datarow;
                $counter = 1;
                foreach ($data->getParticipants() as $active_id => $userdata) 
                {
                        $datarow = $headerrow;
                        $remove = FALSE;
                        if ($passedonly)
                        {
                                if ($data->getParticipant($active_id)->getPassed() == FALSE)
                                {
                                        $remove = TRUE;
                                }
                        }
                        if (!$remove)
                        {
                                $datarow2 = array();
                                if ($this->test_obj->getAnonymity())
                                {
                                        array_push($datarow2, $counter);
                                }
                                else
                                {
                                        array_push($datarow2, $data->getParticipant($active_id)->getName());
                                        array_push($datarow2, $data->getParticipant($active_id)->getLogin());
                                }
                                array_push($datarow2, $data->getParticipant($active_id)->getReached());
                                array_push($datarow2, $data->getParticipant($active_id)->getMaxpoints());
                                array_push($datarow2, $data->getParticipant($active_id)->getMark());
                                if ($this->test_obj->ects_output)
                                {
                                        array_push($datarow2, $data->getParticipant($active_id)->getECTSMark());
                                }
                                array_push($datarow2, $data->getParticipant($active_id)->getQuestionsWorkedThrough());
                                array_push($datarow2, $data->getParticipant($active_id)->getNumberOfQuestions());
                                array_push($datarow2, $data->getParticipant($active_id)->getQuestionsWorkedThroughInPercent() / 100.0);
                                $time = $data->getParticipant($active_id)->getTimeOfWork();
                                $time_seconds = $time;
                                $time_hours    = floor($time_seconds/3600);
                                $time_seconds -= $time_hours   * 3600;
                                $time_minutes  = floor($time_seconds/60);
                                $time_seconds -= $time_minutes * 60;
                                array_push($datarow2, sprintf("%02d:%02d:%02d", $time_hours, $time_minutes, $time_seconds));
                                $time = $data->getParticipant($active_id)->getQuestionsWorkedThrough() ? $data->getParticipant($active_id)->getTimeOfWork() / $data->getParticipant($active_id)->getQuestionsWorkedThrough() : 0;
                                $time_seconds = $time;
                                $time_hours    = floor($time_seconds/3600);
                                $time_seconds -= $time_hours   * 3600;
                                $time_minutes  = floor($time_seconds/60);
                                $time_seconds -= $time_minutes * 60;
                                array_push($datarow2, sprintf("%02d:%02d:%02d", $time_hours, $time_minutes, $time_seconds));
                                $fv = getdate($data->getParticipant($active_id)->getFirstVisit());
                                $firstvisit = ilUtil::excelTime(
                                        $fv["year"],
                                        $fv["mon"],
                                        $fv["mday"],
                                        $fv["hours"],
                                        $fv["minutes"],
                                        $fv["seconds"]
                                );
                                array_push($datarow2, $firstvisit);
                                $lv = getdate($data->getParticipant($active_id)->getLastVisit());
                                $lastvisit = ilUtil::excelTime(
                                        $lv["year"],
                                        $lv["mon"],
                                        $lv["mday"],
                                        $lv["hours"],
                                        $lv["minutes"],
                                        $lv["seconds"]
                                );
                                array_push($datarow2, $lastvisit);

                                $median = $data->getStatistics()->getStatistics()->median();
                                $pct = $data->getParticipant($active_id)->getMaxpoints() ? $median / $data->getParticipant($active_id)->getMaxpoints() * 100.0 : 0;
                                $mark = $this->test_obj->mark_schema->getMatchingMark($pct);
                                $mark_short_name = "";
                                if (is_object($mark))
                                {
                                        $mark_short_name = $mark->getShortName();
                                }
                                array_push($datarow2, $mark_short_name);
                                array_push($datarow2, $data->getStatistics()->getStatistics()->rank($data->getParticipant($active_id)->getReached()));
                                array_push($datarow2, $data->getStatistics()->getStatistics()->rank_median());
                                array_push($datarow2, $data->getStatistics()->getStatistics()->count());
                                array_push($datarow2, $median);
                                if ($this->test_obj->getPassScoring() == SCORE_BEST_PASS)
                                {
                                        array_push($datarow2, $data->getParticipant($active_id)->getBestPass() + 1);
                                }
                                else
                                {
                                        array_push($datarow2, $data->getParticipant($active_id)->getLastPass() + 1);
                                }
                                for ($pass = 0; $pass <= $data->getParticipant($active_id)->getLastPass(); $pass++)
                                {
                                        $finishdate = $this->test_obj->getPassFinishDate($active_id, $pass);
                                        if ($finishdate > 0)
                                        {
                                                if ($pass > 0)
                                                {
                                                        for ($i = 1; $i < $col-1; $i++) 
                                                        {
                                                                array_push($datarow2, "");
                                                                array_push($datarow, "");
                                                        }
                                                        array_push($datarow, "");
                                                }
                                                array_push($datarow2, $pass+1);
                                                foreach ($data->getParticipant($active_id)->getQuestions($pass) as $question)
                                                {
                                                        $question_data = $data->getParticipant($active_id)->getPass($pass)->getAnsweredQuestionByQuestionId($question["id"]);
                                                        array_push($datarow2, $question_data["reached"]);
                                                        array_push($datarow, preg_replace("/<.*?>/", "", $data->getQuestionTitle($question["id"])));
                                                }
                                                if ($this->test_obj->isRandomTest() || $this->test_obj->getShuffleQuestions() || ($counter == 1 && $pass == 0))
                                                {
                                                        array_push($rows, $datarow);
                                                }
                                                $datarow = array();
                                                array_push($rows, $datarow2);
                                                $datarow2 = array();
                                        }
                                }
                                $counter++;
                        }
                }
                $csv = "";
                $separator = ";";
                foreach ($rows as $evalrow)
                {
                        $csvrow =& $this->test_obj->processCSVRow($evalrow, TRUE, $separator);
                        $csv .= join($csvrow, $separator) . "\n";
                }
                if ($deliver)
                {
                        ilUtil::deliverData($csv, ilUtil::getASCIIFilename($this->test_obj->getTitle() . ".csv"));
                        exit;
                }
                else
                {
                        return $csv;
                }
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilTestExport::exportToExcel ( deliver = TRUE,
filterby = "",
filtertext = "",
passedonly = FALSE 
)

Exports the evaluation data to the Microsoft Excel file format.

Exports the evaluation data to the Microsoft Excel file format

Parameters:
string $filtertext Filter text for the user data
boolean $passedonly TRUE if only passed user datasets should be exported, FALSE otherwise public

Definition at line 160 of file class.ilTestExport.php.

References $data, ilExcelUtils::_convert_text(), ilUtil::deliverFile(), ilUtil::excelTime(), exit, ilUtil::getASCIIFilename(), and ilUtil::ilTempnam().

Referenced by buildExportResultFile().

        {
                include_once "./classes/class.ilExcelWriterAdapter.php";
                $excelfile = ilUtil::ilTempnam();
                $adapter = new ilExcelWriterAdapter($excelfile, FALSE);
                $testname = ilUtil::getASCIIFilename(preg_replace("/\s/", "_", $this->test_obj->getTitle())) . ".xls";
                $workbook = $adapter->getWorkbook();
                $workbook->setVersion(8); // Use Excel97/2000 Format
                // Creating a worksheet
                $format_bold =& $workbook->addFormat();
                $format_bold->setBold();
                $format_percent =& $workbook->addFormat();
                $format_percent->setNumFormat("0.00%");
                $format_datetime =& $workbook->addFormat();
                $format_datetime->setNumFormat("DD/MM/YYYY hh:mm:ss");
                $format_title =& $workbook->addFormat();
                $format_title->setBold();
                $format_title->setColor('black');
                $format_title->setPattern(1);
                $format_title->setFgColor('silver');
                $worksheet =& $workbook->addWorksheet();
                $row = 0;
                $col = 0;
                include_once "./classes/class.ilExcelUtils.php";

                if ($this->test_obj->getAnonymity())
                {
                        $worksheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt("counter")), $format_title);
                }
                else
                {
                        $worksheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt("name")), $format_title);
                        $worksheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt("login")), $format_title);
                }
                $worksheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt("tst_stat_result_resultspoints")), $format_title);
                $worksheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt("maximum_points")), $format_title);
                $worksheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt("tst_stat_result_resultsmarks")), $format_title);
                if ($this->test_obj->ects_output)
                {
                        $worksheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt("ects_grade")), $format_title);
                }
                $worksheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt("tst_stat_result_qworkedthrough")), $format_title);
                $worksheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt("tst_stat_result_qmax")), $format_title);
                $worksheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt("tst_stat_result_pworkedthrough")), $format_title);
                $worksheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt("tst_stat_result_timeofwork")), $format_title);
                $worksheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt("tst_stat_result_atimeofwork")), $format_title);
                $worksheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt("tst_stat_result_firstvisit")), $format_title);
                $worksheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt("tst_stat_result_lastvisit")), $format_title);

                $worksheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt("tst_stat_result_mark_median")), $format_title);
                $worksheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt("tst_stat_result_rank_participant")), $format_title);
                $worksheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt("tst_stat_result_rank_median")), $format_title);
                $worksheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt("tst_stat_result_total_participants")), $format_title);
                $worksheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt("tst_stat_result_median")), $format_title);
                $worksheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt("scored_pass")), $format_title);

                $worksheet->write($row, $col++, ilExcelUtils::_convert_text($this->lng->txt("pass")), $format_title);

                include_once "./classes/class.ilExcelUtils.php";
                $counter = 1;
                $data =& $this->test_obj->getCompleteEvaluationData(TRUE, $filterby, $filtertext);
                foreach ($data->getParticipants() as $active_id => $userdata) 
                {
                        $remove = FALSE;
                        if ($passedonly)
                        {
                                if ($data->getParticipant($active_id)->getPassed() == FALSE)
                                {
                                        $remove = TRUE;
                                }
                        }
                        if (!$remove)
                        {
                                $row++;
                                if ($this->test_obj->isRandomTest() || $this->test_obj->getShuffleQuestions())
                                {
                                        $row++;
                                }
                                $col = 0;
                                if ($this->test_obj->getAnonymity())
                                {
                                        $worksheet->write($row, $col++, ilExcelUtils::_convert_text($counter));
                                }
                                else
                                {
                                        $worksheet->write($row, $col++, ilExcelUtils::_convert_text($data->getParticipant($active_id)->getName()));
                                        $worksheet->write($row, $col++, ilExcelUtils::_convert_text($data->getParticipant($active_id)->getLogin()));
                                }
                                $worksheet->write($row, $col++, ilExcelUtils::_convert_text($data->getParticipant($active_id)->getReached()));
                                $worksheet->write($row, $col++, ilExcelUtils::_convert_text($data->getParticipant($active_id)->getMaxpoints()));
                                $worksheet->write($row, $col++, ilExcelUtils::_convert_text($data->getParticipant($active_id)->getMark()));
                                if ($this->test_obj->ects_output)
                                {
                                        $worksheet->write($row, $col++, ilExcelUtils::_convert_text($data->getParticipant($active_id)->getECTSMark()));
                                }
                                $worksheet->write($row, $col++, ilExcelUtils::_convert_text($data->getParticipant($active_id)->getQuestionsWorkedThrough()));
                                $worksheet->write($row, $col++, ilExcelUtils::_convert_text($data->getParticipant($active_id)->getNumberOfQuestions()));
                                $worksheet->write($row, $col++, $data->getParticipant($active_id)->getQuestionsWorkedThroughInPercent() / 100.0, $format_percent);
                                $time = $data->getParticipant($active_id)->getTimeOfWork();
                                $time_seconds = $time;
                                $time_hours    = floor($time_seconds/3600);
                                $time_seconds -= $time_hours   * 3600;
                                $time_minutes  = floor($time_seconds/60);
                                $time_seconds -= $time_minutes * 60;
                                $worksheet->write($row, $col++, ilExcelUtils::_convert_text(sprintf("%02d:%02d:%02d", $time_hours, $time_minutes, $time_seconds)));
                                $time = $data->getParticipant($active_id)->getQuestionsWorkedThrough() ? $data->getParticipant($active_id)->getTimeOfWork() / $data->getParticipant($active_id)->getQuestionsWorkedThrough() : 0;
                                $time_seconds = $time;
                                $time_hours    = floor($time_seconds/3600);
                                $time_seconds -= $time_hours   * 3600;
                                $time_minutes  = floor($time_seconds/60);
                                $time_seconds -= $time_minutes * 60;
                                $worksheet->write($row, $col++, ilExcelUtils::_convert_text(sprintf("%02d:%02d:%02d", $time_hours, $time_minutes, $time_seconds)));
                                $fv = getdate($data->getParticipant($active_id)->getFirstVisit());
                                $firstvisit = ilUtil::excelTime(
                                        $fv["year"],
                                        $fv["mon"],
                                        $fv["mday"],
                                        $fv["hours"],
                                        $fv["minutes"],
                                        $fv["seconds"]
                                );
                                $worksheet->write($row, $col++, $firstvisit, $format_datetime);
                                $lv = getdate($data->getParticipant($active_id)->getLastVisit());
                                $lastvisit = ilUtil::excelTime(
                                        $lv["year"],
                                        $lv["mon"],
                                        $lv["mday"],
                                        $lv["hours"],
                                        $lv["minutes"],
                                        $lv["seconds"]
                                );
                                $worksheet->write($row, $col++, $lastvisit, $format_datetime);

                                $median = $data->getStatistics()->getStatistics()->median();
                                $pct = $data->getParticipant($active_id)->getMaxpoints() ? $median / $data->getParticipant($active_id)->getMaxpoints() * 100.0 : 0;
                                $mark = $this->test_obj->mark_schema->getMatchingMark($pct);
                                $mark_short_name = "";
                                if (is_object($mark))
                                {
                                        $mark_short_name = $mark->getShortName();
                                }
                                $worksheet->write($row, $col++, ilExcelUtils::_convert_text($mark_short_name));
                                $worksheet->write($row, $col++, ilExcelUtils::_convert_text($data->getStatistics()->getStatistics()->rank($data->getParticipant($active_id)->getReached())));
                                $worksheet->write($row, $col++, ilExcelUtils::_convert_text($data->getStatistics()->getStatistics()->rank_median()));
                                $worksheet->write($row, $col++, ilExcelUtils::_convert_text($data->getStatistics()->getStatistics()->count()));
                                $worksheet->write($row, $col++, ilExcelUtils::_convert_text($median));
                                if ($this->test_obj->getPassScoring() == SCORE_BEST_PASS)
                                {
                                        $worksheet->write($row, $col++, $data->getParticipant($active_id)->getBestPass() + 1);
                                }
                                else
                                {
                                        $worksheet->write($row, $col++, $data->getParticipant($active_id)->getLastPass() + 1);
                                }
                                $startcol = $col;
                                for ($pass = 0; $pass <= $data->getParticipant($active_id)->getLastPass(); $pass++)
                                {
                                        $col = $startcol;
                                        $finishdate = $this->test_obj->getPassFinishDate($active_id, $pass);
                                        if ($finishdate > 0)
                                        {
                                                if ($pass > 0)
                                                {
                                                        $row++;
                                                        if ($this->test_obj->isRandomTest() || $this->test_obj->getShuffleQuestions())
                                                        {
                                                                $row++;
                                                        }
                                                }
                                                $worksheet->write($row, $col++, ilExcelUtils::_convert_text($pass+1));
                                                if (is_object($data->getParticipant($active_id)) && is_array($data->getParticipant($active_id)->getQuestions($pass)))
                                                {
                                                        foreach ($data->getParticipant($active_id)->getQuestions($pass) as $question)
                                                        {
                                                                $question_data = $data->getParticipant($active_id)->getPass($pass)->getAnsweredQuestionByQuestionId($question["id"]);
                                                                $worksheet->write($row, $col, ilExcelUtils::_convert_text($question_data["reached"]));
                                                                if ($this->test_obj->isRandomTest() || $this->test_obj->getShuffleQuestions())
                                                                {
                                                                        $worksheet->write($row-1, $col, ilExcelUtils::_convert_text(preg_replace("/<.*?>/", "", $data->getQuestionTitle($question["id"]))), $format_title);
                                                                }
                                                                else
                                                                {
                                                                        if ($pass == 0)
                                                                        {
                                                                                $worksheet->write(0, $col, ilExcelUtils::_convert_text(preg_replace("/<.*?>/", "", $data->getQuestionTitle($question["id"]))), $format_title);
                                                                        }
                                                                }
                                                                $col++;
                                                        }
                                                }
                                        }
                                }
                                $counter++;
                        }
                }
                $workbook->close();
                if ($deliver)
                {
                        ilUtil::deliverFile($excelfile, $testname, "application/vnd.ms-excel");
                        exit;
                }
                else
                {
                        return $excelfile;
                }
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilTestExport::exportXHTMLMediaObjects ( a_export_dir  ) 

Definition at line 658 of file class.ilTestExport.php.

References $mobs, and ilObjMediaObject::_getMobsOfObject().

Referenced by buildExportFileXML().

        {
                include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");

                $mobs = ilObjMediaObject::_getMobsOfObject("tst:html", $this->test_obj->getId());
                foreach ($mobs as $mob)
                {
                        $mob_obj =& new ilObjMediaObject($mob);
                        $mob_obj->exportFiles($a_export_dir);
                        unset($mob_obj);
                }
                foreach ($this->test_obj->questions as $question_id)
                {
                        $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $question_id);
                        foreach ($mobs as $mob)
                        {
                                $mob_obj =& new ilObjMediaObject($mob);
                                $mob_obj->exportFiles($a_export_dir);
                                unset($mob_obj);
                        }
                }
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilTestExport::getExtension (  ) 

Definition at line 83 of file class.ilTestExport.php.

Referenced by buildExportResultFile(), and ilTestExport().

                                 {
                switch ($this->mode) {
                        case "results":
                                return "csv"; break;
                        default:
                                return "xml"; break;
                }
        }

Here is the caller graph for this function:

ilTestExport::getInstId (  ) 

Definition at line 92 of file class.ilTestExport.php.

        {
                return $this->inst_id;
        }

ilTestExport::ilTestExport ( &$  a_test_obj,
a_mode = "xml" 
)

Constructor public.

Definition at line 48 of file class.ilTestExport.php.

References $ilErr, $ilias, $lng, and getExtension().

        {
                global $ilErr, $ilDB, $ilias, $lng;

                $this->test_obj =& $a_test_obj;

                $this->err =& $ilErr;
                $this->ilias =& $ilias;
                $this->db =& $ilDB;
                $this->mode = $a_mode;
                $this->lng =& $lng;

                $settings = $this->ilias->getAllSettings();
                //$this->inst_id = $settings["inst_id"];
                $this->inst_id = IL_INST_ID;

                $date = time();
                $this->export_dir = $this->test_obj->getExportDirectory();
                switch($this->mode)
                {
                        case "results":
                                $this->subdir = $date."__".$this->inst_id."__".
                                        "test__results__".$this->test_obj->getId();
                                break;
                        default:
                                $this->subdir = $date."__".$this->inst_id."__".
                                        "test"."__".$this->test_obj->getId();
                                $this->filename = $this->subdir.".xml";
                                $this->qti_filename = $date."__".$this->inst_id."__".
                                        "qti"."__".$this->test_obj->getId().".xml";
                                break;
                }
                $this->filename = $this->subdir.".".$this->getExtension();
        }

Here is the call graph for this function:


Field Documentation

ilTestExport::$db

Definition at line 37 of file class.ilTestExport.php.

ilTestExport::$err

Definition at line 36 of file class.ilTestExport.php.

ilTestExport::$ilias

Definition at line 38 of file class.ilTestExport.php.

Referenced by ilTestExport().

ilTestExport::$inst_id

Definition at line 40 of file class.ilTestExport.php.

ilTestExport::$lng [private]

Definition at line 42 of file class.ilTestExport.php.

Referenced by ilTestExport().

ilTestExport::$mode

Definition at line 41 of file class.ilTestExport.php.

ilTestExport::$test_obj

Definition at line 39 of file class.ilTestExport.php.


The documentation for this class was generated from the following file: