4require_once
'./Modules/TestQuestionPool/classes/class.assQuestion.php';
5require_once
'./Modules/Test/classes/inc.AssessmentConstants.php';
6require_once
'./Modules/TestQuestionPool/interfaces/interface.ilObjQuestionScoringAdjustable.php';
7require_once
'./Modules/TestQuestionPool/interfaces/interface.iQuestionCondition.php';
48 $this->parameters = array();
62 if (strlen($this->title)
92 array( $this->
getId() )
96 ) .
" (question_fi, width, height, applet, params) VALUES (%s, %s, %s, %s, %s)",
97 array(
"integer",
"integer",
"integer",
"text",
"text" ),
121 isset(
$_SESSION[
'flash_upload_filename']) && is_string(
$_SESSION[
'flash_upload_filename']) &&
122 file_exists(
$_SESSION[
'flash_upload_filename']) && is_file(
$_SESSION[
'flash_upload_filename'])
127 require_once
'Services/Utilities/classes/class.ilFileUtils.php';
129 unset(
$_SESSION[
'flash_upload_filename']);
151 $this->
setId($question_id);
162 include_once(
"./Services/RTE/classes/class.ilRTE.php");
188 $this->parameters = unserialize(
$data[
"params"]);
189 if (!is_array($this->parameters)) {
192 unset(
$_SESSION[
"flash_upload_filename"]);
195 parent::loadFromDb($question_id);
207 if ($this->
id <= 0) {
212 $this_id = $this->
getId();
216 include_once(
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
220 if ((
int) $testObjId > 0) {
221 $clone->setObjId($testObjId);
242 $clone->copyPageOfQuestion($this_id);
244 $clone->copyXHTMLMediaObjectsOfQuestion($this_id);
246 $clone->duplicateApplet($this_id, $thisObjId);
248 $clone->onDuplicate($thisObjId, $this_id, $clone->getObjId(), $clone->getId());
262 if ($this->
id <= 0) {
268 include_once(
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
271 $source_questionpool_id = $this->
getObjId();
272 $clone->setObjId($target_questionpool_id);
283 $clone->copyApplet(
$original_id, $source_questionpool_id);
285 $clone->onCopy($source_questionpool_id,
$original_id, $clone->getObjId(), $clone->getId());
292 if ($this->
id <= 0) {
297 include_once(
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
300 $sourceParentId = $this->
getObjId();
306 $clone->setObjId($targetParentId);
308 if ($targetQuestionTitle) {
309 $clone->setTitle($targetQuestionTitle);
314 $clone->copyPageOfQuestion($sourceQuestionId);
316 $clone->copyXHTMLMediaObjectsOfQuestion($sourceQuestionId);
318 $clone->copyApplet($sourceQuestionId, $sourceParentId);
320 $clone->onCopy($sourceParentId, $sourceQuestionId, $clone->getObjId(), $clone->getId());
334 $flashpath_original = preg_replace(
"/([^\d])$this->id([^\d])/",
"\${1}$question_id\${2}", $flashpath);
336 if ((
int) $objectId > 0) {
337 $flashpath_original = str_replace(
"/$this->obj_id/",
"/$objectId/", $flashpath_original);
340 if (!file_exists($flashpath)) {
345 print "flash applet could not be duplicated!!!! ";
355 protected function copyApplet($question_id, $source_questionpool)
358 $flashpath_original = preg_replace(
"/([^\d])$this->id([^\d])/",
"\${1}$question_id\${2}", $flashpath);
359 $flashpath_original = str_replace(
"/$this->obj_id/",
"/$source_questionpool/", $flashpath_original);
360 if (!file_exists($flashpath)) {
365 print "flash applet could not be copied!!!! ";
392 if ($returndetails) {
393 throw new ilTestException(
'return details not implemented for ' . __METHOD__);
399 $found_values = array();
400 if (is_null(
$pass)) {
418 if (isset($solution[
'points'])) {
419 $points += $solution[
'points'];
430 $params = array(
'http' => array(
434 if ($optional_headers !==
null) {
435 $params[
'http'][
'header'] = $optional_headers;
437 $ctx = stream_context_create($params);
438 $fp = @fopen(
$url,
'rb',
false, $ctx);
440 throw new Exception(
"Problem with $url, " . error_get_last());
444 throw new Exception(
"Problem reading data from $url, " . error_get_last());
460 if (!empty($tmpfile)) {
461 $flashfile = str_replace(
" ",
"_", $flashfile);
463 if (!file_exists($flashpath)) {
515 return "assFlashQuestion";
528 return "qpl_qst_flash";
560 $text = parent::getRTETextWithMediaObjects();
569 parent::setExportDetailsXLS($worksheet, $startrow, $active_id,
$pass);
571 return $startrow + 1;
587 public function fromXML(&$item, &$questionpool_id, &$tst_id, &$tst_object, &$question_counter, &$import_mapping, array $solutionhints = [])
589 include_once
"./Modules/TestQuestionPool/classes/import/qti12/class.assFlashQuestionImport.php";
591 $import->fromXML($item, $questionpool_id, $tst_id, $tst_object, $question_counter, $import_mapping);
601 public function toXML($a_include_header =
true, $a_include_binary =
true, $a_shuffle =
false, $test_output =
false, $force_image_references =
false)
603 include_once
"./Modules/TestQuestionPool/classes/export/qti12/class.assFlashQuestionExport.php";
605 return $export->toXML($a_include_header, $a_include_binary, $a_shuffle, $test_output, $force_image_references);
616 $user_solution = array();
617 return $user_solution;
625 $this->height = $a_height;
638 $this->width = $a_width;
648 $this->applet = $a_applet;
658 $this->parameters[
$name] = $value;
663 if (is_array($params)) {
664 $this->parameters = $params;
666 $this->parameters = array();
672 unset($this->parameters[
$name]);
677 $this->parameters = array();
700 require_once
"./Modules/TestQuestionPool/classes/class.ilOperatorsExpressionMapping.php";
753 return parent::buildTestPresentationConfig()
755 ->setFormChangeDetectionEnabled(
false)
756 ->setBackgroundChangeDetectionEnabled(
true);
An exception for terminatinating execution or to throw for unit testing.
Class for flash question exports.
Class for flash question imports.
Class for Flash based questions.
getRTETextWithMediaObjects()
Collects all text in the question which could contain media objects which were created with the Rich ...
moveUploadedFile($tmpfile, $flashfile)
Uploads a flash file.
getAdditionalTableName()
Returns the name of the additional question data table in the database.
getAvailableAnswerOptions($index=null)
If index is null, the function returns an array with all anwser options Else it returns the specific ...
duplicate($for_test=true, $title="", $author="", $owner="", $testObjId=null)
Duplicates an assFlashQuestion.
getOperators($expression)
Get all available operations for a specific question.
getBestSolution($active_id, $pass)
Returns the best solution for a given pass of a participant.
saveToDb($original_id="")
Saves a assFlashQuestion object to a database.
savePreviewData(ilAssQuestionPreviewSession $previewSession)
setExportDetailsXLS($worksheet, $startrow, $active_id, $pass)
{Creates an Excel worksheet for the detailed cumulated results of this question.object}
getAnswerTableName()
Returns the name of the answer table in the database.
isComplete()
Returns true, if a single choice question is complete for use.
sendToHost($url, $data, $optional_headers=null)
getExpressionTypes()
Get all available expression types for a specific question.
getQuestionType()
Returns the question type of the question.
calculateReachedPoints($active_id, $pass=null, $authorizedSolution=true, $returndetails=false)
Returns the points, a learner has reached answering the question.
__construct( $title="", $comment="", $author="", $owner=-1, $question="")
assFlashQuestion constructor
fromXML(&$item, &$questionpool_id, &$tst_id, &$tst_object, &$question_counter, &$import_mapping, array $solutionhints=[])
Creates a question from a QTI file.
moveAppletIfExists()
Moves an applet file (maybe stored in the PHP session) to its final filesystem destination.
getMaximumPoints()
Returns the maximum points, a learner can reach answering the question.
copyApplet($question_id, $source_questionpool)
Copy the flash applet.
saveWorkingData($active_id, $pass=null, $authorized=true)
Saves the learners input of the question to the database.
saveAdditionalQuestionDataToDb()
Saves a record to the question types additional data table.
addParameter($name, $value)
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...
loadFromDb($question_id)
Loads a assFlashQuestion object from a database.
deleteAnswers($question_id)
Deletes datasets from answers tables.
duplicateApplet($question_id, $objectId=null)
Duplicate the flash applet.
getUserQuestionResult($active_id, $pass)
Get the user solution for a question by active_id and the test pass.
calculateReachedPointsFromPreviewSession(ilAssQuestionPreviewSession $previewSession)
copyObject($target_questionpool_id, $title="")
Copies an assFlashQuestion object.
createNewOriginalFromThisDuplicate($targetParentId, $targetQuestionTitle="")
buildTestPresentationConfig()
Get the test question configuration.
Abstract basic class which is to be extended by the concrete assessment question type classes.
getCurrentSolutionResultSet($active_id, $pass, $authorized=true)
Get a restulset for the current user solution for a this question by active_id and pass.
static _getOriginalId($question_id)
Returns the original id of a question.
setId($id=-1)
Sets the id of the assQuestion object.
setOriginalId($original_id)
setObjId($obj_id=0)
Set the object id of the container object.
getSolutionMaxPass($active_id)
Returns the maximum pass a users question solution.
setSuggestedSolution($solution_id="", $subquestion_index=0, $is_import=false)
Sets a suggested solution for the question.
saveQuestionDataToDb($original_id="")
getId()
Gets the id of the assQuestion object.
getObjId()
Get the object id of the container object.
setTitle($title="")
Sets the title string of the assQuestion object.
setOwner($owner="")
Sets the creator/owner ID of the assQuestion object.
setEstimatedWorkingTime($hour=0, $min=0, $sec=0)
Sets the estimated working time of a question from given hour, minute and second.
deductHintPointsFromReachedPoints(ilAssQuestionPreviewSession $previewSession, $reachedPoints)
getFlashPath()
Returns the image path for web accessable flash files of a question.
setAuthor($author="")
Sets the authors name of the assQuestion object.
setLifecycle(ilAssQuestionLifecycle $lifecycle)
setPoints($a_points)
Sets the maximum available points for the question.
setComment($comment="")
Sets the comment string of the assQuestion object.
setNrOfTries($a_nr_of_tries)
setAdditionalContentEditingMode($additinalContentEditingMode)
setter for additional content editing mode for this question
setQuestion($question="")
Sets the question string of the question object.
ensureNonNegativePoints($points)
static getDraftInstance()
static getInstance($identifier)
getParticipantsSolution()
Class to report exception.
static rename($a_source, $a_target)
Rename a file.
static getRootLogger()
The unique root logger has a fixed error level.
static getOperatorsByExpression($expression)
static _replaceMediaObjectImageSrc($a_text, $a_direction=0, $nic=IL_INST_ID)
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
Base Exception for all Exceptions relating to Modules/Test.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
static makeDirParents($a_dir)
Create a new directory and all parent directories.
Class iQuestionCondition.
const PercentageResultExpression
const NumericResultExpression
const EmptyAnswerExpression
Interface ilObjQuestionScoringAdjustable.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc