143 str_replace(
' ',
'', $this->
getTestTitle() .
'_' . $this->question->getTitle())
150 SELECT tst_solutions.solution_id, tst_solutions.pass, tst_solutions.active_fi, tst_solutions.question_fi,
151 tst_solutions.value1, tst_solutions.value2, tst_solutions.tstamp
152 FROM tst_solutions, tst_active, qpl_questions
153 WHERE tst_solutions.active_fi = tst_active.active_id
154 AND tst_solutions.question_fi = qpl_questions.question_id
155 AND tst_solutions.question_fi = %s
156 AND tst_active.test_fi = %s
157 ORDER BY tst_solutions.active_fi, tst_solutions.tstamp
160 $res = $this->db->queryF(
162 array(
"integer",
"integer"),
163 array($this->question->getId(), $this->getTestId())
166 $solutionData = array();
168 while (
$row = $this->db->fetchAssoc(
$res)) {
169 if (!isset($solutionData[
$row[
'active_fi']])) {
170 $solutionData[
$row[
'active_fi'] ] = array();
173 if (!isset($solutionData[
$row[
'active_fi'] ][
$row[
'pass'] ])) {
174 $solutionData[
$row[
'active_fi'] ][
$row[
'pass'] ] = array();
177 $solutionData[
$row[
'active_fi'] ][
$row[
'pass'] ][] =
$row;
180 return $solutionData;
185 $activeIds = array();
187 foreach ($solutionData as $activeId => $passes) {
188 $activeIds[] = $activeId;
191 require_once
'Modules/Test/classes/class.ilTestParticipantData.php';
193 $participantData->setActiveIds($activeIds);
194 $participantData->load($this->
getTestId());
196 return $participantData;
201 foreach ($solutionData as $activeId => $passes) {
204 $uploadedFileDir = $this->question->getFileUploadPath(
207 $this->question->getId()
211 if (!is_file($uploadedFileDir .
$file[
'value1'])) {
215 $destinationDir = $this->tempDirPath .
'/' . $this->mainFolderName .
'/';
221 copy($uploadedFileDir .
$file[
'value1'], $destinationDir .
$file[
'value2']);
229 return $this->lng->txt(
'pass') .
'_' . (
$pass + 1);
234 ilUtil::zip($this->tempDirPath .
'/' . $this->mainFolderName, $this->tempZipFilePath);
236 $pathinfo = pathinfo($this->tempZipFilePath);
237 $this->finalZipFilePath = dirname($pathinfo[
'dirname']) .
'/' . $pathinfo[
'basename'];
240 require_once
'Services/Utilities/classes/class.ilFileUtils.php';
260 $this->mainFolderName . self::ZIP_FILE_EXTENSION
An exception for terminatinating execution or to throw for unit testing.
__construct(ilDBInterface $db, ilLanguage $lng)
getParticipantData($solutionData)
getFileUploadSolutionData()
collectUploadedFiles($solutionData, ilTestParticipantData $participantData)
removeFileUploadCollection()
createFileUploadCollectionZipFile()
Class to report exception.
static rename($a_source, $a_target)
Rename a file.
static getRootLogger()
The unique root logger has a fixed error level.
getFileSystemCompliantFullnameByActiveId($activeId)
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static zip($a_dir, $a_file, $compress_content=false)
zips given directory/file into given zip.file
static ilTempnam($a_temp_path=null)
Create a temporary file in an ILIAS writable directory.
static getASCIIFilename($a_filename)
convert utf8 to ascii filename
static makeDirParents($a_dir)
Create a new directory and all parent directories.
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file
foreach($_POST as $key=> $value) $res