5 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
6 include_once
"./Modules/Test/classes/inc.AssessmentConstants.php";
112 $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];
170 $params_array = array();
171 if ($this->java_code)
173 array_push($params_array,
"java_code=$this->java_code");
175 if ($this->java_codebase)
177 array_push($params_array,
"java_codebase=$this->java_codebase");
179 if ($this->java_archive)
181 array_push($params_array,
"java_archive=$this->java_archive");
183 if ($this->java_width)
185 array_push($params_array,
"java_width=$this->java_width");
187 if ($this->java_height)
189 array_push($params_array,
"java_height=$this->java_height");
191 foreach ($this->parameters as $key => $value)
193 array_push($params_array,
"param_name_$key=" . $value[
"name"]);
194 array_push($params_array,
"param_value_$key=" . $value[
"value"]);
196 return join($params_array,
"<separator>");
209 $params_array = array();
210 if ($this->java_code)
212 array_push($params_array,
"java_code=$this->java_code");
213 array_push($params_array,
"java_codebase=$this->java_codebase");
214 array_push($params_array,
"java_archive=$this->java_archive");
216 foreach ($this->parameters as $key => $value)
218 array_push($params_array,
"param_name_$key=" . $value[
"name"]);
219 array_push($params_array,
"param_value_$key=" . $value[
"value"]);
221 return join($params_array,
"<separator>");
232 if (strlen($this->title) and ($this->author) and ($this->question) and ($this->javaapplet_filename) and ($this->java_width) and ($this->java_height) and ($this->
getPoints() > 0))
236 else if (strlen($this->title) and ($this->author) and ($this->question) and ($this->
getJavaArchive()) and ($this->
getJavaCodebase()) and ($this->java_width) and ($this->java_height) and ($this->
getPoints() > 0))
263 $affectedRows = $ilDB->manipulateF(
"DELETE FROM " . $this->
getAdditionalTableName() .
" WHERE question_fi = %s",
265 array($this->
getId())
267 $affectedRows = $ilDB->manipulateF(
"INSERT INTO " . $this->
getAdditionalTableName() .
" (question_fi, image_file, params) VALUES (%s, %s, %s)",
268 array(
"integer",
"text",
"text"),
271 $this->javaapplet_filename,
299 $this->
setId($question_id);
308 include_once(
"./Services/RTE/classes/class.ilRTE.php");
330 $this_id = $this->
getId();
332 if( (
int)$testObjId > 0 )
338 include_once (
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
342 if( (
int)$testObjId > 0 )
344 $clone->setObjId($testObjId);
369 $clone->copyPageOfQuestion($this_id);
371 $clone->copyXHTMLMediaObjectsOfQuestion($this_id);
373 $clone->duplicateGenericFeedback($this_id);
376 $clone->duplicateApplet($this_id, $thisObjId);
378 $clone->onDuplicate($thisObjId, $this_id, $clone->getObjId(), $clone->getId());
399 include_once (
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
402 $source_questionpool = $this->
getObjId();
403 $clone->setObjId($target_questionpool);
426 $javapath_original = preg_replace(
"/([^\d])$this->id([^\d])/",
"\${1}$question_id\${2}", $javapath);
428 if( (
int)$objectId > 0 )
430 $javapath_original = str_replace(
"/$this->obj_id/",
"/$objectId/", $javapath_original);
433 if (!file_exists($javapath))
438 if (!copy($javapath_original .
$filename, $javapath . $filename)) {
439 print
"java applet could not be duplicated!!!! ";
446 $javapath_original = preg_replace(
"/([^\d])$this->id([^\d])/",
"\${1}$question_id\${2}", $javapath);
447 $javapath_original = str_replace(
"/$this->obj_id/",
"/$source_questionpool/", $javapath_original);
448 if (!file_exists($javapath))
453 if (!copy($javapath_original .
$filename, $javapath . $filename)) {
454 print
"java applet could not be copied!!!! ";
602 throw new ilTestException(
'return details not implemented for '.__METHOD__);
607 $found_values = array();
612 $result = $ilDB->queryF(
"SELECT points FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
613 array(
'integer',
'integer',
'integer'),
638 $found_values = array();
643 $result = $ilDB->queryF(
"SELECT * FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
644 array(
'integer',
'integer',
'integer'),
648 $user_result = array();
652 if (
$data[
"points"] > 0)
658 "points" =>
$data[
"points"],
660 "value1" =>
$data[
"value1"],
661 "value2" =>
$data[
"value2"],
664 array_push($user_result, $solution);
682 $this->parameters[$index] = array(
"name" => $name,
"value" => $value);
686 array_push($this->parameters, array(
"name" => $name,
"value" => $value));
692 if (array_key_exists($index, $this->parameters))
695 $newparams = array();
696 for ($i = 0; $i < $index; $i++)
698 array_push($newparams, $this->parameters[$i]);
700 array_push($newparams, array($name, $value));
701 for ($i = $index; $i < count($this->parameters); $i++)
703 array_push($newparams, $this->parameters[$i]);
705 $this->parameters = $newparams;
709 array_push($this->parameters, array($name, $value));
722 if ($index < 0)
return;
723 if (count($this->parameters) < 1)
return;
724 if ($index >= count($this->parameters))
return;
725 unset($this->parameters[$index]);
726 $this->parameters = array_values($this->parameters);
739 if (($index < 0) or ($index >= count($this->parameters)))
743 return $this->parameters[$index];
756 foreach ($this->parameters as $key => $value)
758 if (array_key_exists($name, $value))
775 return count($this->parameters);
786 $this->parameters = array();
842 if (!empty($javaapplet_tempfilename))
845 if (!file_exists($javapath))
852 $ilLog->write(
"ERROR: java applet question: java applet not uploaded: $javaapplet_filename");
865 $this->javaapplet_filename =
"";
876 return "assJavaApplet";
887 return "qpl_qst_javaapplet";
913 include_once (
"./Services/Excel/classes/class.ilExcelUtils.php");
918 foreach ($solutions as $solution)
925 return $startrow + $i + 1;