17 #region Constants / Config
98 $this->external_directory_path = $ilias->ini_ilias->readVariable(
'clients',
'datadir');
99 $this->client_id = $ilias->client_id;
101 $this->
ilDB = $ilias->db;
127 copy( $pdf_path, $pdf_new_path );
128 # /home/mbecker/public_html/ilias/trunk-primary/extern/default/tst_data/archive/tst_350/2013/09/19/80_1_root_user_/test_submission.pdf
131 file_put_contents($html_new_path, $html_string);
133 $this->
logArchivingProcess( date( self::LOG_DTSGROUP_FORMAT ) . self::LOG_ADDITION_STRING . $pdf_new_path );
134 $this->
logArchivingProcess( date( self::LOG_DTSGROUP_FORMAT ) . self::LOG_ADDITION_STRING . $html_new_path );
152 . self::DIR_SEP . self::QUESTION_PATH_COMPONENT_PREFIX . $question_fi;
153 if ( !is_dir( $pass_question_directory ) )
155 mkdir( $pass_question_directory , 0777,
true );
158 copy( $file_path, $pass_question_directory . self::DIR_SEP. $original_filename );
161 date(self::LOG_DTSGROUP_FORMAT) . self::LOG_ADDITION_STRING
162 . $pass_question_directory . self::DIR_SEP. $original_filename
181 copy( $file_path, $new_path );
182 $this->
logArchivingProcess( date( self::LOG_DTSGROUP_FORMAT ) . self::LOG_ADDITION_STRING . $new_path );
196 if ( !is_dir( $best_solution_path ) )
198 mkdir( $best_solution_path , 0777,
true );
201 file_put_contents( $best_solution_path . self::DIR_SEP . self::HTML_BEST_SOLUTION_FILENAME, $html_string );
203 copy( $pdf_path, $best_solution_path . self::DIR_SEP . self::PDF_BEST_SOLUTION_FILENAME );
206 date(self::LOG_DTSGROUP_FORMAT) . self::LOG_ADDITION_STRING
207 . $best_solution_path . self::DIR_SEP . self::HTML_BEST_SOLUTION_FILENAME);
210 date(self::LOG_DTSGROUP_FORMAT) . self::LOG_ADDITION_STRING
211 . $best_solution_path . self::DIR_SEP . self::PDF_BEST_SOLUTION_FILENAME);
226 if ( !is_dir( $best_solution_path ) )
228 mkdir( $best_solution_path , 0777,
true);
232 if ( !is_dir( $materials_path ) )
234 mkdir( $materials_path , 0777,
true);
237 $question_materials_path = $materials_path . self::DIR_SEP . self::QUESTION_PATH_COMPONENT_PREFIX . $question_fi;
238 if ( !is_dir( $question_materials_path ) )
240 mkdir( $question_materials_path , 0777,
true);
243 copy( $file_path, $question_materials_path . self::DIR_SEP . $orginial_filename );
246 date(self::LOG_DTSGROUP_FORMAT) . self::LOG_ADDITION_STRING
247 . $question_materials_path . self::DIR_SEP . $orginial_filename);
265 . self::TEST_RESULT_POSTFIX;
266 copy( $pdf_path, $new_path );
267 $this->
logArchivingProcess( date( self::LOG_DTSGROUP_FORMAT ) . self::LOG_ADDITION_STRING . $new_path );
280 . self::TEST_OVERVIEW_PDF_FILENAME
282 copy( $pdf_path, $new_pdf_path );
283 $html_path = $this->
getTestArchive() . self::DIR_SEP . self::TEST_OVERVIEW_HTML_FILENAME
285 file_put_contents($html_path, $html_string);
287 $this->
logArchivingProcess( date( self::LOG_DTSGROUP_FORMAT ) . self::LOG_ADDITION_STRING . $new_pdf_path );
288 $this->
logArchivingProcess( date( self::LOG_DTSGROUP_FORMAT ) . self::LOG_ADDITION_STRING . $html_path );
321 $test_archive_directory = $this->external_directory_path . self::DIR_SEP . $this->client_id . self::DIR_SEP .
'tst_data'
322 . self::DIR_SEP .
'archive' . self::DIR_SEP .
'tst_'.$this->test_obj_id;
323 return $test_archive_directory;
349 $query =
'SELECT * FROM ass_log WHERE obj_fi = ' . $this->
ilDB->
quote($this->test_obj_id,
'integer');
356 $outfile_lines .=
"\r\n" . implode(
"\t",
$row);
358 file_put_contents($this->
getTestArchive() . self::DIR_SEP . self::TEST_LOG_FILENAME, $outfile_lines);
363 $gui->object =
$test;
364 $array_of_actives = array();
365 $participants =
$test->getParticipants();
367 foreach($participants as $key => $value)
369 $array_of_actives[] = $key;
371 $output_template = $gui->createUserResults(
true,
false,
true, $array_of_actives);
373 require_once
'class.ilTestPDFGenerator.php';
410 return $this->external_directory_path . self::DIR_SEP . $this->client_id . self::DIR_SEP .
'tst_data'
411 . self::DIR_SEP . self::EXPORT_DIRECTORY . self::DIR_SEP .
'tst_' .
$this->test_obj_id;
425 $zip_output_filename =
'test_archive_obj_'.$this->test_obj_id .
'_' . time() .
'_.zip';
433 #region PassDataDirectory
477 foreach ($this->archive_data_index as $data_index_entry)
479 if ( $data_index_entry != null && $data_index_entry[
'identifier'] == $active_fi.
'|'.
$pass )
481 array_shift($data_index_entry);
482 return $this->
getTestArchive() . self::DIR_SEP . implode(self::DIR_SEP, $data_index_entry);
486 $this->
appendToArchiveDataIndex(date(DATE_ISO8601), $active_fi,
$pass, $ilUser->getFirstname(), $ilUser->getLastname(), $ilUser->getMatriculation());
488 @array_shift($data_index_entry);
489 return $this->
getTestArchive() . self::DIR_SEP . implode(self::DIR_SEP, $data_index_entry);
513 #region PassMaterialsDirectory
600 if ( @file_exists( $data_index_file ) )
602 $lines = explode(
"\n", file_get_contents( $data_index_file ) );
603 foreach ($lines as $line)
605 $line_items = explode(
'|', $line);
606 $line_data[
'identifier'] = $line_items[0] .
'|' . $line_items[1];
607 $line_data[
'yyyy'] = $line_items[2];
608 $line_data[
'mm'] = $line_items[3];
609 $line_data[
'dd'] = $line_items[4];
610 $line_data[
'directory'] = $line_items[5];
611 $contents[] = $line_data;
633 $this->archive_data_index[] = $line;
634 $output_contents =
'';
636 foreach ($this->archive_data_index as $line_data)
638 if($line_data[
'identifier'] ==
"|")
642 $output_contents .= implode(
'|', $line_data) .
"\n";
645 file_put_contents($this->
getTestArchive() . self::DIR_SEP . self::DATA_INDEX_FILENAME, $output_contents);
664 $date = date_create_from_format(DATE_ISO8601, $date);
666 'identifier' => $active_fi .
'|' .
$pass,
667 'yyyy' => date_format( $date,
'Y' ),
668 'mm' => date_format( $date,
'm' ),
669 'dd' => date_format( $date,
'd' ),
670 'directory' => $active_fi .
'_' . $pass .
'_' . $user_firstname .
'_' . $user_lastname .
'_' . $matriculation
685 file_put_contents($archive, file_get_contents($archive) .
"\n" . $message);
703 if ($handle = opendir( $directory ))
705 while ((
$file = readdir( $handle )) !==
false)
707 if (!in_array(
$file, array(
'.',
'..' ) ) && !is_dir( $directory .
$file ))
709 if ($pattern && strpos($file, $pattern) === 0 )