17 #region Constants / Config 103 $this->external_directory_path = $ilias->ini_ilias->readVariable(
'clients',
'datadir');
104 $this->client_id = $ilias->client_id;
106 $this->
ilDB = $ilias->db;
110 $this->participantData = null;
149 . self::PDF_SUBMISSION_FILENAME;
150 copy( $pdf_path, $pdf_new_path );
151 # /home/mbecker/public_html/ilias/trunk-primary/extern/default/tst_data/archive/tst_350/2013/09/19/80_1_root_user_/test_submission.pdf 153 . self::HTML_SUBMISSION_FILENAME;
154 file_put_contents($html_new_path, $html_string);
175 . self::DIR_SEP . self::QUESTION_PATH_COMPONENT_PREFIX . $question_fi;
176 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 );
218 $best_solution_path = $this->
getTestArchive() . self::DIR_SEP . self::TEST_BEST_SOLUTION_PATH_COMPONENT;
219 if ( !is_dir( $best_solution_path ) )
221 mkdir( $best_solution_path , 0777,
true );
224 file_put_contents( $best_solution_path . self::DIR_SEP . self::HTML_BEST_SOLUTION_FILENAME, $html_string );
226 copy( $pdf_path, $best_solution_path . self::DIR_SEP . self::PDF_BEST_SOLUTION_FILENAME );
229 date(self::LOG_DTSGROUP_FORMAT) . self::LOG_ADDITION_STRING
230 . $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);
248 $best_solution_path = $this->
getTestArchive() . self::DIR_SEP . self::TEST_BEST_SOLUTION_PATH_COMPONENT;
249 if ( !is_dir( $best_solution_path ) )
251 mkdir( $best_solution_path , 0777,
true);
254 $materials_path = $best_solution_path . self::DIR_SEP . self::TEST_MATERIALS_PATH_COMPONENT;
255 if ( !is_dir( $materials_path ) )
257 mkdir( $materials_path , 0777,
true);
260 $question_materials_path = $materials_path . self::DIR_SEP . self::QUESTION_PATH_COMPONENT_PREFIX . $question_fi;
261 if ( !is_dir( $question_materials_path ) )
263 mkdir( $question_materials_path , 0777,
true);
266 copy( $file_path, $question_materials_path . self::DIR_SEP . $orginial_filename );
269 date(self::LOG_DTSGROUP_FORMAT) . self::LOG_ADDITION_STRING
270 . $question_materials_path . self::DIR_SEP . $orginial_filename);
288 . self::TEST_RESULT_POSTFIX;
289 copy( $pdf_path, $new_path );
303 . self::TEST_OVERVIEW_PDF_FILENAME
305 copy( $pdf_path, $new_pdf_path );
306 $html_path = $this->
getTestArchive() . self::DIR_SEP . self::TEST_OVERVIEW_HTML_FILENAME
308 file_put_contents($html_path, $html_string);
345 $test_archive_directory = $this->external_directory_path . self::DIR_SEP . $this->client_id . self::DIR_SEP .
'tst_data' 346 . self::DIR_SEP .
'archive' . self::DIR_SEP .
'tst_'.$this->test_obj_id;
347 return $test_archive_directory;
373 $query =
'SELECT * FROM ass_log WHERE obj_fi = ' . $this->
ilDB->
quote($this->test_obj_id,
'integer');
380 $outfile_lines .=
"\r\n" . implode(
"\t",
$row);
382 file_put_contents($this->
getTestArchive() . self::DIR_SEP . self::TEST_LOG_FILENAME, $outfile_lines);
387 $gui->object =
$test;
388 $array_of_actives =
array();
389 $participants =
$test->getParticipants();
391 foreach($participants as $key => $value)
393 $array_of_actives[] = $key;
395 $output_template = $gui->createUserResults(
true,
false,
true, $array_of_actives);
397 require_once
'class.ilTestPDFGenerator.php';
434 return $this->external_directory_path . self::DIR_SEP . $this->client_id . self::DIR_SEP .
'tst_data' 435 . self::DIR_SEP . self::EXPORT_DIRECTORY . self::DIR_SEP .
'tst_' .
$this->test_obj_id;
449 $zip_output_filename =
'test_archive_obj_'.$this->test_obj_id .
'_' .
time() .
'_.zip';
457 #region PassDataDirectory 493 foreach ($this->archive_data_index as $data_index_entry)
495 if ( $data_index_entry != null && $data_index_entry[
'identifier'] == $active_fi.
'|'.
$pass )
497 array_shift($data_index_entry);
498 return $this->
getTestArchive() . self::DIR_SEP . implode(self::DIR_SEP, $data_index_entry);
523 $user->setFirstname($usrData[
'firstname']);
524 $user->setLastname($usrData[
'lastname']);
525 $user->setMatriculation($usrData[
'matriculation']);
526 $user->setFirstname($usrData[
'firstname']);
536 $user->getFirstname(), $user->getLastname(), $user->getMatriculation()
566 #region PassMaterialsDirectory 603 $user->setFirstname($usrData[
'firstname']);
604 $user->setLastname($usrData[
'lastname']);
605 $user->setMatriculation($usrData[
'matriculation']);
606 $user->setFirstname($usrData[
'firstname']);
615 date(
'Y'), $active_fi,
$pass, $user->getFirstname(), $user->getLastname(), $user->getMatriculation()
631 return $pass_data_directory . self::DIR_SEP . self::PASS_MATERIALS_PATH_COMPONENT;
664 $data_index_file = $this->
getTestArchive() . self::DIR_SEP . self::DATA_INDEX_FILENAME;
669 if ( @file_exists( $data_index_file ) )
671 $lines = explode(
"\n", file_get_contents( $data_index_file ) );
672 foreach ($lines as $line)
674 $line_items = explode(
'|', $line);
675 $line_data[
'identifier'] = $line_items[0] .
'|' . $line_items[1];
676 $line_data[
'yyyy'] = $line_items[2];
677 $line_data[
'mm'] = $line_items[3];
678 $line_data[
'dd'] = $line_items[4];
679 $line_data[
'directory'] = $line_items[5];
702 $this->archive_data_index[] = $line;
703 $output_contents =
'';
705 foreach ($this->archive_data_index as $line_data)
707 if($line_data[
'identifier'] ==
"|")
711 $output_contents .= implode(
'|', $line_data) .
"\n";
714 file_put_contents($this->
getTestArchive() . self::DIR_SEP . self::DATA_INDEX_FILENAME, $output_contents);
733 $date = date_create_from_format(DATE_ISO8601, $date);
735 'identifier' => $active_fi .
'|' .
$pass,
736 'yyyy' => date_format( $date,
'Y' ),
737 'mm' => date_format( $date,
'm' ),
738 'dd' => date_format( $date,
'd' ),
739 'directory' => $active_fi .
'_' . $pass .
'_' . $user_firstname .
'_' . $user_lastname .
'_' . $matriculation
753 $archive = $this->
getTestArchive() . self::DIR_SEP . self::ARCHIVE_LOG;
754 if( file_exists($archive) )
756 $content = file_get_contents($archive).
"\n" . $message;
763 file_put_contents($archive, $content);
779 if ($handle = opendir( $directory ))
781 while ((
$file = readdir( $handle )) !==
false)
783 if (!in_array(
$file,
array(
'.',
'..' ) ) && !is_dir( $directory .
$file ))
785 if ($pattern && strpos($file, $pattern) === 0 )
getPassDataDirectory($active_fi, $pass)
Returns the pass data directory.
static makeDirParents($a_dir)
Create a new directory and all parent directories.
determinePassDataPath($date, $active_fi, $pass, $user_firstname, $user_lastname, $matriculation)
Determines the pass data path.
createArchiveForTest()
Creates the directory for the test archive.
const LOG_DTSGROUP_FORMAT
const HTML_BEST_SOLUTION_FILENAME
createZipExportDirectory()
const TEST_OVERVIEW_PDF_POSTFIX
const TEST_RESULT_FILENAME
handInTestResultsOverview($html_string, $pdf_path)
Hands in a test results overview.
query($sql, $a_handle_error=true)
Query.
createPassDataDirectory($active_fi, $pass)
Creates pass data directory.
countFilesInDirectory($directory, $pattern=null)
Returns the count of files in a directory, eventually matching the given, optional, pattern.
ensureZipExportDirectoryExists()
const TEST_OVERVIEW_HTML_POSTFIX
const TEST_OVERVIEW_PDF_FILENAME
const DATA_INDEX_FILENAME
handInParticipantQuestionMaterial($active_fi, $pass, $question_fi, $original_filename, $file_path)
Hands in a particpants question material, such as an upload or other binary content.
const LOG_DELETION_STRING
getPassMaterialsDirectory($active_fi, $pass)
Returns the pass materials directory.
const PASS_MATERIALS_PATH_COMPONENT
const HTML_SUBMISSION_FILENAME
compressTestArchive()
Generate the test archive for download.
readArchiveDataIndex()
Reads the archive data index.
fetchAssoc($a_set)
Fetch row as associative array from result set.
quote($a_query, $a_type=null)
Wrapper for quote method.
const PDF_BEST_SOLUTION_FILENAME
const TEST_OVERVIEW_HTML_FILENAME
const QUESTION_PATH_COMPONENT_PREFIX
getZipExportDirectory()
Return the export directory, where zips are placed.
buildPassDataDirectory($active_fi, $pass)
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
appendToArchiveDataIndex($date, $active_fi, $pass, $user_firstname, $user_lastname, $matriculation)
Appends a line to the archive data index.
handInParticipantSubmission($active_fi, $pass, $pdf_path, $html_string)
Hands in a participants test submission ("a completed test") for archiving.
const PDF_SUBMISSION_FILENAME
ensurePassDataDirectoryIsAvailable($active_fi, $pass)
Ensures the availability of the participant data directory.
handInBestSolutionQuestionMaterial($question_fi, $orginial_filename, $file_path)
Hands in a file related to a question in context of the best solution.
const LOG_ADDITION_STRING
const LOG_CREATION_STRING
hasZipExportDirectory()
Returns if the export directory for zips exists.
static zip($a_dir, $a_file, $compress_content=false)
zips given directory/file into given zip.file
Create styles array
The data for the language used.
hasTestArchive()
Returns if the archive directory structure for the test the object is created for exists...
handInTestBestSolution($html_string, $pdf_path)
Hands in the best solution for a test.
const TEST_RESULT_POSTFIX
getTestArchive()
Returns the (theoretical) path to the archive directory of the test, this object is created for...
hasPassDataDirectory($active_fi, $pass)
Checks if the directory for pass data is available.
hasPassMaterialsDirectory($active_fi, $pass)
Returns if the pass materials directory exists for a given pass.
createPassMaterialsDirectory($active_fi, $pass)
Creates pass materials directory.
static generatePDF($pdf_output, $output_mode, $filename=null)
const TEST_BEST_SOLUTION_PATH_COMPONENT
ensurePassMaterialsDirectoryIsAvailable($active_fi, $pass)
Ensures the availability of the pass materials directory.
ensureTestArchiveIsAvailable()
Ensures the availability of the test archive directory.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
handInParticipantMisc($active_fi, $pass, $original_filename, $file_path)
Hands in a participants file, which is relevant for archiving but an unspecified type.
const TEST_MATERIALS_PATH_COMPONENT
setParticipantData($participantData)
logArchivingProcess($message)
Logs to the archive log.
updateTestArchive()
Replaces the test-log with the current one.
handInTestResult($active_fi, $pass, $pdf_path)
Hands in an individual test result for a pass.