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)) {
177 mkdir($pass_question_directory, 0777,
true);
180 copy($file_path, $pass_question_directory . self::DIR_SEP . $original_filename);
183 date(self::LOG_DTSGROUP_FORMAT) . self::LOG_ADDITION_STRING
184 . $pass_question_directory . self::DIR_SEP . $original_filename
203 copy($file_path, $new_path);
217 $best_solution_path = $this->
getTestArchive() . self::DIR_SEP . self::TEST_BEST_SOLUTION_PATH_COMPONENT;
218 if (!is_dir($best_solution_path)) {
219 mkdir($best_solution_path, 0777,
true);
222 file_put_contents($best_solution_path . self::DIR_SEP . self::HTML_BEST_SOLUTION_FILENAME, $html_string);
224 copy($pdf_path, $best_solution_path . self::DIR_SEP . self::PDF_BEST_SOLUTION_FILENAME);
227 date(self::LOG_DTSGROUP_FORMAT) . self::LOG_ADDITION_STRING
228 . $best_solution_path . self::DIR_SEP . self::HTML_BEST_SOLUTION_FILENAME
232 date(self::LOG_DTSGROUP_FORMAT) . self::LOG_ADDITION_STRING
233 . $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)) {
250 mkdir($best_solution_path, 0777,
true);
253 $materials_path = $best_solution_path . self::DIR_SEP . self::TEST_MATERIALS_PATH_COMPONENT;
254 if (!is_dir($materials_path)) {
255 mkdir($materials_path, 0777,
true);
258 $question_materials_path = $materials_path . self::DIR_SEP . self::QUESTION_PATH_COMPONENT_PREFIX . $question_fi;
259 if (!is_dir($question_materials_path)) {
260 mkdir($question_materials_path, 0777,
true);
263 copy($file_path, $question_materials_path . self::DIR_SEP . $orginial_filename);
266 date(self::LOG_DTSGROUP_FORMAT) . self::LOG_ADDITION_STRING
267 . $question_materials_path . self::DIR_SEP . $orginial_filename
286 . self::TEST_RESULT_POSTFIX;
287 copy($pdf_path, $new_path);
301 . self::TEST_OVERVIEW_PDF_FILENAME
303 copy($pdf_path, $new_pdf_path);
304 $html_path = $this->
getTestArchive() . self::DIR_SEP . self::TEST_OVERVIEW_HTML_FILENAME
306 file_put_contents($html_path, $html_string);
343 $test_archive_directory = $this->external_directory_path . self::DIR_SEP . $this->client_id . self::DIR_SEP .
'tst_data' 345 return $test_archive_directory;
370 $query =
'SELECT * FROM ass_log WHERE obj_fi = ' . $this->
ilDB->
quote($this->test_obj_id,
'integer');
376 $outfile_lines .=
"\r\n" . implode(
"\t",
$row);
378 file_put_contents($this->
getTestArchive() . self::DIR_SEP . self::TEST_LOG_FILENAME, $outfile_lines);
383 $gui->object =
$test;
384 $array_of_actives =
array();
385 $participants =
$test->getParticipants();
387 foreach ($participants as
$key => $value) {
388 $array_of_actives[] =
$key;
390 $output_template = $gui->createUserResults(
true,
false,
true, $array_of_actives);
392 require_once
'class.ilTestPDFGenerator.php';
428 return $this->external_directory_path . self::DIR_SEP . $this->client_id . self::DIR_SEP .
'tst_data' 429 . self::DIR_SEP . self::EXPORT_DIRECTORY . self::DIR_SEP .
'tst_' .
$this->test_obj_id;
443 $zip_output_filename =
'test_archive_obj_' . $this->test_obj_id .
'_' .
time() .
'_.zip';
451 #region PassDataDirectory 487 foreach ($this->archive_data_index as $data_index_entry) {
488 if ($data_index_entry != null && $data_index_entry[
'identifier'] == $active_fi .
'|' .
$pass) {
489 array_shift($data_index_entry);
490 return $this->
getTestArchive() . self::DIR_SEP . implode(self::DIR_SEP, $data_index_entry);
513 $user->setFirstname($usrData[
'firstname']);
514 $user->setLastname($usrData[
'lastname']);
515 $user->setMatriculation($usrData[
'matriculation']);
516 $user->setFirstname($usrData[
'firstname']);
526 $user->getFirstname(),
527 $user->getLastname(),
528 $user->getMatriculation()
557 #region PassMaterialsDirectory 592 $user->setFirstname($usrData[
'firstname']);
593 $user->setLastname($usrData[
'lastname']);
594 $user->setMatriculation($usrData[
'matriculation']);
595 $user->setFirstname($usrData[
'firstname']);
605 $user->getFirstname(),
606 $user->getLastname(),
607 $user->getMatriculation()
623 return $pass_data_directory . self::DIR_SEP . self::PASS_MATERIALS_PATH_COMPONENT;
655 $data_index_file = $this->
getTestArchive() . self::DIR_SEP . self::DATA_INDEX_FILENAME;
660 if (@file_exists($data_index_file)) {
661 $lines = explode(
"\n", file_get_contents($data_index_file));
662 foreach ($lines as $line) {
663 $line_items = explode(
'|', $line);
664 $line_data[
'identifier'] = $line_items[0] .
'|' . $line_items[1];
665 $line_data[
'yyyy'] = $line_items[2];
666 $line_data[
'mm'] = $line_items[3];
667 $line_data[
'dd'] = $line_items[4];
668 $line_data[
'directory'] = $line_items[5];
691 $this->archive_data_index[] = $line;
692 $output_contents =
'';
694 foreach ($this->archive_data_index as $line_data) {
695 if ($line_data[
'identifier'] ==
"|") {
698 $output_contents .= implode(
'|', $line_data) .
"\n";
701 file_put_contents($this->
getTestArchive() . self::DIR_SEP . self::DATA_INDEX_FILENAME, $output_contents);
720 $date = date_create_from_format(DATE_ISO8601, $date);
722 'identifier' => $active_fi .
'|' .
$pass,
723 'yyyy' => date_format($date,
'Y'),
724 'mm' => date_format($date,
'm'),
725 'dd' => date_format($date,
'd'),
726 'directory' => $active_fi .
'_' . $pass .
'_' . $user_firstname .
'_' . $user_lastname .
'_' . $matriculation
740 $archive = $this->
getTestArchive() . self::DIR_SEP . self::ARCHIVE_LOG;
741 if (file_exists($archive)) {
742 $content = file_get_contents($archive) .
"\n" .
$message;
747 file_put_contents($archive, $content);
763 if ($handle = opendir($directory)) {
764 while ((
$file = readdir($handle)) !==
false) {
765 if (!in_array(
$file,
array(
'.',
'..' )) && !is_dir($directory .
$file)) {
766 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 PDF_USER_RESULT
PDF Purposes.
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
catch(Exception $e) $message
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.
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
static generatePDF($pdf_output, $output_mode, $filename=null, $purpose=null)
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.