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';
49 $this->parameters = array();
63 if (strlen($this->title)
92 array( $this->
getId() )
95 ) .
" (question_fi, width, height, applet, params) VALUES (%s, %s, %s, %s, %s)",
96 array(
"integer",
"integer",
"integer",
"text",
"text" ),
110 unset(
$_SESSION[
"flash_upload_filename"]);
130 $data = $ilDB->fetchAssoc(
$result);
131 $this->
setId($question_id);
142 include_once(
"./Services/RTE/classes/class.ilRTE.php");
144 $this->
setEstimatedWorkingTime(substr($data[
"working_time"], 0, 2), substr($data[
"working_time"], 3, 2), substr($data[
"working_time"], 6, 2));
161 $data = $ilDB->fetchAssoc(
$result);
165 $this->parameters = unserialize($data[
"params"]);
167 unset(
$_SESSION[
"flash_upload_filename"]);
188 $this_id = $this->
getId();
192 include_once (
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
196 if( (
int)$testObjId > 0 )
198 $clone->setObjId($testObjId);
225 $clone->copyPageOfQuestion($this_id);
227 $clone->copyXHTMLMediaObjectsOfQuestion($this_id);
229 $clone->duplicateApplet($this_id, $thisObjId);
231 $clone->onDuplicate($thisObjId, $this_id, $clone->getObjId(), $clone->getId());
252 include_once (
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
255 $source_questionpool_id = $this->
getObjId();
256 $clone->setObjId($target_questionpool_id);
268 $clone->copyApplet(
$original_id, $source_questionpool_id);
270 $clone->onCopy($source_questionpool_id,
$original_id, $clone->getObjId(), $clone->getId());
283 include_once (
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
286 $sourceParentId = $this->
getObjId();
292 $clone->setObjId($targetParentId);
294 if ($targetQuestionTitle)
296 $clone->setTitle($targetQuestionTitle);
301 $clone->copyPageOfQuestion($sourceQuestionId);
303 $clone->copyXHTMLMediaObjectsOfQuestion($sourceQuestionId);
305 $clone->copyApplet($sourceQuestionId, $sourceParentId);
307 $clone->onCopy($sourceParentId, $sourceQuestionId, $clone->getObjId(), $clone->getId());
321 $flashpath_original = preg_replace(
"/([^\d])$this->id([^\d])/",
"\${1}$question_id\${2}", $flashpath);
323 if( (
int)$objectId > 0 )
325 $flashpath_original = str_replace(
"/$this->obj_id/",
"/$objectId/", $flashpath_original);
328 if (!file_exists($flashpath))
333 if (!copy($flashpath_original .
$filename, $flashpath . $filename)) {
334 print
"flash applet could not be duplicated!!!! ";
344 protected function copyApplet($question_id, $source_questionpool)
347 $flashpath_original = preg_replace(
"/([^\d])$this->id([^\d])/",
"\${1}$question_id\${2}", $flashpath);
348 $flashpath_original = str_replace(
"/$this->obj_id/",
"/$source_questionpool/", $flashpath_original);
349 if (!file_exists($flashpath))
354 if (!copy($flashpath_original .
$filename, $flashpath . $filename))
356 print
"flash applet could not be copied!!!! ";
385 throw new ilTestException(
'return details not implemented for '.__METHOD__);
390 $found_values = array();
395 $result = $ilDB->queryF(
"SELECT * FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
396 array(
"integer",
"integer",
"integer"),
401 while ($data = $ilDB->fetchAssoc(
$result))
414 if( isset($solution[
'points']) )
416 $points += $solution[
'points'];
424 $params = array(
'http' => array(
428 if ($optional_headers !== null)
430 $params[
'http'][
'header'] = $optional_headers;
432 $ctx = stream_context_create($params);
433 $fp = @fopen($url,
'rb',
false, $ctx);
436 throw new Exception(
"Problem with $url, $php_errormsg");
438 $response = @stream_get_contents($fp);
439 if ($response ===
false)
441 throw new Exception(
"Problem reading data from $url, $php_errormsg");
457 if (!empty($tmpfile))
459 $flashfile = str_replace(
" ",
"_", $flashfile);
461 if (!file_exists($flashpath))
528 return "assFlashQuestion";
541 return "qpl_qst_flash";
591 include_once (
"./Services/Excel/classes/class.ilExcelUtils.php");
594 return $startrow + 1;
610 function fromXML(&$item, &$questionpool_id, &$tst_id, &$tst_object, &$question_counter, &$import_mapping)
612 include_once
"./Modules/TestQuestionPool/classes/import/qti12/class.assFlashQuestionImport.php";
614 $import->fromXML($item, $questionpool_id, $tst_id, $tst_object, $question_counter, $import_mapping);
624 function toXML($a_include_header =
true, $a_include_binary =
true, $a_shuffle =
false, $test_output =
false, $force_image_references =
false)
626 include_once
"./Modules/TestQuestionPool/classes/export/qti12/class.assFlashQuestionExport.php";
628 return $export->toXML($a_include_header, $a_include_binary, $a_shuffle, $test_output, $force_image_references);
639 $user_solution = array();
640 return $user_solution;
645 if (!$a_height) $a_height = 400;
646 $this->height = $a_height;
656 if (!$a_width) $a_width = 550;
657 $this->width = $a_width;
667 $this->applet = $a_applet;
677 $this->parameters[$name] = $value;
682 if (is_array($params))
684 $this->parameters = $params;
688 $this->parameters = array();
694 unset($this->parameters[$name]);
699 $this->parameters = array();
722 require_once
"./Modules/TestQuestionPool/classes/class.ilOperatorsExpressionMapping.php";