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';
48 $this->parameters = array();
62 if (strlen($this->title)
91 array( $this->
getId() )
94 ) .
" (question_fi, width, height, applet, params) VALUES (%s, %s, %s, %s, %s)",
95 array(
"integer",
"integer",
"integer",
"text",
"text" ),
109 unset(
$_SESSION[
"flash_upload_filename"]);
129 $data = $ilDB->fetchAssoc(
$result);
130 $this->
setId($question_id);
141 include_once(
"./Services/RTE/classes/class.ilRTE.php");
143 $this->
setEstimatedWorkingTime(substr($data[
"working_time"], 0, 2), substr($data[
"working_time"], 3, 2), substr($data[
"working_time"], 6, 2));
160 $data = $ilDB->fetchAssoc(
$result);
164 $this->parameters = unserialize($data[
"params"]);
166 unset(
$_SESSION[
"flash_upload_filename"]);
187 $this_id = $this->
getId();
191 include_once (
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
195 if( (
int)$testObjId > 0 )
197 $clone->setObjId($testObjId);
224 $clone->copyPageOfQuestion($this_id);
226 $clone->copyXHTMLMediaObjectsOfQuestion($this_id);
228 $clone->duplicateApplet($this_id, $thisObjId);
230 $clone->onDuplicate($thisObjId, $this_id, $clone->getObjId(), $clone->getId());
251 include_once (
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
254 $source_questionpool_id = $this->
getObjId();
255 $clone->setObjId($target_questionpool_id);
267 $clone->copyApplet(
$original_id, $source_questionpool_id);
269 $clone->onCopy($source_questionpool_id,
$original_id, $clone->getObjId(), $clone->getId());
282 include_once (
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
285 $sourceParentId = $this->
getObjId();
291 $clone->setObjId($targetParentId);
293 if ($targetQuestionTitle)
295 $clone->setTitle($targetQuestionTitle);
300 $clone->copyPageOfQuestion($sourceQuestionId);
302 $clone->copyXHTMLMediaObjectsOfQuestion($sourceQuestionId);
304 $clone->copyApplet($sourceQuestionId, $sourceParentId);
306 $clone->onCopy($sourceParentId, $sourceQuestionId, $clone->getObjId(), $clone->getId());
320 $flashpath_original = preg_replace(
"/([^\d])$this->id([^\d])/",
"\${1}$question_id\${2}", $flashpath);
322 if( (
int)$objectId > 0 )
324 $flashpath_original = str_replace(
"/$this->obj_id/",
"/$objectId/", $flashpath_original);
327 if (!file_exists($flashpath))
332 if (!copy($flashpath_original .
$filename, $flashpath . $filename)) {
333 print
"flash applet could not be duplicated!!!! ";
343 protected function copyApplet($question_id, $source_questionpool)
346 $flashpath_original = preg_replace(
"/([^\d])$this->id([^\d])/",
"\${1}$question_id\${2}", $flashpath);
347 $flashpath_original = str_replace(
"/$this->obj_id/",
"/$source_questionpool/", $flashpath_original);
348 if (!file_exists($flashpath))
353 if (!copy($flashpath_original .
$filename, $flashpath . $filename))
355 print
"flash applet could not be copied!!!! ";
384 throw new ilTestException(
'return details not implemented for '.__METHOD__);
389 $found_values = array();
394 $result = $ilDB->queryF(
"SELECT * FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
395 array(
"integer",
"integer",
"integer"),
400 while ($data = $ilDB->fetchAssoc(
$result))
410 $params = array(
'http' => array(
414 if ($optional_headers !== null)
416 $params[
'http'][
'header'] = $optional_headers;
418 $ctx = stream_context_create($params);
419 $fp = @fopen($url,
'rb',
false, $ctx);
422 throw new Exception(
"Problem with $url, $php_errormsg");
424 $response = @stream_get_contents($fp);
425 if ($response ===
false)
427 throw new Exception(
"Problem reading data from $url, $php_errormsg");
443 if (!empty($tmpfile))
445 $flashfile = str_replace(
" ",
"_", $flashfile);
447 if (!file_exists($flashpath))
507 return "assFlashQuestion";
520 return "qpl_qst_flash";
570 include_once (
"./Services/Excel/classes/class.ilExcelUtils.php");
573 return $startrow + 1;
589 function fromXML(&$item, &$questionpool_id, &$tst_id, &$tst_object, &$question_counter, &$import_mapping)
591 include_once
"./Modules/TestQuestionPool/classes/import/qti12/class.assFlashQuestionImport.php";
593 $import->fromXML($item, $questionpool_id, $tst_id, $tst_object, $question_counter, $import_mapping);
603 function toXML($a_include_header =
true, $a_include_binary =
true, $a_shuffle =
false, $test_output =
false, $force_image_references =
false)
605 include_once
"./Modules/TestQuestionPool/classes/export/qti12/class.assFlashQuestionExport.php";
607 return $export->toXML($a_include_header, $a_include_binary, $a_shuffle, $test_output, $force_image_references);
618 $user_solution = array();
619 return $user_solution;
624 if (!$a_height) $a_height = 400;
625 $this->height = $a_height;
635 if (!$a_width) $a_width = 550;
636 $this->width = $a_width;
646 $this->applet = $a_applet;
656 $this->parameters[$name] = $value;
661 if (is_array($params))
663 $this->parameters = $params;
667 $this->parameters = array();
673 unset($this->parameters[$name]);
678 $this->parameters = array();