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"]);
130 $this->
setId($question_id);
141 include_once(
"./Services/RTE/classes/class.ilRTE.php");
164 $this->parameters = unserialize(
$data[
"params"]);
166 unset(
$_SESSION[
"flash_upload_filename"]);
169 parent::loadFromDb($question_id);
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"),
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";
552 $text = parent::getRTETextWithMediaObjects();
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();
static makeDirParents($a_dir)
Create a new directory and all parent directories.
getId()
Gets the id of the assQuestion object.
getBestSolution($active_id, $pass)
Returns the best solution for a given pass of a participant.
static _getOriginalId($question_id)
Returns the original id of a question.
__construct( $title="", $comment="", $author="", $owner=-1, $question="")
assFlashQuestion constructor
isComplete()
Returns true, if a single choice question is complete for use.
setSuggestedSolution($solution_id="", $subquestion_index=0, $is_import=false)
Sets a suggested solution for the question.
copyApplet($question_id, $source_questionpool)
Copy the flash applet.
saveAdditionalQuestionDataToDb()
getRTETextWithMediaObjects()
Collects all text in the question which could contain media objects which were created with the Rich ...
calculateReachedPoints($active_id, $pass=NULL, $returndetails=FALSE)
Returns the points, a learner has reached answering the question.
sendToHost($url, $data, $optional_headers=null)
Abstract basic class which is to be extended by the concrete assessment question type classes...
getAdditionalTableName()
Returns the name of the additional question data table in the database.
_convert_text($a_text, $a_target="has been removed")
setId($id=-1)
Sets the id of the assQuestion object.
getSolutionMaxPass($active_id)
Returns the maximum pass a users question solution.
setEstimatedWorkingTime($hour=0, $min=0, $sec=0)
Sets the estimated working time of a question.
Class for Flash based questions.
setNrOfTries($a_nr_of_tries)
setAdditionalContentEditingMode($additinalContentEditingMode)
setter for additional content editing mode for this question
getObjId()
Get the object id of the container object.
Base Exception for all Exceptions relating to Modules/Test.
saveToDb($original_id="")
Saves a assFlashQuestion object to a database.
fetchAssoc($a_set)
Fetch row as associative array from result set.
toXML($a_include_header=true, $a_include_binary=true, $a_shuffle=false, $test_output=false, $force_image_references=false)
Returns a QTI xml representation of the question and sets the internal domxml variable with the DOM X...
getFlashPath()
Returns the image path for web accessable flash files of a question.
setAuthor($author="")
Sets the authors name of the assQuestion object.
getAnswerTableName()
Returns the name of the answer table in the database.
addParameter($name, $value)
Class for flash question exports.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
deleteAnswers($question_id)
Deletes datasets from answers tables.
duplicateApplet($question_id, $objectId=null)
Duplicate the flash applet.
createNewOriginalFromThisDuplicate($targetParentId, $targetQuestionTitle="")
loadFromDb($question_id)
Loads a assFlashQuestion object from a database.
saveWorkingData($active_id, $pass=NULL)
Saves the learners input of the question to the database.
setPoints($a_points)
Sets the maximum available points for the question.
saveQuestionDataToDb($original_id="")
static _replaceMediaObjectImageSrc($a_text, $a_direction=0)
replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data
setExportDetailsXLS(&$worksheet, $startrow, $active_id, $pass, &$format_title, &$format_bold)
Creates an Excel worksheet for the detailed cumulated results of this question.
setQuestion($question="")
Sets the question string of the question object.
setOriginalId($original_id)
Class for flash question imports.
getTitle()
Gets the title string of the assQuestion object.
duplicate($for_test=true, $title="", $author="", $owner="", $testObjId=null)
Duplicates an assFlashQuestion.
getQuestionType()
Returns the question type of the question.
reworkWorkingData($active_id, $pass, $obligationsAnswered)
Reworks the allready saved working data if neccessary.
setTitle($title="")
Sets the title string of the assQuestion object.
setObjId($obj_id=0)
Set the object id of the container object.
copyObject($target_questionpool_id, $title="")
Copies an assFlashQuestion object.
setComment($comment="")
Sets the comment string of the assQuestion object.
getMaximumPoints()
Returns the maximum points, a learner can reach answering the question.
fromXML(&$item, &$questionpool_id, &$tst_id, &$tst_object, &$question_counter, &$import_mapping)
Creates a question from a QTI file.
setOwner($owner="")
Sets the creator/owner ID of the assQuestion object.
moveUploadedFile($tmpfile, $flashfile)
Uploads a flash file.