23 include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
   24 include_once 
"./Modules/Test/classes/inc.AssessmentConstants.php";
 
   68                 if (($this->title) and ($this->author) and ($this->question) and ($this->
getMaximumPoints() > 0))
 
   90                 $affectedRows = $ilDB->manipulateF(
"DELETE FROM " . $this->
getAdditionalTableName() . 
" WHERE question_fi = %s", 
 
   94                 $affectedRows = $ilDB->manipulateF(
"INSERT INTO " . $this->
getAdditionalTableName() . 
" (question_fi, maxsize, allowedextensions) VALUES (%s, %s, %s)", 
 
   95                         array(
"integer", 
"float", 
"text"),
 
  121                         $this->
setId($question_id);
 
  132                         include_once(
"./Services/RTE/classes/class.ilRTE.php");
 
  152                 $this_id = $this->
getId();
 
  154                 include_once (
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
 
  181                 $clone->copyPageOfQuestion($this_id);
 
  183                 $clone->copyXHTMLMediaObjectsOfQuestion($this_id);
 
  185                 $clone->duplicateFeedbackGeneric($this_id);
 
  187                 $clone->onDuplicate($this_id);
 
  203                 include_once (
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
 
  206                 $source_questionpool = $this->
getObjId();
 
  207                 $clone->setObjId($target_questionpool);
 
  264                 $this->lng->loadLanguageModule(
"form");
 
  266                 while (substr($_FILES[
"upload"][
"name"],-1) == 
'/')
 
  268                         $_FILES[
"upload"][
"name"] = substr($_FILES[
"upload"][
"name"],0,-1);
 
  272                 $filename_arr = pathinfo($_FILES[
"upload"][
"name"]);
 
  273                 $suffix = $filename_arr[
"extension"];
 
  274                 $mimetype = $_FILES[
"upload"][
"type"];
 
  275                 $size_bytes = $_FILES[
"upload"][
"size"];
 
  276                 $temp_name = $_FILES[
"upload"][
"tmp_name"];
 
  277                 $error = $_FILES[
"upload"][
"error"];
 
  290                                 case UPLOAD_ERR_INI_SIZE:
 
  295                                 case UPLOAD_ERR_FORM_SIZE:
 
  300                                 case UPLOAD_ERR_PARTIAL:
 
  301                                         ilUtil::sendInfo($this->lng->txt(
"form_msg_file_partially_uploaded"), 
true);
 
  305                                 case UPLOAD_ERR_NO_FILE:
 
  310                                 case UPLOAD_ERR_NO_TMP_DIR:
 
  315                                 case UPLOAD_ERR_CANT_WRITE:
 
  316                                         ilUtil::sendInfo($this->lng->txt(
"form_msg_file_cannot_write_to_disk"), 
true);
 
  320                                 case UPLOAD_ERR_EXTENSION:
 
  321                                         ilUtil::sendInfo($this->lng->txt(
"form_msg_file_upload_stopped_ext"), 
true);
 
  338                 if (strlen($temp_name))
 
  341                         if ($vir[0] == 
false)
 
  343                                 ilUtil::sendInfo($this->lng->txt(
"form_msg_file_virus_found").
"<br />".$vir[1], 
true);
 
  355                 if (is_null($question_id)) $question_id = $this->
getId();
 
  356                 return CLIENT_WEB_DIR . 
"/assessment/tst_$test_id/$active_id/$question_id/files/";
 
  366                 if (is_null($question_id)) $question_id = $this->
getId();
 
  367                 include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  384                 $result = $ilDB->queryF(
"SELECT * FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s ORDER BY tstamp",
 
  385                         array(
"integer", 
"integer", 
"integer"),
 
  391                         array_push($found, 
$data);
 
  406                 $result = $ilDB->queryF(
"SELECT test_fi FROM tst_active WHERE active_id = %s",
 
  415                         foreach ($found as $idx => 
$data)
 
  417                                 $found[$idx][
'webpath'] = 
$path;
 
  434                 foreach (
$files as $solution_id)
 
  436                         $result = $ilDB->queryF(
"SELECT * FROM tst_solutions WHERE solution_id = %s",
 
  444                                 $active_id = 
$data[
'active_fi'];
 
  448                 foreach (
$files as $solution_id)
 
  450                         $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_solutions WHERE solution_id = %s", 
 
  467                         $max_filesize = sprintf(
"%.1f Bytes",
$size);
 
  469                 else if (
$size < 1024*1024)
 
  471                         $max_filesize = sprintf(
"%.1f KB",
$size/1024);
 
  475                         $max_filesize = sprintf(
"%.1f MB",
$size/1024/1024);
 
  478                 return $max_filesize;
 
  495                         $umf = get_cfg_var(
"upload_max_filesize");
 
  497                         $pms = get_cfg_var(
"post_max_size");
 
  500                         $multiplier_a=array(
"K"=>1024, 
"M"=>1024*1024, 
"G"=>1024*1024*1024);
 
  502                         $umf_parts=preg_split(
"/(\d+)([K|G|M])/", $umf, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);
 
  503                         $pms_parts=preg_split(
"/(\d+)([K|G|M])/", $pms, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);
 
  505                         if (count($umf_parts) == 2) { $umf = $umf_parts[0]*$multiplier_a[$umf_parts[1]]; }
 
  506                         if (count($pms_parts) == 2) { $pms = $pms_parts[0]*$multiplier_a[$pms_parts[1]]; }
 
  509                         $max_filesize = min($umf, $pms);
 
  511                         if (!$max_filesize) $max_filesize=max($umf, $pms);
 
  512                         return $max_filesize;
 
  530                         include_once 
"./Modules/Test/classes/class.ilObjTest.php";
 
  534                 $result = $ilDB->queryF(
"SELECT test_fi FROM tst_active WHERE active_id = %s",
 
  545                 $entered_values = 
false;
 
  546                 if (strcmp(
$_POST[
'cmd'][
'gotoquestion'], $this->lng->txt(
'delete')) == 0)
 
  548                         $deletefiles = 
$_POST[
'file'];
 
  549                         if (is_array($deletefiles) && count($deletefiles) > 0)
 
  560                         if (strlen($_FILES[
"upload"][
"tmp_name"]))
 
  566                                         $filename_arr = pathinfo($_FILES[
"upload"][
"name"]);
 
  567                                         $extension = $filename_arr[
"extension"];
 
  568                                         $newfile = 
"file_" . $active_id . 
"_" . 
$pass . 
"_" . $version . 
"." . $extension;
 
  570                                         $next_id = $ilDB->nextId(
'tst_solutions');
 
  571                                         $affectedRows = $ilDB->insert(
"tst_solutions", array(
 
  572                                                 "solution_id" => array(
"integer", $next_id),
 
  573                                                 "active_fi" => array(
"integer", $active_id),
 
  574                                                 "question_fi" => array(
"integer", $this->
getId()),
 
  575                                                 "value1" => array(
"clob", $newfile),
 
  576                                                 "value2" => array(
"clob", $_FILES[
'upload'][
'name']),
 
  577                                                 "pass" => array(
"integer", 
$pass),
 
  578                                                 "tstamp" => array(
"integer", time())
 
  580                                         $entered_values = 
true;
 
  586                         include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
  594                         include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
  611                 return "assFileUpload";
 
  621                 return "qpl_qst_fileupload";
 
  666                 include_once (
"./Services/Excel/classes/class.ilExcelUtils.php");
 
  671                 foreach ($solutions as $solution)
 
  674                         if (strlen($solution[
"value1"]))
 
  681                 return $startrow + $i + 1;
 
  696         public function fromXML(&$item, &$questionpool_id, &$tst_id, &$tst_object, &$question_counter, &$import_mapping)
 
  698                 include_once 
"./Modules/TestQuestionPool/classes/import/qti12/class.assFileUploadImport.php";
 
  700                 $import->fromXML($item, $questionpool_id, $tst_id, $tst_object, $question_counter, $import_mapping);
 
  709         public function toXML($a_include_header = 
true, $a_include_binary = 
true, $a_shuffle = 
false, $test_output = 
false, $force_image_references = 
false)
 
  711                 include_once 
"./Modules/TestQuestionPool/classes/export/qti12/class.assFileUploadExport.php";
 
  713                 return $export->toXML($a_include_header, $a_include_binary, $a_shuffle, $test_output, $force_image_references);
 
  723                 $user_solution = array();
 
  724                 return $user_solution;
 
  744                 $this->maxsize = $a_value;
 
  754                 if (strlen($this->allowedextensions))
 
  756                         return split(
",", $this->allowedextensions);
 
  778                 $this->allowedextensions = strtolower(trim($a_value));
 
  791                         case "allowedextensions":
 
  810                         case "allowedextensions":
 
  827                 $result = $ilDB->queryF(
"SELECT tst_solutions.solution_id FROM tst_solutions, tst_active, qpl_questions WHERE tst_solutions.active_fi = tst_active.active_id AND tst_solutions.question_fi = qpl_questions.question_id AND qpl_questions.original_id = %s AND tst_active.test_fi = %s",
 
  828                         array(
"integer", 
"integer"),
 
  847                 $result = $ilDB->queryF(
"SELECT tst_solutions.solution_id, tst_solutions.pass, tst_solutions.active_fi, tst_solutions.question_fi, tst_solutions.value1, tst_solutions.value2, tst_solutions.tstamp FROM tst_solutions, tst_active, qpl_questions WHERE tst_solutions.active_fi = tst_active.active_id AND tst_solutions.question_fi = qpl_questions.question_id AND qpl_questions.original_id = %s AND tst_active.test_fi = %s ORDER BY tst_solutions.active_fi, tst_solutions.tstamp",
 
  848                         array(
"integer", 
"integer"),
 
  856                         $data .= 
"<html><head>";
 
  857                         $data .= 
'<meta http-equiv="content-type" content="text/html; charset=UTF-8" />';
 
  859                          table { border: 1px #333 solid; border-collapse:collapse;}      
  860                          td, th { border: 1px #333 solid; padding: 0.25em;}      
  861                          th { color: #fff; background-color: #666;} 
  864                         $data .= 
"<title>" . $this->
getTitle() . 
"</title></head><body>\n";
 
  866                         $data .= 
"<table><thead>\n";
 
  867                         $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";
 
  871                                 @copy($this->
getFileUploadPath(
$test_id, $row[
"active_fi"], $row[
"question_fi"]) . $row[
"value1"], $tempdir . 
"/" . $row[
"active_fi"].
"/".$row[
"question_fi"] . 
"/" . $row[
"value1"]);
 
  872                                 if (!array_key_exists($row[
"active_fi"], $userdata))
 
  874                                         include_once 
"./Modules/Test/classes/class.ilObjTestAccess.php";
 
  877                                 $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>";
 
  881                         $data .= 
"</tbody></table>\n";
 
  882                         $data .= 
"</body></html>\n";
 
  884                         $indexfile = $tempdir . 
"/index.html";
 
  885                         $fh = fopen($indexfile, 
'w');