17    #region Constants / Config 
  103        $ilias = 
$DIC[
'ilias'];
 
  104        $this->external_directory_path = $ilias->ini_ilias->readVariable(
'clients', 
'datadir');
 
  105        $this->client_id = $ilias->client_id;
 
  107        $this->ilDB = $ilias->db;
 
  111        $this->participantData = 
null;
 
  151        copy($pdf_path, $pdf_new_path);
 
  152        # /home/mbecker/public_html/ilias/trunk-primary/extern/default/tst_data/archive/tst_350/2013/09/19/80_1_root_user_/test_submission.pdf 
  155        file_put_contents($html_new_path, $html_string);
 
  157        $this->
logArchivingProcess(date(self::LOG_DTSGROUP_FORMAT) . self::LOG_ADDITION_STRING . $pdf_new_path);
 
  158        $this->
logArchivingProcess(date(self::LOG_DTSGROUP_FORMAT) . self::LOG_ADDITION_STRING . $html_new_path);
 
  176                                    . self::DIR_SEP . self::QUESTION_PATH_COMPONENT_PREFIX . $question_fi;
 
  177        if (!is_dir($pass_question_directory)) {
 
  178            mkdir($pass_question_directory, 0777, 
true);
 
  181        copy($file_path, $pass_question_directory . self::DIR_SEP . $original_filename);
 
  184            date(self::LOG_DTSGROUP_FORMAT) . self::LOG_ADDITION_STRING
 
  185            . $pass_question_directory . self::DIR_SEP . $original_filename
 
  204        copy($file_path, $new_path);
 
  205        $this->
logArchivingProcess(date(self::LOG_DTSGROUP_FORMAT) . self::LOG_ADDITION_STRING . $new_path);
 
  219        if (!is_dir($best_solution_path)) {
 
  220            mkdir($best_solution_path, 0777, 
true);
 
  223        file_put_contents($best_solution_path . self::DIR_SEP . self::HTML_BEST_SOLUTION_FILENAME, $html_string);
 
  225        copy($pdf_path, $best_solution_path . self::DIR_SEP . self::PDF_BEST_SOLUTION_FILENAME);
 
  228            date(self::LOG_DTSGROUP_FORMAT) . self::LOG_ADDITION_STRING
 
  229                . $best_solution_path . self::DIR_SEP . self::HTML_BEST_SOLUTION_FILENAME
 
  233            date(self::LOG_DTSGROUP_FORMAT) . self::LOG_ADDITION_STRING
 
  234                . $best_solution_path . self::DIR_SEP . self::PDF_BEST_SOLUTION_FILENAME
 
  250        if (!is_dir($best_solution_path)) {
 
  251            mkdir($best_solution_path, 0777, 
true);
 
  255        if (!is_dir($materials_path)) {
 
  256            mkdir($materials_path, 0777, 
true);
 
  259        $question_materials_path = $materials_path . self::DIR_SEP . self::QUESTION_PATH_COMPONENT_PREFIX . $question_fi;
 
  260        if (!is_dir($question_materials_path)) {
 
  261            mkdir($question_materials_path, 0777, 
true);
 
  264        copy($file_path, $question_materials_path . self::DIR_SEP . $orginial_filename);
 
  267            date(self::LOG_DTSGROUP_FORMAT) . self::LOG_ADDITION_STRING
 
  268                . $question_materials_path . self::DIR_SEP . $orginial_filename
 
  287            . self::TEST_RESULT_POSTFIX;
 
  288        copy($pdf_path, $new_path);
 
  289        $this->
logArchivingProcess(date(self::LOG_DTSGROUP_FORMAT) . self::LOG_ADDITION_STRING . $new_path);
 
  302            . self::TEST_OVERVIEW_PDF_FILENAME
 
  304        copy($pdf_path, $new_pdf_path);
 
  305        $html_path = $this->
getTestArchive() . self::DIR_SEP . self::TEST_OVERVIEW_HTML_FILENAME
 
  307        file_put_contents($html_path, $html_string);
 
  309        $this->
logArchivingProcess(date(self::LOG_DTSGROUP_FORMAT) . self::LOG_ADDITION_STRING . $new_pdf_path);
 
  310        $this->
logArchivingProcess(date(self::LOG_DTSGROUP_FORMAT) . self::LOG_ADDITION_STRING . $html_path);
 
  344        $test_archive_directory = $this->external_directory_path . self::DIR_SEP . $this->client_id . self::DIR_SEP . 
'tst_data' 
  346        return $test_archive_directory;
 
  371        $query = 
'SELECT * FROM ass_log WHERE obj_fi = ' . $this->ilDB->quote($this->test_obj_id, 
'integer');
 
  377            $outfile_lines .= 
"\r\n" . implode(
"\t", 
$row);
 
  379        file_put_contents($this->
getTestArchive() . self::DIR_SEP . self::TEST_LOG_FILENAME, $outfile_lines);
 
  383        require_once 
'Modules/Test/classes/class.ilParticipantsTestResultsGUI.php';
 
  385        $gui->setTestObj(
$test);
 
  386        require_once 
'Modules/Test/classes/class.ilTestObjectiveOrientedContainer.php';
 
  388        $gui->setObjectiveParent($objectiveOrientedContainer);
 
  389        $array_of_actives = array();
 
  390        $participants = 
$test->getParticipants();
 
  392        foreach ($participants as 
$key => $value) {
 
  393            $array_of_actives[] = 
$key;
 
  395        $output_template = $gui->createUserResults(
true, 
false, 
true, $array_of_actives);
 
  397        require_once 
'Modules/Test/classes/class.ilTestPDFGenerator.php';
 
  433        return $this->external_directory_path . self::DIR_SEP . $this->client_id . self::DIR_SEP . 
'tst_data' 
  434            . self::DIR_SEP . self::EXPORT_DIRECTORY . self::DIR_SEP . 
'tst_' . 
$this->test_obj_id;
 
  448        $zip_output_filename = 
'test_archive_obj_' . $this->test_obj_id . 
'_' . time() . 
'_.zip';
 
  456    #region PassDataDirectory 
  492        foreach ($this->archive_data_index as $data_index_entry) {
 
  493            if ($data_index_entry != 
null && $data_index_entry[
'identifier'] == $active_fi . 
'|' . 
$pass) {
 
  494                array_shift($data_index_entry);
 
  495                return $this->
getTestArchive() . self::DIR_SEP . implode(self::DIR_SEP, $data_index_entry);
 
  518                $user->setFirstname($usrData[
'firstname']);
 
  519                $user->setLastname($usrData[
'lastname']);
 
  520                $user->setMatriculation($usrData[
'matriculation']);
 
  521                $user->setFirstname($usrData[
'firstname']);
 
  532                $user->getFirstname(),
 
  533                $user->getLastname(),
 
  534                $user->getMatriculation()
 
  563    #region PassMaterialsDirectory 
  598            $user->setFirstname($usrData[
'firstname']);
 
  599            $user->setLastname($usrData[
'lastname']);
 
  600            $user->setMatriculation($usrData[
'matriculation']);
 
  601            $user->setFirstname($usrData[
'firstname']);
 
  612            $user->getFirstname(),
 
  613            $user->getLastname(),
 
  614            $user->getMatriculation()
 
  667        if (@file_exists($data_index_file)) {
 
  668            $lines = explode(
"\n", file_get_contents($data_index_file));
 
  669            foreach ($lines as $line) {
 
  670                $line_items = explode(
'|', $line);
 
  671                $line_data[
'identifier'] = $line_items[0] . 
'|' . $line_items[1];
 
  672                $line_data[
'yyyy'] = $line_items[2];
 
  673                $line_data[
'mm'] = $line_items[3];
 
  674                $line_data[
'dd'] = $line_items[4];
 
  675                $line_data[
'directory'] = $line_items[5];
 
  676                $contents[] = $line_data;
 
  698        $this->archive_data_index[] = $line;
 
  699        $output_contents = 
'';
 
  701        foreach ($this->archive_data_index as $line_data) {
 
  702            if ($line_data[
'identifier'] == 
"|") {
 
  705            $output_contents .= implode(
'|', $line_data) . 
"\n";
 
  708        file_put_contents($this->
getTestArchive() . self::DIR_SEP . self::DATA_INDEX_FILENAME, $output_contents);
 
  727        $date = date_create_from_format(DATE_ISO8601, $date);
 
  729            'identifier' => $active_fi . 
'|' . 
$pass,
 
  730            'yyyy' => date_format($date, 
'Y'),
 
  731            'mm' => date_format($date, 
'm'),
 
  732            'dd' => date_format($date, 
'd'),
 
  733            'directory' => $active_fi . 
'_' . 
$pass . 
'_' . $user_firstname . 
'_' . $user_lastname . 
'_' . $matriculation
 
  748        if (file_exists($archive)) {
 
  749            $content = file_get_contents($archive) . 
"\n" . 
$message;
 
  754        file_put_contents($archive, $content);
 
  770        if ($handle = opendir($directory)) {
 
  771            while (($file = readdir($handle)) !== 
false) {
 
  772                if (!in_array($file, array( 
'.', 
'..' )) && !is_dir($directory . $file)) {
 
  773                    if ($pattern && strpos($file, $pattern) === 0) {
 
An exception for terminatinating execution or to throw for unit testing.
ensureZipExportDirectoryExists()
handInTestResult($active_fi, $pass, $pdf_path)
Hands in an individual test result for a pass.
handInParticipantSubmission($active_fi, $pass, $pdf_path, $html_string)
Hands in a participants test submission ("a completed test") for archiving.
handInBestSolutionQuestionMaterial($question_fi, $orginial_filename, $file_path)
Hands in a file related to a question in context of the best solution.
const TEST_OVERVIEW_HTML_POSTFIX
const TEST_OVERVIEW_HTML_FILENAME
const DATA_INDEX_FILENAME
const TEST_MATERIALS_PATH_COMPONENT
compressTestArchive()
Generate the test archive for download.
hasPassMaterialsDirectory($active_fi, $pass)
Returns if the pass materials directory exists for a given pass.
countFilesInDirectory($directory, $pattern=null)
Returns the count of files in a directory, eventually matching the given, optional,...
ensureTestArchiveIsAvailable()
Ensures the availability of the test archive directory.
const PDF_SUBMISSION_FILENAME
getTestArchive()
Returns the (theoretical) path to the archive directory of the test, this object is created for.
getZipExportDirectory()
Return the export directory, where zips are placed.
const PASS_MATERIALS_PATH_COMPONENT
handInParticipantQuestionMaterial($active_fi, $pass, $question_fi, $original_filename, $file_path)
Hands in a particpants question material, such as an upload or other binary content.
getPassMaterialsDirectory($active_fi, $pass)
Returns the pass materials directory.
handInTestResultsOverview($html_string, $pdf_path)
Hands in a test results overview.
handInTestBestSolution($html_string, $pdf_path)
Hands in the best solution for a test.
hasPassDataDirectory($active_fi, $pass)
Checks if the directory for pass data is available.
const LOG_DTSGROUP_FORMAT
const HTML_SUBMISSION_FILENAME
const TEST_RESULT_POSTFIX
const PDF_BEST_SOLUTION_FILENAME
setParticipantData($participantData)
const TEST_RESULT_FILENAME
readArchiveDataIndex()
Reads the archive data index.
getPassDataDirectory($active_fi, $pass)
Returns the pass data directory.
hasTestArchive()
Returns if the archive directory structure for the test the object is created for exists.
createZipExportDirectory()
handInParticipantMisc($active_fi, $pass, $original_filename, $file_path)
Hands in a participants file, which is relevant for archiving but an unspecified type.
createPassDataDirectory($active_fi, $pass)
Creates pass data directory.
const TEST_BEST_SOLUTION_PATH_COMPONENT
buildPassDataDirectory($active_fi, $pass)
appendToArchiveDataIndex($date, $active_fi, $pass, $user_firstname, $user_lastname, $matriculation)
Appends a line to the archive data index.
createPassMaterialsDirectory($active_fi, $pass)
Creates pass materials directory.
const HTML_BEST_SOLUTION_FILENAME
ensurePassMaterialsDirectoryIsAvailable($active_fi, $pass)
Ensures the availability of the pass materials directory.
const QUESTION_PATH_COMPONENT_PREFIX
const LOG_CREATION_STRING
updateTestArchive()
Replaces the test-log with the current one.
logArchivingProcess($message)
Logs to the archive log.
hasZipExportDirectory()
Returns if the export directory for zips exists.
const LOG_ADDITION_STRING
createArchiveForTest()
Creates the directory for the test archive.
ensurePassDataDirectoryIsAvailable($active_fi, $pass)
Ensures the availability of the participant data directory.
determinePassDataPath($date, $active_fi, $pass, $user_firstname, $user_lastname, $matriculation)
Determines the pass data path.
const TEST_OVERVIEW_PDF_POSTFIX
const LOG_DELETION_STRING
const TEST_OVERVIEW_PDF_FILENAME
static generatePDF($pdf_output, $output_mode, $filename=null, $purpose=null)
static zip($a_dir, $a_file, $compress_content=false)
zips given directory/file into given zip.file
static makeDirParents($a_dir)
Create a new directory and all parent directories.
const PDF_USER_RESULT
PDF Purposes.
catch(Exception $e) $message