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';
111 $this->parameters = array();
123 $params_array = split(
"<separator>", $params);
124 foreach ($params_array as $pair)
126 if (preg_match(
"/(.*?)\=(.*)/", $pair, $matches))
131 $this->java_code = $matches[2];
133 case "java_codebase" :
134 $this->java_codebase = $matches[2];
136 case "java_archive" :
137 $this->java_archive = $matches[2];
140 $this->java_width = $matches[2];
143 $this->java_height = $matches[2];
146 if (preg_match(
"/param_name_(\d+)/", $matches[1], $found_key))
148 $this->parameters[$found_key[1]][
"name"] = $matches[2];
150 if (preg_match(
"/param_value_(\d+)/", $matches[1], $found_key))
152 $this->parameters[$found_key[1]][
"value"] = $matches[2];
167 $params_array = array();
168 if ($this->java_code)
170 array_push($params_array,
"java_code=$this->java_code");
172 if ($this->java_codebase)
174 array_push($params_array,
"java_codebase=$this->java_codebase");
176 if ($this->java_archive)
178 array_push($params_array,
"java_archive=$this->java_archive");
180 if ($this->java_width)
182 array_push($params_array,
"java_width=$this->java_width");
184 if ($this->java_height)
186 array_push($params_array,
"java_height=$this->java_height");
188 foreach ($this->parameters as $key => $value)
190 array_push($params_array,
"param_name_$key=" . $value[
"name"]);
191 array_push($params_array,
"param_value_$key=" . $value[
"value"]);
194 return join($params_array,
"<separator>");
204 $params_array = array();
205 if ($this->java_code)
207 array_push($params_array,
"java_code=$this->java_code");
208 array_push($params_array,
"java_codebase=$this->java_codebase");
209 array_push($params_array,
"java_archive=$this->java_archive");
211 foreach ($this->parameters as $key => $value)
213 array_push($params_array,
"param_name_$key=" . $value[
"name"]);
214 array_push($params_array,
"param_value_$key=" . $value[
"value"]);
216 return join($params_array,
"<separator>");
226 if (strlen($this->title)
229 && $this->javaapplet_filename
231 && $this->java_height
237 else if (strlen($this->title)
243 && $this->java_height
274 array( $this->
getId() )
277 ) .
" (question_fi, image_file, params) VALUES (%s, %s, %s)",
278 array(
"integer",
"text",
"text" ),
281 $this->javaapplet_filename,
303 $data = $ilDB->fetchAssoc(
$result);
304 $this->
setId($question_id);
313 include_once(
"./Services/RTE/classes/class.ilRTE.php");
317 $this->
setEstimatedWorkingTime(substr($data[
"working_time"], 0, 2), substr($data[
"working_time"], 3, 2), substr($data[
"working_time"], 6, 2));
343 $this_id = $this->
getId();
347 include_once (
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
351 if( (
int)$testObjId > 0 )
353 $clone->setObjId($testObjId);
378 $clone->copyPageOfQuestion($this_id);
380 $clone->copyXHTMLMediaObjectsOfQuestion($this_id);
382 $clone->duplicateApplet($this_id, $thisObjId);
384 $clone->onDuplicate($thisObjId, $this_id, $clone->getObjId(), $clone->getId());
405 include_once (
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
408 $source_questionpool_id = $this->
getObjId();
409 $clone->setObjId($target_questionpool_id);
421 $clone->copyApplet(
$original_id, $source_questionpool_id);
423 $clone->onCopy($source_questionpool_id,
$original_id, $clone->getObjId(), $clone->getId());
436 include_once (
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
439 $sourceParentId = $this->
getObjId();
445 $clone->setObjId($targetParentId);
447 if ($targetQuestionTitle)
449 $clone->setTitle($targetQuestionTitle);
454 $clone->copyPageOfQuestion($sourceQuestionId);
456 $clone->copyXHTMLMediaObjectsOfQuestion($sourceQuestionId);
458 $clone->copyApplet($sourceQuestionId, $sourceParentId);
460 $clone->onCopy($sourceParentId, $sourceQuestionId, $clone->getObjId(), $clone->getId());
468 $javapath_original = preg_replace(
"/([^\d])$this->id([^\d])/",
"\${1}$question_id\${2}", $javapath);
470 if( (
int)$objectId > 0 )
472 $javapath_original = str_replace(
"/$this->obj_id/",
"/$objectId/", $javapath_original);
475 if (!file_exists($javapath))
480 if (!copy($javapath_original .
$filename, $javapath . $filename)) {
481 print
"java applet could not be duplicated!!!! ";
488 $javapath_original = preg_replace(
"/([^\d])$this->id([^\d])/",
"\${1}$question_id\${2}", $javapath);
489 $javapath_original = str_replace(
"/$this->obj_id/",
"/$source_questionpool/", $javapath_original);
490 if (!file_exists($javapath))
495 if (!copy($javapath_original .
$filename, $javapath . $filename)) {
496 print
"java applet could not be copied!!!! ";
644 throw new ilTestException(
'return details not implemented for '.__METHOD__);
649 $found_values = array();
654 $result = $ilDB->queryF(
"SELECT points FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
655 array(
'integer',
'integer',
'integer'),
659 while ($data = $ilDB->fetchAssoc(
$result))
679 $found_values = array();
684 $result = $ilDB->queryF(
"SELECT * FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
685 array(
'integer',
'integer',
'integer'),
689 $user_result = array();
690 while ($data = $ilDB->fetchAssoc(
$result))
693 if ($data[
"points"] > 0)
699 "points" => $data[
"points"],
701 "value1" => $data[
"value1"],
702 "value2" => $data[
"value2"],
705 array_push($user_result, $solution);
723 $this->parameters[$index] = array(
"name" => $name,
"value" => $value);
727 array_push($this->parameters, array(
"name" => $name,
"value" => $value));
733 if (array_key_exists($index, $this->parameters))
736 $newparams = array();
737 for ($i = 0; $i < $index; $i++)
739 array_push($newparams, $this->parameters[$i]);
741 array_push($newparams, array($name, $value));
742 for ($i = $index; $i < count($this->parameters); $i++)
744 array_push($newparams, $this->parameters[$i]);
746 $this->parameters = $newparams;
750 array_push($this->parameters, array($name, $value));
763 if ($index < 0)
return;
764 if (count($this->parameters) < 1)
return;
765 if ($index >= count($this->parameters))
return;
766 unset($this->parameters[$index]);
767 $this->parameters = array_values($this->parameters);
780 if (($index < 0) or ($index >= count($this->parameters)))
784 return $this->parameters[$index];
797 foreach ($this->parameters as $key => $value)
799 if (array_key_exists($name, $value))
816 return count($this->parameters);
827 $this->parameters = array();
887 if (!empty($javaapplet_tempfilename))
890 if (!file_exists($javapath))
897 $ilLog->write(
"ERROR: java applet question: java applet not uploaded: $javaapplet_filename");
910 $this->javaapplet_filename =
"";
920 return "assJavaApplet";
930 return "qpl_qst_javaapplet";
956 include_once (
"./Services/Excel/classes/class.ilExcelUtils.php");
961 foreach ($solutions as $solution)
968 return $startrow + $i + 1;