32 private \ILIAS\ResourceStorage\Services
$irss;
33 private \ILIAS\Filesystem\Util\Archive\Archives
$archive;
77 $this->access_filter =
$f->getAccessStatisticsUserFilter($this->ref_id);
79 $this->irss = $DIC->resourceStorage();
80 $this->archive = $DIC->archives();
81 $this->file_delivery = $DIC->fileDelivery();
92 return $this->test_id;
142 str_replace(
' ',
'', $this->
getTestTitle() .
'_' . $this->question->getTitle())
149 SELECT tst_solutions.solution_id, tst_solutions.pass, tst_solutions.active_fi, tst_solutions.question_fi, 150 tst_solutions.value1, tst_solutions.value2, tst_solutions.tstamp 151 FROM tst_solutions, tst_active, qpl_questions 152 WHERE tst_solutions.active_fi = tst_active.active_id 153 AND tst_solutions.question_fi = qpl_questions.question_id 154 AND tst_solutions.question_fi = %s 155 AND tst_active.test_fi = %s 156 ORDER BY tst_solutions.active_fi, tst_solutions.tstamp 159 $res = $this->db->queryF(
161 [
"integer",
"integer"],
162 [$this->question->getId(), $this->
getTestId()]
167 while ($row = $this->db->fetchAssoc(
$res)) {
168 if (!isset($solutionData[$row[
'active_fi']])) {
169 $solutionData[ $row[
'active_fi'] ] = [];
172 if (!isset($solutionData[ $row[
'active_fi'] ][ $row[
'pass'] ])) {
173 $solutionData[ $row[
'active_fi'] ][ $row[
'pass'] ] = [];
176 $solutionData[ $row[
'active_fi'] ][ $row[
'pass'] ][] = $row;
179 return $solutionData;
186 foreach ($solutionData as $activeId => $passes) {
187 $activeIds[] = $activeId;
191 $participantData->setActiveIdsFilter($activeIds);
192 $participantData->setParticipantAccessFilter($this->access_filter);
193 $participantData->load($this->
getTestId());
195 return $participantData;
202 foreach ($solution_data as $activeId => $passes) {
203 if (!in_array($activeId, $participant_data->
getActiveIds(),
true)) {
207 foreach ($passes as $pass => $files) {
208 foreach ($files as $file) {
215 if ($file[
'value2'] ===
'rid') {
216 $revision = $this->irss->manage()->getCurrentRevision(
217 $rid = $this->irss->manage()->find($file[
'value1'])
219 $streams[$dir . $revision->getTitle()] = $this->irss->consume()->stream($rid)->getStream();
224 $file_dir = $this->question->getFileUploadPath(
227 $this->question->getId()
230 $legacy_file_path = $file_dir . $file[
'value1'];
231 if (!is_file($legacy_file_path)) {
235 $streams[$dir . $file[
'value2']] = Streams::ofResource(fopen($legacy_file_path,
'rb'));
240 $zip = $this->archive->zip($streams);
242 $this->file_delivery->delivery()->attached(
251 return $this->
lng->txt(
'pass') .
'_' . ($pass + 1);
256 ilFileUtils::zip($this->tempDirPath .
'/' . $this->mainFolderName, $this->tempZipFilePath);
258 $pathinfo = pathinfo($this->tempZipFilePath);
259 $this->finalZipFilePath = dirname($pathinfo[
'dirname']) .
'/' . $pathinfo[
'basename'];
276 $this->test_title .
'_' . $this->question->getTitle() . self::ZIP_FILE_EXTENSION
282 return self::ZIP_FILE_MIME_TYPE;
__construct(private ilDBInterface $db, private ilLanguage $lng, private int $ref_id, private int $test_id,)
createFileUploadCollectionZipFile()
ILIAS Filesystem Util Archive Archives $archive
ILIAS FileDelivery Services $file_delivery
setTestTitle(string $test_title)
getFileUploadSolutionData()
collectUploadedFiles(array $solution_data, ilTestParticipantData $participant_data)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getASCIIFilename(string $a_filename)
static ilTempnam(?string $a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.
ILIAS ResourceStorage Services $irss
static zip(string $a_dir, string $a_file, bool $compress_content=false)
static rename(string $a_source, string $a_target)
getFileSystemCompliantFullnameByActiveId($activeId)
static getRootLogger()
The unique root logger has a fixed error level.
getParticipantData($solutionData)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...