23 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
24 include_once
"./Modules/Test/classes/inc.AssessmentConstants.php";
62 $this->parameters = array();
76 if (($this->title) and ($this->author) and ($this->question) and ($this->
getMaximumPoints() > 0) and (strlen($this->
getApplet())))
98 $affectedRows = $ilDB->manipulateF(
"DELETE FROM " . $this->
getAdditionalTableName() .
" WHERE question_fi = %s",
100 array($this->
getId())
102 $affectedRows = $ilDB->manipulateF(
"INSERT INTO " . $this->
getAdditionalTableName() .
" (question_fi, width, height, applet, params) VALUES (%s, %s, %s, %s, %s)",
103 array(
"integer",
"integer",
"integer",
"text",
"text"),
117 unset(
$_SESSION[
"flash_upload_filename"]);
137 if ($result->numRows() == 1)
139 $data = $ilDB->fetchAssoc($result);
140 $this->
setId($question_id);
151 include_once(
"./Services/RTE/classes/class.ilRTE.php");
159 if ($result->numRows() == 1)
161 $data = $ilDB->fetchAssoc($result);
165 $this->parameters = unserialize(
$data[
"params"]);
167 unset(
$_SESSION[
"flash_upload_filename"]);
188 $this_id = $this->
getId();
190 include_once (
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
217 $clone->copyPageOfQuestion($this_id);
219 $clone->copyXHTMLMediaObjectsOfQuestion($this_id);
221 $clone->duplicateFeedbackGeneric($this_id);
223 $clone->duplicateApplet($this_id);
225 $clone->onDuplicate($this_id);
245 include_once (
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
248 $source_questionpool = $this->
getObjId();
249 $clone->setObjId($target_questionpool);
279 $flashpath_original = preg_replace(
"/([^\d])$this->id([^\d])/",
"\${1}$question_id\${2}", $flashpath);
280 if (!file_exists($flashpath))
285 if (!copy($flashpath_original .
$filename, $flashpath . $filename)) {
286 print
"flash applet could not be duplicated!!!! ";
296 protected function copyApplet($question_id, $source_questionpool)
299 $flashpath_original = preg_replace(
"/([^\d])$this->id([^\d])/",
"\${1}$question_id\${2}", $flashpath);
300 $flashpath_original = str_replace(
"/$this->obj_id/",
"/$source_questionpool/", $flashpath_original);
301 if (!file_exists($flashpath))
306 if (!copy($flashpath_original .
$filename, $flashpath . $filename))
308 print
"flash applet could not be copied!!!! ";
336 $found_values = array();
341 $result = $ilDB->queryF(
"SELECT * FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
342 array(
"integer",
"integer",
"integer"),
347 while (
$data = $ilDB->fetchAssoc($result))
358 $params = array(
'http' => array(
362 if ($optional_headers !== null)
364 $params[
'http'][
'header'] = $optional_headers;
366 $ctx = stream_context_create($params);
367 $fp = @fopen($url,
'rb',
false, $ctx);
370 throw new Exception(
"Problem with $url, $php_errormsg");
372 $response = @stream_get_contents($fp);
373 if ($response ===
false)
375 throw new Exception(
"Problem reading data from $url, $php_errormsg");
391 if (!empty($tmpfile))
393 $flashfile = str_replace(
" ",
"_", $flashfile);
395 if (!file_exists($flashpath))
401 $result = $flashfile;
437 return "assFlashQuestion";
450 return "qpl_qst_flash";
497 $adapter->setCellValue($startrow, 0, $this->lng->txt($this->getQuestionType()),
CELL_FORMAT_TITLE);
499 return $startrow + 1;
515 function fromXML(&$item, &$questionpool_id, &$tst_id, &$tst_object, &$question_counter, &$import_mapping)
517 include_once
"./Modules/TestQuestionPool/classes/import/qti12/class.assFlashQuestionImport.php";
519 $import->fromXML($item, $questionpool_id, $tst_id, $tst_object, $question_counter, $import_mapping);
529 function toXML($a_include_header =
true, $a_include_binary =
true, $a_shuffle =
false, $test_output =
false, $force_image_references =
false)
531 include_once
"./Modules/TestQuestionPool/classes/export/qti12/class.assFlashQuestionExport.php";
533 return $export->toXML($a_include_header, $a_include_binary, $a_shuffle, $test_output, $force_image_references);
544 $user_solution = array();
545 return $user_solution;
550 if (!$a_height) $a_height = 400;
551 $this->height = $a_height;
561 if (!$a_width) $a_width = 550;
562 $this->width = $a_width;
572 $this->applet = $a_applet;
582 $this->parameters[
$name] = $value;
587 if (is_array($params))
589 $this->parameters = $params;
593 $this->parameters = array();
599 unset($this->parameters[
$name]);
604 $this->parameters = array();