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';
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']);
143 $ilDB = $DIC[
'ilDB'];
151 $this->
setId($question_id);
162 include_once(
"./Services/RTE/classes/class.ilRTE.php");
182 $this->parameters = unserialize(
$data[
"params"]);
183 if (!is_array($this->parameters)) {
186 unset(
$_SESSION[
"flash_upload_filename"]);
189 parent::loadFromDb($question_id);
201 if ($this->
id <= 0) {
206 $this_id = $this->
getId();
210 include_once(
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
214 if ((
int) $testObjId > 0) {
215 $clone->setObjId($testObjId);
236 $clone->copyPageOfQuestion($this_id);
238 $clone->copyXHTMLMediaObjectsOfQuestion($this_id);
240 $clone->duplicateApplet($this_id, $thisObjId);
242 $clone->onDuplicate($thisObjId, $this_id, $clone->getObjId(), $clone->getId());
256 if ($this->
id <= 0) {
262 include_once(
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
265 $source_questionpool_id = $this->
getObjId();
266 $clone->setObjId($target_questionpool_id);
277 $clone->copyApplet(
$original_id, $source_questionpool_id);
279 $clone->onCopy($source_questionpool_id,
$original_id, $clone->getObjId(), $clone->getId());
286 if ($this->
id <= 0) {
291 include_once(
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
294 $sourceParentId = $this->
getObjId();
300 $clone->setObjId($targetParentId);
302 if ($targetQuestionTitle) {
303 $clone->setTitle($targetQuestionTitle);
308 $clone->copyPageOfQuestion($sourceQuestionId);
310 $clone->copyXHTMLMediaObjectsOfQuestion($sourceQuestionId);
312 $clone->copyApplet($sourceQuestionId, $sourceParentId);
314 $clone->onCopy($sourceParentId, $sourceQuestionId, $clone->getObjId(), $clone->getId());
328 $flashpath_original = preg_replace(
"/([^\d])$this->id([^\d])/",
"\${1}$question_id\${2}", $flashpath);
330 if ((
int) $objectId > 0) {
331 $flashpath_original = str_replace(
"/$this->obj_id/",
"/$objectId/", $flashpath_original);
334 if (!file_exists($flashpath)) {
338 if (!copy($flashpath_original .
$filename, $flashpath . $filename)) {
339 print
"flash applet could not be duplicated!!!! ";
349 protected function copyApplet($question_id, $source_questionpool)
352 $flashpath_original = preg_replace(
"/([^\d])$this->id([^\d])/",
"\${1}$question_id\${2}", $flashpath);
353 $flashpath_original = str_replace(
"/$this->obj_id/",
"/$source_questionpool/", $flashpath_original);
354 if (!file_exists($flashpath)) {
358 if (!copy($flashpath_original .
$filename, $flashpath . $filename)) {
359 print
"flash applet could not be copied!!!! ";
386 if ($returndetails) {
387 throw new ilTestException(
'return details not implemented for ' . __METHOD__);
391 $ilDB = $DIC[
'ilDB'];
393 $found_values = array();
394 if (is_null(
$pass)) {
412 if (isset($solution[
'points'])) {
413 $points += $solution[
'points'];
424 $params = array(
'http' => array(
428 if ($optional_headers !== null) {
429 $params[
'http'][
'header'] = $optional_headers;
431 $ctx = stream_context_create(
$params);
434 throw new Exception(
"Problem with $url, $php_errormsg");
438 throw new Exception(
"Problem reading data from $url, $php_errormsg");
454 if (!empty($tmpfile)) {
455 $flashfile = str_replace(
" ",
"_", $flashfile);
457 if (!file_exists($flashpath)) {
460 if (ilUtil::moveUploadedFile($tmpfile, $flashfile, $flashpath . $flashfile)) {
509 return "assFlashQuestion";
522 return "qpl_qst_flash";
554 $text = parent::getRTETextWithMediaObjects();
563 parent::setExportDetailsXLS($worksheet, $startrow, $active_id,
$pass);
565 return $startrow + 1;
581 public function fromXML(&$item, &$questionpool_id, &$tst_id, &$tst_object, &$question_counter, &$import_mapping)
583 include_once
"./Modules/TestQuestionPool/classes/import/qti12/class.assFlashQuestionImport.php";
585 $import->fromXML($item, $questionpool_id, $tst_id, $tst_object, $question_counter, $import_mapping);
595 public function toXML($a_include_header =
true, $a_include_binary =
true, $a_shuffle =
false, $test_output =
false, $force_image_references =
false)
597 include_once
"./Modules/TestQuestionPool/classes/export/qti12/class.assFlashQuestionExport.php";
599 return $export->toXML($a_include_header, $a_include_binary, $a_shuffle, $test_output, $force_image_references);
610 $user_solution = array();
611 return $user_solution;
619 $this->height = $a_height;
632 $this->width = $a_width;
642 $this->applet = $a_applet;
652 $this->parameters[
$name] = $value;
660 $this->parameters = array();
666 unset($this->parameters[
$name]);
671 $this->parameters = array();
694 require_once
"./Modules/TestQuestionPool/classes/class.ilOperatorsExpressionMapping.php";
747 return parent::buildTestPresentationConfig()
749 ->setFormChangeDetectionEnabled(
false)
750 ->setBackgroundChangeDetectionEnabled(
true);
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.
const PercentageResultExpression
__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.
Class iQuestionCondition.
copyApplet($question_id, $source_questionpool)
Copy the flash applet.
saveAdditionalQuestionDataToDb()
Saves a record to the question types additional data table.
getRTETextWithMediaObjects()
Collects all text in the question which could contain media objects which were created with the Rich ...
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.
getOperators($expression)
Get all available operations for a specific question.
ensureNonNegativePoints($points)
setId($id=-1)
Sets the id of the assQuestion object.
buildTestPresentationConfig()
Get the test question configuration.
getSolutionMaxPass($active_id)
Returns the maximum pass a users question solution.
calculateReachedPointsFromPreviewSession(ilAssQuestionPreviewSession $previewSession)
setEstimatedWorkingTime($hour=0, $min=0, $sec=0)
Sets the estimated working time of a question from given hour, minute and second. ...
Class for Flash based questions.
getParticipantsSolution()
setNrOfTries($a_nr_of_tries)
setAdditionalContentEditingMode($additinalContentEditingMode)
setter for additional content editing mode for this question
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...
getObjId()
Get the object id of the container object.
Base Exception for all Exceptions relating to Modules/Test.
savePreviewData(ilAssQuestionPreviewSession $previewSession)
saveToDb($original_id="")
Saves a assFlashQuestion object to a database.
static rename($a_source, $a_target)
Rename a file.
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.
const NumericResultExpression
deleteAnswers($question_id)
Deletes datasets from answers tables.
duplicateApplet($question_id, $objectId=null)
Duplicate the flash applet.
calculateReachedPoints($active_id, $pass=null, $authorizedSolution=true, $returndetails=false)
Returns the points, a learner has reached answering the question.
createNewOriginalFromThisDuplicate($targetParentId, $targetQuestionTitle="")
static getOperatorsByExpression($expression)
deductHintPointsFromReachedPoints(ilAssQuestionPreviewSession $previewSession, $reachedPoints)
loadFromDb($question_id)
Loads a assFlashQuestion object from a database.
setPoints($a_points)
Sets the maximum available points for the question.
saveQuestionDataToDb($original_id="")
getUserQuestionResult($active_id, $pass)
Get the user solution for a question by active_id and the test pass.
setExportDetailsXLS($worksheet, $startrow, $active_id, $pass)
{}
setQuestion($question="")
Sets the question string of the question object.
Interface ilObjQuestionScoringAdjustable.
setOriginalId($original_id)
getCurrentSolutionResultSet($active_id, $pass, $authorized=true)
Get a restulset for the current user solution for a this question by active_id and pass...
Class for flash question imports.
saveWorkingData($active_id, $pass=null, $authorized=true)
Saves the learners input of the question to the database.
moveAppletIfExists()
Moves an applet file (maybe stored in the PHP session) to its final filesystem destination.
duplicate($for_test=true, $title="", $author="", $owner="", $testObjId=null)
Duplicates an assFlashQuestion.
getExpressionTypes()
Get all available expression types for a specific question.
getQuestionType()
Returns the question type of the question.
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.
getAvailableAnswerOptions($index=null)
If index is null, the function returns an array with all anwser options Else it returns the specific ...
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.
static getRootLogger()
The unique root logger has a fixed error level.
Class to report exception.
setOwner($owner="")
Sets the creator/owner ID of the assQuestion object.
const EmptyAnswerExpression
moveUploadedFile($tmpfile, $flashfile)
Uploads a flash file.