ILIAS  release_7 Revision v7.30-3-g800a261c036
assMatchingQuestion Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for assMatchingQuestion:
+ Collaboration diagram for assMatchingQuestion:

Public Member Functions

 __construct ( $title="", $comment="", $author="", $owner=-1, $question="", $matching_type=MT_TERMS_DEFINITIONS)
 assMatchingQuestion constructor More...
 
 isComplete ()
 Returns true, if a matching question is complete for use. More...
 
 saveToDb ($original_id="")
 Saves a assMatchingQuestion object to a database. More...
 
 saveAnswerSpecificDataToDb ()
 Saves the answer specific records into a question types answer table. More...
 
 saveAdditionalQuestionDataToDb ()
 Saves a record to the question types additional data table. More...
 
 loadFromDb ($question_id)
 Loads a assMatchingQuestion object from a database. More...
 
 duplicate ($for_test=true, $title="", $author="", $owner="", $testObjId=null)
 Duplicates an assMatchingQuestion. More...
 
 copyObject ($target_questionpool_id, $title="")
 Copies an assMatchingQuestion. More...
 
 createNewOriginalFromThisDuplicate ($targetParentId, $targetQuestionTitle="")
 
 duplicateImages ($question_id, $objectId=null)
 
 copyImages ($question_id, $source_questionpool)
 
 insertMatchingPair ($position, $term=null, $definition=null, $points=0.0)
 Inserts a matching pair for an matching choice question. More...
 
 addMatchingPair ($term=null, $definition=null, $points=0.0)
 Adds an matching pair for an matching choice question. More...
 
 getTermWithIdentifier ($a_identifier)
 Returns a term with a given identifier. More...
 
 getDefinitionWithIdentifier ($a_identifier)
 Returns a definition with a given identifier. More...
 
 getMatchingPair ($index=0)
 Returns a matching pair with a given index. More...
 
 deleteMatchingPair ($index=0)
 Deletes a matching pair with a given index. More...
 
 flushMatchingPairs ()
 Deletes all matching pairs. More...
 
 getMatchingPairCount ()
 Returns the number of matching pairs. More...
 
 getTerms ()
 Returns the terms of the matching question. More...
 
 getDefinitions ()
 Returns the definitions of the matching question. More...
 
 getTermCount ()
 Returns the number of terms. More...
 
 getDefinitionCount ()
 Returns the number of definitions. More...
 
 addTerm ($term)
 Adds a term. More...
 
 addDefinition ($definition)
 Adds a definition. More...
 
 insertTerm ($position, $term=null)
 Inserts a term. More...
 
 insertDefinition ($position, $definition=null)
 Inserts a definition. More...
 
 flushTerms ()
 Deletes all terms. More...
 
 flushDefinitions ()
 Deletes all definitions. More...
 
 deleteTerm ($position)
 Deletes a term. More...
 
 deleteDefinition ($position)
 Deletes a definition. More...
 
 setTerm ($term, $index)
 Sets a specific term. More...
 
 calculateReachedPoints ($active_id, $pass=null, $authorizedSolution=true, $returndetails=false)
 Returns the points, a learner has reached answering the question. More...
 
 getMaximumPoints ()
 Calculates and Returns the maximum points, a learner can reach answering the question. More...
 
 getMaximumScoringMatchingPairs ()
 
 fetchIndexedValuesFromValuePairs (array $valuePairs)
 
 getEncryptedFilename ($filename)
 Returns the encrypted save filename of a matching picture Images are saved with an encrypted filename to prevent users from cheating by guessing the solution from the image filename. More...
 
 removeTermImage ($index)
 
 removeDefinitionImage ($index)
 
 deleteImagefile ($filename)
 Deletes an imagefile from the system if the file is deleted manually. More...
 
 setImageFile ($image_tempfilename, $image_filename, $previous_filename='')
 Sets the image file and uploads the image to the object's image directory. More...
 
 saveWorkingData ($active_id, $pass=null, $authorized=true)
 Saves the learners input of the question to the database. More...
 
 getRandomId ()
 
 setShuffle ($shuffle=true)
 Sets the shuffle flag. More...
 
 getQuestionType ()
 Returns the question type of the question. More...
 
 getAdditionalTableName ()
 Returns the name of the additional question data table in the database. More...
 
 getAnswerTableName ()
 Returns the name of the answer table in the database. More...
 
 getRTETextWithMediaObjects ()
 Collects all text in the question which could contain media objects which were created with the Rich Text Editor. More...
 
getMatchingPairs ()
 Returns the matchingpairs array. More...
 
 setExportDetailsXLS ($worksheet, $startrow, $active_id, $pass)
 {} More...
 
 getThumbGeometry ()
 Get the thumbnail geometry. More...
 
 getThumbSize ()
 Get the thumbnail geometry. More...
 
 setThumbGeometry ($a_geometry)
 Set the thumbnail geometry. More...
 
 rebuildThumbnails ()
 Rebuild the thumbnail images with a new thumbnail size. More...
 
 getThumbPrefix ()
 
 toJSON ()
 Returns a JSON representation of the question TODO. More...
 
 supportsJavascriptOutput ()
 
 supportsNonJsOutput ()
 
 setMatchingMode ($matchingMode)
 
 getMatchingMode ()
 
 getOperators ($expression)
 Get all available operations for a specific question. More...
 
 getExpressionTypes ()
 Get all available expression types for a specific question. More...
 
 getAvailableAnswerOptions ($index=null)
 If index is null, the function returns an array with all anwser options Else it returns the specific answer option. More...
 
- Public Member Functions inherited from assQuestion
 getShuffler ()
 
 setShuffler (ilArrayElementShuffler $shuffler)
 
 setProcessLocker ($processLocker)
 
 getProcessLocker ()
 
 fromXML (&$item, &$questionpool_id, &$tst_id, &$tst_object, &$question_counter, &$import_mapping, array $solutionhints=[])
 Receives parameters from a QTI parser and creates a valid ILIAS question object. More...
 
 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. More...
 
 isComplete ()
 Returns true, if a question is complete for use. More...
 
 questionTitleExists ($questionpool_id, $title)
 Returns TRUE if the question title exists in the database. More...
 
 setTitle ($title="")
 Sets the title string of the assQuestion object. More...
 
 setId ($id=-1)
 Sets the id of the assQuestion object. More...
 
 setTestId ($id=-1)
 Sets the test id of the assQuestion object. More...
 
 setComment ($comment="")
 Sets the comment string of the assQuestion object. More...
 
 setOutputType ($outputType=OUTPUT_HTML)
 Sets the output type. More...
 
 setShuffle ($shuffle=true)
 Sets the shuffle flag. More...
 
 setEstimatedWorkingTime ($hour=0, $min=0, $sec=0)
 Sets the estimated working time of a question from given hour, minute and second. More...
 
 setEstimatedWorkingTimeFromDurationString ($durationString)
 Sets the estimated working time of a question from a given datetime string. More...
 
 keyInArray ($searchkey, $array)
 returns TRUE if the key occurs in an array More...
 
 setAuthor ($author="")
 Sets the authors name of the assQuestion object. More...
 
 setOwner ($owner="")
 Sets the creator/owner ID of the assQuestion object. More...
 
 getTitle ()
 Gets the title string of the assQuestion object. More...
 
 getTitleFilenameCompliant ()
 returns the object title prepared to be used as a filename More...
 
 getId ()
 Gets the id of the assQuestion object. More...
 
 getShuffle ()
 Gets the shuffle flag. More...
 
 getTestId ()
 Gets the test id of the assQuestion object. More...
 
 getComment ()
 Gets the comment string of the assQuestion object. More...
 
 getOutputType ()
 Gets the output type. More...
 
 getDescriptionForHTMLOutput ()
 
 supportsJavascriptOutput ()
 Returns true if the question type supports JavaScript output. More...
 
 supportsNonJsOutput ()
 
 requiresJsSwitch ()
 
 getEstimatedWorkingTime ()
 Gets the estimated working time of a question. More...
 
 getAuthor ()
 Gets the authors name of the assQuestion object. More...
 
 getAuthorForHTMLOutput ()
 
 getOwner ()
 Gets the creator/owner ID of the assQuestion object. More...
 
 getObjId ()
 Get the object id of the container object. More...
 
 setObjId ($obj_id=0)
 Set the object id of the container object. More...
 
 getLifecycle ()
 
 setLifecycle (ilAssQuestionLifecycle $lifecycle)
 
 setExternalId ($external_id)
 
 getExternalId ()
 
 getSuggestedSolutionOutput ()
 
_getSuggestedSolution ($question_id, $subquestion_index=0)
 Returns a suggested solution for a given subquestion index. More...
 
 getSuggestedSolutions ()
 Return the suggested solutions. More...
 
 getReachedPoints ($active_id, $pass=null)
 Returns the points, a learner has reached answering the question This is the fast way to get the points directly from the database. More...
 
 getMaximumPoints ()
 Returns the maximum points, a learner can reach answering the question. More...
 
 getAdjustedReachedPoints ($active_id, $pass=null, $authorizedSolution=true)
 returns the reached points ... More...
 
 calculateResultsFromSolution ($active_id, $pass=null, $obligationsEnabled=false)
 Calculates the question results from a previously saved question solution. More...
 
 persistWorkingState ($active_id, $pass=null, $obligationsEnabled=false, $authorized=true)
 persists the working state for current testactive and testpass More...
 
 persistPreviewState (ilAssQuestionPreviewSession $previewSession)
 persists the preview state for current user and question More...
 
 validateSolutionSubmit ()
 
 saveWorkingData ($active_id, $pass=null, $authorized=true)
 Saves the learners input of the question to the database. More...
 
 moveUploadedMediaFile ($file, $name)
 Move an uploaded media file to an public accessible temp dir to present it. More...
 
 getSuggestedSolutionPath ()
 Returns the path for a suggested solution. More...
 
 getJavaPath ()
 Returns the image path for web accessable images of a question. More...
 
 getImagePath ($question_id=null, $object_id=null)
 Returns the image path for web accessable images of a question. More...
 
 buildImagePath ($questionId, $parentObjectId)
 
 getFlashPath ()
 Returns the image path for web accessable flash files of a question. More...
 
 getJavaPathWeb ()
 Returns the web image path for web accessable java applets of a question. More...
 
 getSuggestedSolutionPathWeb ()
 Returns the web path for a suggested solution. More...
 
 getImagePathWeb ()
 Returns the web image path for web accessable images of a question. More...
 
 getFlashPathWeb ()
 Returns the web image path for web accessable flash applications of a question. More...
 
 getTestOutputSolutions ($activeId, $pass)
 
 getUserSolutionPreferingIntermediate ($active_id, $pass=null)
 
 getSolutionValues ($active_id, $pass=null, $authorized=true)
 Loads solutions of a given user from the database an returns it. More...
 
 isInUse ($question_id="")
 Checks whether the question is in use or not. More...
 
 isClone ($question_id="")
 Checks whether the question is a clone of another question or not. More...
 
 pcArrayShuffle ($array)
 Shuffles the values of a given array. More...
 
 getAdditionalTableName ()
 Returns the name of the additional question data table in the database. More...
 
 getAnswerTableName ()
 Returns the name of the answer table in the database. More...
 
 deleteAnswers ($question_id)
 Deletes datasets from answers tables. More...
 
 deleteAdditionalTableData ($question_id)
 Deletes datasets from the additional question table in the database. More...
 
 delete ($question_id)
 Deletes a question and all materials from the database. More...
 
 getTotalAnswers ()
 get total number of answers More...
 
 _getTotalAnswers ($a_q_id)
 get number of answers for question id (static) note: do not use $this inside this method More...
 
 copyXHTMLMediaObjectsOfQuestion ($a_q_id)
 
 syncXHTMLMediaObjectsOfQuestion ()
 
 createPageObject ()
 create page object of question More...
 
 copyPageOfQuestion ($a_q_id)
 
 getPageOfQuestion ()
 
 setOriginalId ($original_id)
 
 getOriginalId ()
 
 fixSvgToPng ($imageFilenameContainingString)
 
 fixUnavailableSkinImageSources ($html)
 
 loadFromDb ($question_id)
 Loads the question from the database. More...
 
 createNewQuestion ($a_create_page=true)
 Creates a new question without an owner when a new question is created This assures that an ID is given to the question if a file upload or something else occurs. More...
 
 saveQuestionDataToDb ($original_id="")
 
 saveToDb ($original_id="")
 Saves the question to the database. More...
 
 setNewOriginalId ($newId)
 
 deleteSuggestedSolutions ()
 Deletes all suggestes solutions in the database. More...
 
 getSuggestedSolution ($subquestion_index=0)
 Returns a suggested solution for a given subquestion index. More...
 
 getSuggestedSolutionTitle ($subquestion_index=0)
 Returns the title of a suggested solution at a given subquestion_index. More...
 
 setSuggestedSolution ($solution_id="", $subquestion_index=0, $is_import=false)
 Sets a suggested solution for the question. More...
 
 _resolveInternalLink ($internal_link)
 
 _resolveIntLinks ($question_id)
 
 syncWithOriginal ()
 
 _questionExists ($question_id)
 Returns true if the question already exists in the database. More...
 
 _questionExistsInPool ($question_id)
 Returns true if the question already exists in the database and is assigned to a question pool. More...
 
 getPoints ()
 Returns the maximum available points for the question. More...
 
 setPoints ($a_points)
 Sets the maximum available points for the question. More...
 
 getSolutionMaxPass ($active_id)
 Returns the maximum pass a users question solution. More...
 
 calculateReachedPoints ($active_id, $pass=null, $authorizedSolution=true, $returndetails=false)
 Returns the points, a learner has reached answering the question. More...
 
 deductHintPointsFromReachedPoints (ilAssQuestionPreviewSession $previewSession, $reachedPoints)
 
 calculateReachedPointsFromPreviewSession (ilAssQuestionPreviewSession $previewSession)
 
 isPreviewSolutionCorrect (ilAssQuestionPreviewSession $previewSession)
 
 adjustReachedPointsByScoringOptions ($points, $active_id, $pass=null)
 Adjust the given reached points by checks for all special scoring options in the test container. More...
 
 isHTML ($a_text)
 Checks if a given string contains HTML or not. More...
 
 prepareTextareaOutput ($txt_output, $prepare_for_latex_output=false, $omitNl2BrWhenTextArea=false)
 Prepares a string for a text area output in tests. More...
 
 QTIMaterialToString ($a_material)
 Reads an QTI material tag an creates a text string. More...
 
 addQTIMaterial (&$a_xml_writer, $a_material, $close_material_tag=true, $add_mobs=true)
 Creates a QTI material tag from a plain text or xhtml text. More...
 
 buildHashedImageFilename ($plain_image_filename, $unique=false)
 
 getQuestion ()
 Gets the question string of the question object. More...
 
 setQuestion ($question="")
 Sets the question string of the question object. More...
 
 getQuestionForHTMLOutput ()
 
 getQuestionType ()
 Returns the question type of the question. More...
 
 getQuestionTypeID ()
 Returns the question type of the question. More...
 
 cleanupMediaObjectUsage ()
 synchronises appearances of media objects in the question with media object usage table More...
 
getInstances ()
 Gets all instances of the question. More...
 
 getActiveUserData ($active_id)
 Returns the user id and the test id for a given active id. More...
 
 setExportDetailsXLS ($worksheet, $startrow, $active_id, $pass)
 Creates an Excel worksheet for the detailed cumulated results of this question. More...
 
 __get ($value)
 Object getter. More...
 
 __set ($key, $value)
 Object setter. More...
 
 getNrOfTries ()
 
 setNrOfTries ($a_nr_of_tries)
 
 setExportImagePath ($a_path)
 
 formatSAQuestion ($a_q)
 Format self assessment question. More...
 
 setPreventRteUsage ($a_val)
 Set prevent rte usage. More...
 
 getPreventRteUsage ()
 Get prevent rte usage. More...
 
 migrateContentForLearningModule (ilAssSelfAssessmentMigrator $migrator)
 
 setSelfAssessmentEditingMode ($a_selfassessmenteditingmode)
 Set Self-Assessment Editing Mode. More...
 
 getSelfAssessmentEditingMode ()
 Get Self-Assessment Editing Mode. More...
 
 setDefaultNrOfTries ($a_defaultnroftries)
 Set Default Nr of Tries. More...
 
 getDefaultNrOfTries ()
 Get Default Nr of Tries. More...
 
 syncSkillAssignments ($srcParentId, $srcQuestionId, $trgParentId, $trgQuestionId)
 
 isAnswered ($active_id, $pass=null)
 returns boolean wether the question is answered during test pass or not More...
 
 isAutosaveable ()
 
 getAdditionalContentEditingMode ()
 getter for additional content editing mode for this question More...
 
 setAdditionalContentEditingMode ($additinalContentEditingMode)
 setter for additional content editing mode for this question More...
 
 isAdditionalContentEditingModePageObject ()
 isser for additional "pageobject" content editing mode More...
 
 isValidAdditionalContentEditingMode ($additionalContentEditingMode)
 returns the fact wether the passed additional content mode is valid or not More...
 
 getValidAdditionalContentEditingModes ()
 getter for valid additional content editing modes More...
 
 addQuestionChangeListener (ilQuestionChangeListener $listener)
 
 getQuestionChangeListeners ()
 
 getHtmlUserSolutionPurifier ()
 
 getHtmlQuestionContentPurifier ()
 
 setLastChange ($lastChange)
 
 getLastChange ()
 
 removeIntermediateSolution ($active_id, $pass)
 
 removeCurrentSolution ($active_id, $pass, $authorized=true)
 
 saveCurrentSolution ($active_id, $pass, $value1, $value2, $authorized=true, $tstamp=null)
 
 updateCurrentSolution ($solutionId, $value1, $value2, $authorized=true)
 
 updateCurrentSolutionsAuthorization ($activeId, $pass, $authorized, $keepTime=false)
 
 setStep ($step)
 
 getStep ()
 
 toJSON ()
 
 duplicate ($for_test=true, $title="", $author="", $owner="", $testObjId=null)
 
 intermediateSolutionExists ($active_id, $pass)
 
 authorizedSolutionExists ($active_id, $pass)
 
 authorizedOrIntermediateSolutionExists ($active_id, $pass)
 
 isAddableAnswerOptionValue ($qIndex, $answerOptionValue)
 
 addAnswerOptionValue ($qIndex, $answerOptionValue, $points)
 
 removeAllExistingSolutions ()
 
 removeExistingSolutions ($activeId, $pass)
 
 resetUsersAnswer ($activeId, $pass)
 
 removeResultRecord ($activeId, $pass)
 
 fetchValuePairsFromIndexedValues (array $indexedValues)
 
 fetchIndexedValuesFromValuePairs (array $valuePairs)
 
 areObligationsToBeConsidered ()
 
 setObligationsToBeConsidered ($obligationsToBeConsidered)
 
 updateTimestamp ()
 
 getTestPresentationConfig ()
 Get the test question configuration (initialised once) More...
 
 savePartial ()
 
 isInActiveTest ()
 
- Public Member Functions inherited from iQuestionCondition
 getUserQuestionResult ($active_id, $pass)
 Get the user solution for a question by active_id and the test pass. More...
 

Data Fields

 $matchingpairs
 
 $matching_type
 
 $thumb_geometry = 100
 
 $element_height
 
const MATCHING_MODE_1_ON_1 = '1:1'
 
const MATCHING_MODE_N_ON_N = 'n:n'
 
- Data Fields inherited from assQuestion
const IMG_MIME_TYPE_JPG = 'image/jpeg'
 
const IMG_MIME_TYPE_PNG = 'image/png'
 
const IMG_MIME_TYPE_GIF = 'image/gif'
 
const ADDITIONAL_CONTENT_EDITING_MODE_RTE = 'default'
 constant for additional content editing mode "default" More...
 
const ADDITIONAL_CONTENT_EDITING_MODE_IPE = 'pageobject'
 constant for additional content editing mode "pageobject" More...
 
 $feedbackOBJ = null
 
 $prevent_rte_usage = false
 
 $selfassessmenteditingmode = false
 
 $defaultnroftries = 0
 
 $questionActionCmd = 'handleQuestionAction'
 
const KEY_VALUES_IMPLOSION_SEPARATOR = ':'
 
- Data Fields inherited from iQuestionCondition
const StringResultExpression = '~TEXT~'
 
const PercentageResultExpression = '%n%'
 
const NumericResultExpression = '#n#'
 
const MatchingResultExpression = ';n:m;'
 
const OrderingResultExpression = '$n,m,o,p$'
 
const NumberOfResultExpression = '+n+'
 
const ExclusiveResultExpression = '*n,m,o,p*'
 
const EmptyAnswerExpression = "?"
 

Protected Member Functions

 savePreviewData (ilAssQuestionPreviewSession $previewSession)
 
 generateThumbForFile ($path, $file)
 
 calculateReachedPointsForSolution ($found_values)
 
 afterSyncWithOriginal ($origQuestionId, $dupQuestionId, $origParentObjId, $dupParentObjId)
 {} More...
 
- Protected Member Functions inherited from assQuestion
 getQuestionAction ()
 
 isNonEmptyItemListPostSubmission ($postSubmissionFieldname)
 
 ensureCurrentTestPass ($active_id, $pass)
 
 lookupCurrentTestPass ($active_id, $pass)
 
 lookupTestId ($active_id)
 
 log ($active_id, $langVar)
 
 savePreviewData (ilAssQuestionPreviewSession $previewSession)
 
 deletePageOfQuestion ($question_id)
 Deletes the page object of a question with a given ID. More...
 
 onDuplicate ($originalParentId, $originalQuestionId, $duplicateParentId, $duplicateQuestionId)
 Will be called when a question is duplicated (inside a question pool or for insertion in a test) More...
 
 beforeSyncWithOriginal ($origQuestionId, $dupQuestionId, $origParentObjId, $dupParentObjId)
 
 afterSyncWithOriginal ($origQuestionId, $dupQuestionId, $origParentObjId, $dupParentObjId)
 
 onCopy ($sourceParentId, $sourceQuestionId, $targetParentId, $targetQuestionId)
 Will be called when a question is copied (into another question pool) More...
 
 duplicateSuggestedSolutionFiles ($parent_id, $question_id)
 Duplicates the files of a suggested solution if the question is duplicated. More...
 
 syncSuggestedSolutionFiles ($original_id)
 Syncs the files of a suggested solution if the question is synced. More...
 
 copySuggestedSolutionFiles ($source_questionpool_id, $source_question_id)
 
 ensureNonNegativePoints ($points)
 
 purifyAndPrepareTextAreaOutput (string $content)
 
 getRTETextWithMediaObjects ()
 Collects all text in the question which could contain media objects which were created with the Rich Text Editor. More...
 
 getSelfAssessmentFormatter ()
 
 lmMigrateQuestionTypeGenericContent (ilAssSelfAssessmentMigrator $migrator)
 
 lmMigrateQuestionTypeSpecificContent (ilAssSelfAssessmentMigrator $migrator)
 
 duplicateQuestionHints ($originalQuestionId, $duplicateQuestionId)
 
 duplicateSkillAssignments ($srcParentId, $srcQuestionId, $trgParentId, $trgQuestionId)
 
 buildQuestionDataQuery ()
 
 getCurrentSolutionResultSet ($active_id, $pass, $authorized=true)
 Get a restulset for the current user solution for a this question by active_id and pass. More...
 
 removeSolutionRecordById ($solutionId)
 
 getSolutionRecordById ($solutionId)
 
 deleteDummySolutionRecord ($activeId, $passIndex)
 
 isDummySolutionRecord ($solutionRecord)
 
 deleteSolutionRecordByValues ($activeId, $passIndex, $authorized, $matchValues)
 
 duplicateIntermediateSolutionAuthorized ($activeId, $passIndex)
 
 forceExistingIntermediateSolution ($activeId, $passIndex, $considerDummyRecordCreation)
 
 buildTestPresentationConfig ()
 build basic test question configuration instance More...
 

Protected Attributes

 $terms
 
 $definitions
 
 $matchingMode = self::MATCHING_MODE_1_ON_1
 
- Protected Attributes inherited from assQuestion
 $id
 
 $title
 
 $comment
 
 $owner
 
 $author
 
 $question
 
 $points
 
 $est_working_time
 
 $shuffle
 
 $test_id
 
 $obj_id
 
 $ilias
 
 $tpl
 
 $lng
 
 $db
 
 $refinery
 
 $outputType = OUTPUT_JAVASCRIPT
 
 $suggested_solutions
 
 $original_id
 
 $page
 
 $external_id = ''
 
 $questionChangeListeners = array()
 
 $processLocker
 
 $step = null
 
 $lastChange
 
 $shuffler
 
 $testQuestionConfig
 
 $lifecycle
 

Private Member Functions

 getPositiveScoredMatchingPairs ()
 
 getMostPositiveScoredUniqueTermMatchingPairs ()
 
 fetchSubmittedMatchingsFromPost ()
 
 checkSubmittedMatchings ($submittedMatchings)
 

Additional Inherited Members

- Static Public Member Functions inherited from assQuestion
static setForcePassResultUpdateEnabled ($forcePassResultsUpdateEnabled)
 
static isForcePassResultUpdateEnabled ()
 
static isAllowedImageMimeType ($mimeType)
 
static fetchMimeTypeIdentifier ($contentTypeString)
 
static getAllowedFileExtensionsForMimeType ($mimeType)
 
static isAllowedImageFileExtension ($mimeType, $fileExtension)
 
static getAllowedImageMaterialFileExtensions ()
 
static _getMaximumPoints ($question_id)
 Returns the maximum points, a learner can reach answering the question. More...
 
static _getQuestionInfo ($question_id)
 Returns question information from the database. More...
 
static _getSuggestedSolutionCount ($question_id)
 Returns the number of suggested solutions associated with a question. More...
 
static _getSuggestedSolutionOutput ($question_id)
 Returns the output of the suggested solution. More...
 
static _getReachedPoints ($active_id, $question_id, $pass=null)
 Returns the points, a learner has reached answering the question. More...
 
static _updateTestResultCache ($active_id, ilAssQuestionProcessLocker $processLocker=null)
 Move this to a proper place. More...
 
static logAction ($logtext="", $active_id="", $question_id="")
 Logs an action into the Test&Assessment log. More...
 
static getQuestionTypeFromDb ($question_id)
 get question type for question id More...
 
static _getTotalRightAnswers ($a_q_id)
 get number of answers for question id (static) note: do not use $this inside this method More...
 
static _getTitle ($a_q_id)
 Returns the title of a question. More...
 
static _getQuestionText ($a_q_id)
 Returns question text. More...
 
static isFileAvailable ($file)
 
static _getQuestionType ($question_id)
 Returns the question type of a question with a given id. More...
 
static _getQuestionTitle ($question_id)
 Returns the question title of a question with a given id. More...
 
static saveOriginalId ($questionId, $originalId)
 
static resetOriginalId ($questionId)
 
static _getInternalLinkHref ($target="")
 
static _getOriginalId ($question_id)
 Returns the original id of a question. More...
 
static originalQuestionExists ($questionId)
 
static _instanciateQuestion ($question_id)
 Creates an instance of a question with a given question id. More...
 
static _instantiateQuestion ($question_id)
 
static _getSolutionMaxPass ($question_id, $active_id)
 Returns the maximum pass a users question solution. More...
 
static _isWriteable ($question_id, $user_id)
 Returns true if the question is writeable by a certain user. More...
 
static _isUsedInRandomTest ($question_id="")
 Checks whether the question is used in a random test or not. More...
 
static _isWorkedThrough ($active_id, $question_id, $pass=null)
 Returns true if the question was worked through in the given pass Worked through means that the user entered at least one value. More...
 
static _areAnswered ($a_user_id, $a_question_ids)
 Checks if an array of question ids is answered by an user or not. More...
 
static _setReachedPoints ($active_id, $question_id, $points, $maxpoints, $pass, $manualscoring, $obligationsEnabled)
 Sets the points, a learner has reached answering the question Additionally objective results are updated. More...
 
static _needsManualScoring ($question_id)
 
static _includeClass ($question_type, $gui=0)
 Include the php class file for a given question type. More...
 
static getGuiClassNameByQuestionType ($questionType)
 
static getObjectClassNameByQuestionType ($questionType)
 
static getFeedbackClassNameByQuestionType ($questionType)
 
static isCoreQuestionType ($questionType)
 
static includeCoreClass ($questionType, $withGuiClass)
 
static includePluginClass ($questionType, $withGuiClass)
 
static _getQuestionTypeName ($type_tag)
 Return the translation for a given question type tag. More...
 
static & _instanciateQuestionGUI ($question_id)
 Creates an instance of a question gui with a given question id. More...
 
static instantiateQuestionGUI ($a_question_id)
 Creates an instance of a question gui with a given question id. More...
 
static _questionExistsInTest ($question_id, $test_id)
 
static lookupParentObjId ($questionId)
 ilDBInterface $ilDB More...
 
static lookupOriginalParentObjId ($originalQuestionId)
 returns the parent object id for given original question id (should be a qpl id, but theoretically it can be a tst id, too) More...
 
static isObligationPossible ($questionId)
 returns boolean wether it is possible to set this question type as obligatory or not considering the current question configuration More...
 
static implodeKeyValues ($keyValues)
 
static explodeKeyValues ($keyValues)
 
static setResultGateway ($resultGateway)
 
static getResultGateway ()
 
static sumTimesInISO8601FormatH_i_s_Extended ($time1, $time2)
 
static convertISO8601FormatH_i_s_ExtendedToSeconds ($time)
 
static missingResultRecordExists ($activeId, $pass, $questionIds)
 
static getQuestionsMissingResultRecord ($activeId, $pass, $questionIds)
 
static lookupResultRecordExist ($activeId, $questionId, $pass)
 
- Static Protected Member Functions inherited from assQuestion
static getNumExistingSolutionRecords ($activeId, $pass, $questionId)
 returns the number of existing solution records for the given test active / pass and given question id More...
 
static getKeyValuesImplosionSeparator ()
 
- Static Protected Attributes inherited from assQuestion
static $allowedFileExtensionsByMimeType
 
static $allowedCharsetsByMimeType
 
static $allowedImageMaterialFileExtensionsByMimeType
 
static $forcePassResultsUpdateEnabled = false
 
static $imageSourceFixReplaceMap
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class for matching questions

assMatchingQuestion is a class for matching questions.

Author
Helmut Schottmüller helmu.nosp@m.t.sc.nosp@m.hottm.nosp@m.uell.nosp@m.er@ma.nosp@m.c.co.nosp@m.m
Björn Heyser bheys.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
Maximilian Becker mbeck.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

Definition at line 37 of file class.assMatchingQuestion.php.

Constructor & Destructor Documentation

◆ __construct()

assMatchingQuestion::__construct (   $title = "",
  $comment = "",
  $author = "",
  $owner = -1,
  $question = "",
  $matching_type = MT_TERMS_DEFINITIONS 
)

assMatchingQuestion constructor

The constructor takes possible arguments an creates an instance of the assMatchingQuestion object.

Parameters
string$titleA title string to describe the question
string$commentA comment string to describe the question
string$authorA string containing the name of the questions author
integer$ownerA numerical ID to identify the owner/creator
string$questionThe question string of the matching question
int$matching_type
Returns

Definition at line 98 of file class.assMatchingQuestion.php.

References assQuestion\$author, assQuestion\$comment, $matching_type, assQuestion\$owner, assQuestion\$question, assQuestion\$title, and ILIAS\GlobalScreen\Provider\__construct().

105  {
107  $this->matchingpairs = array();
108  $this->matching_type = $matching_type;
109  $this->terms = array();
110  $this->definitions = array();
111  }
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ addDefinition()

assMatchingQuestion::addDefinition (   $definition)

Adds a definition.

Parameters
object$definitionThe definition
See also
$definitions

Definition at line 759 of file class.assMatchingQuestion.php.

760  {
761  array_push($this->definitions, $definition);
762  }

◆ addMatchingPair()

assMatchingQuestion::addMatchingPair (   $term = null,
  $definition = null,
  $points = 0.0 
)

Adds an matching pair for an matching choice question.

The students have to fill in an order for the matching pair. The matching pair is an ASS_AnswerMatching object that will be created and assigned to the array $this->matchingpairs.

Parameters
assAnswerMatchingTerm | null$termA matching term
assAnswerMatchingDefinition | null$definitionA matching definition
float$pointsThe points for selecting the matching pair, incl. negative.
See also
$matchingpairs

Definition at line 593 of file class.assMatchingQuestion.php.

References assQuestion\$points.

594  {
595  require_once './Modules/TestQuestionPool/classes/class.assAnswerMatchingPair.php';
596  require_once './Modules/TestQuestionPool/classes/class.assAnswerMatchingTerm.php';
597  require_once './Modules/TestQuestionPool/classes/class.assAnswerMatchingDefinition.php';
598  if (is_null($term)) {
599  $term = new assAnswerMatchingTerm();
600  }
601  if (is_null($definition)) {
602  $definition = new assAnswerMatchingDefinition();
603  }
604  $pair = new assAnswerMatchingPair($term, $definition, $points);
605  array_push($this->matchingpairs, $pair);
606  }
Class for matching question terms.
Class for matching question pairs.
Class for matching question definitions.

◆ addTerm()

assMatchingQuestion::addTerm (   $term)

Adds a term.

Parameters
string$termThe text of the term
See also
$terms

Definition at line 748 of file class.assMatchingQuestion.php.

749  {
750  array_push($this->terms, $term);
751  }

◆ afterSyncWithOriginal()

assMatchingQuestion::afterSyncWithOriginal (   $origQuestionId,
  $dupQuestionId,
  $origParentObjId,
  $dupParentObjId 
)
protected

{}

Definition at line 1612 of file class.assMatchingQuestion.php.

References assQuestion\buildImagePath(), ilUtil\delDir(), ilUtil\makeDirParents(), and ilUtil\rCopy().

1613  {
1614  parent::afterSyncWithOriginal($origQuestionId, $dupQuestionId, $origParentObjId, $dupParentObjId);
1615 
1616  $origImagePath = $this->buildImagePath($origQuestionId, $origParentObjId);
1617  $dupImagePath = $this->buildImagePath($dupQuestionId, $dupParentObjId);
1618 
1619  ilUtil::delDir($origImagePath);
1620  if (is_dir($dupImagePath)) {
1621  ilUtil::makeDirParents($origImagePath);
1622  ilUtil::rCopy($dupImagePath, $origImagePath);
1623  }
1624  }
static makeDirParents($a_dir)
Create a new directory and all parent directories.
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
buildImagePath($questionId, $parentObjectId)
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
+ Here is the call graph for this function:

◆ calculateReachedPoints()

assMatchingQuestion::calculateReachedPoints (   $active_id,
  $pass = null,
  $authorizedSolution = true,
  $returndetails = false 
)

Returns the points, a learner has reached answering the question.

The points are calculated from the given answers.

public

Parameters
integer$active_id
integer$pass
boolean$returndetails(deprecated !!)
Returns
integer/array $points/$details (array $details is deprecated !!)

Definition at line 870 of file class.assMatchingQuestion.php.

References $data, $DIC, $ilDB, $pass, assQuestion\$points, $result, calculateReachedPointsForSolution(), assQuestion\getCurrentSolutionResultSet(), and assQuestion\getSolutionMaxPass().

Referenced by getExpressionTypes().

871  {
872  if ($returndetails) {
873  throw new ilTestException('return details not implemented for ' . __METHOD__);
874  }
875 
876  global $DIC;
877  $ilDB = $DIC['ilDB'];
878 
879  $found_values = array();
880  if (is_null($pass)) {
881  $pass = $this->getSolutionMaxPass($active_id);
882  }
883  $result = $this->getCurrentSolutionResultSet($active_id, $pass, $authorizedSolution);
884  while ($data = $ilDB->fetchAssoc($result)) {
885  if (strcmp($data["value1"], "") != 0) {
886  if (!isset($found_values[$data['value2']])) {
887  $found_values[$data['value2']] = array();
888  }
889 
890  $found_values[$data['value2']][] = $data['value1'];
891  }
892  }
893 
894  $points = $this->calculateReachedPointsForSolution($found_values);
895 
896  return $points;
897  }
$data
Definition: storeScorm.php:23
$result
getSolutionMaxPass($active_id)
Returns the maximum pass a users question solution.
calculateReachedPointsForSolution($found_values)
Base Exception for all Exceptions relating to Modules/Test.
global $DIC
Definition: goto.php:24
global $ilDB
getCurrentSolutionResultSet($active_id, $pass, $authorized=true)
Get a restulset for the current user solution for a this question by active_id and pass...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calculateReachedPointsForSolution()

assMatchingQuestion::calculateReachedPointsForSolution (   $found_values)
protected
Parameters
$found_values
Returns
int

Definition at line 1481 of file class.assMatchingQuestion.php.

References assQuestion\$points, and $terms.

Referenced by calculateReachedPoints().

1482  {
1483  $points = 0;
1484  foreach ($found_values as $definition => $terms) {
1485  foreach ($terms as $term) {
1486  foreach ($this->matchingpairs as $pair) {
1487  if ($pair->definition->identifier == $definition && $pair->term->identifier == $term) {
1488  $points += $pair->points;
1489  }
1490  }
1491  }
1492  }
1493  return $points;
1494  }
+ Here is the caller graph for this function:

◆ checkSubmittedMatchings()

assMatchingQuestion::checkSubmittedMatchings (   $submittedMatchings)
private

Definition at line 1084 of file class.assMatchingQuestion.php.

References $i, $terms, getMatchingMode(), and ilUtil\sendFailure().

Referenced by savePreviewData(), and saveWorkingData().

1085  {
1086  if ($this->getMatchingMode() == self::MATCHING_MODE_N_ON_N) {
1087  return true;
1088  }
1089 
1090  $handledTerms = array();
1091 
1092  foreach ($submittedMatchings as $definition => $terms) {
1093  if (count($terms) > 1) {
1094  ilUtil::sendFailure($this->lng->txt("multiple_matching_values_selected"), true);
1095  return false;
1096  }
1097 
1098  foreach ($terms as $i => $term) {
1099  if (isset($handledTerms[$term])) {
1100  ilUtil::sendFailure($this->lng->txt("duplicate_matching_values_selected"), true);
1101  return false;
1102  }
1103 
1104  $handledTerms[$term] = $term;
1105  }
1106  }
1107 
1108  return true;
1109  }
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$i
Definition: metadata.php:24
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copyImages()

assMatchingQuestion::copyImages (   $question_id,
  $source_questionpool 
)

Definition at line 507 of file class.assMatchingQuestion.php.

References $DIC, $filename, assQuestion\getImagePath(), getThumbPrefix(), assQuestion\isFileAvailable(), and ilUtil\makeDirParents().

508  {
509  global $DIC;
510  $ilLog = $DIC['ilLog'];
511 
512  $imagepath = $this->getImagePath();
513  $imagepath_original = str_replace("/$this->id/images", "/$question_id/images", $imagepath);
514  $imagepath_original = str_replace("/$this->obj_id/", "/$source_questionpool/", $imagepath_original);
515  foreach ($this->terms as $term) {
516  if (strlen($term->picture)) {
517  if (!file_exists($imagepath)) {
518  ilUtil::makeDirParents($imagepath);
519  }
520  $filename = $term->picture;
521  if (!@copy($imagepath_original . $filename, $imagepath . $filename)) {
522  $ilLog->write("matching question image could not be copied: $imagepath_original$filename");
523  }
524  if (!@copy($imagepath_original . $this->getThumbPrefix() . $filename, $imagepath . $this->getThumbPrefix() . $filename)) {
525  $ilLog->write("matching question image thumbnail could not be copied: $imagepath_original" . $this->getThumbPrefix() . $filename);
526  }
527  }
528  }
529  foreach ($this->definitions as $definition) {
530  if (strlen($definition->picture)) {
531  $filename = $definition->picture;
532  if (!file_exists($imagepath)) {
533  ilUtil::makeDirParents($imagepath);
534  }
535 
536  if (assQuestion::isFileAvailable($imagepath_original . $filename)) {
537  copy($imagepath_original . $filename, $imagepath . $filename);
538  } else {
539  $ilLog->write("matching question image could not be copied: $imagepath_original$filename");
540  }
541 
542  if (assQuestion::isFileAvailable($imagepath_original . $this->getThumbPrefix() . $filename)) {
543  copy($imagepath_original . $this->getThumbPrefix() . $filename, $imagepath . $this->getThumbPrefix() . $filename);
544  } else {
545  $ilLog->write("matching question image thumbnail could not be copied: $imagepath_original" . $this->getThumbPrefix() . $filename);
546  }
547  }
548  }
549  }
static makeDirParents($a_dir)
Create a new directory and all parent directories.
static isFileAvailable($file)
getImagePath($question_id=null, $object_id=null)
Returns the image path for web accessable images of a question.
global $DIC
Definition: goto.php:24
$filename
Definition: buildRTE.php:89
+ Here is the call graph for this function:

◆ copyObject()

assMatchingQuestion::copyObject (   $target_questionpool_id,
  $title = "" 
)

Copies an assMatchingQuestion.

Definition at line 398 of file class.assMatchingQuestion.php.

References assQuestion\$original_id, assQuestion\$title, assQuestion\_getOriginalId(), and assQuestion\getObjId().

399  {
400  if ($this->id <= 0) {
401  // The question has not been saved. It cannot be duplicated
402  return;
403  }
404  // duplicate the question in database
405  $clone = $this;
406  include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
408  $clone->id = -1;
409  $source_questionpool_id = $this->getObjId();
410  $clone->setObjId($target_questionpool_id);
411  if ($title) {
412  $clone->setTitle($title);
413  }
414  $clone->saveToDb();
415  // copy question page content
416  $clone->copyPageOfQuestion($original_id);
417  // copy XHTML media objects
418  $clone->copyXHTMLMediaObjectsOfQuestion($original_id);
419  // duplicate the image
420  $clone->copyImages($original_id, $source_questionpool_id);
421 
422  $clone->onCopy($source_questionpool_id, $original_id, $clone->getObjId(), $clone->getId());
423 
424  return $clone->id;
425  }
static _getOriginalId($question_id)
Returns the original id of a question.
getObjId()
Get the object id of the container object.
+ Here is the call graph for this function:

◆ createNewOriginalFromThisDuplicate()

assMatchingQuestion::createNewOriginalFromThisDuplicate (   $targetParentId,
  $targetQuestionTitle = "" 
)

Definition at line 427 of file class.assMatchingQuestion.php.

References assQuestion\$id, and assQuestion\getObjId().

428  {
429  if ($this->id <= 0) {
430  // The question has not been saved. It cannot be duplicated
431  return;
432  }
433 
434  include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
435 
436  $sourceQuestionId = $this->id;
437  $sourceParentId = $this->getObjId();
438 
439  // duplicate the question in database
440  $clone = $this;
441  $clone->id = -1;
442 
443  $clone->setObjId($targetParentId);
444 
445  if ($targetQuestionTitle) {
446  $clone->setTitle($targetQuestionTitle);
447  }
448 
449  $clone->saveToDb();
450  // copy question page content
451  $clone->copyPageOfQuestion($sourceQuestionId);
452  // copy XHTML media objects
453  $clone->copyXHTMLMediaObjectsOfQuestion($sourceQuestionId);
454  // duplicate the image
455  $clone->copyImages($sourceQuestionId, $sourceParentId);
456 
457  $clone->onCopy($sourceParentId, $sourceQuestionId, $clone->getObjId(), $clone->getId());
458 
459  return $clone->id;
460  }
getObjId()
Get the object id of the container object.
+ Here is the call graph for this function:

◆ deleteDefinition()

assMatchingQuestion::deleteDefinition (   $position)

Deletes a definition.

Parameters
integer$positionThe position of the definition in the definition array
See also
$definitions

Definition at line 842 of file class.assMatchingQuestion.php.

843  {
844  unset($this->definitions[$position]);
845  $this->definitions = array_values($this->definitions);
846  }

◆ deleteImagefile()

assMatchingQuestion::deleteImagefile (   $filename)

Deletes an imagefile from the system if the file is deleted manually.

Parameters
string$filenameImage file filename
Returns
boolean Success

Definition at line 1021 of file class.assMatchingQuestion.php.

References $filename, $result, assQuestion\getImagePath(), and getThumbPrefix().

Referenced by removeDefinitionImage(), removeTermImage(), and setImageFile().

1022  {
1023  $deletename = $filename;
1024  $result = @unlink($this->getImagePath() . $deletename);
1025  $result = $result & @unlink($this->getImagePath() . $this->getThumbPrefix() . $deletename);
1026  return $result;
1027  }
$result
getImagePath($question_id=null, $object_id=null)
Returns the image path for web accessable images of a question.
$filename
Definition: buildRTE.php:89
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteMatchingPair()

assMatchingQuestion::deleteMatchingPair (   $index = 0)

Deletes a matching pair with a given index.

The index of the first matching pair is 0, the index of the second matching pair is 1 and so on.

Parameters
integer$indexA nonnegative index of the n-th matching pair
See also
$matchingpairs

Definition at line 663 of file class.assMatchingQuestion.php.

References $index.

664  {
665  if ($index < 0) {
666  return;
667  }
668  if (count($this->matchingpairs) < 1) {
669  return;
670  }
671  if ($index >= count($this->matchingpairs)) {
672  return;
673  }
674  unset($this->matchingpairs[$index]);
675  $this->matchingpairs = array_values($this->matchingpairs);
676  }
$index
Definition: metadata.php:128

◆ deleteTerm()

assMatchingQuestion::deleteTerm (   $position)

Deletes a term.

Parameters
string$term_idThe id of the term to delete
See also
$terms

Definition at line 830 of file class.assMatchingQuestion.php.

831  {
832  unset($this->terms[$position]);
833  $this->terms = array_values($this->terms);
834  }

◆ duplicate()

assMatchingQuestion::duplicate (   $for_test = true,
  $title = "",
  $author = "",
  $owner = "",
  $testObjId = null 
)

Duplicates an assMatchingQuestion.

Definition at line 349 of file class.assMatchingQuestion.php.

References assQuestion\$author, assQuestion\$original_id, assQuestion\$owner, assQuestion\$title, assQuestion\_getOriginalId(), assQuestion\getId(), and assQuestion\getObjId().

350  {
351  if ($this->id <= 0) {
352  // The question has not been saved. It cannot be duplicated
353  return;
354  }
355  // duplicate the question in database
356  $this_id = $this->getId();
357  $thisObjId = $this->getObjId();
358 
359  $clone = $this;
360  include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
362  $clone->id = -1;
363 
364  if ((int) $testObjId > 0) {
365  $clone->setObjId($testObjId);
366  }
367 
368  if ($title) {
369  $clone->setTitle($title);
370  }
371  if ($author) {
372  $clone->setAuthor($author);
373  }
374  if ($owner) {
375  $clone->setOwner($owner);
376  }
377  if ($for_test) {
378  $clone->saveToDb($original_id);
379  } else {
380  $clone->saveToDb();
381  }
382 
383  // copy question page content
384  $clone->copyPageOfQuestion($this_id);
385  // copy XHTML media objects
386  $clone->copyXHTMLMediaObjectsOfQuestion($this_id);
387  // duplicate the image
388  $clone->duplicateImages($this_id, $thisObjId, $clone->getId(), $testObjId);
389 
390  $clone->onDuplicate($thisObjId, $this_id, $clone->getObjId(), $clone->getId());
391 
392  return $clone->id;
393  }
getId()
Gets the id of the assQuestion object.
static _getOriginalId($question_id)
Returns the original id of a question.
getObjId()
Get the object id of the container object.
+ Here is the call graph for this function:

◆ duplicateImages()

assMatchingQuestion::duplicateImages (   $question_id,
  $objectId = null 
)

Definition at line 462 of file class.assMatchingQuestion.php.

References $DIC, $filename, assQuestion\getImagePath(), getThumbPrefix(), and ilUtil\makeDirParents().

463  {
464  global $DIC;
465  $ilLog = $DIC['ilLog'];
466  $imagepath = $this->getImagePath();
467  $imagepath_original = str_replace("/$this->id/images", "/$question_id/images", $imagepath);
468 
469  if ((int) $objectId > 0) {
470  $imagepath_original = str_replace("/$this->obj_id/", "/$objectId/", $imagepath_original);
471  }
472 
473  foreach ($this->terms as $term) {
474  if (strlen($term->picture)) {
475  $filename = $term->picture;
476  if (!file_exists($imagepath)) {
477  ilUtil::makeDirParents($imagepath);
478  }
479  if (!@copy($imagepath_original . $filename, $imagepath . $filename)) {
480  $ilLog->write("matching question image could not be duplicated: $imagepath_original$filename");
481  }
482  if (@file_exists($imagepath_original . $this->getThumbPrefix() . $filename)) {
483  if (!@copy($imagepath_original . $this->getThumbPrefix() . $filename, $imagepath . $this->getThumbPrefix() . $filename)) {
484  $ilLog->write("matching question image thumbnail could not be duplicated: $imagepath_original" . $this->getThumbPrefix() . $filename);
485  }
486  }
487  }
488  }
489  foreach ($this->definitions as $definition) {
490  if (strlen($definition->picture)) {
491  $filename = $definition->picture;
492  if (!file_exists($imagepath)) {
493  ilUtil::makeDirParents($imagepath);
494  }
495  if (!@copy($imagepath_original . $filename, $imagepath . $filename)) {
496  $ilLog->write("matching question image could not be duplicated: $imagepath_original$filename");
497  }
498  if (@file_exists($imagepath_original . $this->getThumbPrefix() . $filename)) {
499  if (!@copy($imagepath_original . $this->getThumbPrefix() . $filename, $imagepath . $this->getThumbPrefix() . $filename)) {
500  $ilLog->write("matching question image thumbnail could not be duplicated: $imagepath_original" . $this->getThumbPrefix() . $filename);
501  }
502  }
503  }
504  }
505  }
static makeDirParents($a_dir)
Create a new directory and all parent directories.
getImagePath($question_id=null, $object_id=null)
Returns the image path for web accessable images of a question.
global $DIC
Definition: goto.php:24
$filename
Definition: buildRTE.php:89
+ Here is the call graph for this function:

◆ fetchIndexedValuesFromValuePairs()

assMatchingQuestion::fetchIndexedValuesFromValuePairs ( array  $valuePairs)
Parameters
array$valuePairs
Returns
array $indexedValues

Definition at line 964 of file class.assMatchingQuestion.php.

965  {
966  $indexedValues = array();
967 
968  foreach ($valuePairs as $valuePair) {
969  if (!isset($indexedValues[$valuePair['value2']])) {
970  $indexedValues[$valuePair['value2']] = array();
971  }
972 
973  $indexedValues[$valuePair['value2']][] = $valuePair['value1'];
974  }
975 
976  return $indexedValues;
977  }

◆ fetchSubmittedMatchingsFromPost()

assMatchingQuestion::fetchSubmittedMatchingsFromPost ( )
private

Definition at line 1061 of file class.assMatchingQuestion.php.

References $_POST, getDefinitions(), assQuestion\getId(), and getTerms().

Referenced by savePreviewData(), and saveWorkingData().

1062  {
1063  $postData = $_POST['matching'][$this->getId()];
1064 
1065  $matchings = array();
1066 
1067  foreach ($this->getDefinitions() as $definition) {
1068  if (isset($postData[$definition->identifier])) {
1069  foreach ($this->getTerms() as $term) {
1070  if (isset($postData[$definition->identifier][$term->identifier])) {
1071  if (!is_array($postData[$definition->identifier])) {
1072  $postData[$definition->identifier] = array();
1073  }
1074 
1075  $matchings[$definition->identifier][] = $term->identifier;
1076  }
1077  }
1078  }
1079  }
1080 
1081  return $matchings;
1082  }
getId()
Gets the id of the assQuestion object.
getDefinitions()
Returns the definitions of the matching question.
getTerms()
Returns the terms of the matching question.
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ flushDefinitions()

assMatchingQuestion::flushDefinitions ( )

Deletes all definitions.

See also
$definitions

Definition at line 819 of file class.assMatchingQuestion.php.

820  {
821  $this->definitions = array();
822  }

◆ flushMatchingPairs()

assMatchingQuestion::flushMatchingPairs ( )

Deletes all matching pairs.

See also
$matchingpairs

Definition at line 682 of file class.assMatchingQuestion.php.

683  {
684  $this->matchingpairs = array();
685  }

◆ flushTerms()

assMatchingQuestion::flushTerms ( )

Deletes all terms.

See also
$terms

Definition at line 810 of file class.assMatchingQuestion.php.

811  {
812  $this->terms = array();
813  }

◆ generateThumbForFile()

assMatchingQuestion::generateThumbForFile (   $path,
  $file 
)
protected

Definition at line 1348 of file class.assMatchingQuestion.php.

References $filename, ilUtil\convertImage(), getThumbGeometry(), and getThumbPrefix().

Referenced by rebuildThumbnails().

1349  {
1350  $filename = $path . $file;
1351  if (@file_exists($filename)) {
1352  $thumbpath = $path . $this->getThumbPrefix() . $file;
1353  $path_info = @pathinfo($filename);
1354  $ext = "";
1355  switch (strtoupper($path_info['extension'])) {
1356  case 'PNG':
1357  $ext = 'PNG';
1358  break;
1359  case 'GIF':
1360  $ext = 'GIF';
1361  break;
1362  default:
1363  $ext = 'JPEG';
1364  break;
1365  }
1366  ilUtil::convertImage($filename, $thumbpath, $ext, $this->getThumbGeometry());
1367  }
1368  }
getThumbGeometry()
Get the thumbnail geometry.
static convertImage( $a_from, $a_to, $a_target_format="", $a_geometry="", $a_background_color="")
convert image
$filename
Definition: buildRTE.php:89
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAdditionalTableName()

assMatchingQuestion::getAdditionalTableName ( )

Returns the name of the additional question data table in the database.

Returns
string The additional table name

Definition at line 1225 of file class.assMatchingQuestion.php.

Referenced by saveAdditionalQuestionDataToDb().

1226  {
1227  return "qpl_qst_matching";
1228  }
+ Here is the caller graph for this function:

◆ getAnswerTableName()

assMatchingQuestion::getAnswerTableName ( )

Returns the name of the answer table in the database.

Returns
string The answer table name

Definition at line 1235 of file class.assMatchingQuestion.php.

1236  {
1237  return array("qpl_a_matching", "qpl_a_mterm");
1238  }

◆ getAvailableAnswerOptions()

assMatchingQuestion::getAvailableAnswerOptions (   $index = null)

If index is null, the function returns an array with all anwser options Else it returns the specific answer option.

Parameters
null | int$index
Returns
array|ASS_AnswerSimple

Implements iQuestionCondition.

Definition at line 1600 of file class.assMatchingQuestion.php.

References $index, getMatchingPair(), and getMatchingPairs().

1601  {
1602  if ($index !== null) {
1603  return $this->getMatchingPair($index);
1604  } else {
1605  return $this->getMatchingPairs();
1606  }
1607  }
getMatchingPair($index=0)
Returns a matching pair with a given index.
$index
Definition: metadata.php:128
& getMatchingPairs()
Returns the matchingpairs array.
+ Here is the call graph for this function:

◆ getDefinitionCount()

assMatchingQuestion::getDefinitionCount ( )

Returns the number of definitions.

Returns
integer The number of definitions
See also
$definitions

Definition at line 737 of file class.assMatchingQuestion.php.

738  {
739  return count($this->definitions);
740  }

◆ getDefinitions()

assMatchingQuestion::getDefinitions ( )

Returns the definitions of the matching question.

Returns
array An array containing the definitions
See also
$terms

Definition at line 715 of file class.assMatchingQuestion.php.

References $definitions.

Referenced by fetchSubmittedMatchingsFromPost(), and toJSON().

716  {
717  return $this->definitions;
718  }
+ Here is the caller graph for this function:

◆ getDefinitionWithIdentifier()

assMatchingQuestion::getDefinitionWithIdentifier (   $a_identifier)

Returns a definition with a given identifier.

Definition at line 624 of file class.assMatchingQuestion.php.

625  {
626  foreach ($this->definitions as $definition) {
627  if ($definition->identifier == $a_identifier) {
628  return $definition;
629  }
630  }
631  return null;
632  }

◆ getEncryptedFilename()

assMatchingQuestion::getEncryptedFilename (   $filename)

Returns the encrypted save filename of a matching picture Images are saved with an encrypted filename to prevent users from cheating by guessing the solution from the image filename.

Parameters
string$filenameOriginal filename
Returns
string Encrypted filename

Definition at line 987 of file class.assMatchingQuestion.php.

References $filename.

988  {
989  $extension = "";
990  if (preg_match("/.*\\.(\\w+)$/", $filename, $matches)) {
991  $extension = $matches[1];
992  }
993  return md5($filename) . "." . $extension;
994  }
$filename
Definition: buildRTE.php:89

◆ getExpressionTypes()

◆ getMatchingMode()

assMatchingQuestion::getMatchingMode ( )

Definition at line 1472 of file class.assMatchingQuestion.php.

References $matchingMode.

Referenced by checkSubmittedMatchings(), getMaximumScoringMatchingPairs(), saveAdditionalQuestionDataToDb(), and toJSON().

1473  {
1474  return $this->matchingMode;
1475  }
+ Here is the caller graph for this function:

◆ getMatchingPair()

assMatchingQuestion::getMatchingPair (   $index = 0)

Returns a matching pair with a given index.

The index of the first matching pair is 0, the index of the second matching pair is 1 and so on.

Parameters
integer$indexA nonnegative index of the n-th matching pair
Returns
object ASS_AnswerMatching-Object
See also
$matchingpairs

Definition at line 642 of file class.assMatchingQuestion.php.

References $index.

Referenced by getAvailableAnswerOptions().

643  {
644  if ($index < 0) {
645  return null;
646  }
647  if (count($this->matchingpairs) < 1) {
648  return null;
649  }
650  if ($index >= count($this->matchingpairs)) {
651  return null;
652  }
653  return $this->matchingpairs[$index];
654  }
$index
Definition: metadata.php:128
+ Here is the caller graph for this function:

◆ getMatchingPairCount()

assMatchingQuestion::getMatchingPairCount ( )

Returns the number of matching pairs.

Returns
integer The number of matching pairs of the matching question
See also
$matchingpairs

Definition at line 693 of file class.assMatchingQuestion.php.

694  {
695  return count($this->matchingpairs);
696  }

◆ getMatchingPairs()

& assMatchingQuestion::getMatchingPairs ( )

Returns the matchingpairs array.

Definition at line 1252 of file class.assMatchingQuestion.php.

References $matchingpairs.

Referenced by getAvailableAnswerOptions(), saveAnswerSpecificDataToDb(), setExportDetailsXLS(), and toJSON().

1253  {
1254  return $this->matchingpairs;
1255  }
+ Here is the caller graph for this function:

◆ getMaximumPoints()

assMatchingQuestion::getMaximumPoints ( )

Calculates and Returns the maximum points, a learner can reach answering the question.

Definition at line 902 of file class.assMatchingQuestion.php.

References assQuestion\$points, and getMaximumScoringMatchingPairs().

Referenced by getExpressionTypes(), and isComplete().

903  {
904  $points = 0;
905 
906  foreach ($this->getMaximumScoringMatchingPairs() as $pair) {
907  $points += $pair->points;
908  }
909 
910  return $points;
911  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMaximumScoringMatchingPairs()

assMatchingQuestion::getMaximumScoringMatchingPairs ( )

Definition at line 913 of file class.assMatchingQuestion.php.

References getMatchingMode(), getMostPositiveScoredUniqueTermMatchingPairs(), and getPositiveScoredMatchingPairs().

Referenced by getMaximumPoints().

914  {
915  if ($this->getMatchingMode() == self::MATCHING_MODE_N_ON_N) {
916  return $this->getPositiveScoredMatchingPairs();
917  } elseif ($this->getMatchingMode() == self::MATCHING_MODE_1_ON_1) {
919  }
920 
921  return array();
922  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMostPositiveScoredUniqueTermMatchingPairs()

assMatchingQuestion::getMostPositiveScoredUniqueTermMatchingPairs ( )
private

Definition at line 939 of file class.assMatchingQuestion.php.

Referenced by getMaximumScoringMatchingPairs().

940  {
941  $matchingPairsByDefinition = array();
942 
943  foreach ($this->matchingpairs as $pair) {
944  if ($pair->points <= 0) {
945  continue;
946  }
947 
948  $defId = $pair->definition->identifier;
949 
950  if (!isset($matchingPairsByDefinition[$defId])) {
951  $matchingPairsByDefinition[$defId] = $pair;
952  } elseif ($pair->points > $matchingPairsByDefinition[$defId]->points) {
953  $matchingPairsByDefinition[$defId] = $pair;
954  }
955  }
956 
957  return $matchingPairsByDefinition;
958  }
+ Here is the caller graph for this function:

◆ getOperators()

assMatchingQuestion::getOperators (   $expression)

Get all available operations for a specific question.

Parameters
$expression

Implements iQuestionCondition.

Definition at line 1504 of file class.assMatchingQuestion.php.

References ilOperatorsExpressionMapping\getOperatorsByExpression().

1505  {
1506  require_once "./Modules/TestQuestionPool/classes/class.ilOperatorsExpressionMapping.php";
1508  }
+ Here is the call graph for this function:

◆ getPositiveScoredMatchingPairs()

assMatchingQuestion::getPositiveScoredMatchingPairs ( )
private

Definition at line 924 of file class.assMatchingQuestion.php.

Referenced by getMaximumScoringMatchingPairs().

925  {
926  $matchingPairs = array();
927 
928  foreach ($this->matchingpairs as $pair) {
929  if ($pair->points <= 0) {
930  continue;
931  }
932 
933  $matchingPairs[] = $pair;
934  }
935 
936  return $matchingPairs;
937  }
+ Here is the caller graph for this function:

◆ getQuestionType()

assMatchingQuestion::getQuestionType ( )

Returns the question type of the question.

Returns
integer The question type of the question

Definition at line 1215 of file class.assMatchingQuestion.php.

Referenced by toJSON().

1216  {
1217  return "assMatchingQuestion";
1218  }
+ Here is the caller graph for this function:

◆ getRandomId()

assMatchingQuestion::getRandomId ( )

Definition at line 1172 of file class.assMatchingQuestion.php.

1173  {
1174  mt_srand((double) microtime() * 1000000);
1175  $random_number = mt_rand(1, 100000);
1176  $found = false;
1177  while ($found) {
1178  $found = false;
1179  foreach ($this->matchingpairs as $key => $pair) {
1180  if (($pair->term->identifier == $random_number) || ($pair->definition->identifier == $random_number)) {
1181  $found = true;
1182  $random_number++;
1183  }
1184  }
1185  }
1186  return $random_number;
1187  }

◆ getRTETextWithMediaObjects()

assMatchingQuestion::getRTETextWithMediaObjects ( )

Collects all text in the question which could contain media objects which were created with the Rich Text Editor.

Definition at line 1244 of file class.assMatchingQuestion.php.

1245  {
1246  return parent::getRTETextWithMediaObjects();
1247  }

◆ getTermCount()

assMatchingQuestion::getTermCount ( )

Returns the number of terms.

Returns
integer The number of terms
See also
$terms

Definition at line 726 of file class.assMatchingQuestion.php.

727  {
728  return count($this->terms);
729  }

◆ getTerms()

assMatchingQuestion::getTerms ( )

Returns the terms of the matching question.

Returns
array An array containing the terms
See also
$terms

Definition at line 704 of file class.assMatchingQuestion.php.

References $terms.

Referenced by fetchSubmittedMatchingsFromPost(), and toJSON().

705  {
706  return $this->terms;
707  }
+ Here is the caller graph for this function:

◆ getTermWithIdentifier()

assMatchingQuestion::getTermWithIdentifier (   $a_identifier)

Returns a term with a given identifier.

Definition at line 611 of file class.assMatchingQuestion.php.

612  {
613  foreach ($this->terms as $term) {
614  if ($term->identifier == $a_identifier) {
615  return $term;
616  }
617  }
618  return null;
619  }

◆ getThumbGeometry()

assMatchingQuestion::getThumbGeometry ( )

Get the thumbnail geometry.

Returns
integer Geometry

Definition at line 1301 of file class.assMatchingQuestion.php.

References $thumb_geometry.

Referenced by generateThumbForFile(), getThumbSize(), saveAdditionalQuestionDataToDb(), and setImageFile().

1302  {
1303  return $this->thumb_geometry;
1304  }
+ Here is the caller graph for this function:

◆ getThumbPrefix()

assMatchingQuestion::getThumbPrefix ( )

Definition at line 1343 of file class.assMatchingQuestion.php.

Referenced by copyImages(), deleteImagefile(), duplicateImages(), generateThumbForFile(), and setImageFile().

1344  {
1345  return "thumb.";
1346  }
+ Here is the caller graph for this function:

◆ getThumbSize()

assMatchingQuestion::getThumbSize ( )

Get the thumbnail geometry.

Returns
integer Geometry

Definition at line 1311 of file class.assMatchingQuestion.php.

References getThumbGeometry().

1312  {
1313  return $this->getThumbGeometry();
1314  }
getThumbGeometry()
Get the thumbnail geometry.
+ Here is the call graph for this function:

◆ insertDefinition()

assMatchingQuestion::insertDefinition (   $position,
  $definition = null 
)

Inserts a definition.

Parameters
object$definitionThe definition
See also
$definitions

Definition at line 791 of file class.assMatchingQuestion.php.

792  {
793  if (is_null($definition)) {
794  include_once "./Modules/TestQuestionPool/classes/class.assAnswerMatchingDefinition.php";
795  $definition = new assAnswerMatchingDefinition();
796  }
797  if ($position < count($this->definitions)) {
798  $part1 = array_slice($this->definitions, 0, $position);
799  $part2 = array_slice($this->definitions, $position);
800  $this->definitions = array_merge($part1, array($definition), $part2);
801  } else {
802  array_push($this->definitions, $definition);
803  }
804  }
Class for matching question definitions.

◆ insertMatchingPair()

assMatchingQuestion::insertMatchingPair (   $position,
  $term = null,
  $definition = null,
  $points = 0.0 
)

Inserts a matching pair for an matching choice question.

The students have to fill in an order for the matching pair. The matching pair is an ASS_AnswerMatching object that will be created and assigned to the array $this->matchingpairs.

Parameters
integer$positionThe insert position in the matching pairs array
object$termA matching term
object$definitionA matching definition
double$pointsThe points for selecting the matching pair (even negative points can be used)
See also
$matchingpairs

Definition at line 561 of file class.assMatchingQuestion.php.

References assQuestion\$points.

562  {
563  include_once "./Modules/TestQuestionPool/classes/class.assAnswerMatchingPair.php";
564  include_once "./Modules/TestQuestionPool/classes/class.assAnswerMatchingTerm.php";
565  include_once "./Modules/TestQuestionPool/classes/class.assAnswerMatchingDefinition.php";
566  if (is_null($term)) {
567  $term = new assAnswerMatchingTerm();
568  }
569  if (is_null($definition)) {
570  $definition = new assAnswerMatchingDefinition();
571  }
572  $pair = new assAnswerMatchingPair($term, $definition, $points);
573  if ($position < count($this->matchingpairs)) {
574  $part1 = array_slice($this->matchingpairs, 0, $position);
575  $part2 = array_slice($this->matchingpairs, $position);
576  $this->matchingpairs = array_merge($part1, array($pair), $part2);
577  } else {
578  array_push($this->matchingpairs, $pair);
579  }
580  }
Class for matching question terms.
Class for matching question pairs.
Class for matching question definitions.

◆ insertTerm()

assMatchingQuestion::insertTerm (   $position,
  $term = null 
)

Inserts a term.

Parameters
string$termThe text of the term
See also
$terms

Definition at line 770 of file class.assMatchingQuestion.php.

771  {
772  if (is_null($term)) {
773  include_once "./Modules/TestQuestionPool/classes/class.assAnswerMatchingTerm.php";
774  $term = new assAnswerMatchingTerm();
775  }
776  if ($position < count($this->terms)) {
777  $part1 = array_slice($this->terms, 0, $position);
778  $part2 = array_slice($this->terms, $position);
779  $this->terms = array_merge($part1, array($term), $part2);
780  } else {
781  array_push($this->terms, $term);
782  }
783  }
Class for matching question terms.

◆ isComplete()

assMatchingQuestion::isComplete ( )

Returns true, if a matching question is complete for use.

Returns
boolean True, if the matching question is complete for use, otherwise false

Definition at line 118 of file class.assMatchingQuestion.php.

References getMaximumPoints().

119  {
120  if (strlen($this->title)
121  && $this->author
122  && $this->question
123  && count($this->matchingpairs)
124  && $this->getMaximumPoints() > 0
125  ) {
126  return true;
127  }
128  return false;
129  }
getMaximumPoints()
Calculates and Returns the maximum points, a learner can reach answering the question.
+ Here is the call graph for this function:

◆ loadFromDb()

assMatchingQuestion::loadFromDb (   $question_id)

Loads a assMatchingQuestion object from a database.

Parameters
object$dbA pear DB object
integer$question_idA unique key which defines the multiple choice test in the database

Definition at line 248 of file class.assMatchingQuestion.php.

References $data, $DIC, Vendor\Package\$e, $ilDB, $query, $result, ilRTE\_replaceMediaObjectImageSrc(), ilAssQuestionLifecycle\getDraftInstance(), ilAssQuestionLifecycle\getInstance(), assQuestion\setAdditionalContentEditingMode(), assQuestion\setAuthor(), assQuestion\setComment(), assQuestion\setEstimatedWorkingTime(), assQuestion\setId(), assQuestion\setLifecycle(), setMatchingMode(), assQuestion\setNrOfTries(), assQuestion\setObjId(), assQuestion\setOriginalId(), assQuestion\setOwner(), assQuestion\setPoints(), assQuestion\setQuestion(), setShuffle(), setThumbGeometry(), and assQuestion\setTitle().

249  {
250  global $DIC;
251  $ilDB = $DIC['ilDB'];
252 
253  $query = "
254  SELECT qpl_questions.*,
255  {$this->getAdditionalTableName()}.*
256  FROM qpl_questions
257  LEFT JOIN {$this->getAdditionalTableName()}
258  ON {$this->getAdditionalTableName()}.question_fi = qpl_questions.question_id
259  WHERE qpl_questions.question_id = %s
260  ";
261 
262  $result = $ilDB->queryF(
263  $query,
264  array('integer'),
265  array($question_id)
266  );
267 
268  if ($result->numRows() == 1) {
269  $data = $ilDB->fetchAssoc($result);
270  $this->setId($question_id);
271  $this->setObjId($data["obj_fi"]);
272  $this->setTitle($data["title"]);
273  $this->setComment($data["description"]);
274  $this->setOriginalId($data["original_id"]);
275  $this->setNrOfTries($data['nr_of_tries']);
276  $this->setAuthor($data["author"]);
277  $this->setPoints($data["points"]);
278  $this->setOwner($data["owner"]);
279  include_once("./Services/RTE/classes/class.ilRTE.php");
280  $this->setQuestion(ilRTE::_replaceMediaObjectImageSrc($data["question_text"], 1));
281  $this->setThumbGeometry($data["thumb_geometry"]);
282  $this->setShuffle($data["shuffle"]);
283  $this->setMatchingMode($data['matching_mode'] === null ? self::MATCHING_MODE_1_ON_1 : $data['matching_mode']);
284  $this->setEstimatedWorkingTime(substr($data["working_time"], 0, 2), substr($data["working_time"], 3, 2), substr($data["working_time"], 6, 2));
285 
286  try {
290  }
291 
292  try {
293  $this->setAdditionalContentEditingMode($data['add_cont_edit_mode']);
294  } catch (ilTestQuestionPoolException $e) {
295  }
296  }
297 
298  $termids = array();
299  $result = $ilDB->queryF(
300  "SELECT * FROM qpl_a_mterm WHERE question_fi = %s ORDER BY term_id ASC",
301  array('integer'),
302  array($question_id)
303  );
304  include_once "./Modules/TestQuestionPool/classes/class.assAnswerMatchingTerm.php";
305  $this->terms = array();
306  if ($result->numRows() > 0) {
307  while ($data = $ilDB->fetchAssoc($result)) {
308  $term = new assAnswerMatchingTerm($data['term'], $data['picture'], $data['ident']);
309  array_push($this->terms, $term);
310  $termids[$data['term_id']] = $term;
311  }
312  }
313 
314  $definitionids = array();
315  $result = $ilDB->queryF(
316  "SELECT * FROM qpl_a_mdef WHERE question_fi = %s ORDER BY def_id ASC",
317  array('integer'),
318  array($question_id)
319  );
320  include_once "./Modules/TestQuestionPool/classes/class.assAnswerMatchingDefinition.php";
321  $this->definitions = array();
322  if ($result->numRows() > 0) {
323  while ($data = $ilDB->fetchAssoc($result)) {
324  $definition = new assAnswerMatchingDefinition($data['definition'], $data['picture'], $data['ident']);
325  array_push($this->definitions, $definition);
326  $definitionids[$data['def_id']] = $definition;
327  }
328  }
329 
330  $this->matchingpairs = array();
331  $result = $ilDB->queryF(
332  "SELECT * FROM qpl_a_matching WHERE question_fi = %s ORDER BY answer_id",
333  array('integer'),
334  array($question_id)
335  );
336  include_once "./Modules/TestQuestionPool/classes/class.assAnswerMatchingPair.php";
337  if ($result->numRows() > 0) {
338  while ($data = $ilDB->fetchAssoc($result)) {
339  array_push($this->matchingpairs, new assAnswerMatchingPair($termids[$data['term_fi']], $definitionids[$data['definition_fi']], $data['points']));
340  }
341  }
342  parent::loadFromDb($question_id);
343  }
Class for matching question terms.
Class for matching question pairs.
$data
Definition: storeScorm.php:23
$result
setId($id=-1)
Sets the 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. ...
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...
setAuthor($author="")
Sets the authors name of the assQuestion object.
setShuffle($shuffle=true)
Sets the shuffle flag.
global $DIC
Definition: goto.php:24
$query
setPoints($a_points)
Sets the maximum available points for the question.
setQuestion($question="")
Sets the question string of the question object.
setThumbGeometry($a_geometry)
Set the thumbnail geometry.
global $ilDB
setOriginalId($original_id)
Class for matching question definitions.
setLifecycle(ilAssQuestionLifecycle $lifecycle)
setTitle($title="")
Sets the title string of the assQuestion object.
setObjId($obj_id=0)
Set the object id of the container object.
setComment($comment="")
Sets the comment string of the assQuestion object.
setOwner($owner="")
Sets the creator/owner ID of the assQuestion object.
+ Here is the call graph for this function:

◆ rebuildThumbnails()

assMatchingQuestion::rebuildThumbnails ( )

Rebuild the thumbnail images with a new thumbnail size.

Definition at line 1329 of file class.assMatchingQuestion.php.

References generateThumbForFile(), and assQuestion\getImagePath().

Referenced by saveAnswerSpecificDataToDb().

1330  {
1331  foreach ($this->terms as $term) {
1332  if (strlen($term->picture)) {
1333  $this->generateThumbForFile($this->getImagePath(), $term->picture);
1334  }
1335  }
1336  foreach ($this->definitions as $definition) {
1337  if (strlen($definition->picture)) {
1338  $this->generateThumbForFile($this->getImagePath(), $definition->picture);
1339  }
1340  }
1341  }
getImagePath($question_id=null, $object_id=null)
Returns the image path for web accessable images of a question.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeDefinitionImage()

assMatchingQuestion::removeDefinitionImage (   $index)

Definition at line 1005 of file class.assMatchingQuestion.php.

References $index, and deleteImagefile().

1006  {
1007  $definition = $this->definitions[$index];
1008  if (is_object($definition)) {
1009  $this->deleteImagefile($definition->picture);
1010  $definition->picture = null;
1011  }
1012  }
deleteImagefile($filename)
Deletes an imagefile from the system if the file is deleted manually.
$index
Definition: metadata.php:128
+ Here is the call graph for this function:

◆ removeTermImage()

assMatchingQuestion::removeTermImage (   $index)

Definition at line 996 of file class.assMatchingQuestion.php.

References $index, and deleteImagefile().

997  {
998  $term = $this->terms[$index];
999  if (is_object($term)) {
1000  $this->deleteImagefile($term->picture);
1001  $term->picture = null;
1002  }
1003  }
deleteImagefile($filename)
Deletes an imagefile from the system if the file is deleted manually.
$index
Definition: metadata.php:128
+ Here is the call graph for this function:

◆ saveAdditionalQuestionDataToDb()

assMatchingQuestion::saveAdditionalQuestionDataToDb ( )

Saves a record to the question types additional data table.

Returns
mixed

Implements ilObjQuestionScoringAdjustable.

Definition at line 220 of file class.assMatchingQuestion.php.

References $DIC, $ilDB, getAdditionalTableName(), assQuestion\getId(), getMatchingMode(), and getThumbGeometry().

Referenced by saveToDb().

221  {
222  global $DIC;
223  $ilDB = $DIC['ilDB'];
224 
225  // save additional data
226 
227  $ilDB->manipulateF(
228  "DELETE FROM " . $this->getAdditionalTableName() . " WHERE question_fi = %s",
229  array( "integer" ),
230  array( $this->getId() )
231  );
232 
233  $ilDB->insert($this->getAdditionalTableName(), array(
234  'question_fi' => array('integer', $this->getId()),
235  'shuffle' => array('text', $this->shuffle),
236  'matching_type' => array('text', $this->matching_type),
237  'thumb_geometry' => array('integer', $this->getThumbGeometry()),
238  'matching_mode' => array('text', $this->getMatchingMode())
239  ));
240  }
getThumbGeometry()
Get the thumbnail geometry.
getId()
Gets the id of the assQuestion object.
getAdditionalTableName()
Returns the name of the additional question data table in the database.
global $DIC
Definition: goto.php:24
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveAnswerSpecificDataToDb()

assMatchingQuestion::saveAnswerSpecificDataToDb ( )

Saves the answer specific records into a question types answer table.

Returns
mixed

Implements ilObjAnswerScoringAdjustable.

Definition at line 150 of file class.assMatchingQuestion.php.

References $DIC, $ilDB, $matchingpairs, assQuestion\getId(), getMatchingPairs(), and rebuildThumbnails().

Referenced by saveToDb().

151  {
152  global $DIC;
153  $ilDB = $DIC['ilDB'];
154  // delete old terms
155  $ilDB->manipulateF(
156  "DELETE FROM qpl_a_mterm WHERE question_fi = %s",
157  array( 'integer' ),
158  array( $this->getId() )
159  );
160 
161  // delete old definitions
162  $ilDB->manipulateF(
163  "DELETE FROM qpl_a_mdef WHERE question_fi = %s",
164  array( 'integer' ),
165  array( $this->getId() )
166  );
167 
168  $termids = array();
169  // write terms
170  foreach ($this->terms as $key => $term) {
171  $next_id = $ilDB->nextId('qpl_a_mterm');
172  $ilDB->insert('qpl_a_mterm', array(
173  'term_id' => array('integer', $next_id),
174  'question_fi' => array('integer', $this->getId()),
175  'picture' => array('text', $term->picture),
176  'term' => array('text', $term->text),
177  'ident' => array('integer', $term->identifier)
178  ));
179  $termids[$term->identifier] = $next_id;
180  }
181 
182  $definitionids = array();
183  // write definitions
184  foreach ($this->definitions as $key => $definition) {
185  $next_id = $ilDB->nextId('qpl_a_mdef');
186  $ilDB->insert('qpl_a_mdef', array(
187  'def_id' => array('integer', $next_id),
188  'question_fi' => array('integer', $this->getId()),
189  'picture' => array('text', $definition->picture),
190  'definition' => array('text', $definition->text),
191  'ident' => array('integer', $definition->identifier)
192  ));
193  $definitionids[$definition->identifier] = $next_id;
194  }
195 
196  $ilDB->manipulateF(
197  "DELETE FROM qpl_a_matching WHERE question_fi = %s",
198  array( 'integer' ),
199  array( $this->getId() )
200  );
201  $matchingpairs = $this->getMatchingPairs();
202  foreach ($matchingpairs as $key => $pair) {
203  $next_id = $ilDB->nextId('qpl_a_matching');
204  $ilDB->manipulateF(
205  "INSERT INTO qpl_a_matching (answer_id, question_fi, points, term_fi, definition_fi) VALUES (%s, %s, %s, %s, %s)",
206  array( 'integer', 'integer', 'float', 'integer', 'integer' ),
207  array(
208  $next_id,
209  $this->getId(),
210  $pair->points,
211  $termids[$pair->term->identifier],
212  $definitionids[$pair->definition->identifier]
213  )
214  );
215  }
216 
217  $this->rebuildThumbnails();
218  }
getId()
Gets the id of the assQuestion object.
rebuildThumbnails()
Rebuild the thumbnail images with a new thumbnail size.
global $DIC
Definition: goto.php:24
global $ilDB
& getMatchingPairs()
Returns the matchingpairs array.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ savePreviewData()

assMatchingQuestion::savePreviewData ( ilAssQuestionPreviewSession  $previewSession)
protected

Definition at line 1163 of file class.assMatchingQuestion.php.

References checkSubmittedMatchings(), fetchSubmittedMatchingsFromPost(), and ilAssQuestionPreviewSession\setParticipantsSolution().

1164  {
1165  $submittedMatchings = $this->fetchSubmittedMatchingsFromPost();
1166 
1167  if ($this->checkSubmittedMatchings($submittedMatchings)) {
1168  $previewSession->setParticipantsSolution($submittedMatchings);
1169  }
1170  }
checkSubmittedMatchings($submittedMatchings)
+ Here is the call graph for this function:

◆ saveToDb()

assMatchingQuestion::saveToDb (   $original_id = "")

Saves a assMatchingQuestion object to a database.

Parameters
string$original_id

Definition at line 137 of file class.assMatchingQuestion.php.

References $DIC, $ilDB, assQuestion\$original_id, saveAdditionalQuestionDataToDb(), saveAnswerSpecificDataToDb(), and assQuestion\saveQuestionDataToDb().

138  {
139  global $DIC;
140  $ilDB = $DIC['ilDB'];
141 
145 
146 
147  parent::saveToDb($original_id);
148  }
saveAdditionalQuestionDataToDb()
Saves a record to the question types additional data table.
global $DIC
Definition: goto.php:24
saveAnswerSpecificDataToDb()
Saves the answer specific records into a question types answer table.
saveQuestionDataToDb($original_id="")
global $ilDB
+ Here is the call graph for this function:

◆ saveWorkingData()

assMatchingQuestion::saveWorkingData (   $active_id,
  $pass = null,
  $authorized = true 
)

Saves the learners input of the question to the database.

public

Parameters
integer$active_idActive id of the user
integer$passTest pass
Returns
boolean $status

Definition at line 1119 of file class.assMatchingQuestion.php.

References $DIC, $i, $ilDB, $pass, $terms, ilObjAssessmentFolder\_enabledAssessmentLogging(), ilObjAssessmentFolder\_getLogLanguage(), ilObjTest\_getPass(), checkSubmittedMatchings(), fetchSubmittedMatchingsFromPost(), assQuestion\getId(), assQuestion\getProcessLocker(), assQuestion\logAction(), assQuestion\removeCurrentSolution(), and assQuestion\saveCurrentSolution().

1120  {
1121  global $DIC;
1122  $ilDB = $DIC['ilDB'];
1123 
1124  $submittedMatchings = $this->fetchSubmittedMatchingsFromPost();
1125  $submittedMatchingsValid = $this->checkSubmittedMatchings($submittedMatchings);
1126 
1127  $matchingsExist = false;
1128 
1129  if ($submittedMatchingsValid) {
1130  if (is_null($pass)) {
1131  include_once "./Modules/Test/classes/class.ilObjTest.php";
1132  $pass = ilObjTest::_getPass($active_id);
1133  }
1134 
1135  $this->getProcessLocker()->executeUserSolutionUpdateLockOperation(function () use (&$matchingsExist, $submittedMatchings, $active_id, $pass, $authorized) {
1136  $this->removeCurrentSolution($active_id, $pass, $authorized);
1137 
1138  foreach ($submittedMatchings as $definition => $terms) {
1139  foreach ($terms as $i => $term) {
1140  $this->saveCurrentSolution($active_id, $pass, $term, $definition, $authorized);
1141  $matchingsExist = true;
1142  }
1143  }
1144  });
1145 
1146  $saveWorkingDataResult = true;
1147  } else {
1148  $saveWorkingDataResult = false;
1149  }
1150 
1151  include_once("./Modules/Test/classes/class.ilObjAssessmentFolder.php");
1153  if ($matchingsExist) {
1154  assQuestion::logAction($this->lng->txtlng("assessment", "log_user_entered_values", ilObjAssessmentFolder::_getLogLanguage()), $active_id, $this->getId());
1155  } else {
1156  assQuestion::logAction($this->lng->txtlng("assessment", "log_user_not_entered_values", ilObjAssessmentFolder::_getLogLanguage()), $active_id, $this->getId());
1157  }
1158  }
1159 
1160  return $saveWorkingDataResult;
1161  }
static logAction($logtext="", $active_id="", $question_id="")
Logs an action into the Test&Assessment log.
getId()
Gets the id of the assQuestion object.
static _getPass($active_id)
Retrieves the actual pass of a given user for a given test.
static _getLogLanguage()
retrieve the log language for assessment logging
static _enabledAssessmentLogging()
check wether assessment logging is enabled or not
saveCurrentSolution($active_id, $pass, $value1, $value2, $authorized=true, $tstamp=null)
global $DIC
Definition: goto.php:24
checkSubmittedMatchings($submittedMatchings)
removeCurrentSolution($active_id, $pass, $authorized=true)
global $ilDB
$i
Definition: metadata.php:24
+ Here is the call graph for this function:

◆ setExportDetailsXLS()

assMatchingQuestion::setExportDetailsXLS (   $worksheet,
  $startrow,
  $active_id,
  $pass 
)

{}

Definition at line 1260 of file class.assMatchingQuestion.php.

References $i, $pass, assQuestion\getImagePath(), getMatchingPairs(), and assQuestion\getSolutionValues().

1261  {
1262  parent::setExportDetailsXLS($worksheet, $startrow, $active_id, $pass);
1263 
1264  $solutions = $this->getSolutionValues($active_id, $pass);
1265 
1266  $imagepath = $this->getImagePath();
1267  $i = 1;
1268  foreach ($solutions as $solution) {
1269  $matches_written = false;
1270  foreach ($this->getMatchingPairs() as $idx => $pair) {
1271  if (!$matches_written) {
1272  $worksheet->setCell($startrow + $i, 1, $this->lng->txt("matches"));
1273  }
1274  $matches_written = true;
1275  if ($pair->definition->identifier == $solution["value2"]) {
1276  if (strlen($pair->definition->text)) {
1277  $worksheet->setCell($startrow + $i, 0, $pair->definition->text);
1278  } else {
1279  $worksheet->setCell($startrow + $i, 0, $pair->definition->picture);
1280  }
1281  }
1282  if ($pair->term->identifier == $solution["value1"]) {
1283  if (strlen($pair->term->text)) {
1284  $worksheet->setCell($startrow + $i, 2, $pair->term->text);
1285  } else {
1286  $worksheet->setCell($startrow + $i, 2, $pair->term->picture);
1287  }
1288  }
1289  }
1290  $i++;
1291  }
1292 
1293  return $startrow + $i + 1;
1294  }
getSolutionValues($active_id, $pass=null, $authorized=true)
Loads solutions of a given user from the database an returns it.
getImagePath($question_id=null, $object_id=null)
Returns the image path for web accessable images of a question.
& getMatchingPairs()
Returns the matchingpairs array.
$i
Definition: metadata.php:24
+ Here is the call graph for this function:

◆ setImageFile()

assMatchingQuestion::setImageFile (   $image_tempfilename,
  $image_filename,
  $previous_filename = '' 
)

Sets the image file and uploads the image to the object's image directory.

Parameters
string$image_filenameName of the original image file
string$image_tempfilenameName of the temporary uploaded image file
Returns
integer An errorcode if the image upload fails, 0 otherwise public

Definition at line 1037 of file class.assMatchingQuestion.php.

References $result, ilUtil\convertImage(), deleteImagefile(), assQuestion\getImagePath(), getThumbGeometry(), getThumbPrefix(), ilUtil\makeDirParents(), and ilUtil\moveUploadedFile().

1038  {
1039  $result = true;
1040  if (strlen($image_tempfilename)) {
1041  $image_filename = str_replace(" ", "_", $image_filename);
1042  $imagepath = $this->getImagePath();
1043  if (!file_exists($imagepath)) {
1044  ilUtil::makeDirParents($imagepath);
1045  }
1046  $savename = $image_filename;
1047  if (!ilUtil::moveUploadedFile($image_tempfilename, $savename, $imagepath . $savename)) {
1048  $result = false;
1049  } else {
1050  // create thumbnail file
1051  $thumbpath = $imagepath . $this->getThumbPrefix() . $savename;
1052  ilUtil::convertImage($imagepath . $savename, $thumbpath, "JPEG", $this->getThumbGeometry());
1053  }
1054  if ($result && (strcmp($image_filename, $previous_filename) != 0) && (strlen($previous_filename))) {
1055  $this->deleteImagefile($previous_filename);
1056  }
1057  }
1058  return $result;
1059  }
getThumbGeometry()
Get the thumbnail geometry.
static makeDirParents($a_dir)
Create a new directory and all parent directories.
$result
deleteImagefile($filename)
Deletes an imagefile from the system if the file is deleted manually.
getImagePath($question_id=null, $object_id=null)
Returns the image path for web accessable images of a question.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
static convertImage( $a_from, $a_to, $a_target_format="", $a_geometry="", $a_background_color="")
convert image
+ Here is the call graph for this function:

◆ setMatchingMode()

assMatchingQuestion::setMatchingMode (   $matchingMode)

Definition at line 1467 of file class.assMatchingQuestion.php.

References $matchingMode.

Referenced by loadFromDb().

1468  {
1469  $this->matchingMode = $matchingMode;
1470  }
+ Here is the caller graph for this function:

◆ setShuffle()

assMatchingQuestion::setShuffle (   $shuffle = true)

Sets the shuffle flag.

Parameters
integer$shuffleA flag indicating whether the answers are shuffled or not
See also
$shuffle

Definition at line 1195 of file class.assMatchingQuestion.php.

References assQuestion\$shuffle.

Referenced by loadFromDb().

1196  {
1197  switch ($shuffle) {
1198  case 0:
1199  case 1:
1200  case 2:
1201  case 3:
1202  $this->shuffle = $shuffle;
1203  break;
1204  default:
1205  $this->shuffle = 1;
1206  break;
1207  }
1208  }
+ Here is the caller graph for this function:

◆ setTerm()

assMatchingQuestion::setTerm (   $term,
  $index 
)

Sets a specific term.

Parameters
string$termThe text of the term
string$indexThe index of the term
See also
$terms

Definition at line 855 of file class.assMatchingQuestion.php.

References $index.

856  {
857  $this->terms[$index] = $term;
858  }
$index
Definition: metadata.php:128

◆ setThumbGeometry()

assMatchingQuestion::setThumbGeometry (   $a_geometry)

Set the thumbnail geometry.

Parameters
integer$a_geometryGeometry

Definition at line 1321 of file class.assMatchingQuestion.php.

Referenced by loadFromDb().

1322  {
1323  $this->thumb_geometry = ($a_geometry < 1) ? 100 : $a_geometry;
1324  }
+ Here is the caller graph for this function:

◆ supportsJavascriptOutput()

assMatchingQuestion::supportsJavascriptOutput ( )

Definition at line 1457 of file class.assMatchingQuestion.php.

1458  {
1459  return true;
1460  }

◆ supportsNonJsOutput()

assMatchingQuestion::supportsNonJsOutput ( )

Definition at line 1462 of file class.assMatchingQuestion.php.

1463  {
1464  return false;
1465  }

◆ toJSON()

assMatchingQuestion::toJSON ( )

Returns a JSON representation of the question TODO.

Definition at line 1374 of file class.assMatchingQuestion.php.

References $definitions, $DIC, assQuestion\$lng, $mobs, $result, $terms, ilObjMediaObject\_getMobsOfObject(), assQuestion\formatSAQuestion(), getDefinitions(), assQuestion\getId(), getMatchingMode(), getMatchingPairs(), assQuestion\getNrOfTries(), assQuestion\getQuestion(), getQuestionType(), assQuestion\getShuffler(), getTerms(), assQuestion\getTitle(), and assQuestion\setShuffler().

1375  {
1376  $result = array();
1377 
1378  $result['id'] = (int) $this->getId();
1379  $result['type'] = (string) $this->getQuestionType();
1380  $result['title'] = (string) $this->getTitle();
1381  $result['question'] = $this->formatSAQuestion($this->getQuestion());
1382  $result['nr_of_tries'] = (int) $this->getNrOfTries();
1383  $result['matching_mode'] = $this->getMatchingMode();
1384  $result['shuffle'] = true;
1385  $result['feedback'] = array(
1386  'onenotcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), false)),
1387  'allcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), true))
1388  );
1389 
1390  require_once 'Services/Randomization/classes/class.ilArrayElementShuffler.php';
1391  $this->setShuffler(new ilArrayElementShuffler());
1392  $seed = $this->getShuffler()->getSeed();
1393 
1394  $terms = array();
1395  $this->getShuffler()->setSeed($this->getShuffler()->buildSeedFromString($seed . 'terms'));
1396  foreach ($this->getShuffler()->shuffle($this->getTerms()) as $term) {
1397  $terms[] = array(
1398  "text" => $this->formatSAQuestion($term->text),
1399  "id" => (int) $this->getId() . $term->identifier
1400  );
1401  }
1402  $result['terms'] = $terms;
1403 
1404  // alex 9.9.2010 as a fix for bug 6513 I added the question id
1405  // to the "def_id" in the array. The $pair->definition->identifier is not
1406  // unique, since it gets it value from the morder table field
1407  // this value is not changed, when a question is copied.
1408  // thus copying the same question on a page results in problems
1409  // when the second one (the copy) is answered.
1410 
1411  $definitions = array();
1412  $this->getShuffler()->setSeed($this->getShuffler()->buildSeedFromString($seed . 'definitions'));
1413  foreach ($this->getShuffler()->shuffle($this->getDefinitions()) as $def) {
1414  $definitions[] = array(
1415  "text" => $this->formatSAQuestion((string) $def->text),
1416  "id" => (int) $this->getId() . $def->identifier
1417  );
1418  }
1419  $result['definitions'] = $definitions;
1420 
1421  // #10353
1422  $matchings = array();
1423  foreach ($this->getMatchingPairs() as $pair) {
1424  // fau: fixLmMatchingPoints - ignore matching pairs with 0 or negative points
1425  if ($pair->points <= 0) {
1426  continue;
1427  }
1428  // fau.
1429 
1430  $pid = $pair->definition->identifier;
1431  if ($this->getMatchingMode() == self::MATCHING_MODE_N_ON_N) {
1432  $pid .= '::' . $pair->term->identifier;
1433  }
1434 
1435  if (!isset($matchings[$pid]) || $matchings[$pid]["points"] < $pair->points) {
1436  $matchings[$pid] = array(
1437  "term_id" => (int) $this->getId() . $pair->term->identifier,
1438  "def_id" => (int) $this->getId() . $pair->definition->identifier,
1439  "points" => (int) $pair->points
1440  );
1441  }
1442  }
1443 
1444  $result['matchingPairs'] = array_values($matchings);
1445 
1446  $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $this->getId());
1447  $result['mobs'] = $mobs;
1448 
1449  global $DIC;
1450  $lng = $DIC['lng'];
1451  $lng->loadLanguageModule('assessment');
1452  $result['reset_button_label'] = $lng->txt("reset_terms");
1453 
1454  return json_encode($result);
1455  }
getId()
Gets the id of the assQuestion object.
static _getMobsOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
get mobs of object
formatSAQuestion($a_q)
Format self assessment question.
$result
$mobs
Definition: imgupload.php:54
getQuestionType()
Returns the question type of the question.
getDefinitions()
Returns the definitions of the matching question.
global $DIC
Definition: goto.php:24
getQuestion()
Gets the question string of the question object.
getTerms()
Returns the terms of the matching question.
getTitle()
Gets the title string of the assQuestion object.
& getMatchingPairs()
Returns the matchingpairs array.
setShuffler(ilArrayElementShuffler $shuffler)
+ Here is the call graph for this function:

Field Documentation

◆ $definitions

assMatchingQuestion::$definitions
protected

Definition at line 64 of file class.assMatchingQuestion.php.

Referenced by getDefinitions(), getExpressionTypes(), and toJSON().

◆ $element_height

assMatchingQuestion::$element_height

Definition at line 77 of file class.assMatchingQuestion.php.

◆ $matching_type

assMatchingQuestion::$matching_type

Definition at line 55 of file class.assMatchingQuestion.php.

Referenced by __construct().

◆ $matchingMode

assMatchingQuestion::$matchingMode = self::MATCHING_MODE_1_ON_1
protected

Definition at line 82 of file class.assMatchingQuestion.php.

Referenced by getMatchingMode(), and setMatchingMode().

◆ $matchingpairs

assMatchingQuestion::$matchingpairs

Definition at line 46 of file class.assMatchingQuestion.php.

Referenced by getMatchingPairs(), and saveAnswerSpecificDataToDb().

◆ $terms

assMatchingQuestion::$terms
protected

◆ $thumb_geometry

assMatchingQuestion::$thumb_geometry = 100

Definition at line 70 of file class.assMatchingQuestion.php.

Referenced by getThumbGeometry().

◆ MATCHING_MODE_1_ON_1

const assMatchingQuestion::MATCHING_MODE_1_ON_1 = '1:1'

◆ MATCHING_MODE_N_ON_N

const assMatchingQuestion::MATCHING_MODE_N_ON_N = 'n:n'

The documentation for this class was generated from the following file: