19 declare(strict_types=1);
24 require_once
'./Modules/Test/classes/inc.AssessmentConstants.php';
113 $this->matchingpairs = [];
116 $this->definitions = [];
117 $this->randomGroup = $DIC->refinery()->random();
137 if (strlen($this->title)
140 && count($this->matchingpairs)
172 $this->db->manipulateF(
173 "DELETE FROM qpl_a_mterm WHERE question_fi = %s",
179 $this->db->manipulateF(
180 "DELETE FROM qpl_a_mdef WHERE question_fi = %s",
187 foreach ($this->terms as
$key => $term) {
188 $next_id = $this->db->nextId(
'qpl_a_mterm');
189 $this->db->insert(
'qpl_a_mterm', [
190 'term_id' => [
'integer', $next_id],
191 'question_fi' => [
'integer', $this->
getId()],
192 'picture' => [
'text', $term->getPicture()],
193 'term' => [
'text', $term->getText()],
194 'ident' => [
'integer', $term->getIdentifier()]
196 $termids[$term->getIdentifier()] = $next_id;
201 foreach ($this->definitions as
$key => $definition) {
202 $next_id = $this->db->nextId(
'qpl_a_mdef');
203 $this->db->insert(
'qpl_a_mdef', [
204 'def_id' => [
'integer', $next_id],
205 'question_fi' => [
'integer', $this->
getId()],
206 'picture' => [
'text', $definition->getPicture()],
207 'definition' => [
'text', $definition->getText()],
208 'ident' => [
'integer', $definition->getIdentifier()]
210 $definitionids[$definition->getIdentifier()] = $next_id;
213 $this->db->manipulateF(
214 "DELETE FROM qpl_a_matching WHERE question_fi = %s",
220 $next_id = $this->db->nextId(
'qpl_a_matching');
221 $this->db->manipulateF(
222 "INSERT INTO qpl_a_matching (answer_id, question_fi, points, term_fi, definition_fi) VALUES (%s, %s, %s, %s, %s)",
223 [
'integer',
'integer',
'float',
'integer',
'integer' ],
228 $termids[$pair->getTerm()->getIdentifier()],
229 $definitionids[$pair->getDefinition()->getIdentifier()]
237 $this->db->manipulateF(
244 'question_fi' => [
'integer', $this->
getId()],
246 'matching_type' => [
'text', $this->matching_type],
261 SELECT qpl_questions.*, 262 {$this->getAdditionalTableName()}.* 264 LEFT JOIN {$this->getAdditionalTableName()} 265 ON {$this->getAdditionalTableName()}.question_fi = qpl_questions.question_id 266 WHERE qpl_questions.question_id = %s 269 $result = $this->db->queryF(
275 if ($result->numRows() == 1) {
276 $data = $this->db->fetchAssoc($result);
277 $this->
setId((
int) $question_id);
279 $this->
setTitle((
string) $data[
"title"]);
280 $this->
setComment((
string) $data[
"description"]);
284 $this->
setPoints((
float) $data[
"points"]);
285 $this->
setOwner((
int) $data[
"owner"]);
290 $this->
setMatchingMode($data[
'matching_mode'] === null ? self::MATCHING_MODE_1_ON_1 : $data[
'matching_mode']);
305 $result = $this->db->queryF(
306 "SELECT * FROM qpl_a_mterm WHERE question_fi = %s ORDER BY term_id ASC",
311 if ($result->numRows() > 0) {
312 while (
$data = $this->db->fetchAssoc($result)) {
314 $this->terms[] = $term;
315 $termids[$data[
'term_id']] = $term;
320 $result = $this->db->queryF(
321 "SELECT * FROM qpl_a_mdef WHERE question_fi = %s ORDER BY def_id ASC",
326 $this->definitions = [];
327 if ($result->numRows() > 0) {
328 while (
$data = $this->db->fetchAssoc($result)) {
330 array_push($this->definitions, $definition);
331 $definitionids[$data[
'def_id']] = $definition;
335 $this->matchingpairs = [];
336 $result = $this->db->queryF(
337 "SELECT * FROM qpl_a_matching WHERE question_fi = %s ORDER BY answer_id",
341 if ($result->numRows() > 0) {
342 while (
$data = $this->db->fetchAssoc($result)) {
344 $termids[
$data[
'term_fi']],
345 $definitionids[$data[
'definition_fi']],
346 (
float) $data[
'points']
348 array_push($this->matchingpairs, $pair);
351 parent::loadFromDb((
int) $question_id);
360 if ($this->
id <= 0) {
365 $this_id = $this->
getId();
370 $original_id = $this->questioninfo->getOriginalId($this->
id);
373 if ((
int) $testObjId > 0) {
374 $clone->setObjId($testObjId);
384 $clone->setOwner((
int)
$owner);
393 $clone->copyPageOfQuestion($this_id);
395 $clone->copyXHTMLMediaObjectsOfQuestion($this_id);
397 $clone->duplicateImages($this_id, $thisObjId, $clone->getId(), $testObjId);
399 $clone->onDuplicate($thisObjId, $this_id, $clone->getObjId(), $clone->getId());
409 if ($this->
getId() <= 0) {
410 throw new RuntimeException(
'The question has not been saved. It cannot be duplicated');
415 $original_id = $this->questioninfo->getOriginalId($this->
id);
417 $source_questionpool_id = $this->
getObjId();
418 $clone->setObjId($target_questionpool_id);
428 $clone->copyImages(
$original_id, $source_questionpool_id);
430 $clone->onCopy($source_questionpool_id,
$original_id, $clone->getObjId(), $clone->getId());
437 if ($this->
getId() <= 0) {
438 throw new RuntimeException(
'The question has not been saved. It cannot be duplicated');
442 $sourceParentId = $this->
getObjId();
448 $clone->setObjId($targetParentId);
450 if ($targetQuestionTitle) {
451 $clone->setTitle($targetQuestionTitle);
456 $clone->copyPageOfQuestion($sourceQuestionId);
458 $clone->copyXHTMLMediaObjectsOfQuestion($sourceQuestionId);
460 $clone->copyImages($sourceQuestionId, $sourceParentId);
462 $clone->onCopy($sourceParentId, $sourceQuestionId, $clone->getObjId(), $clone->getId());
472 $imagepath_original = str_replace(
"/$this->id/images",
"/$question_id/images", $imagepath);
474 if ((
int) $objectId > 0) {
475 $imagepath_original = str_replace(
"/$this->obj_id/",
"/$objectId/", $imagepath_original);
478 foreach ($this->terms as $term) {
479 if (strlen($term->getPicture())) {
481 if (!file_exists($imagepath)) {
484 if (!@copy($imagepath_original .
$filename, $imagepath . $filename)) {
485 $ilLog->write(
"matching question image could not be duplicated: $imagepath_original$filename");
487 if (@file_exists($imagepath_original . $this->
getThumbPrefix() . $filename)) {
489 $ilLog->write(
"matching question image thumbnail could not be duplicated: $imagepath_original" . $this->
getThumbPrefix() . $filename);
494 foreach ($this->definitions as $definition) {
495 if (strlen($definition->getPicture())) {
497 if (!file_exists($imagepath)) {
500 if (!@copy($imagepath_original .
$filename, $imagepath . $filename)) {
501 $ilLog->write(
"matching question image could not be duplicated: $imagepath_original$filename");
503 if (@file_exists($imagepath_original . $this->
getThumbPrefix() . $filename)) {
505 $ilLog->write(
"matching question image thumbnail could not be duplicated: $imagepath_original" . $this->
getThumbPrefix() . $filename);
512 public function copyImages($question_id, $source_questionpool): void
518 $imagepath_original = str_replace(
"/$this->id/images",
"/$question_id/images", $imagepath);
519 $imagepath_original = str_replace(
"/$this->obj_id/",
"/$source_questionpool/", $imagepath_original);
520 foreach ($this->terms as $term) {
521 if (strlen($term->getPicture())) {
522 if (!file_exists($imagepath)) {
526 if (!@copy($imagepath_original .
$filename, $imagepath . $filename)) {
527 $ilLog->write(
"matching question image could not be copied: $imagepath_original$filename");
530 $ilLog->write(
"matching question image thumbnail could not be copied: $imagepath_original" . $this->
getThumbPrefix() . $filename);
534 foreach ($this->definitions as $definition) {
535 if (strlen($definition->getPicture())) {
537 if (!file_exists($imagepath)) {
542 copy($imagepath_original . $filename, $imagepath . $filename);
544 $ilLog->write(
"matching question image could not be copied: $imagepath_original$filename");
550 $ilLog->write(
"matching question image thumbnail could not be copied: $imagepath_original" . $this->
getThumbPrefix() . $filename);
570 if ($position < count($this->matchingpairs)) {
571 $part1 = array_slice($this->matchingpairs, 0, $position);
572 $part2 = array_slice($this->matchingpairs, $position);
573 $this->matchingpairs = array_merge($part1, [$pair], $part2);
575 array_push($this->matchingpairs, $pair);
593 array_push($this->matchingpairs, $pair);
601 foreach ($this->terms as $term) {
602 if ($term->getIdentifier() == $a_identifier) {
614 foreach ($this->definitions as $definition) {
615 if ($definition->getIdentifier() == $a_identifier) {
635 if (count($this->matchingpairs) < 1) {
638 if ($index >= count($this->matchingpairs)) {
641 return $this->matchingpairs[$index];
656 if (count($this->matchingpairs) < 1) {
659 if ($index >= count($this->matchingpairs)) {
662 unset($this->matchingpairs[$index]);
663 $this->matchingpairs = array_values($this->matchingpairs);
672 $this->matchingpairs = [];
680 $clone = clone $this;
681 $clone->matchingpairs = $pairs;
694 return count($this->matchingpairs);
727 return count($this->terms);
738 return count($this->definitions);
743 $this->terms[] = $term;
754 array_push($this->definitions, $definition);
765 if (is_null($term)) {
768 if ($position < count($this->terms)) {
769 $part1 = array_slice($this->terms, 0, $position);
770 $part2 = array_slice($this->terms, $position);
771 $this->terms = array_merge($part1, [$term], $part2);
773 array_push($this->terms, $term);
785 if (is_null($definition)) {
788 if ($position < count($this->definitions)) {
789 $part1 = array_slice($this->definitions, 0, $position);
790 $part2 = array_slice($this->definitions, $position);
791 $this->definitions = array_merge($part1, [$definition], $part2);
793 array_push($this->definitions, $definition);
812 $this->definitions = [];
823 unset($this->terms[$position]);
824 $this->terms = array_values($this->terms);
835 unset($this->definitions[$position]);
836 $this->definitions = array_values($this->definitions);
848 $this->terms[$index] = $term;
861 public function calculateReachedPoints($active_id, $pass = null, $authorizedSolution =
true, $returndetails =
false): float
863 if ($returndetails) {
864 throw new ilTestException(
'return details not implemented for ' . __METHOD__);
868 if (is_null($pass)) {
872 while (
$data = $this->db->fetchAssoc($result)) {
873 if (strcmp(
$data[
"value1"],
"") != 0) {
874 if (!isset($found_values[
$data[
'value2']])) {
875 $found_values[$data[
'value2']] = [];
878 $found_values[$data[
'value2']][] = $data[
'value1'];
916 foreach ($this->matchingpairs as $pair) {
917 if ($pair->getPoints() <= 0) {
921 $matchingPairs[] = $pair;
924 return $matchingPairs;
929 $matchingPairsByDefinition = [];
931 foreach ($this->matchingpairs as $pair) {
932 if ($pair->getPoints() <= 0) {
936 $defId = $pair->getDefinition()->getIdentifier();
938 if (!isset($matchingPairsByDefinition[$defId])) {
939 $matchingPairsByDefinition[$defId] = $pair;
940 } elseif ($pair->getPoints() > $matchingPairsByDefinition[$defId]->getPoints()) {
941 $matchingPairsByDefinition[$defId] = $pair;
945 return $matchingPairsByDefinition;
956 foreach ($valuePairs as $valuePair) {
957 if (!isset($indexedValues[$valuePair[
'value2']])) {
958 $indexedValues[$valuePair[
'value2']] = [];
961 $indexedValues[$valuePair[
'value2']][] = $valuePair[
'value1'];
964 return $indexedValues;
978 if (preg_match(
"/.*\\.(\\w+)$/",
$filename, $matches)) {
979 $extension = $matches[1];
981 return md5(
$filename) .
"." . $extension;
986 $term = $this->terms[$index] ?? null;
987 if (is_object($term)) {
989 $term = $term->withPicture(
'');
995 $definition = $this->definitions[$index] ?? null;
996 if (is_object($definition)) {
998 $definition = $definition->withPicture(
'');
1029 public function setImageFile($image_tempfilename, $image_filename, $previous_filename =
'')
1032 if (strlen($image_tempfilename)) {
1033 $image_filename = str_replace(
" ",
"_", $image_filename);
1035 if (!file_exists($imagepath)) {
1038 $savename = $image_filename;
1046 if ($result && (strcmp($image_filename, $previous_filename) != 0) && (strlen($previous_filename))) {
1055 $request = $this->dic->testQuestionPool()->internal()->request();
1056 $post = $request->getParsedBody();
1059 if (array_key_exists(
'matching',
$post)) {
1060 $postData =
$post[
'matching'][$this->
getId()];
1062 if (isset($postData[$definition->getIdentifier()])) {
1063 foreach ($this->
getTerms() as $term) {
1064 if (isset($postData[$definition->getIdentifier()][$term->getIdentifier()])) {
1065 if (!is_array($postData[$definition->getIdentifier()])) {
1066 $postData[$definition->getIdentifier()] = [];
1068 $matchings[$definition->getIdentifier()][] = $term->getIdentifier();
1086 foreach ($submittedMatchings as $definition => $terms) {
1087 if (count($terms) > 1) {
1088 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"multiple_matching_values_selected"),
true);
1092 foreach ($terms as $i => $term) {
1093 if (isset($handledTerms[$term])) {
1094 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"duplicate_matching_values_selected"),
true);
1098 $handledTerms[$term] = $term;
1118 $matchingsExist =
false;
1120 if ($submittedMatchingsValid) {
1121 if (is_null($pass)) {
1125 $this->
getProcessLocker()->executeUserSolutionUpdateLockOperation(
function () use (&$matchingsExist, $submittedMatchings, $active_id, $pass, $authorized) {
1128 foreach ($submittedMatchings as $definition => $terms) {
1129 foreach ($terms as $i => $term) {
1131 $matchingsExist =
true;
1136 $saveWorkingDataResult =
true;
1138 $saveWorkingDataResult =
false;
1142 if ($matchingsExist) {
1145 "log_user_entered_values",
1147 ), $active_id, $this->
getId());
1151 "log_user_not_entered_values",
1153 ), $active_id, $this->
getId());
1157 return $saveWorkingDataResult;
1171 mt_srand((
float) microtime() * 1000000);
1172 $random_number = mt_rand(1, 100000);
1176 foreach ($this->matchingpairs as
$key => $pair) {
1177 if (($pair->getTerm()->getIdentifier() == $random_number) || ($pair->getDefinition()->getIdentifier() == $random_number)) {
1183 return $random_number;
1198 return "assMatchingQuestion";
1203 return "qpl_qst_matching";
1208 return [
"qpl_a_matching",
"qpl_a_mterm"];
1217 return parent::getRTETextWithMediaObjects();
1233 parent::setExportDetailsXLSX($worksheet, $startrow, $col, $active_id, $pass);
1239 foreach ($solutions as $solution) {
1240 $matches_written =
false;
1242 if (!$matches_written) {
1243 $worksheet->
setCell($startrow + $i, $col + 1, $this->
lng->txt(
"matches"));
1245 $matches_written =
true;
1246 if ($pair->getDefinition()->getIdentifier() == $solution[
"value2"]) {
1247 if (strlen($pair->getDefinition()->getText())) {
1248 $worksheet->
setCell($startrow + $i, $col, $pair->getDefinition()->getText());
1250 $worksheet->
setCell($startrow + $i, $col, $pair->getDefinition()->getPicture());
1253 if ($pair->getTerm()->getIdentifier() == $solution[
"value1"]) {
1254 if (strlen($pair->getTerm()->getText())) {
1255 $worksheet->
setCell($startrow + $i, $col + 2, $pair->getTerm()->getText());
1257 $worksheet->
setCell($startrow + $i, $col + 2, $pair->getTerm()->getPicture());
1264 return $startrow + $i + 1;
1294 $this->thumb_geometry = ($a_geometry < 1) ? 100 : $a_geometry;
1303 foreach ($this->terms as $term) {
1304 if ($term->getPicture() !==
'') {
1305 $current_file_path = $this->
getImagePath() . $term->getPicture();
1306 if (!file_exists($current_file_path)) {
1307 $new_terms[] = $term;
1311 $new_file_path = $this->
getImagePath() . $new_file_name;
1312 rename($current_file_path, $new_file_path);
1313 $term = $term->withPicture($new_file_name);
1316 $new_terms[] = $term;
1318 $this->terms = $new_terms;
1320 $new_definitions = [];
1321 foreach ($this->definitions as $definition) {
1322 if ($definition->getPicture() !==
'') {
1323 $current_file_path = $this->
getImagePath() . $definition->getPicture();
1324 if (!file_exists($current_file_path)) {
1325 $new_definitions[] = $definition;
1329 $new_file_path = $this->
getImagePath() . $new_file_name;
1330 rename($current_file_path, $new_file_path);
1331 $definition = $definition->withPicture($new_file_name);
1334 $new_definitions[] = $definition;
1336 $this->definitions = $new_definitions;
1351 switch (strtoupper($path_info[
'extension'])) {
1373 $result[
'id'] = $this->
getId();
1379 $result[
'shuffle'] =
true;
1380 $result[
'feedback'] = [
1381 'onenotcorrect' => $this->
formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(),
false)),
1382 'allcorrect' => $this->
formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(),
true))
1391 "id" => $this->
getId() . $term->getIdentifier()
1394 $result[
'terms'] =
$terms;
1402 "id" => $this->
getId() . $def->getIdentifier()
1411 if ($pair->getPoints() <= 0) {
1416 $pid = $pair->getDefinition()->getIdentifier();
1418 $pid .=
'::' . $pair->getTerm()->getIdentifier();
1421 if (!isset($matchings[$pid]) || $matchings[$pid][
"points"] < $pair->getPoints()) {
1422 $matchings[$pid] = [
1423 "term_id" => $this->
getId() . $pair->getTerm()->getIdentifier(),
1424 "def_id" => $this->
getId() . $pair->getDefinition()->getIdentifier(),
1425 "points" => (
int) $pair->getPoints()
1430 $result[
'matchingPairs'] = array_values($matchings);
1433 $result[
'mobs'] = $mobs;
1435 $this->
lng->loadLanguageModule(
'assessment');
1436 $result[
'reset_button_label'] = $this->
lng->txt(
"reset_terms");
1438 return json_encode($result);
1458 if (! is_array($found_values)) {
1461 foreach ($found_values as $definition => $terms) {
1462 if (!is_array($terms)) {
1465 foreach ($terms as $term) {
1466 foreach ($this->matchingpairs as $pair) {
1467 if ($pair->getDefinition()->getIdentifier() == $definition && $pair->getTerm()->getIdentifier() == $term) {
1468 $points += $pair->getPoints();
1514 $data = $this->db->queryF(
1515 "SELECT ident FROM qpl_a_mdef WHERE question_fi = %s ORDER BY def_id",
1521 for ($index = 1; $index <= $this->db->numRows(
$data); ++$index) {
1522 $row = $this->db->fetchAssoc(
$data);
1526 $data = $this->db->queryF(
1527 "SELECT ident FROM qpl_a_mterm WHERE question_fi = %s ORDER BY term_id",
1533 for ($index = 1; $index <= $this->db->numRows(
$data); ++$index) {
1534 $row = $this->db->fetchAssoc(
$data);
1535 $terms[$row[
"ident"]] = $index;
1541 $data = $this->db->queryF(
1542 "SELECT value1, value2 FROM tst_solutions WHERE active_fi = %s AND pass = %s AND question_fi = %s AND step = %s",
1543 [
"integer",
"integer",
"integer",
"integer"],
1544 [$active_id, $pass, $this->
getId(), $maxStep]
1547 $data = $this->db->queryF(
1548 "SELECT value1, value2 FROM tst_solutions WHERE active_fi = %s AND pass = %s AND question_fi = %s",
1549 [
"integer",
"integer",
"integer"],
1550 [$active_id, $pass, $this->
getId()]
1554 while ($row = $this->db->fetchAssoc(
$data)) {
1555 if ($row[
"value1"] > 0) {
1556 $result->addKeyValue(
$definitions[$row[
"value2"]], $terms[$row[
"value1"]]);
1563 $result->setReachedPercentage((
$points / $max_points) * 100);
1576 if ($index !== null) {
1588 parent::afterSyncWithOriginal($origQuestionId, $dupQuestionId, $origParentObjId, $dupParentObjId);
1590 $origImagePath = $this->questionFilesService->buildImagePath($origQuestionId, $origParentObjId);
1591 $dupImagePath = $this->questionFilesService->buildImagePath($dupQuestionId, $dupParentObjId);
1594 if (is_dir($dupImagePath)) {
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...
getThumbGeometry()
Get the thumbnail geometry.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getSolutionValues($active_id, $pass=null, bool $authorized=true)
Loads solutions of a given user from the database an returns it.
setNrOfTries(int $a_nr_of_tries)
addTerm(assAnswerMatchingTerm $term)
getMaximumPoints()
Calculates and Returns the maximum points, a learner can reach answering the question.
static getInstance($identifier)
const PercentageResultExpression
calculateReachedPoints($active_id, $pass=null, $authorizedSolution=true, $returndetails=false)
Returns the points, a learner has reached answering the question.
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...
static _getPass($active_id)
Retrieves the actual pass of a given user for a given test.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
saveAdditionalQuestionDataToDb()
Saves a record to the question types additional data table.
getPositiveScoredMatchingPairs()
getTermCount()
Returns the number of terms.
const MATCHING_MODE_N_ON_N
copyObject($target_questionpool_id, $title="")
Copies an assMatchingQuestion.
generateThumbForFile($path, $file)
getUserQuestionResult($active_id, $pass)
Get the user solution for a question by active_id and the test pass.
withMatchingPairs(array $pairs)
deleteMatchingPair($index=0)
Deletes a matching pair with a given index.
Abstract basic class which is to be extended by the concrete assessment question type classes...
static isFileAvailable(string $file)
afterSyncWithOriginal($origQuestionId, $dupQuestionId, $origParentObjId, $dupParentObjId)
{}
getDefinitionCount()
Returns the number of definitions.
setShuffleMode(int $shuffle)
const MATCHING_MODE_1_ON_1
getQuestionType()
Returns the question type of the question.
bool $shuffle
Indicates whether the answers will be shuffled or not.
flushMatchingPairs()
Deletes all matching pairs.
setImageFile($image_tempfilename, $image_filename, $previous_filename='')
Sets the image file and uploads the image to the object's image directory.
getEncryptedFilename($filename)
Returns the encrypted save filename of a matching picture Images are saved with an encrypted filename...
flushTerms()
Deletes all terms.
const MT_TERMS_DEFINITIONS
static rCopy(string $a_sdir, string $a_tdir, bool $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
fetchIndexedValuesFromValuePairs(array $valuePairs)
createNewOriginalFromThisDuplicate($targetParentId, $targetQuestionTitle="")
getRTETextWithMediaObjects()
Collects all text in the question which could contain media objects which were created with the Rich ...
deleteTerm($position)
Deletes a term.
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
setComment(string $comment="")
setThumbGeometry(int $a_geometry)
Set the thumbnail geometry.
rebuildThumbnails()
Rebuild the thumbnail images with a new thumbnail size.
calculateReachedPointsForSolution($found_values)
getDefinitions()
Returns the definitions of the matching question.
float $points
The maximum available points for the question.
addMatchingPair(assAnswerMatchingTerm $term=null, assAnswerMatchingDefinition $definition=null, $points=0.0)
Adds an matching pair for an matching choice question.
loadFromDb($question_id)
Loads a assMatchingQuestion object from a database.
getMatchingPair($index=0)
Returns a matching pair with a given index.
Base Exception for all Exceptions relating to Modules/Test.
setMatchingMode($matchingMode)
Class for matching questions.
setParticipantsSolution($participantSolution)
duplicateImages($question_id, $objectId=null)
fetchSubmittedMatchingsFromPost()
getTermWithIdentifier($a_identifier)
Returns a term with a given identifier.
getAvailableAnswerOptions($index=null)
If index is null, the function returns an array with all anwser options Else it returns the specific ...
insertMatchingPair($position, $term=null, $definition=null, $points=0.0)
Inserts a matching pair for an matching choice question.
saveCurrentSolution(int $active_id, int $pass, $value1, $value2, bool $authorized=true, $tstamp=0)
removeDefinitionImage($index)
static _enabledAssessmentLogging()
getImagePath($question_id=null, $object_id=null)
Returns the image path for web accessable images of a question.
duplicate(bool $for_test=true, string $title="", string $author="", int $owner=-1, $testObjId=null)
Duplicates an assMatchingQuestion.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
buildHashedImageFilename(string $plain_image_filename, bool $unique=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setTerm($term, $index)
Sets a specific term.
static logAction(string $logtext, int $active_id, int $question_id)
getMatchingPairCount()
Returns the number of matching pairs.
const NumericResultExpression
getExpressionTypes()
Get all available expression types for a specific question.
getMostPositiveScoredUniqueTermMatchingPairs()
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
setShuffle($shuffle=true)
getOperators($expression)
Get all available operations for a specific question.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
checkSubmittedMatchings($submittedMatchings)
const MatchingResultExpression
saveWorkingData($active_id, $pass=null, $authorized=true)
Saves the learners input of the question to the database.
deleteImagefile(string $filename)
Deletes an imagefile from the system if the file is deleted manually.
addDefinition($definition)
Adds a definition.
getMaximumScoringMatchingPairs()
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file
string $question
The question text.
static convertImage(string $a_from, string $a_to, string $a_target_format="", string $a_geometry="", string $a_background_color="")
flushDefinitions()
Deletes all definitions.
saveAnswerSpecificDataToDb()
Saves the answer specific records into a question types answer table.
static getOperatorsByExpression($expression)
createMatchingTerm(string $term='', string $picture='', int $identifier=0)
__construct( $title="", $comment="", $author="", $owner=-1, $question="", $matching_type=MT_TERMS_DEFINITIONS)
assMatchingQuestion constructor
toJSON()
Returns a JSON representation of the question.
insertTerm($position, assAnswerMatchingTerm $term=null)
Inserts a term.
deleteDefinition($position)
Deletes a definition.
setExportDetailsXLSX(ilAssExcelFormatHelper $worksheet, int $startrow, int $col, int $active_id, int $pass)
{}
saveQuestionDataToDb(int $original_id=-1)
getSolutionMaxPass(int $active_id)
getTerms()
Returns the terms of the matching question.
removeCurrentSolution(int $active_id, int $pass, bool $authorized=true)
getDefinitionWithIdentifier($a_identifier)
Returns a definition with a given identifier.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
createMatchingPair(assAnswerMatchingTerm $term=null, assAnswerMatchingDefinition $definition=null, float $points=0.0)
setOriginalId(?int $original_id)
setShuffler(Transformation $shuffler)
setTitle(string $title="")
createMatchingDefinition(string $term='', string $picture='', int $identifier=0)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setLifecycle(ilAssQuestionLifecycle $lifecycle)
getCurrentSolutionResultSet(int $active_id, int $pass, bool $authorized=true)
saveToDb($original_id="")
Saves a assMatchingQuestion object to a database.
& getMatchingPairs()
Returns the matchingpairs array.
copyImages($question_id, $source_questionpool)
ILIAS DI LoggingServices $ilLog
lookupMaxStep(int $active_id, int $pass)
setAuthor(string $author="")
savePreviewData(ilAssQuestionPreviewSession $previewSession)
setAdditionalContentEditingMode(?string $additionalContentEditingMode)
isComplete()
Returns true, if a matching question is complete for use.
static getDraftInstance()
insertDefinition($position, assAnswerMatchingDefinition $definition=null)
Inserts a definition.
getThumbSize()
Get the thumbnail geometry.
setQuestion(string $question="")
const EmptyAnswerExpression