19declare(strict_types=1);
24require_once
'./Modules/Test/classes/inc.AssessmentConstants.php';
113 $this->matchingpairs = array();
115 $this->terms = array();
116 $this->definitions = array();
117 $this->randomGroup =
$DIC->refinery()->random();
137 if (strlen($this->title)
140 && count($this->matchingpairs)
174 "DELETE FROM qpl_a_mterm WHERE question_fi = %s",
176 array( $this->
getId() )
181 "DELETE FROM qpl_a_mdef WHERE question_fi = %s",
183 array( $this->
getId() )
188 foreach ($this->terms as
$key => $term) {
189 $next_id =
$ilDB->nextId(
'qpl_a_mterm');
190 $ilDB->insert(
'qpl_a_mterm', array(
191 'term_id' => array(
'integer', $next_id),
192 'question_fi' => array(
'integer', $this->
getId()),
193 'picture' => array(
'text', $term->getPicture()),
194 'term' => array(
'text', $term->getText()),
195 'ident' => array(
'integer', $term->getIdentifier())
197 $termids[$term->getIdentifier()] = $next_id;
200 $definitionids = array();
202 foreach ($this->definitions as
$key => $definition) {
203 $next_id =
$ilDB->nextId(
'qpl_a_mdef');
204 $ilDB->insert(
'qpl_a_mdef', array(
205 'def_id' => array(
'integer', $next_id),
206 'question_fi' => array(
'integer', $this->
getId()),
207 'picture' => array(
'text', $definition->getPicture()),
208 'definition' => array(
'text', $definition->getText()),
209 'ident' => array(
'integer', $definition->getIdentifier())
211 $definitionids[$definition->getIdentifier()] = $next_id;
215 "DELETE FROM qpl_a_matching WHERE question_fi = %s",
217 array( $this->
getId() )
221 $next_id =
$ilDB->nextId(
'qpl_a_matching');
223 "INSERT INTO qpl_a_matching (answer_id, question_fi, points, term_fi, definition_fi) VALUES (%s, %s, %s, %s, %s)",
224 array(
'integer',
'integer',
'float',
'integer',
'integer' ),
229 $termids[$pair->getTerm()->getIdentifier()],
230 $definitionids[$pair->getDefinition()->getIdentifier()]
248 array( $this->
getId() )
252 'question_fi' => array(
'integer', $this->
getId()),
254 'matching_type' => array(
'text', $this->matching_type),
272 SELECT qpl_questions.*,
273 {$this->getAdditionalTableName()}.*
275 LEFT JOIN {$this->getAdditionalTableName()}
276 ON {$this->getAdditionalTableName()}.question_fi = qpl_questions.question_id
277 WHERE qpl_questions.question_id = %s
280 $result =
$ilDB->queryF(
286 if ($result->numRows() == 1) {
288 $this->
setId((
int) $question_id);
290 $this->
setTitle((
string) $data[
"title"]);
291 $this->
setComment((
string) $data[
"description"]);
295 $this->
setPoints((
float) $data[
"points"]);
296 $this->
setOwner((
int) $data[
"owner"]);
297 include_once(
"./Services/RTE/classes/class.ilRTE.php");
302 $this->
setMatchingMode($data[
'matching_mode'] ===
null ? self::MATCHING_MODE_1_ON_1 :
$data[
'matching_mode']);
317 $result =
$ilDB->queryF(
318 "SELECT * FROM qpl_a_mterm WHERE question_fi = %s ORDER BY term_id ASC",
323 if ($result->numRows() > 0) {
326 $this->terms[] = $term;
327 $termids[
$data[
'term_id']] = $term;
331 $definitionids = array();
332 $result =
$ilDB->queryF(
333 "SELECT * FROM qpl_a_mdef WHERE question_fi = %s ORDER BY def_id ASC",
338 $this->definitions = array();
339 if ($result->numRows() > 0) {
342 array_push($this->definitions, $definition);
343 $definitionids[
$data[
'def_id']] = $definition;
347 $this->matchingpairs = array();
348 $result =
$ilDB->queryF(
349 "SELECT * FROM qpl_a_matching WHERE question_fi = %s ORDER BY answer_id",
353 if ($result->numRows() > 0) {
356 $termids[
$data[
'term_fi']],
357 $definitionids[
$data[
'definition_fi']],
358 (
float)
$data[
'points']
360 array_push($this->matchingpairs, $pair);
363 parent::loadFromDb((
int) $question_id);
372 if ($this->
id <= 0) {
377 $this_id = $this->
getId();
381 include_once(
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
385 if ((
int) $testObjId > 0) {
386 $clone->setObjId($testObjId);
396 $clone->setOwner((
int)
$owner);
405 $clone->copyPageOfQuestion($this_id);
407 $clone->copyXHTMLMediaObjectsOfQuestion($this_id);
409 $clone->duplicateImages($this_id, $thisObjId, $clone->getId(), $testObjId);
411 $clone->onDuplicate($thisObjId, $this_id, $clone->getObjId(), $clone->getId());
421 if ($this->
getId() <= 0) {
422 throw new RuntimeException(
'The question has not been saved. It cannot be duplicated');
426 include_once(
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
429 $source_questionpool_id = $this->
getObjId();
430 $clone->setObjId($target_questionpool_id);
440 $clone->copyImages(
$original_id, $source_questionpool_id);
442 $clone->onCopy($source_questionpool_id,
$original_id, $clone->getObjId(), $clone->getId());
449 if ($this->
getId() <= 0) {
450 throw new RuntimeException(
'The question has not been saved. It cannot be duplicated');
453 include_once(
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
456 $sourceParentId = $this->
getObjId();
462 $clone->setObjId($targetParentId);
464 if ($targetQuestionTitle) {
465 $clone->setTitle($targetQuestionTitle);
470 $clone->copyPageOfQuestion($sourceQuestionId);
472 $clone->copyXHTMLMediaObjectsOfQuestion($sourceQuestionId);
474 $clone->copyImages($sourceQuestionId, $sourceParentId);
476 $clone->onCopy($sourceParentId, $sourceQuestionId, $clone->getObjId(), $clone->getId());
486 $imagepath_original = str_replace(
"/$this->id/images",
"/$question_id/images", $imagepath);
488 if ((
int) $objectId > 0) {
489 $imagepath_original = str_replace(
"/$this->obj_id/",
"/$objectId/", $imagepath_original);
492 foreach ($this->terms as $term) {
493 if (strlen($term->getPicture())) {
495 if (!file_exists($imagepath)) {
499 $ilLog->write(
"matching question image could not be duplicated: $imagepath_original$filename");
501 if (@file_exists($imagepath_original . $this->
getThumbPrefix() . $filename)) {
503 $ilLog->write(
"matching question image thumbnail could not be duplicated: $imagepath_original" . $this->
getThumbPrefix() . $filename);
508 foreach ($this->definitions as $definition) {
509 if (strlen($definition->getPicture())) {
511 if (!file_exists($imagepath)) {
515 $ilLog->write(
"matching question image could not be duplicated: $imagepath_original$filename");
517 if (@file_exists($imagepath_original . $this->
getThumbPrefix() . $filename)) {
519 $ilLog->write(
"matching question image thumbnail could not be duplicated: $imagepath_original" . $this->
getThumbPrefix() . $filename);
526 public function copyImages($question_id, $source_questionpool): void
532 $imagepath_original = str_replace(
"/$this->id/images",
"/$question_id/images", $imagepath);
533 $imagepath_original = str_replace(
"/$this->obj_id/",
"/$source_questionpool/", $imagepath_original);
534 foreach ($this->terms as $term) {
535 if (strlen($term->getPicture())) {
536 if (!file_exists($imagepath)) {
541 $ilLog->write(
"matching question image could not be copied: $imagepath_original$filename");
544 $ilLog->write(
"matching question image thumbnail could not be copied: $imagepath_original" . $this->
getThumbPrefix() . $filename);
548 foreach ($this->definitions as $definition) {
549 if (strlen($definition->getPicture())) {
551 if (!file_exists($imagepath)) {
558 $ilLog->write(
"matching question image could not be copied: $imagepath_original$filename");
564 $ilLog->write(
"matching question image thumbnail could not be copied: $imagepath_original" . $this->
getThumbPrefix() . $filename);
584 if ($position < count($this->matchingpairs)) {
585 $part1 = array_slice($this->matchingpairs, 0, $position);
586 $part2 = array_slice($this->matchingpairs, $position);
587 $this->matchingpairs = array_merge($part1, array($pair), $part2);
589 array_push($this->matchingpairs, $pair);
607 array_push($this->matchingpairs, $pair);
615 foreach ($this->terms as $term) {
616 if ($term->getIdentifier() == $a_identifier) {
628 foreach ($this->definitions as $definition) {
629 if ($definition->getIdentifier() == $a_identifier) {
649 if (count($this->matchingpairs) < 1) {
652 if (
$index >= count($this->matchingpairs)) {
655 return $this->matchingpairs[
$index];
670 if (count($this->matchingpairs) < 1) {
673 if (
$index >= count($this->matchingpairs)) {
676 unset($this->matchingpairs[
$index]);
677 $this->matchingpairs = array_values($this->matchingpairs);
686 $this->matchingpairs = array();
694 $clone = clone $this;
695 $clone->matchingpairs = $pairs;
708 return count($this->matchingpairs);
741 return count($this->terms);
752 return count($this->definitions);
757 $this->terms[] = $term;
768 array_push($this->definitions, $definition);
779 if (is_null($term)) {
782 if ($position < count($this->terms)) {
783 $part1 = array_slice($this->terms, 0, $position);
784 $part2 = array_slice($this->terms, $position);
785 $this->terms = array_merge($part1, array($term), $part2);
787 array_push($this->terms, $term);
799 if (is_null($definition)) {
802 if ($position < count($this->definitions)) {
803 $part1 = array_slice($this->definitions, 0, $position);
804 $part2 = array_slice($this->definitions, $position);
805 $this->definitions = array_merge($part1, array($definition), $part2);
807 array_push($this->definitions, $definition);
817 $this->terms = array();
826 $this->definitions = array();
837 unset($this->terms[$position]);
838 $this->terms = array_values($this->terms);
849 unset($this->definitions[$position]);
850 $this->definitions = array_values($this->definitions);
862 $this->terms[
$index] = $term;
875 public function calculateReachedPoints($active_id, $pass =
null, $authorizedSolution =
true, $returndetails =
false): float
877 if ($returndetails) {
878 throw new ilTestException(
'return details not implemented for ' . __METHOD__);
885 if (is_null($pass)) {
890 if (strcmp(
$data[
"value1"],
"") != 0) {
891 if (!isset($found_values[
$data[
'value2']])) {
892 $found_values[
$data[
'value2']] = array();
895 $found_values[
$data[
'value2']][] =
$data[
'value1'];
931 $matchingPairs = array();
933 foreach ($this->matchingpairs as $pair) {
934 if ($pair->getPoints() <= 0) {
938 $matchingPairs[] = $pair;
941 return $matchingPairs;
946 $matchingPairsByDefinition = array();
948 foreach ($this->matchingpairs as $pair) {
949 if ($pair->getPoints() <= 0) {
953 $defId = $pair->getDefinition()->getIdentifier();
955 if (!isset($matchingPairsByDefinition[$defId])) {
956 $matchingPairsByDefinition[$defId] = $pair;
957 } elseif ($pair->getPoints() > $matchingPairsByDefinition[$defId]->getPoints()) {
958 $matchingPairsByDefinition[$defId] = $pair;
962 return $matchingPairsByDefinition;
971 $indexedValues = array();
973 foreach ($valuePairs as $valuePair) {
974 if (!isset($indexedValues[$valuePair[
'value2']])) {
975 $indexedValues[$valuePair[
'value2']] = array();
978 $indexedValues[$valuePair[
'value2']][] = $valuePair[
'value1'];
981 return $indexedValues;
995 if (preg_match(
"/.*\\.(\\w+)$/",
$filename, $matches)) {
996 $extension = $matches[1];
998 return md5(
$filename) .
"." . $extension;
1003 $term = $this->terms[
$index] ??
null;
1004 if (is_object($term)) {
1006 $term = $term->withPicture(
'');
1012 $definition = $this->definitions[
$index] ??
null;
1013 if (is_object($definition)) {
1015 $definition = $definition->withPicture(
'');
1032 }
catch (Throwable
$e) {
1046 public function setImageFile($image_tempfilename, $image_filename, $previous_filename =
'')
1049 if (strlen($image_tempfilename)) {
1050 $image_filename = str_replace(
" ",
"_", $image_filename);
1052 if (!file_exists($imagepath)) {
1055 $savename = $image_filename;
1063 if ($result && (strcmp($image_filename, $previous_filename) != 0) && (strlen($previous_filename))) {
1072 $request = $this->dic->testQuestionPool()->internal()->request();
1073 $post = $request->getParsedBody();
1075 $matchings = array();
1076 if (array_key_exists(
'matching',
$post)) {
1077 $postData =
$post[
'matching'][$this->
getId()];
1079 if (isset($postData[$definition->getIdentifier()])) {
1080 foreach ($this->
getTerms() as $term) {
1081 if (isset($postData[$definition->getIdentifier()][$term->getIdentifier()])) {
1082 if (!is_array($postData[$definition->getIdentifier()])) {
1083 $postData[$definition->getIdentifier()] = array();
1085 $matchings[$definition->getIdentifier()][] = $term->getIdentifier();
1101 $handledTerms = array();
1103 foreach ($submittedMatchings as $definition =>
$terms) {
1105 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"multiple_matching_values_selected"),
true);
1109 foreach ($terms as
$i => $term) {
1110 if (isset($handledTerms[$term])) {
1111 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"duplicate_matching_values_selected"),
true);
1115 $handledTerms[$term] = $term;
1135 $matchingsExist =
false;
1137 if ($submittedMatchingsValid) {
1138 if (is_null($pass)) {
1139 include_once
"./Modules/Test/classes/class.ilObjTest.php";
1143 $this->
getProcessLocker()->executeUserSolutionUpdateLockOperation(
function () use (&$matchingsExist, $submittedMatchings, $active_id, $pass, $authorized) {
1146 foreach ($submittedMatchings as $definition =>
$terms) {
1149 $matchingsExist =
true;
1154 $saveWorkingDataResult =
true;
1156 $saveWorkingDataResult =
false;
1159 include_once(
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
1161 if ($matchingsExist) {
1164 "log_user_entered_values",
1166 ), $active_id, $this->getId());
1170 "log_user_not_entered_values",
1172 ), $active_id, $this->getId());
1176 return $saveWorkingDataResult;
1190 mt_srand((
float) microtime() * 1000000);
1191 $random_number = mt_rand(1, 100000);
1195 foreach ($this->matchingpairs as
$key => $pair) {
1196 if (($pair->getTerm()->getIdentifier() == $random_number) || ($pair->getDefinition()->getIdentifier() == $random_number)) {
1202 return $random_number;
1217 return "assMatchingQuestion";
1222 return "qpl_qst_matching";
1227 return array(
"qpl_a_matching",
"qpl_a_mterm");
1236 return parent::getRTETextWithMediaObjects();
1252 parent::setExportDetailsXLS($worksheet, $startrow, $active_id, $pass);
1258 foreach ($solutions as $solution) {
1259 $matches_written =
false;
1261 if (!$matches_written) {
1262 $worksheet->
setCell($startrow +
$i, 1, $this->
lng->txt(
"matches"));
1264 $matches_written =
true;
1265 if ($pair->getDefinition()->getIdentifier() == $solution[
"value2"]) {
1266 if (strlen($pair->getDefinition()->getText())) {
1267 $worksheet->
setCell($startrow +
$i, 0, $pair->getDefinition()->getText());
1269 $worksheet->
setCell($startrow +
$i, 0, $pair->getDefinition()->getPicture());
1272 if ($pair->getTerm()->getIdentifier() == $solution[
"value1"]) {
1273 if (strlen($pair->getTerm()->getText())) {
1274 $worksheet->
setCell($startrow +
$i, 2, $pair->getTerm()->getText());
1276 $worksheet->
setCell($startrow +
$i, 2, $pair->getTerm()->getPicture());
1283 return $startrow +
$i + 1;
1313 $this->thumb_geometry = ($a_geometry < 1) ? 100 : $a_geometry;
1321 foreach ($this->terms as $term) {
1322 if (strlen($term->getPicture())) {
1326 foreach ($this->definitions as $definition) {
1327 if (strlen($definition->getPicture())) {
1345 switch (strtoupper($path_info[
'extension'])) {
1367 $result[
'id'] = $this->
getId();
1373 $result[
'shuffle'] =
true;
1374 $result[
'feedback'] = array(
1375 'onenotcorrect' => $this->
formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(),
false)),
1376 'allcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(),
true))
1385 "id" => $this->
getId() . $term->getIdentifier()
1388 $result[
'terms'] =
$terms;
1396 "id" => $this->
getId() . $def->getIdentifier()
1405 if ($pair->getPoints() <= 0) {
1410 $pid = $pair->getDefinition()->getIdentifier();
1412 $pid .=
'::' . $pair->getTerm()->getIdentifier();
1415 if (!isset($matchings[$pid]) || $matchings[$pid][
"points"] < $pair->getPoints()) {
1416 $matchings[$pid] = [
1417 "term_id" => $this->
getId() . $pair->getTerm()->getIdentifier(),
1418 "def_id" => $this->
getId() . $pair->getDefinition()->getIdentifier(),
1419 "points" => (
int) $pair->getPoints()
1424 $result[
'matchingPairs'] = array_values($matchings);
1427 $result[
'mobs'] =
$mobs;
1429 $this->
lng->loadLanguageModule(
'assessment');
1430 $result[
'reset_button_label'] = $this->
lng->txt(
"reset_terms");
1432 return json_encode($result);
1462 if (! is_array($found_values)) {
1465 foreach ($found_values as $definition =>
$terms) {
1469 foreach (
$terms as $term) {
1470 foreach ($this->matchingpairs as $pair) {
1471 if ($pair->getDefinition()->getIdentifier() == $definition && $pair->getTerm()->getIdentifier() == $term) {
1472 $points += $pair->getPoints();
1522 "SELECT ident FROM qpl_a_mdef WHERE question_fi = %s ORDER BY def_id",
1524 array($this->
getId())
1534 "SELECT ident FROM qpl_a_mterm WHERE question_fi = %s ORDER BY term_id",
1536 array($this->
getId())
1547 if ($maxStep !==
null) {
1549 "SELECT value1, value2 FROM tst_solutions WHERE active_fi = %s AND pass = %s AND question_fi = %s AND step = %s",
1550 array(
"integer",
"integer",
"integer",
"integer"),
1551 array($active_id, $pass, $this->
getId(), $maxStep)
1555 "SELECT value1, value2 FROM tst_solutions WHERE active_fi = %s AND pass = %s AND question_fi = %s",
1556 array(
"integer",
"integer",
"integer"),
1557 array($active_id, $pass, $this->
getId())
1562 if ($row[
"value1"] > 0) {
1570 $result->setReachedPercentage((
$points / $max_points) * 100);
1595 parent::afterSyncWithOriginal($origQuestionId, $dupQuestionId, $origParentObjId, $dupParentObjId);
1597 $origImagePath = $this->
buildImagePath($origQuestionId, $origParentObjId);
1598 $dupImagePath = $this->
buildImagePath($dupQuestionId, $dupParentObjId);
1601 if (is_dir($dupImagePath)) {
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class for matching questions.
supportsJavascriptOutput()
deleteDefinition($position)
Deletes a definition.
getEncryptedFilename($filename)
Returns the encrypted save filename of a matching picture Images are saved with an encrypted filename...
__construct( $title="", $comment="", $author="", $owner=-1, $question="", $matching_type=MT_TERMS_DEFINITIONS)
assMatchingQuestion constructor
removeDefinitionImage($index)
getMatchingPairCount()
Returns the number of matching pairs.
calculateReachedPointsForSolution($found_values)
addDefinition($definition)
Adds a definition.
getMaximumPoints()
Calculates and Returns the maximum points, a learner can reach answering the question.
setThumbGeometry(int $a_geometry)
Set the thumbnail geometry.
savePreviewData(ilAssQuestionPreviewSession $previewSession)
copyObject($target_questionpool_id, $title="")
Copies an assMatchingQuestion.
getMostPositiveScoredUniqueTermMatchingPairs()
toJSON()
Returns a JSON representation of the question.
getOperators($expression)
Get all available operations for a specific question.
getDefinitionCount()
Returns the number of definitions.
getDefinitions()
Returns the definitions of the matching question.
getMatchingPair($index=0)
Returns a matching pair with a given index.
createMatchingDefinition(string $term='', string $picture='', int $identifier=0)
createNewOriginalFromThisDuplicate($targetParentId, $targetQuestionTitle="")
withMatchingPairs(array $pairs)
getQuestionType()
Returns the question type of the question.
isComplete()
Returns true, if a matching question is complete for use.
calculateReachedPoints($active_id, $pass=null, $authorizedSolution=true, $returndetails=false)
Returns the points, a learner has reached answering the question.
& getMatchingPairs()
Returns the matchingpairs array.
saveWorkingData($active_id, $pass=null, $authorized=true)
Saves the learners input of the question to the database.
rebuildThumbnails()
Rebuild the thumbnail images with a new thumbnail size.
insertDefinition($position, assAnswerMatchingDefinition $definition=null)
Inserts a definition.
getPositiveScoredMatchingPairs()
duplicateImages($question_id, $objectId=null)
getTermCount()
Returns the number of terms.
getThumbGeometry()
Get the thumbnail geometry.
deleteTerm($position)
Deletes a term.
checkSubmittedMatchings($submittedMatchings)
createMatchingTerm(string $term='', string $picture='', int $identifier=0)
getTerms()
Returns the terms of the matching question.
createMatchingPair(assAnswerMatchingTerm $term=null, assAnswerMatchingDefinition $definition=null, float $points=0.0)
flushDefinitions()
Deletes all definitions.
fetchIndexedValuesFromValuePairs(array $valuePairs)
loadFromDb($question_id)
Loads a assMatchingQuestion object from a database.
getDefinitionWithIdentifier($a_identifier)
Returns a definition with a given identifier.
insertTerm($position, assAnswerMatchingTerm $term=null)
Inserts a term.
flushTerms()
Deletes all terms.
copyImages($question_id, $source_questionpool)
flushMatchingPairs()
Deletes all matching pairs.
setShuffleMode(int $shuffle)
saveToDb($original_id="")
Saves a assMatchingQuestion object to a database.
addTerm(assAnswerMatchingTerm $term)
setMatchingMode($matchingMode)
getAvailableAnswerOptions($index=null)
If index is null, the function returns an array with all anwser options Else it returns the specific ...
setImageFile($image_tempfilename, $image_filename, $previous_filename='')
Sets the image file and uploads the image to the object's image directory.
setShuffle($shuffle=true)
getThumbSize()
Get the thumbnail geometry.
getTermWithIdentifier($a_identifier)
Returns a term with a given identifier.
addMatchingPair(assAnswerMatchingTerm $term=null, assAnswerMatchingDefinition $definition=null, $points=0.0)
Adds an matching pair for an matching choice question.
setTerm($term, $index)
Sets a specific term.
getRTETextWithMediaObjects()
Collects all text in the question which could contain media objects which were created with the Rich ...
deleteImagefile(string $filename)
Deletes an imagefile from the system if the file is deleted manually.
fetchSubmittedMatchingsFromPost()
saveAnswerSpecificDataToDb()
Saves the answer specific records into a question types answer table.
duplicate(bool $for_test=true, string $title="", string $author="", string $owner="", $testObjId=null)
Duplicates an assMatchingQuestion.
afterSyncWithOriginal($origQuestionId, $dupQuestionId, $origParentObjId, $dupParentObjId)
{}
getExpressionTypes()
Get all available expression types for a specific question.
const MATCHING_MODE_1_ON_1
setExportDetailsXLS(ilAssExcelFormatHelper $worksheet, int $startrow, int $active_id, int $pass)
{}
getMaximumScoringMatchingPairs()
deleteMatchingPair($index=0)
Deletes a matching pair with a given index.
const MATCHING_MODE_N_ON_N
insertMatchingPair($position, $term=null, $definition=null, $points=0.0)
Inserts a matching pair for an matching choice question.
saveAdditionalQuestionDataToDb()
Saves a record to the question types additional data table.
generateThumbForFile($path, $file)
Abstract basic class which is to be extended by the concrete assessment question type classes.
float $points
The maximum available points for the question.
setOriginalId(?int $original_id)
string $question
The question text.
static logAction(string $logtext, int $active_id, int $question_id)
setAdditionalContentEditingMode(?string $additionalContentEditingMode)
static isFileAvailable(string $file)
saveCurrentSolution(int $active_id, int $pass, $value1, $value2, bool $authorized=true, $tstamp=0)
getSolutionValues($active_id, $pass=null, bool $authorized=true)
Loads solutions of a given user from the database an returns it.
setQuestion(string $question="")
buildImagePath($questionId, $parentObjectId)
getImagePath($question_id=null, $object_id=null)
Returns the image path for web accessable images of a question.
getCurrentSolutionResultSet(int $active_id, int $pass, bool $authorized=true)
static _getOriginalId(int $question_id)
ILIAS DI LoggingServices $ilLog
saveQuestionDataToDb(int $original_id=-1)
setAuthor(string $author="")
bool $shuffle
Indicates whether the answers will be shuffled or not.
setComment(string $comment="")
getSolutionMaxPass(int $active_id)
setNrOfTries(int $a_nr_of_tries)
setLifecycle(ilAssQuestionLifecycle $lifecycle)
setTitle(string $title="")
removeCurrentSolution(int $active_id, int $pass, bool $authorized=true)
setShuffler(Transformation $shuffler)
lookupMaxStep(int $active_id, int $pass)
static getDraftInstance()
static getInstance($identifier)
setParticipantsSolution($participantSolution)
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file
static rCopy(string $a_sdir, string $a_tdir, bool $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
static _enabledAssessmentLogging()
static _getPass($active_id)
Retrieves the actual pass of a given user for a given test.
static getOperatorsByExpression($expression)
static _replaceMediaObjectImageSrc(string $a_text, int $a_direction=0, string $nic='')
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
static convertImage(string $a_from, string $a_to, string $a_target_format="", string $a_geometry="", string $a_background_color="")
convert image
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const MT_TERMS_DEFINITIONS
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const PercentageResultExpression
const MatchingResultExpression
getUserQuestionResult($active_id, $pass)
Get the user solution for a question by active_id and the test pass.
const NumericResultExpression
const EmptyAnswerExpression
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc