4 require_once
'./Modules/TestQuestionPool/classes/class.assQuestion.php';
5 require_once
'./Modules/Test/classes/inc.AssessmentConstants.php';
6 require_once
'./Modules/TestQuestionPool/interfaces/interface.ilObjQuestionScoringAdjustable.php';
7 require_once
'./Modules/TestQuestionPool/interfaces/interface.iQuestionCondition.php';
8 require_once
'./Modules/TestQuestionPool/classes/class.ilUserQuestionResult.php';
113 $this->parameters = array();
125 $params_array = split(
"<separator>", $params);
126 foreach ($params_array as $pair)
128 if (preg_match(
"/(.*?)\=(.*)/", $pair, $matches))
133 $this->java_code = $matches[2];
135 case "java_codebase" :
136 $this->java_codebase = $matches[2];
138 case "java_archive" :
139 $this->java_archive = $matches[2];
142 $this->java_width = $matches[2];
145 $this->java_height = $matches[2];
148 if (preg_match(
"/param_name_(\d+)/", $matches[1], $found_key))
150 $this->parameters[$found_key[1]][
"name"] = $matches[2];
152 if (preg_match(
"/param_value_(\d+)/", $matches[1], $found_key))
154 $this->parameters[$found_key[1]][
"value"] = $matches[2];
169 $params_array = array();
170 if ($this->java_code)
172 array_push($params_array,
"java_code=$this->java_code");
174 if ($this->java_codebase)
176 array_push($params_array,
"java_codebase=$this->java_codebase");
178 if ($this->java_archive)
180 array_push($params_array,
"java_archive=$this->java_archive");
182 if ($this->java_width)
184 array_push($params_array,
"java_width=$this->java_width");
186 if ($this->java_height)
188 array_push($params_array,
"java_height=$this->java_height");
190 foreach ($this->parameters as $key => $value)
192 array_push($params_array,
"param_name_$key=" . $value[
"name"]);
193 array_push($params_array,
"param_value_$key=" . $value[
"value"]);
196 return join($params_array,
"<separator>");
206 $params_array = array();
207 if ($this->java_code)
209 array_push($params_array,
"java_code=$this->java_code");
210 array_push($params_array,
"java_codebase=$this->java_codebase");
211 array_push($params_array,
"java_archive=$this->java_archive");
213 foreach ($this->parameters as $key => $value)
215 array_push($params_array,
"param_name_$key=" . $value[
"name"]);
216 array_push($params_array,
"param_value_$key=" . $value[
"value"]);
218 return join($params_array,
"<separator>");
228 if (strlen($this->title)
231 && $this->javaapplet_filename
233 && $this->java_height
239 else if (strlen($this->title)
245 && $this->java_height
276 array( $this->
getId() )
279 ) .
" (question_fi, image_file, params) VALUES (%s, %s, %s)",
280 array(
"integer",
"text",
"text" ),
283 $this->javaapplet_filename,
305 $data = $ilDB->fetchAssoc(
$result);
306 $this->
setId($question_id);
315 include_once(
"./Services/RTE/classes/class.ilRTE.php");
319 $this->
setEstimatedWorkingTime(substr($data[
"working_time"], 0, 2), substr($data[
"working_time"], 3, 2), substr($data[
"working_time"], 6, 2));
345 $this_id = $this->
getId();
349 include_once (
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
353 if( (
int)$testObjId > 0 )
355 $clone->setObjId($testObjId);
380 $clone->copyPageOfQuestion($this_id);
382 $clone->copyXHTMLMediaObjectsOfQuestion($this_id);
384 $clone->duplicateApplet($this_id, $thisObjId);
386 $clone->onDuplicate($thisObjId, $this_id, $clone->getObjId(), $clone->getId());
407 include_once (
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
410 $source_questionpool_id = $this->
getObjId();
411 $clone->setObjId($target_questionpool_id);
423 $clone->copyApplet(
$original_id, $source_questionpool_id);
425 $clone->onCopy($source_questionpool_id,
$original_id, $clone->getObjId(), $clone->getId());
438 include_once (
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
441 $sourceParentId = $this->
getObjId();
447 $clone->setObjId($targetParentId);
449 if ($targetQuestionTitle)
451 $clone->setTitle($targetQuestionTitle);
456 $clone->copyPageOfQuestion($sourceQuestionId);
458 $clone->copyXHTMLMediaObjectsOfQuestion($sourceQuestionId);
460 $clone->copyApplet($sourceQuestionId, $sourceParentId);
462 $clone->onCopy($sourceParentId, $sourceQuestionId, $clone->getObjId(), $clone->getId());
470 $javapath_original = preg_replace(
"/([^\d])$this->id([^\d])/",
"\${1}$question_id\${2}", $javapath);
472 if( (
int)$objectId > 0 )
474 $javapath_original = str_replace(
"/$this->obj_id/",
"/$objectId/", $javapath_original);
477 if (!file_exists($javapath))
482 if (!copy($javapath_original .
$filename, $javapath . $filename)) {
483 print
"java applet could not be duplicated!!!! ";
490 $javapath_original = preg_replace(
"/([^\d])$this->id([^\d])/",
"\${1}$question_id\${2}", $javapath);
491 $javapath_original = str_replace(
"/$this->obj_id/",
"/$source_questionpool/", $javapath_original);
492 if (!file_exists($javapath))
497 if (!copy($javapath_original .
$filename, $javapath . $filename)) {
498 print
"java applet could not be copied!!!! ";
646 throw new ilTestException(
'return details not implemented for '.__METHOD__);
651 $found_values = array();
656 $result = $ilDB->queryF(
"SELECT points FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
657 array(
'integer',
'integer',
'integer'),
661 while ($data = $ilDB->fetchAssoc(
$result))
674 if( isset($solution[
'points']) )
676 $points += $solution[
'points'];
694 $found_values = array();
699 $result = $ilDB->queryF(
"SELECT * FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
700 array(
'integer',
'integer',
'integer'),
704 $user_result = array();
705 while ($data = $ilDB->fetchAssoc(
$result))
708 if ($data[
"points"] > 0)
714 "points" => $data[
"points"],
716 "value1" => $data[
"value1"],
717 "value2" => $data[
"value2"],
720 array_push($user_result, $solution);
738 $this->parameters[$index] = array(
"name" => $name,
"value" => $value);
742 array_push($this->parameters, array(
"name" => $name,
"value" => $value));
748 if (array_key_exists($index, $this->parameters))
751 $newparams = array();
752 for ($i = 0; $i < $index; $i++)
754 array_push($newparams, $this->parameters[$i]);
756 array_push($newparams, array($name, $value));
757 for ($i = $index; $i < count($this->parameters); $i++)
759 array_push($newparams, $this->parameters[$i]);
761 $this->parameters = $newparams;
765 array_push($this->parameters, array($name, $value));
778 if ($index < 0)
return;
779 if (count($this->parameters) < 1)
return;
780 if ($index >= count($this->parameters))
return;
781 unset($this->parameters[$index]);
782 $this->parameters = array_values($this->parameters);
795 if (($index < 0) or ($index >= count($this->parameters)))
799 return $this->parameters[$index];
812 foreach ($this->parameters as $key => $value)
814 if (array_key_exists($name, $value))
831 return count($this->parameters);
842 $this->parameters = array();
909 if (!empty($javaapplet_tempfilename))
912 if (!file_exists($javapath))
919 $ilLog->write(
"ERROR: java applet question: java applet not uploaded: $javaapplet_filename");
932 $this->javaapplet_filename =
"";
942 return "assJavaApplet";
952 return "qpl_qst_javaapplet";
978 include_once (
"./Services/Excel/classes/class.ilExcelUtils.php");
983 foreach ($solutions as $solution)
990 return $startrow + $i + 1;
1008 require_once
"./Modules/TestQuestionPool/classes/class.ilOperatorsExpressionMapping.php";