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.ilObjAnswerScoringAdjustable.php';
 
    8require_once 
'./Modules/TestQuestionPool/interfaces/interface.iQuestionCondition.php';
 
    9require_once 
'./Modules/TestQuestionPool/classes/class.ilUserQuestionResult.php';
 
   94        $this->matchingpairs = array();
 
   96        $this->terms = array();
 
   97        $this->definitions = array();
 
  107        if (strlen($this->title)
 
  110            && count($this->matchingpairs)
 
  141            "DELETE FROM qpl_a_mterm WHERE question_fi = %s",
 
  143            array( $this->
getId() )
 
  148            "DELETE FROM qpl_a_mdef WHERE question_fi = %s",
 
  150            array( $this->
getId() )
 
  155        foreach ($this->terms as 
$key => $term) {
 
  156            $next_id = 
$ilDB->nextId(
'qpl_a_mterm');
 
  157            $ilDB->insert(
'qpl_a_mterm', array(
 
  158                'term_id' => array(
'integer', $next_id),
 
  159                'question_fi' => array(
'integer', $this->
getId()),
 
  160                'picture' => array(
'text', $term->picture),
 
  161                'term' => array(
'text', $term->text),
 
  162                'ident' => array(
'integer', $term->identifier)
 
  164            $termids[$term->identifier] = $next_id;
 
  167        $definitionids = array();
 
  169        foreach ($this->definitions as 
$key => $definition) {
 
  170            $next_id = 
$ilDB->nextId(
'qpl_a_mdef');
 
  171            $ilDB->insert(
'qpl_a_mdef', array(
 
  172                'def_id' => array(
'integer', $next_id),
 
  173                'question_fi' => array(
'integer', $this->
getId()),
 
  174                'picture' => array(
'text', $definition->picture),
 
  175                'definition' => array(
'text', $definition->text),
 
  176                'ident' => array(
'integer', $definition->identifier)
 
  178            $definitionids[$definition->identifier] = $next_id;
 
  182            "DELETE FROM qpl_a_matching WHERE question_fi = %s",
 
  184            array( $this->
getId() )
 
  188            $next_id = 
$ilDB->nextId(
'qpl_a_matching');
 
  190                "INSERT INTO qpl_a_matching (answer_id, question_fi, points, term_fi, definition_fi) VALUES (%s, %s, %s, %s, %s)",
 
  191                array( 
'integer', 
'integer', 
'float', 
'integer', 
'integer' ),
 
  196                                    $termids[$pair->term->identifier],
 
  197                                    $definitionids[$pair->definition->identifier]
 
  214            array( $this->
getId() )
 
  218            'question_fi' => array(
'integer', $this->
getId()),
 
  219            'shuffle' => array(
'text', $this->shuffle),
 
  220            'matching_type' => array(
'text', $this->matching_type),
 
  237                        SELECT          qpl_questions.*, 
  238                                                {$this->getAdditionalTableName()}.* 
  240                        LEFT JOIN       {$this->getAdditionalTableName()} 
  241                        ON                      {$this->getAdditionalTableName()}.question_fi = qpl_questions.question_id 
  242                        WHERE           qpl_questions.question_id = %s 
  253            $this->
setId($question_id);
 
  262            include_once(
"./Services/RTE/classes/class.ilRTE.php");
 
  277            "SELECT * FROM qpl_a_mterm WHERE question_fi = %s ORDER BY term_id ASC",
 
  281        include_once 
"./Modules/TestQuestionPool/classes/class.assAnswerMatchingTerm.php";
 
  282        $this->terms = array();
 
  286                array_push($this->terms, $term);
 
  287                $termids[
$data[
'term_id']] = $term;
 
  291        $definitionids = array();
 
  293            "SELECT * FROM qpl_a_mdef WHERE question_fi = %s ORDER BY def_id ASC",
 
  297        include_once 
"./Modules/TestQuestionPool/classes/class.assAnswerMatchingDefinition.php";
 
  298        $this->definitions = array();
 
  302                array_push($this->definitions, $definition);
 
  303                $definitionids[
$data[
'def_id']] = $definition;
 
  307        $this->matchingpairs = array();
 
  309            "SELECT * FROM qpl_a_matching WHERE question_fi = %s ORDER BY answer_id",
 
  313        include_once 
"./Modules/TestQuestionPool/classes/class.assAnswerMatchingPair.php";
 
  319        parent::loadFromDb($question_id);
 
  328        if ($this->
id <= 0) {
 
  333        $this_id = $this->
getId();
 
  337        include_once(
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
 
  341        if ((
int) $testObjId > 0) {
 
  342            $clone->setObjId($testObjId);
 
  361        $clone->copyPageOfQuestion($this_id);
 
  363        $clone->copyXHTMLMediaObjectsOfQuestion($this_id);
 
  365        $clone->duplicateImages($this_id, $thisObjId, $clone->getId(), $testObjId);
 
  367        $clone->onDuplicate($thisObjId, $this_id, $clone->getObjId(), $clone->getId());
 
  377        if ($this->
id <= 0) {
 
  383        include_once(
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
 
  386        $source_questionpool_id = $this->
getObjId();
 
  387        $clone->setObjId($target_questionpool_id);
 
  397        $clone->copyImages(
$original_id, $source_questionpool_id);
 
  399        $clone->onCopy($source_questionpool_id, 
$original_id, $clone->getObjId(), $clone->getId());
 
  406        if ($this->
id <= 0) {
 
  411        include_once(
"./Modules/TestQuestionPool/classes/class.assQuestion.php");
 
  414        $sourceParentId = $this->
getObjId();
 
  420        $clone->setObjId($targetParentId);
 
  422        if ($targetQuestionTitle) {
 
  423            $clone->setTitle($targetQuestionTitle);
 
  428        $clone->copyPageOfQuestion($sourceQuestionId);
 
  430        $clone->copyXHTMLMediaObjectsOfQuestion($sourceQuestionId);
 
  432        $clone->copyImages($sourceQuestionId, $sourceParentId);
 
  434        $clone->onCopy($sourceParentId, $sourceQuestionId, $clone->getObjId(), $clone->getId());
 
  443        $imagepath_original = str_replace(
"/$this->id/images", 
"/$question_id/images", $imagepath);
 
  445        if ((
int) $objectId > 0) {
 
  446            $imagepath_original = str_replace(
"/$this->obj_id/", 
"/$objectId/", $imagepath_original);
 
  449        foreach ($this->terms as $term) {
 
  450            if (strlen($term->picture)) {
 
  452                if (!file_exists($imagepath)) {
 
  456                    $ilLog->write(
"matching question image could not be duplicated: $imagepath_original$filename");
 
  458                if (@file_exists($imagepath_original . $this->
getThumbPrefix() . $filename)) {
 
  460                        $ilLog->write(
"matching question image thumbnail could not be duplicated: $imagepath_original" . $this->
getThumbPrefix() . $filename);
 
  465        foreach ($this->definitions as $definition) {
 
  466            if (strlen($definition->picture)) {
 
  468                if (!file_exists($imagepath)) {
 
  472                    $ilLog->write(
"matching question image could not be duplicated: $imagepath_original$filename");
 
  474                if (@file_exists($imagepath_original . $this->
getThumbPrefix() . $filename)) {
 
  476                        $ilLog->write(
"matching question image thumbnail could not be duplicated: $imagepath_original" . $this->
getThumbPrefix() . $filename);
 
  483    public function copyImages($question_id, $source_questionpool)
 
  488        $imagepath_original = str_replace(
"/$this->id/images", 
"/$question_id/images", $imagepath);
 
  489        $imagepath_original = str_replace(
"/$this->obj_id/", 
"/$source_questionpool/", $imagepath_original);
 
  490        foreach ($this->terms as $term) {
 
  491            if (strlen($term->picture)) {
 
  492                if (!file_exists($imagepath)) {
 
  497                    $ilLog->write(
"matching question image could not be copied: $imagepath_original$filename");
 
  500                    $ilLog->write(
"matching question image thumbnail could not be copied: $imagepath_original" . $this->
getThumbPrefix() . $filename);
 
  504        foreach ($this->definitions as $definition) {
 
  505            if (strlen($definition->picture)) {
 
  507                if (!file_exists($imagepath)) {
 
  514                    $ilLog->write(
"matching question image could not be copied: $imagepath_original$filename");
 
  520                    $ilLog->write(
"matching question image thumbnail could not be copied: $imagepath_original" . $this->
getThumbPrefix() . $filename);
 
  538        include_once 
"./Modules/TestQuestionPool/classes/class.assAnswerMatchingPair.php";
 
  539        include_once 
"./Modules/TestQuestionPool/classes/class.assAnswerMatchingTerm.php";
 
  540        include_once 
"./Modules/TestQuestionPool/classes/class.assAnswerMatchingDefinition.php";
 
  541        if (is_null($term)) {
 
  544        if (is_null($definition)) {
 
  548        if ($position < count($this->matchingpairs)) {
 
  549            $part1 = array_slice($this->matchingpairs, 0, $position);
 
  550            $part2 = array_slice($this->matchingpairs, $position);
 
  551            $this->matchingpairs = array_merge($part1, array($pair), $part2);
 
  553            array_push($this->matchingpairs, $pair);
 
  570        require_once 
'./Modules/TestQuestionPool/classes/class.assAnswerMatchingPair.php';
 
  571        require_once 
'./Modules/TestQuestionPool/classes/class.assAnswerMatchingTerm.php';
 
  572        require_once 
'./Modules/TestQuestionPool/classes/class.assAnswerMatchingDefinition.php';
 
  573        if (is_null($term)) {
 
  576        if (is_null($definition)) {
 
  580        array_push($this->matchingpairs, $pair);
 
  588        foreach ($this->terms as $term) {
 
  589            if ($term->identifier == $a_identifier) {
 
  601        foreach ($this->definitions as $definition) {
 
  602            if ($definition->identifier == $a_identifier) {
 
  622        if (count($this->matchingpairs) < 1) {
 
  625        if (
$index >= count($this->matchingpairs)) {
 
  628        return $this->matchingpairs[
$index];
 
  643        if (count($this->matchingpairs) < 1) {
 
  646        if (
$index >= count($this->matchingpairs)) {
 
  649        unset($this->matchingpairs[
$index]);
 
  650        $this->matchingpairs = array_values($this->matchingpairs);
 
  659        $this->matchingpairs = array();
 
  670        return count($this->matchingpairs);
 
  703        return count($this->terms);
 
  714        return count($this->definitions);
 
  725        array_push($this->terms, $term);
 
  736        array_push($this->definitions, $definition);
 
  747        if (is_null($term)) {
 
  748            include_once 
"./Modules/TestQuestionPool/classes/class.assAnswerMatchingTerm.php";
 
  751        if ($position < count($this->terms)) {
 
  752            $part1 = array_slice($this->terms, 0, $position);
 
  753            $part2 = array_slice($this->terms, $position);
 
  754            $this->terms = array_merge($part1, array($term), $part2);
 
  756            array_push($this->terms, $term);
 
  768        if (is_null($definition)) {
 
  769            include_once 
"./Modules/TestQuestionPool/classes/class.assAnswerMatchingDefinition.php";
 
  772        if ($position < count($this->definitions)) {
 
  773            $part1 = array_slice($this->definitions, 0, $position);
 
  774            $part2 = array_slice($this->definitions, $position);
 
  775            $this->definitions = array_merge($part1, array($definition), $part2);
 
  777            array_push($this->definitions, $definition);
 
  787        $this->terms = array();
 
  796        $this->definitions = array();
 
  807        unset($this->terms[$position]);
 
  808        $this->terms = array_values($this->terms);
 
  819        unset($this->definitions[$position]);
 
  820        $this->definitions = array_values($this->definitions);
 
  832        $this->terms[
$index] = $term;
 
  847        if ($returndetails) {
 
  848            throw new ilTestException(
'return details not implemented for ' . __METHOD__);
 
  853        $found_values = array();
 
  854        if (is_null(
$pass)) {
 
  859            if (strcmp(
$data[
"value1"], 
"") != 0) {
 
  860                if (!isset($found_values[
$data[
'value2']])) {
 
  861                    $found_values[
$data[
'value2']] = array();
 
  864                $found_values[
$data[
'value2']][] = 
$data[
'value1'];
 
  900        $matchingPairs = array();
 
  902        foreach ($this->matchingpairs as $pair) {
 
  903            if ($pair->points <= 0) {
 
  907            $matchingPairs[] = $pair;
 
  910        return $matchingPairs;
 
  915        $matchingPairsByDefinition = array();
 
  917        foreach ($this->matchingpairs as $pair) {
 
  918            if ($pair->points <= 0) {
 
  922            $defId = $pair->definition->identifier;
 
  924            if (!isset($matchingPairsByDefinition[$defId])) {
 
  925                $matchingPairsByDefinition[$defId] = $pair;
 
  926            } elseif ($pair->points > $matchingPairsByDefinition[$defId]->points) {
 
  927                $matchingPairsByDefinition[$defId] = $pair;
 
  931        return $matchingPairsByDefinition;
 
  940        $indexedValues = array();
 
  942        foreach ($valuePairs as $valuePair) {
 
  943            if (!isset($indexedValues[$valuePair[
'value2']])) {
 
  944                $indexedValues[$valuePair[
'value2']] = array();
 
  947            $indexedValues[$valuePair[
'value2']][] = $valuePair[
'value1'];
 
  950        return $indexedValues;
 
  964        if (preg_match(
"/.*\\.(\\w+)$/", 
$filename, $matches)) {
 
  965            $extension = $matches[1];
 
  967        return md5(
$filename) . 
"." . $extension;
 
  972        $term = $this->terms[
$index];
 
  973        if (is_object($term)) {
 
  975            $term->picture = 
null;
 
  981        $definition = $this->definitions[
$index];
 
  982        if (is_object($definition)) {
 
  984            $definition->picture = 
null;
 
 1011    public function setImageFile($image_tempfilename, $image_filename, $previous_filename = 
'')
 
 1014        if (strlen($image_tempfilename)) {
 
 1015            $image_filename = str_replace(
" ", 
"_", $image_filename);
 
 1017            if (!file_exists($imagepath)) {
 
 1020            $savename = $image_filename;
 
 1021            if (!ilUtil::moveUploadedFile($image_tempfilename, $savename, $imagepath . $savename)) {
 
 1028            if (
$result && (strcmp($image_filename, $previous_filename) != 0) && (strlen($previous_filename))) {
 
 1039        $matchings = array();
 
 1042            if (isset(
$postData[$definition->identifier])) {
 
 1043                foreach ($this->
getTerms() as $term) {
 
 1044                    if (isset(
$postData[$definition->identifier][$term->identifier])) {
 
 1045                        if (!is_array(
$postData[$definition->identifier])) {
 
 1046                            $postData[$definition->identifier] = array();
 
 1049                        $matchings[$definition->identifier][] = $term->identifier;
 
 1064        $handledTerms = array();
 
 1066        foreach ($submittedMatchings as $definition => 
$terms) {
 
 1073                if (isset($handledTerms[$term])) {
 
 1078                $handledTerms[$term] = $term;
 
 1100        $matchingsExist = 
false;
 
 1102        if ($submittedMatchingsValid) {
 
 1103            if (is_null(
$pass)) {
 
 1104                include_once 
"./Modules/Test/classes/class.ilObjTest.php";
 
 1108            $this->
getProcessLocker()->executeUserSolutionUpdateLockOperation(
function () use (&$matchingsExist, $submittedMatchings, $active_id, 
$pass, $authorized) {
 
 1111                foreach ($submittedMatchings as $definition => 
$terms) {
 
 1114                        $matchingsExist = 
true;
 
 1119            $saveWorkingDataResult = 
true;
 
 1121            $saveWorkingDataResult = 
false;
 
 1124        include_once(
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 1126            if ($matchingsExist) {
 
 1133        return $saveWorkingDataResult;
 
 1155        mt_srand((
double) microtime()*1000000);
 
 1156        $random_number = mt_rand(1, 100000);
 
 1160            foreach ($this->matchingpairs as 
$key => $pair) {
 
 1161                if (($pair->term->identifier == $random_number) || ($pair->definition->identifier == $random_number)) {
 
 1167        return $random_number;
 
 1198        return "assMatchingQuestion";
 
 1208        return "qpl_qst_matching";
 
 1218        return array(
"qpl_a_matching", 
"qpl_a_mterm");
 
 1227        return parent::getRTETextWithMediaObjects();
 
 1243        parent::setExportDetailsXLS(
$worksheet, $startrow, $active_id, 
$pass);
 
 1249        foreach ($solutions as $solution) {
 
 1250            $matches_written = 
false;
 
 1252                if (!$matches_written) {
 
 1253                    $worksheet->setCell($startrow + 
$i, 1, $this->lng->txt(
"matches"));
 
 1255                $matches_written = 
true;
 
 1256                if ($pair->definition->identifier == $solution[
"value2"]) {
 
 1257                    if (strlen($pair->definition->text)) {
 
 1258                        $worksheet->setCell($startrow + 
$i, 0, $pair->definition->text);
 
 1260                        $worksheet->setCell($startrow + 
$i, 0, $pair->definition->picture);
 
 1263                if ($pair->term->identifier == $solution[
"value1"]) {
 
 1264                    if (strlen($pair->term->text)) {
 
 1265                        $worksheet->setCell($startrow + 
$i, 2, $pair->term->text);
 
 1267                        $worksheet->setCell($startrow + 
$i, 2, $pair->term->picture);
 
 1274        return $startrow + 
$i + 1;
 
 1304        $this->thumb_geometry = ($a_geometry < 1) ? 100 : $a_geometry;
 
 1312        foreach ($this->terms as $term) {
 
 1313            if (strlen($term->picture)) {
 
 1317        foreach ($this->definitions as $definition) {
 
 1318            if (strlen($definition->picture)) {
 
 1336            switch (strtoupper($path_info[
'extension'])) {
 
 1367            'onenotcorrect' => $this->
formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), 
false)),
 
 1368            'allcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), 
true))
 
 1371        require_once 
'Services/Randomization/classes/class.ilArrayElementShuffler.php';
 
 1380                "id" =>(
int) $this->getId() . $term->identifier
 
 1397                "id" => (
int) $this->getId() . 
$def->identifier
 
 1403        $matchings = array();
 
 1406            if ($pair->points <= 0) {
 
 1411            $pid = $pair->definition->identifier;
 
 1413                $pid .= 
'::' . $pair->term->identifier;
 
 1416            if (!isset($matchings[$pid]) || $matchings[$pid][
"points"] < $pair->points) {
 
 1417                $matchings[$pid] = array(
 
 1418                    "term_id" => (
int) $this->
getId() . $pair->term->identifier,
 
 1419                    "def_id" => (
int) $this->getId() . $pair->definition->identifier,
 
 1420                    "points" => (
int) $pair->points
 
 1425        $result[
'matchingPairs'] = array_values($matchings);
 
 1431        $lng->loadLanguageModule(
'assessment');
 
 1432        $result[
'reset_button_label'] = 
$lng->txt(
"reset_terms");
 
 1464        foreach ($found_values as $definition => 
$terms) {
 
 1465            foreach (
$terms as $term) {
 
 1466                foreach ($this->matchingpairs as $pair) {
 
 1467                    if ($pair->definition->identifier == $definition && $pair->term->identifier == $term) {
 
 1486        require_once 
"./Modules/TestQuestionPool/classes/class.ilOperatorsExpressionMapping.php";
 
 1518            "SELECT ident FROM qpl_a_mdef WHERE question_fi = %s ORDER BY def_id",
 
 1520            array($this->
getId())
 
 1530            "SELECT ident FROM qpl_a_mterm WHERE question_fi = %s ORDER BY term_id",
 
 1532            array($this->
getId())
 
 1541        $maxStep = $this->lookupMaxStep($active_id, 
$pass);
 
 1543        if ($maxStep !== 
null) {
 
 1545                "SELECT value1, value2 FROM tst_solutions WHERE active_fi = %s AND pass = %s AND question_fi = %s AND step = %s",
 
 1546                array(
"integer", 
"integer", 
"integer",
"integer"),
 
 1547                array($active_id, 
$pass, $this->
getId(), $maxStep)
 
 1551                "SELECT value1, value2 FROM tst_solutions WHERE active_fi = %s AND pass = %s AND question_fi = %s",
 
 1552                array(
"integer", 
"integer", 
"integer"),
 
 1557        while (
$row = $ilDB->fetchAssoc(
$data)) {
 
 1558            if (
$row[
"value1"] > 0) {
 
 1593        parent::afterSyncWithOriginal($origQuestionId, $dupQuestionId, $origParentObjId, $dupParentObjId);
 
 1595        $origImagePath = $this->
buildImagePath($origQuestionId, $origParentObjId);
 
 1596        $dupImagePath  = $this->
buildImagePath($dupQuestionId, $dupParentObjId);
 
 1599        if (is_dir($dupImagePath)) {
 
An exception for terminatinating execution or to throw for unit testing.
Class for matching question definitions.
Class for matching question pairs.
Class for matching question terms.
Class for matching questions.
supportsJavascriptOutput()
Returns true if the question type supports JavaScript output.
setThumbGeometry($a_geometry)
Set the thumbnail geometry.
deleteDefinition($position)
Deletes a definition.
getEncryptedFilename($filename)
Returns the encrypted save filename of a matching picture Images are saved with an encrypted filename...
reworkWorkingData($active_id, $pass, $obligationsAnswered, $authorized)
{Reworks the allready saved working data if neccessary.}
__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.
savePreviewData(ilAssQuestionPreviewSession $previewSession)
copyObject($target_questionpool_id, $title="")
Copies an assMatchingQuestion.
getMostPositiveScoredUniqueTermMatchingPairs()
toJSON()
Returns a JSON representation of the question TODO.
getOperators($expression)
Get all available operations for a specific question.
setExportDetailsXLS($worksheet, $startrow, $active_id, $pass)
{Creates an Excel worksheet for the detailed cumulated results of this question.object}
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.
createNewOriginalFromThisDuplicate($targetParentId, $targetQuestionTitle="")
duplicate($for_test=true, $title="", $author="", $owner="", $testObjId=null)
Duplicates an assMatchingQuestion.
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.
insertDefinition($position, $definition=null)
Inserts a definition.
& 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.
getPositiveScoredMatchingPairs()
duplicateImages($question_id, $objectId=null)
getTermCount()
Returns the number of terms.
getThumbGeometry()
Get the thumbnail geometry.
deleteTerm($position)
Deletes a term.
checkSubmittedMatchings($submittedMatchings)
getTerms()
Returns the terms of the matching question.
addMatchingPair($term=null, $definition=null, $points=0.0)
Adds an matching pair for an matching choice question.
flushDefinitions()
Deletes all definitions.
fetchIndexedValuesFromValuePairs(array $valuePairs)
loadFromDb($question_id)
Loads a assMatchingQuestion object from a database.
getAnswerTableName()
Returns the name of the answer table in the database.
getDefinitionWithIdentifier($a_identifier)
Returns a definition with a given identifier.
getAdditionalTableName()
Returns the name of the additional question data table in the database.
flushTerms()
Deletes all terms.
copyImages($question_id, $source_questionpool)
flushMatchingPairs()
Deletes all matching pairs.
saveToDb($original_id="")
Saves a assMatchingQuestion object to a database.
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)
Sets the shuffle flag.
getThumbSize()
Get the thumbnail geometry.
getTermWithIdentifier($a_identifier)
Returns a term with a given identifier.
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 ...
fetchSubmittedMatchingsFromPost()
addTerm($term)
Adds a term.
saveAnswerSpecificDataToDb()
Saves the answer specific records into a question types answer table.
afterSyncWithOriginal($origQuestionId, $dupQuestionId, $origParentObjId, $dupParentObjId)
{}
getExpressionTypes()
Get all available expression types for a specific question.
const MATCHING_MODE_1_ON_1
deleteImagefile($filename)
Deletes an imagefile from the system if the file is deleted manually.
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.
insertTerm($position, $term=null)
Inserts a term.
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.
getCurrentSolutionResultSet($active_id, $pass, $authorized=true)
Get a restulset for the current user solution for a this question by active_id and pass.
getSolutionValues($active_id, $pass=null, $authorized=true)
Loads solutions of a given user from the database an returns it.
static _getOriginalId($question_id)
Returns the original id of a question.
formatSAQuestion($a_q)
Format self assessment 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.
saveQuestionDataToDb($original_id="")
getId()
Gets the id of the assQuestion object.
saveCurrentSolution($active_id, $pass, $value1, $value2, $authorized=true, $tstamp=null)
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.
buildImagePath($questionId, $parentObjectId)
static logAction($logtext="", $active_id="", $question_id="")
Logs an action into the Test&Assessment log.
getImagePath($question_id=null, $object_id=null)
Returns the image path for web accessable images of a question.
removeCurrentSolution($active_id, $pass, $authorized=true)
setAuthor($author="")
Sets the authors name of the assQuestion object.
static isFileAvailable($file)
setShuffler(ilArrayElementShuffler $shuffler)
getTitle()
Gets the title string of the assQuestion object.
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)
getQuestion()
Gets the question string of the question object.
setAdditionalContentEditingMode($additinalContentEditingMode)
setter for additional content editing mode for this question
setQuestion($question="")
Sets the question string of the question object.
setParticipantsSolution($participantSolution)
static _getLogLanguage()
retrieve the log language for assessment logging
static _enabledAssessmentLogging()
check wether assessment logging is enabled or not
static _getPass($active_id)
Retrieves the actual pass of a given user for a given test.
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.
Class ilUserQuestionResult.
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static convertImage( $a_from, $a_to, $a_target_format="", $a_geometry="", $a_background_color="")
convert image
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static makeDirParents($a_dir)
Create a new directory and all parent directories.
const MT_TERMS_DEFINITIONS
Class iQuestionCondition.
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
Interface ilObjAnswerScoringAdjustable.
Interface ilObjQuestionScoringAdjustable.
if($session===NULL) $postData
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file