5 include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
    6 include_once 
"./Modules/Test/classes/inc.AssessmentConstants.php";
 
   86                 $affectedRows = $ilDB->manipulateF(
"DELETE FROM " . $this->
getAdditionalTableName() . 
" WHERE question_fi = %s", 
 
   90                 $affectedRows = $ilDB->manipulateF(
"INSERT INTO " . $this->
getAdditionalTableName() . 
" (question_fi, maxsize, allowedextensions, compl_by_submission) VALUES (%s, %s, %s, %s)", 
 
   91                         array(
"integer", 
"float", 
"text", 
"integer"),
 
  118                         $this->
setId($question_id);
 
  129                         include_once(
"./Services/RTE/classes/class.ilRTE.php");
 
  150                 $this_id = $this->
getId();
 
  152                 if( (
int)$testObjId > 0 )
 
  158                 include_once (
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
 
  162                 if( (
int)$testObjId > 0 )
 
  164                         $clone->setObjId($testObjId);
 
  191                 $clone->copyPageOfQuestion($this_id);
 
  193                 $clone->copyXHTMLMediaObjectsOfQuestion($this_id);
 
  195                 $clone->duplicateGenericFeedback($this_id);
 
  197                 $clone->onDuplicate($thisObjId, $this_id, $clone->getObjId(), $clone->getId());
 
  214                 include_once (
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
 
  217                 $source_questionpool = $this->
getObjId();
 
  218                 $clone->setObjId($target_questionpool);
 
  261                         throw new ilTestException(
'return details not implemented for '.__METHOD__);
 
  281                 $this->lng->loadLanguageModule(
"form");
 
  283                 while (substr($_FILES[
"upload"][
"name"],-1) == 
'/')
 
  285                         $_FILES[
"upload"][
"name"] = substr($_FILES[
"upload"][
"name"],0,-1);
 
  289                 $filename_arr = pathinfo($_FILES[
"upload"][
"name"]);
 
  290                 $suffix = $filename_arr[
"extension"];
 
  291                 $mimetype = $_FILES[
"upload"][
"type"];
 
  292                 $size_bytes = $_FILES[
"upload"][
"size"];
 
  293                 $temp_name = $_FILES[
"upload"][
"tmp_name"];
 
  294                 $error = $_FILES[
"upload"][
"error"];
 
  307                                 case UPLOAD_ERR_INI_SIZE:
 
  312                                 case UPLOAD_ERR_FORM_SIZE:
 
  317                                 case UPLOAD_ERR_PARTIAL:
 
  318                                         ilUtil::sendInfo($this->lng->txt(
"form_msg_file_partially_uploaded"), 
true);
 
  322                                 case UPLOAD_ERR_NO_FILE:
 
  327                                 case UPLOAD_ERR_NO_TMP_DIR:
 
  332                                 case UPLOAD_ERR_CANT_WRITE:
 
  333                                         ilUtil::sendInfo($this->lng->txt(
"form_msg_file_cannot_write_to_disk"), 
true);
 
  337                                 case UPLOAD_ERR_EXTENSION:
 
  338                                         ilUtil::sendInfo($this->lng->txt(
"form_msg_file_upload_stopped_ext"), 
true);
 
  355                 if (strlen($temp_name))
 
  358                         if ($vir[0] == 
false)
 
  360                                 ilUtil::sendInfo($this->lng->txt(
"form_msg_file_virus_found").
"<br />".$vir[1], 
true);
 
  372                 if (is_null($question_id)) $question_id = $this->
getId();
 
  373                 return CLIENT_WEB_DIR . 
"/assessment/tst_$test_id/$active_id/$question_id/files/";
 
  383                 if (is_null($question_id)) $question_id = $this->
getId();
 
  384                 include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  401                 $result = $ilDB->queryF(
"SELECT * FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s ORDER BY tstamp",
 
  402                         array(
"integer", 
"integer", 
"integer"),
 
  408                         array_push($found, 
$data);
 
  423                 $result = $ilDB->queryF(
"SELECT test_fi FROM tst_active WHERE active_id = %s",
 
  432                         foreach ($found as $idx => 
$data)
 
  434                                 $found[$idx][
'webpath'] = 
$path;
 
  451                 foreach ($files as $solution_id)
 
  453                         $result = $ilDB->queryF(
"SELECT * FROM tst_solutions WHERE solution_id = %s",
 
  461                                 $active_id = 
$data[
'active_fi'];
 
  465                 foreach ($files as $solution_id)
 
  467                         $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_solutions WHERE solution_id = %s", 
 
  484                         $max_filesize = sprintf(
"%.1f Bytes",
$size);
 
  486                 else if (
$size < 1024*1024)
 
  488                         $max_filesize = sprintf(
"%.1f KB",
$size/1024);
 
  492                         $max_filesize = sprintf(
"%.1f MB",
$size/1024/1024);
 
  495                 return $max_filesize;
 
  512                         $umf = get_cfg_var(
"upload_max_filesize");
 
  514                         $pms = get_cfg_var(
"post_max_size");
 
  517                         $multiplier_a=array(
"K"=>1024, 
"M"=>1024*1024, 
"G"=>1024*1024*1024);
 
  519                         $umf_parts=preg_split(
"/(\d+)([K|G|M])/", $umf, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);
 
  520                         $pms_parts=preg_split(
"/(\d+)([K|G|M])/", $pms, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);
 
  522                         if (count($umf_parts) == 2) { $umf = $umf_parts[0]*$multiplier_a[$umf_parts[1]]; }
 
  523                         if (count($pms_parts) == 2) { $pms = $pms_parts[0]*$multiplier_a[$pms_parts[1]]; }
 
  526                         $max_filesize = min($umf, $pms);
 
  528                         if (!$max_filesize) $max_filesize=max($umf, $pms);
 
  529                         return $max_filesize;
 
  548                         include_once 
"./Modules/Test/classes/class.ilObjTest.php";
 
  552                 $result = $ilDB->queryF(
"SELECT test_fi FROM tst_active WHERE active_id = %s",
 
  563                 $entered_values = 
false;
 
  564                 if (strcmp(
$_POST[
'cmd'][
'gotoquestion'], $this->lng->txt(
'delete')) == 0)
 
  566                         $deletefiles = 
$_POST[
'file'];
 
  567                         if (is_array($deletefiles) && count($deletefiles) > 0)
 
  578                         if (strlen($_FILES[
"upload"][
"tmp_name"]))
 
  584                                         $filename_arr = pathinfo($_FILES[
"upload"][
"name"]);
 
  585                                         $extension = $filename_arr[
"extension"];
 
  586                                         $newfile = 
"file_" . $active_id . 
"_" . 
$pass . 
"_" . $version . 
"." . $extension;
 
  588                                         $next_id = $ilDB->nextId(
'tst_solutions');
 
  589                                         $affectedRows = $ilDB->insert(
"tst_solutions", array(
 
  590                                                 "solution_id" => array(
"integer", $next_id),
 
  591                                                 "active_fi" => array(
"integer", $active_id),
 
  592                                                 "question_fi" => array(
"integer", $this->
getId()),
 
  593                                                 "value1" => array(
"clob", $newfile),
 
  594                                                 "value2" => array(
"clob", $_FILES[
'upload'][
'name']),
 
  595                                                 "pass" => array(
"integer", 
$pass),
 
  596                                                 "tstamp" => array(
"integer", time())
 
  598                                         $entered_values = 
true;
 
  604                         include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
  612                         include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
  646                 global $ilObjDataCache;         
 
  664                         include_once 
'Modules/Test/classes/class.ilObjTestAccess.php';
 
  665                         include_once 
'Services/Tracking/classes/class.ilLPStatusWrapper.php';
 
  680                 return "assFileUpload";
 
  690                 return "qpl_qst_fileupload";
 
  735                 include_once (
"./Services/Excel/classes/class.ilExcelUtils.php");
 
  740                 foreach ($solutions as $solution)
 
  743                         if (strlen($solution[
"value1"]))
 
  750                 return $startrow + $i + 1;
 
  765         public function fromXML(&$item, &$questionpool_id, &$tst_id, &$tst_object, &$question_counter, &$import_mapping)
 
  767                 include_once 
"./Modules/TestQuestionPool/classes/import/qti12/class.assFileUploadImport.php";
 
  769                 $import->fromXML($item, $questionpool_id, $tst_id, $tst_object, $question_counter, $import_mapping);
 
  778         public function toXML($a_include_header = 
true, $a_include_binary = 
true, $a_shuffle = 
false, $test_output = 
false, $force_image_references = 
false)
 
  780                 include_once 
"./Modules/TestQuestionPool/classes/export/qti12/class.assFileUploadExport.php";
 
  782                 return $export->toXML($a_include_header, $a_include_binary, $a_shuffle, $test_output, $force_image_references);
 
  792                 $user_solution = array();
 
  793                 return $user_solution;
 
  813                 $this->maxsize = $a_value;
 
  823                 if (strlen($this->allowedextensions))
 
  825                         return array_filter(array_map(
'trim', explode(
",", $this->allowedextensions)));
 
  847                 $this->allowedextensions = strtolower(trim($a_value));
 
  860                         case "allowedextensions":
 
  863                         case 'completion_by_submission':
 
  882                         case "allowedextensions":
 
  885                         case 'completion_by_submission':
 
  903                 SELECT tst_solutions.solution_id  
  904                 FROM tst_solutions, tst_active, qpl_questions  
  905                 WHERE tst_solutions.active_fi = tst_active.active_id  
  906                 AND tst_solutions.question_fi = qpl_questions.question_id  
  907                 AND qpl_questions.question_id = %s  
  908                 AND tst_active.test_fi = %s",
 
  909                         array(
"integer", 
"integer"),
 
  925         public function getFileUploadZIPFile(
$test_id)
 
  931                         tst_solutions.solution_id, tst_solutions.pass, tst_solutions.active_fi, tst_solutions.question_fi,  
  932                         tst_solutions.value1, tst_solutions.value2, tst_solutions.tstamp  
  933                 FROM tst_solutions, tst_active, qpl_questions  
  934                 WHERE tst_solutions.active_fi = tst_active.active_id  
  935                 AND tst_solutions.question_fi = qpl_questions.question_id  
  936                 AND tst_solutions.question_fi = %s  
  937                 AND tst_active.test_fi = %s  
  938                 ORDER BY tst_solutions.active_fi, tst_solutions.tstamp";
 
  941                                                                  array(
"integer", 
"integer"),
 
  950                         $data .= 
"<html><head>";
 
  951                         $data .= 
'<meta http-equiv="content-type" content="text/html; charset=UTF-8" />';
 
  953                          table { border: 1px #333 solid; border-collapse:collapse;}      
  954                          td, th { border: 1px #333 solid; padding: 0.25em;}      
  955                          th { color: #fff; background-color: #666;} 
  958                         $data .= 
"<title>" . $this->
getTitle() . 
"</title></head><body>\n";
 
  960                         $data .= 
"<table><thead>\n";
 
  961                         $data .= 
"<tr><th>" . $this->lng->txt(
"name") . 
"</th><th>" . $this->lng->txt(
"filename") . 
"</th><th>" . $this->lng->txt(
"pass") . 
"</th><th>" . $this->lng->txt(
"location") . 
"</th><th>" . $this->lng->txt(
"date") . 
"</th></tr></thead><tbody>\n";
 
  965                                 @copy($this->
getFileUploadPath(
$test_id, 
$row[
"active_fi"], 
$row[
"question_fi"]) . 
$row[
"value1"], $tempdir . 
"/" . $row[
"active_fi"].
"/".$row[
"question_fi"] . 
"/" . $row[
"value1"]);
 
  966                                 if (!array_key_exists(
$row[
"active_fi"], $userdata))
 
  968                                         include_once 
"./Modules/Test/classes/class.ilObjTestAccess.php";
 
  971                                 $data .= 
"<tr><td>".$userdata[
$row[
"active_fi"]].
"</td><td><a href=\"".
$row[
"active_fi"].
"/".
$row[
"question_fi"].
"/".
$row[
"value1"].
"\" target=\"_blank\">".
$row[
"value2"].
"</a></td><td>".
$row[
"pass"].
"</td><td>".
$row[
"active_fi"].
"/".
$row[
"question_fi"].
"/".
$row[
"value1"].
"</td>";
 
  975                         $data .= 
"</tbody></table>\n";
 
  976                         $data .= 
"</body></html>\n";
 
  978                         $indexfile = $tempdir . 
"/index.html";
 
  979                         $fh = fopen($indexfile, 
'w');
 
 1012                 $this->completion_by_submission = (bool)$bool;