23 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
24 include_once
"./Modules/Test/classes/inc.AssessmentConstants.php";
126 $this->parameters = array();
139 $params_array = split(
"<separator>", $params);
140 foreach ($params_array as $pair)
142 if (preg_match(
"/(.*?)\=(.*)/", $pair, $matches))
147 $this->java_code = $matches[2];
149 case "java_codebase" :
150 $this->java_codebase = $matches[2];
152 case "java_archive" :
153 $this->java_archive = $matches[2];
156 $this->java_width = $matches[2];
159 $this->java_height = $matches[2];
162 if (preg_match(
"/param_name_(\d+)/", $matches[1], $found_key))
164 $this->parameters[$found_key[1]][
"name"] = $matches[2];
166 if (preg_match(
"/param_value_(\d+)/", $matches[1], $found_key))
168 $this->parameters[$found_key[1]][
"value"] = $matches[2];
184 $params_array = array();
185 if ($this->java_code)
187 array_push($params_array,
"java_code=$this->java_code");
189 if ($this->java_codebase)
191 array_push($params_array,
"java_codebase=$this->java_codebase");
193 if ($this->java_archive)
195 array_push($params_array,
"java_archive=$this->java_archive");
197 if ($this->java_width)
199 array_push($params_array,
"java_width=$this->java_width");
201 if ($this->java_height)
203 array_push($params_array,
"java_height=$this->java_height");
205 foreach ($this->parameters as $key => $value)
207 array_push($params_array,
"param_name_$key=" . $value[
"name"]);
208 array_push($params_array,
"param_value_$key=" . $value[
"value"]);
210 return join($params_array,
"<separator>");
223 $params_array = array();
224 if ($this->java_code)
226 array_push($params_array,
"java_code=$this->java_code");
227 array_push($params_array,
"java_codebase=$this->java_codebase");
228 array_push($params_array,
"java_archive=$this->java_archive");
230 foreach ($this->parameters as $key => $value)
232 array_push($params_array,
"param_name_$key=" . $value[
"name"]);
233 array_push($params_array,
"param_value_$key=" . $value[
"value"]);
235 return join($params_array,
"<separator>");
246 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))
250 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))
277 $affectedRows = $ilDB->manipulateF(
"DELETE FROM " . $this->
getAdditionalTableName() .
" WHERE question_fi = %s",
279 array($this->
getId())
281 $affectedRows = $ilDB->manipulateF(
"INSERT INTO " . $this->
getAdditionalTableName() .
" (question_fi, image_file, params) VALUES (%s, %s, %s)",
282 array(
"integer",
"text",
"text"),
285 $this->javaapplet_filename,
313 $this->
setId($question_id);
322 include_once(
"./Services/RTE/classes/class.ilRTE.php");
344 $this_id = $this->
getId();
346 if( (
int)$testObjId > 0 )
352 include_once (
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
356 if( (
int)$testObjId > 0 )
358 $clone->setObjId($testObjId);
383 $clone->copyPageOfQuestion($this_id);
385 $clone->copyXHTMLMediaObjectsOfQuestion($this_id);
387 $clone->duplicateFeedbackGeneric($this_id);
390 $clone->duplicateApplet($this_id, $thisObjId);
392 $clone->onDuplicate($thisObjId, $this_id, $clone->getObjId(), $clone->getId());
413 include_once (
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
416 $source_questionpool = $this->
getObjId();
417 $clone->setObjId($target_questionpool);
440 $javapath_original = preg_replace(
"/([^\d])$this->id([^\d])/",
"\${1}$question_id\${2}", $javapath);
442 if( (
int)$objectId > 0 )
444 $javapath_original = str_replace(
"/$this->obj_id/",
"/$objectId/", $javapath_original);
447 if (!file_exists($javapath))
452 if (!copy($javapath_original .
$filename, $javapath . $filename)) {
453 print
"java applet could not be duplicated!!!! ";
460 $javapath_original = preg_replace(
"/([^\d])$this->id([^\d])/",
"\${1}$question_id\${2}", $javapath);
461 $javapath_original = str_replace(
"/$this->obj_id/",
"/$source_questionpool/", $javapath_original);
462 if (!file_exists($javapath))
467 if (!copy($javapath_original .
$filename, $javapath . $filename)) {
468 print
"java applet could not be copied!!!! ";
617 $found_values = array();
622 $result = $ilDB->queryF(
"SELECT points FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
623 array(
'integer',
'integer',
'integer'),
649 $found_values = array();
654 $result = $ilDB->queryF(
"SELECT * FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
655 array(
'integer',
'integer',
'integer'),
659 $user_result = array();
663 if (
$data[
"points"] > 0)
669 "points" =>
$data[
"points"],
671 "value1" =>
$data[
"value1"],
672 "value2" =>
$data[
"value2"],
675 array_push($user_result, $solution);
693 $this->parameters[$index] = array(
"name" => $name,
"value" => $value);
697 array_push($this->parameters, array(
"name" => $name,
"value" => $value));
703 if (array_key_exists($index, $this->parameters))
706 $newparams = array();
707 for ($i = 0; $i < $index; $i++)
709 array_push($newparams, $this->parameters[$i]);
711 array_push($newparams, array($name, $value));
712 for ($i = $index; $i < count($this->parameters); $i++)
714 array_push($newparams, $this->parameters[$i]);
716 $this->parameters = $newparams;
720 array_push($this->parameters, array($name, $value));
733 if ($index < 0)
return;
734 if (count($this->parameters) < 1)
return;
735 if ($index >= count($this->parameters))
return;
736 unset($this->parameters[$index]);
737 $this->parameters = array_values($this->parameters);
750 if (($index < 0) or ($index >= count($this->parameters)))
754 return $this->parameters[$index];
767 foreach ($this->parameters as $key => $value)
769 if (array_key_exists($name, $value))
786 return count($this->parameters);
797 $this->parameters = array();
839 if (!empty($javaapplet_tempfilename))
842 if (!file_exists($javapath))
849 $ilLog->write(
"ERROR: java applet question: java applet not uploaded: $javaapplet_filename");
862 $this->javaapplet_filename =
"";
873 return "assJavaApplet";
884 return "qpl_qst_javaapplet";
910 include_once (
"./Services/Excel/classes/class.ilExcelUtils.php");
915 foreach ($solutions as $solution)
922 return $startrow + $i + 1;