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 (($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 (($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 include_once (
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
371 $clone->copyPageOfQuestion($this_id);
373 $clone->copyXHTMLMediaObjectsOfQuestion($this_id);
375 $clone->duplicateFeedbackGeneric($this_id);
378 $clone->duplicateApplet($this_id);
379 $clone->onDuplicate($this_id);
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);
427 if (!file_exists($javapath))
432 if (!copy($javapath_original .
$filename, $javapath . $filename)) {
433 print
"java applet could not be duplicated!!!! ";
440 $javapath_original = preg_replace(
"/([^\d])$this->id([^\d])/",
"\${1}$question_id\${2}", $javapath);
441 $javapath_original = str_replace(
"/$this->obj_id/",
"/$source_questionpool/", $javapath_original);
442 if (!file_exists($javapath))
447 if (!copy($javapath_original .
$filename, $javapath . $filename)) {
448 print
"java applet could not be copied!!!! ";
597 $found_values = array();
602 $result = $ilDB->queryF(
"SELECT points FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
603 array(
'integer',
'integer',
'integer'),
629 $found_values = array();
634 $result = $ilDB->queryF(
"SELECT * FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
635 array(
'integer',
'integer',
'integer'),
639 $user_result = array();
643 if (
$data[
"points"] > 0)
649 "points" =>
$data[
"points"],
651 "value1" =>
$data[
"value1"],
652 "value2" =>
$data[
"value2"],
655 array_push($user_result, $solution);
673 $this->parameters[$index] = array(
"name" =>
$name,
"value" => $value);
677 array_push($this->parameters, array(
"name" =>
$name,
"value" => $value));
683 if (array_key_exists($index, $this->parameters))
686 $newparams = array();
687 for ($i = 0; $i < $index; $i++)
689 array_push($newparams, $this->parameters[$i]);
691 array_push($newparams, array(
$name, $value));
692 for ($i = $index; $i < count($this->parameters); $i++)
694 array_push($newparams, $this->parameters[$i]);
696 $this->parameters = $newparams;
700 array_push($this->parameters, array(
$name, $value));
713 if ($index < 0)
return;
714 if (count($this->parameters) < 1)
return;
715 if ($index >= count($this->parameters))
return;
716 unset($this->parameters[$index]);
717 $this->parameters = array_values($this->parameters);
730 if (($index < 0) or ($index >= count($this->parameters)))
734 return $this->parameters[$index];
747 foreach ($this->parameters as
$key => $value)
749 if (array_key_exists(
$name, $value))
766 return count($this->parameters);
777 $this->parameters = array();
819 if (!empty($javaapplet_tempfilename))
822 if (!file_exists($javapath))
829 $ilLog->write(
"ERROR: java applet question: java applet not uploaded: $javaapplet_filename");
842 $this->javaapplet_filename =
"";
853 return "assJavaApplet";
864 return "qpl_qst_javaapplet";
890 include_once (
"./Services/Excel/classes/class.ilExcelUtils.php");
895 foreach ($solutions as $solution)
902 return $startrow + $i + 1;