ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
assMatchingQuestion Class Reference

Class for matching questions. 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
 __construct ( $title="", $comment="", $author="", $owner=-1, $question="")
 assQuestion constructor More...
 
 getShuffler ()
 
 setShuffler (ilArrayElementShuffler $shuffler)
 
 setProcessLocker ($processLocker)
 
 getProcessLocker ()
 
 fromXML (&$item, &$questionpool_id, &$tst_id, &$tst_object, &$question_counter, &$import_mapping)
 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...
 
 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...
 
 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...
 
 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 ()
 
 createRandomSolution ($test_id, $user_id)
 
 _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...
 
 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 ()
 
- 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_DEFAULT = 'default'
 constant for additional content editing mode "default" More...
 
const ADDITIONAL_CONTENT_EDITING_MODE_PAGE_OBJECT = '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)
 
 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
 
 $outputType = OUTPUT_JAVASCRIPT
 
 $suggested_solutions
 
 $original_id
 
 $page
 
 $external_id = ''
 
 $questionChangeListeners = array()
 
 $processLocker
 
 $step = null
 
 $lastChange
 
 $shuffler
 
 $testQuestionConfig
 

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

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 24 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 85 of file class.assMatchingQuestion.php.

References assQuestion\$author, assQuestion\$comment, $matching_type, assQuestion\$owner, assQuestion\$question, and assQuestion\$title.

92  {
93  parent::__construct($title, $comment, $author, $owner, $question);
94  $this->matchingpairs = array();
95  $this->matching_type = $matching_type;
96  $this->terms = array();
97  $this->definitions = array();
98  }

Member Function Documentation

◆ addDefinition()

assMatchingQuestion::addDefinition (   $definition)

Adds a definition.

Parameters
object$definitionThe definition
See also
$definitions

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

741  {
742  array_push($this->definitions, $definition);
743  }

◆ 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 574 of file class.assMatchingQuestion.php.

References assQuestion\$points.

575  {
576  require_once './Modules/TestQuestionPool/classes/class.assAnswerMatchingPair.php';
577  require_once './Modules/TestQuestionPool/classes/class.assAnswerMatchingTerm.php';
578  require_once './Modules/TestQuestionPool/classes/class.assAnswerMatchingDefinition.php';
579  if (is_null($term)) {
580  $term = new assAnswerMatchingTerm();
581  }
582  if (is_null($definition)) {
583  $definition = new assAnswerMatchingDefinition();
584  }
585  $pair = new assAnswerMatchingPair($term, $definition, $points);
586  array_push($this->matchingpairs, $pair);
587  }
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 729 of file class.assMatchingQuestion.php.

730  {
731  array_push($this->terms, $term);
732  }

◆ afterSyncWithOriginal()

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

{}

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

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

1594  {
1595  parent::afterSyncWithOriginal($origQuestionId, $dupQuestionId, $origParentObjId, $dupParentObjId);
1596 
1597  $origImagePath = $this->buildImagePath($origQuestionId, $origParentObjId);
1598  $dupImagePath = $this->buildImagePath($dupQuestionId, $dupParentObjId);
1599 
1600  ilUtil::delDir($origImagePath);
1601  if (is_dir($dupImagePath)) {
1602  ilUtil::makeDirParents($origImagePath);
1603  ilUtil::rCopy($dupImagePath, $origImagePath);
1604  }
1605  }
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 851 of file class.assMatchingQuestion.php.

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

Referenced by getExpressionTypes().

852  {
853  if ($returndetails) {
854  throw new ilTestException('return details not implemented for ' . __METHOD__);
855  }
856 
857  global $DIC;
858  $ilDB = $DIC['ilDB'];
859 
860  $found_values = array();
861  if (is_null($pass)) {
862  $pass = $this->getSolutionMaxPass($active_id);
863  }
864  $result = $this->getCurrentSolutionResultSet($active_id, $pass, $authorizedSolution);
865  while ($data = $ilDB->fetchAssoc($result)) {
866  if (strcmp($data["value1"], "") != 0) {
867  if (!isset($found_values[$data['value2']])) {
868  $found_values[$data['value2']] = array();
869  }
870 
871  $found_values[$data['value2']][] = $data['value1'];
872  }
873  }
874 
875  $points = $this->calculateReachedPointsForSolution($found_values);
876 
877  return $points;
878  }
$result
global $DIC
Definition: saml.php:7
getSolutionMaxPass($active_id)
Returns the maximum pass a users question solution.
calculateReachedPointsForSolution($found_values)
Base Exception for all Exceptions relating to Modules/Test.
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...
$data
Definition: bench.php:6
+ 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 1462 of file class.assMatchingQuestion.php.

References assQuestion\$points, and $terms.

Referenced by calculateReachedPoints().

1463  {
1464  $points = 0;
1465  foreach ($found_values as $definition => $terms) {
1466  foreach ($terms as $term) {
1467  foreach ($this->matchingpairs as $pair) {
1468  if ($pair->definition->identifier == $definition && $pair->term->identifier == $term) {
1469  $points += $pair->points;
1470  }
1471  }
1472  }
1473  }
1474  return $points;
1475  }
+ Here is the caller graph for this function:

◆ checkSubmittedMatchings()

assMatchingQuestion::checkSubmittedMatchings (   $submittedMatchings)
private

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

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

Referenced by savePreviewData(), and saveWorkingData().

1066  {
1067  if ($this->getMatchingMode() == self::MATCHING_MODE_N_ON_N) {
1068  return true;
1069  }
1070 
1071  $handledTerms = array();
1072 
1073  foreach ($submittedMatchings as $definition => $terms) {
1074  if (count($terms) > 1) {
1075  ilUtil::sendFailure($this->lng->txt("multiple_matching_values_selected"), true);
1076  return false;
1077  }
1078 
1079  foreach ($terms as $i => $term) {
1080  if (isset($handledTerms[$term])) {
1081  ilUtil::sendFailure($this->lng->txt("duplicate_matching_values_selected"), true);
1082  return false;
1083  }
1084 
1085  $handledTerms[$term] = $term;
1086  }
1087  }
1088 
1089  return true;
1090  }
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$i
Definition: disco.tpl.php:19
+ 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 488 of file class.assMatchingQuestion.php.

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

489  {
490  global $DIC;
491  $ilLog = $DIC['ilLog'];
492 
493  $imagepath = $this->getImagePath();
494  $imagepath_original = str_replace("/$this->id/images", "/$question_id/images", $imagepath);
495  $imagepath_original = str_replace("/$this->obj_id/", "/$source_questionpool/", $imagepath_original);
496  foreach ($this->terms as $term) {
497  if (strlen($term->picture)) {
498  if (!file_exists($imagepath)) {
499  ilUtil::makeDirParents($imagepath);
500  }
501  $filename = $term->picture;
502  if (!@copy($imagepath_original . $filename, $imagepath . $filename)) {
503  $ilLog->write("matching question image could not be copied: $imagepath_original$filename");
504  }
505  if (!@copy($imagepath_original . $this->getThumbPrefix() . $filename, $imagepath . $this->getThumbPrefix() . $filename)) {
506  $ilLog->write("matching question image thumbnail could not be copied: $imagepath_original" . $this->getThumbPrefix() . $filename);
507  }
508  }
509  }
510  foreach ($this->definitions as $definition) {
511  if (strlen($definition->picture)) {
512  $filename = $definition->picture;
513  if (!file_exists($imagepath)) {
514  ilUtil::makeDirParents($imagepath);
515  }
516 
517  if (assQuestion::isFileAvailable($imagepath_original . $filename)) {
518  copy($imagepath_original . $filename, $imagepath . $filename);
519  } else {
520  $ilLog->write("matching question image could not be copied: $imagepath_original$filename");
521  }
522 
523  if (assQuestion::isFileAvailable($imagepath_original . $this->getThumbPrefix() . $filename)) {
524  copy($imagepath_original . $this->getThumbPrefix() . $filename, $imagepath . $this->getThumbPrefix() . $filename);
525  } else {
526  $ilLog->write("matching question image thumbnail could not be copied: $imagepath_original" . $this->getThumbPrefix() . $filename);
527  }
528  }
529  }
530  }
static makeDirParents($a_dir)
Create a new directory and all parent directories.
static isFileAvailable($file)
global $DIC
Definition: saml.php:7
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:

◆ copyObject()

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

Copies an assMatchingQuestion.

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

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

380  {
381  if ($this->id <= 0) {
382  // The question has not been saved. It cannot be duplicated
383  return;
384  }
385  // duplicate the question in database
386  $clone = $this;
387  include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
389  $clone->id = -1;
390  $source_questionpool_id = $this->getObjId();
391  $clone->setObjId($target_questionpool_id);
392  if ($title) {
393  $clone->setTitle($title);
394  }
395  $clone->saveToDb();
396  // copy question page content
397  $clone->copyPageOfQuestion($original_id);
398  // copy XHTML media objects
399  $clone->copyXHTMLMediaObjectsOfQuestion($original_id);
400  // duplicate the image
401  $clone->copyImages($original_id, $source_questionpool_id);
402 
403  $clone->onCopy($source_questionpool_id, $original_id, $clone->getObjId(), $clone->getId());
404 
405  return $clone->id;
406  }
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 408 of file class.assMatchingQuestion.php.

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

409  {
410  if ($this->id <= 0) {
411  // The question has not been saved. It cannot be duplicated
412  return;
413  }
414 
415  include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
416 
417  $sourceQuestionId = $this->id;
418  $sourceParentId = $this->getObjId();
419 
420  // duplicate the question in database
421  $clone = $this;
422  $clone->id = -1;
423 
424  $clone->setObjId($targetParentId);
425 
426  if ($targetQuestionTitle) {
427  $clone->setTitle($targetQuestionTitle);
428  }
429 
430  $clone->saveToDb();
431  // copy question page content
432  $clone->copyPageOfQuestion($sourceQuestionId);
433  // copy XHTML media objects
434  $clone->copyXHTMLMediaObjectsOfQuestion($sourceQuestionId);
435  // duplicate the image
436  $clone->copyImages($sourceQuestionId, $sourceParentId);
437 
438  $clone->onCopy($sourceParentId, $sourceQuestionId, $clone->getObjId(), $clone->getId());
439 
440  return $clone->id;
441  }
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 823 of file class.assMatchingQuestion.php.

824  {
825  unset($this->definitions[$position]);
826  $this->definitions = array_values($this->definitions);
827  }

◆ 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 1002 of file class.assMatchingQuestion.php.

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

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

1003  {
1004  $deletename = $filename;
1005  $result = @unlink($this->getImagePath() . $deletename);
1006  $result = $result & @unlink($this->getImagePath() . $this->getThumbPrefix() . $deletename);
1007  return $result;
1008  }
$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 644 of file class.assMatchingQuestion.php.

References $index.

645  {
646  if ($index < 0) {
647  return;
648  }
649  if (count($this->matchingpairs) < 1) {
650  return;
651  }
652  if ($index >= count($this->matchingpairs)) {
653  return;
654  }
655  unset($this->matchingpairs[$index]);
656  $this->matchingpairs = array_values($this->matchingpairs);
657  }
$index
Definition: metadata.php:60

◆ deleteTerm()

assMatchingQuestion::deleteTerm (   $position)

Deletes a term.

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

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

812  {
813  unset($this->terms[$position]);
814  $this->terms = array_values($this->terms);
815  }

◆ duplicate()

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

Duplicates an assMatchingQuestion.

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

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

331  {
332  if ($this->id <= 0) {
333  // The question has not been saved. It cannot be duplicated
334  return;
335  }
336  // duplicate the question in database
337  $this_id = $this->getId();
338  $thisObjId = $this->getObjId();
339 
340  $clone = $this;
341  include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
343  $clone->id = -1;
344 
345  if ((int) $testObjId > 0) {
346  $clone->setObjId($testObjId);
347  }
348 
349  if ($title) {
350  $clone->setTitle($title);
351  }
352  if ($author) {
353  $clone->setAuthor($author);
354  }
355  if ($owner) {
356  $clone->setOwner($owner);
357  }
358  if ($for_test) {
359  $clone->saveToDb($original_id);
360  } else {
361  $clone->saveToDb();
362  }
363 
364  // copy question page content
365  $clone->copyPageOfQuestion($this_id);
366  // copy XHTML media objects
367  $clone->copyXHTMLMediaObjectsOfQuestion($this_id);
368  // duplicate the image
369  $clone->duplicateImages($this_id, $thisObjId, $clone->getId(), $testObjId);
370 
371  $clone->onDuplicate($thisObjId, $this_id, $clone->getObjId(), $clone->getId());
372 
373  return $clone->id;
374  }
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 443 of file class.assMatchingQuestion.php.

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

444  {
445  global $DIC;
446  $ilLog = $DIC['ilLog'];
447  $imagepath = $this->getImagePath();
448  $imagepath_original = str_replace("/$this->id/images", "/$question_id/images", $imagepath);
449 
450  if ((int) $objectId > 0) {
451  $imagepath_original = str_replace("/$this->obj_id/", "/$objectId/", $imagepath_original);
452  }
453 
454  foreach ($this->terms as $term) {
455  if (strlen($term->picture)) {
456  $filename = $term->picture;
457  if (!file_exists($imagepath)) {
458  ilUtil::makeDirParents($imagepath);
459  }
460  if (!@copy($imagepath_original . $filename, $imagepath . $filename)) {
461  $ilLog->write("matching question image could not be duplicated: $imagepath_original$filename");
462  }
463  if (@file_exists($imagepath_original . $this->getThumbPrefix() . $filename)) {
464  if (!@copy($imagepath_original . $this->getThumbPrefix() . $filename, $imagepath . $this->getThumbPrefix() . $filename)) {
465  $ilLog->write("matching question image thumbnail could not be duplicated: $imagepath_original" . $this->getThumbPrefix() . $filename);
466  }
467  }
468  }
469  }
470  foreach ($this->definitions as $definition) {
471  if (strlen($definition->picture)) {
472  $filename = $definition->picture;
473  if (!file_exists($imagepath)) {
474  ilUtil::makeDirParents($imagepath);
475  }
476  if (!@copy($imagepath_original . $filename, $imagepath . $filename)) {
477  $ilLog->write("matching question image could not be duplicated: $imagepath_original$filename");
478  }
479  if (@file_exists($imagepath_original . $this->getThumbPrefix() . $filename)) {
480  if (!@copy($imagepath_original . $this->getThumbPrefix() . $filename, $imagepath . $this->getThumbPrefix() . $filename)) {
481  $ilLog->write("matching question image thumbnail could not be duplicated: $imagepath_original" . $this->getThumbPrefix() . $filename);
482  }
483  }
484  }
485  }
486  }
static makeDirParents($a_dir)
Create a new directory and all parent directories.
global $DIC
Definition: saml.php:7
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:

◆ fetchIndexedValuesFromValuePairs()

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

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

946  {
947  $indexedValues = array();
948 
949  foreach ($valuePairs as $valuePair) {
950  if (!isset($indexedValues[$valuePair['value2']])) {
951  $indexedValues[$valuePair['value2']] = array();
952  }
953 
954  $indexedValues[$valuePair['value2']][] = $valuePair['value1'];
955  }
956 
957  return $indexedValues;
958  }

◆ fetchSubmittedMatchingsFromPost()

assMatchingQuestion::fetchSubmittedMatchingsFromPost ( )
private

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

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

Referenced by savePreviewData(), and saveWorkingData().

1043  {
1044  $postData = $_POST['matching'][$this->getId()];
1045 
1046  $matchings = array();
1047 
1048  foreach ($this->getDefinitions() as $definition) {
1049  if (isset($postData[$definition->identifier])) {
1050  foreach ($this->getTerms() as $term) {
1051  if (isset($postData[$definition->identifier][$term->identifier])) {
1052  if (!is_array($postData[$definition->identifier])) {
1053  $postData[$definition->identifier] = array();
1054  }
1055 
1056  $matchings[$definition->identifier][] = $term->identifier;
1057  }
1058  }
1059  }
1060  }
1061 
1062  return $matchings;
1063  }
getId()
Gets the id of the assQuestion object.
getDefinitions()
Returns the definitions of the matching question.
if($session===NULL) $postData
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 800 of file class.assMatchingQuestion.php.

801  {
802  $this->definitions = array();
803  }

◆ flushMatchingPairs()

assMatchingQuestion::flushMatchingPairs ( )

Deletes all matching pairs.

See also
$matchingpairs

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

664  {
665  $this->matchingpairs = array();
666  }

◆ flushTerms()

assMatchingQuestion::flushTerms ( )

Deletes all terms.

See also
$terms

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

792  {
793  $this->terms = array();
794  }

◆ generateThumbForFile()

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

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

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

Referenced by rebuildThumbnails().

1330  {
1331  $filename = $path . $file;
1332  if (@file_exists($filename)) {
1333  $thumbpath = $path . $this->getThumbPrefix() . $file;
1334  $path_info = @pathinfo($filename);
1335  $ext = "";
1336  switch (strtoupper($path_info['extension'])) {
1337  case 'PNG':
1338  $ext = 'PNG';
1339  break;
1340  case 'GIF':
1341  $ext = 'GIF';
1342  break;
1343  default:
1344  $ext = 'JPEG';
1345  break;
1346  }
1347  ilUtil::convertImage($filename, $thumbpath, $ext, $this->getThumbGeometry());
1348  }
1349  }
getThumbGeometry()
Get the thumbnail geometry.
$path
Definition: aliased.php:25
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 1206 of file class.assMatchingQuestion.php.

Referenced by saveAdditionalQuestionDataToDb().

1207  {
1208  return "qpl_qst_matching";
1209  }
+ 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 1216 of file class.assMatchingQuestion.php.

1217  {
1218  return array("qpl_a_matching", "qpl_a_mterm");
1219  }

◆ 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 1581 of file class.assMatchingQuestion.php.

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

1582  {
1583  if ($index !== null) {
1584  return $this->getMatchingPair($index);
1585  } else {
1586  return $this->getMatchingPairs();
1587  }
1588  }
$index
Definition: metadata.php:60
getMatchingPair($index=0)
Returns a matching pair with a given index.
& 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 718 of file class.assMatchingQuestion.php.

719  {
720  return count($this->definitions);
721  }

◆ getDefinitions()

assMatchingQuestion::getDefinitions ( )

Returns the definitions of the matching question.

Returns
array An array containing the definitions
See also
$terms

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

References $definitions.

Referenced by fetchSubmittedMatchingsFromPost(), and toJSON().

697  {
698  return $this->definitions;
699  }
+ Here is the caller graph for this function:

◆ getDefinitionWithIdentifier()

assMatchingQuestion::getDefinitionWithIdentifier (   $a_identifier)

Returns a definition with a given identifier.

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

606  {
607  foreach ($this->definitions as $definition) {
608  if ($definition->identifier == $a_identifier) {
609  return $definition;
610  }
611  }
612  return null;
613  }

◆ 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 968 of file class.assMatchingQuestion.php.

References $filename.

969  {
970  $extension = "";
971  if (preg_match("/.*\\.(\\w+)$/", $filename, $matches)) {
972  $extension = $matches[1];
973  }
974  return md5($filename) . "." . $extension;
975  }
$filename
Definition: buildRTE.php:89

◆ getExpressionTypes()

◆ getMatchingMode()

assMatchingQuestion::getMatchingMode ( )

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

References $matchingMode.

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

1454  {
1455  return $this->matchingMode;
1456  }
+ 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 623 of file class.assMatchingQuestion.php.

References $index.

Referenced by getAvailableAnswerOptions().

624  {
625  if ($index < 0) {
626  return null;
627  }
628  if (count($this->matchingpairs) < 1) {
629  return null;
630  }
631  if ($index >= count($this->matchingpairs)) {
632  return null;
633  }
634  return $this->matchingpairs[$index];
635  }
$index
Definition: metadata.php:60
+ 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 674 of file class.assMatchingQuestion.php.

675  {
676  return count($this->matchingpairs);
677  }

◆ getMatchingPairs()

& assMatchingQuestion::getMatchingPairs ( )

Returns the matchingpairs array.

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

References $matchingpairs.

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

1234  {
1235  return $this->matchingpairs;
1236  }
+ 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 883 of file class.assMatchingQuestion.php.

References assQuestion\$points, and getMaximumScoringMatchingPairs().

Referenced by getExpressionTypes(), and isComplete().

884  {
885  $points = 0;
886 
887  foreach ($this->getMaximumScoringMatchingPairs() as $pair) {
888  $points += $pair->points;
889  }
890 
891  return $points;
892  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMaximumScoringMatchingPairs()

assMatchingQuestion::getMaximumScoringMatchingPairs ( )

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

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

Referenced by getMaximumPoints().

895  {
896  if ($this->getMatchingMode() == self::MATCHING_MODE_N_ON_N) {
897  return $this->getPositiveScoredMatchingPairs();
898  } elseif ($this->getMatchingMode() == self::MATCHING_MODE_1_ON_1) {
900  }
901 
902  return array();
903  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMostPositiveScoredUniqueTermMatchingPairs()

assMatchingQuestion::getMostPositiveScoredUniqueTermMatchingPairs ( )
private

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

Referenced by getMaximumScoringMatchingPairs().

921  {
922  $matchingPairsByDefinition = array();
923 
924  foreach ($this->matchingpairs as $pair) {
925  if ($pair->points <= 0) {
926  continue;
927  }
928 
929  $defId = $pair->definition->identifier;
930 
931  if (!isset($matchingPairsByDefinition[$defId])) {
932  $matchingPairsByDefinition[$defId] = $pair;
933  } elseif ($pair->points > $matchingPairsByDefinition[$defId]->points) {
934  $matchingPairsByDefinition[$defId] = $pair;
935  }
936  }
937 
938  return $matchingPairsByDefinition;
939  }
+ 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 1485 of file class.assMatchingQuestion.php.

References ilOperatorsExpressionMapping\getOperatorsByExpression().

1486  {
1487  require_once "./Modules/TestQuestionPool/classes/class.ilOperatorsExpressionMapping.php";
1489  }
+ Here is the call graph for this function:

◆ getPositiveScoredMatchingPairs()

assMatchingQuestion::getPositiveScoredMatchingPairs ( )
private

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

Referenced by getMaximumScoringMatchingPairs().

906  {
907  $matchingPairs = array();
908 
909  foreach ($this->matchingpairs as $pair) {
910  if ($pair->points <= 0) {
911  continue;
912  }
913 
914  $matchingPairs[] = $pair;
915  }
916 
917  return $matchingPairs;
918  }
+ 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 1196 of file class.assMatchingQuestion.php.

Referenced by toJSON().

1197  {
1198  return "assMatchingQuestion";
1199  }
+ Here is the caller graph for this function:

◆ getRandomId()

assMatchingQuestion::getRandomId ( )

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

References $key.

1154  {
1155  mt_srand((double) microtime() * 1000000);
1156  $random_number = mt_rand(1, 100000);
1157  $found = false;
1158  while ($found) {
1159  $found = false;
1160  foreach ($this->matchingpairs as $key => $pair) {
1161  if (($pair->term->identifier == $random_number) || ($pair->definition->identifier == $random_number)) {
1162  $found = true;
1163  $random_number++;
1164  }
1165  }
1166  }
1167  return $random_number;
1168  }
$key
Definition: croninfo.php:18

◆ 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 1225 of file class.assMatchingQuestion.php.

1226  {
1227  return parent::getRTETextWithMediaObjects();
1228  }

◆ getTermCount()

assMatchingQuestion::getTermCount ( )

Returns the number of terms.

Returns
integer The number of terms
See also
$terms

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

708  {
709  return count($this->terms);
710  }

◆ getTerms()

assMatchingQuestion::getTerms ( )

Returns the terms of the matching question.

Returns
array An array containing the terms
See also
$terms

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

References $terms.

Referenced by fetchSubmittedMatchingsFromPost(), and toJSON().

686  {
687  return $this->terms;
688  }
+ Here is the caller graph for this function:

◆ getTermWithIdentifier()

assMatchingQuestion::getTermWithIdentifier (   $a_identifier)

Returns a term with a given identifier.

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

593  {
594  foreach ($this->terms as $term) {
595  if ($term->identifier == $a_identifier) {
596  return $term;
597  }
598  }
599  return null;
600  }

◆ getThumbGeometry()

assMatchingQuestion::getThumbGeometry ( )

Get the thumbnail geometry.

Returns
integer Geometry

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

References $thumb_geometry.

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

1283  {
1284  return $this->thumb_geometry;
1285  }
+ Here is the caller graph for this function:

◆ getThumbPrefix()

assMatchingQuestion::getThumbPrefix ( )

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

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

1325  {
1326  return "thumb.";
1327  }
+ Here is the caller graph for this function:

◆ getThumbSize()

assMatchingQuestion::getThumbSize ( )

Get the thumbnail geometry.

Returns
integer Geometry

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

References getThumbGeometry().

1293  {
1294  return $this->getThumbGeometry();
1295  }
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 772 of file class.assMatchingQuestion.php.

773  {
774  if (is_null($definition)) {
775  include_once "./Modules/TestQuestionPool/classes/class.assAnswerMatchingDefinition.php";
776  $definition = new assAnswerMatchingDefinition();
777  }
778  if ($position < count($this->definitions)) {
779  $part1 = array_slice($this->definitions, 0, $position);
780  $part2 = array_slice($this->definitions, $position);
781  $this->definitions = array_merge($part1, array($definition), $part2);
782  } else {
783  array_push($this->definitions, $definition);
784  }
785  }
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 542 of file class.assMatchingQuestion.php.

References assQuestion\$points.

543  {
544  include_once "./Modules/TestQuestionPool/classes/class.assAnswerMatchingPair.php";
545  include_once "./Modules/TestQuestionPool/classes/class.assAnswerMatchingTerm.php";
546  include_once "./Modules/TestQuestionPool/classes/class.assAnswerMatchingDefinition.php";
547  if (is_null($term)) {
548  $term = new assAnswerMatchingTerm();
549  }
550  if (is_null($definition)) {
551  $definition = new assAnswerMatchingDefinition();
552  }
553  $pair = new assAnswerMatchingPair($term, $definition, $points);
554  if ($position < count($this->matchingpairs)) {
555  $part1 = array_slice($this->matchingpairs, 0, $position);
556  $part2 = array_slice($this->matchingpairs, $position);
557  $this->matchingpairs = array_merge($part1, array($pair), $part2);
558  } else {
559  array_push($this->matchingpairs, $pair);
560  }
561  }
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 751 of file class.assMatchingQuestion.php.

752  {
753  if (is_null($term)) {
754  include_once "./Modules/TestQuestionPool/classes/class.assAnswerMatchingTerm.php";
755  $term = new assAnswerMatchingTerm();
756  }
757  if ($position < count($this->terms)) {
758  $part1 = array_slice($this->terms, 0, $position);
759  $part2 = array_slice($this->terms, $position);
760  $this->terms = array_merge($part1, array($term), $part2);
761  } else {
762  array_push($this->terms, $term);
763  }
764  }
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 105 of file class.assMatchingQuestion.php.

References getMaximumPoints().

106  {
107  if (strlen($this->title)
108  && $this->author
109  && $this->question
110  && count($this->matchingpairs)
111  && $this->getMaximumPoints() > 0
112  ) {
113  return true;
114  }
115  return false;
116  }
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 235 of file class.assMatchingQuestion.php.

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

236  {
237  global $DIC;
238  $ilDB = $DIC['ilDB'];
239 
240  $query = "
241  SELECT qpl_questions.*,
242  {$this->getAdditionalTableName()}.*
243  FROM qpl_questions
244  LEFT JOIN {$this->getAdditionalTableName()}
245  ON {$this->getAdditionalTableName()}.question_fi = qpl_questions.question_id
246  WHERE qpl_questions.question_id = %s
247  ";
248 
249  $result = $ilDB->queryF(
250  $query,
251  array('integer'),
252  array($question_id)
253  );
254 
255  if ($result->numRows() == 1) {
256  $data = $ilDB->fetchAssoc($result);
257  $this->setId($question_id);
258  $this->setObjId($data["obj_fi"]);
259  $this->setTitle($data["title"]);
260  $this->setComment($data["description"]);
261  $this->setOriginalId($data["original_id"]);
262  $this->setNrOfTries($data['nr_of_tries']);
263  $this->setAuthor($data["author"]);
264  $this->setPoints($data["points"]);
265  $this->setOwner($data["owner"]);
266  include_once("./Services/RTE/classes/class.ilRTE.php");
267  $this->setQuestion(ilRTE::_replaceMediaObjectImageSrc($data["question_text"], 1));
268  $this->setThumbGeometry($data["thumb_geometry"]);
269  $this->setShuffle($data["shuffle"]);
270  $this->setMatchingMode($data['matching_mode'] === null ? self::MATCHING_MODE_1_ON_1 : $data['matching_mode']);
271  $this->setEstimatedWorkingTime(substr($data["working_time"], 0, 2), substr($data["working_time"], 3, 2), substr($data["working_time"], 6, 2));
272 
273  try {
274  $this->setAdditionalContentEditingMode($data['add_cont_edit_mode']);
275  } catch (ilTestQuestionPoolException $e) {
276  }
277  }
278 
279  $termids = array();
280  $result = $ilDB->queryF(
281  "SELECT * FROM qpl_a_mterm WHERE question_fi = %s ORDER BY term_id ASC",
282  array('integer'),
283  array($question_id)
284  );
285  include_once "./Modules/TestQuestionPool/classes/class.assAnswerMatchingTerm.php";
286  $this->terms = array();
287  if ($result->numRows() > 0) {
288  while ($data = $ilDB->fetchAssoc($result)) {
289  $term = new assAnswerMatchingTerm($data['term'], $data['picture'], $data['ident']);
290  array_push($this->terms, $term);
291  $termids[$data['term_id']] = $term;
292  }
293  }
294 
295  $definitionids = array();
296  $result = $ilDB->queryF(
297  "SELECT * FROM qpl_a_mdef WHERE question_fi = %s ORDER BY def_id ASC",
298  array('integer'),
299  array($question_id)
300  );
301  include_once "./Modules/TestQuestionPool/classes/class.assAnswerMatchingDefinition.php";
302  $this->definitions = array();
303  if ($result->numRows() > 0) {
304  while ($data = $ilDB->fetchAssoc($result)) {
305  $definition = new assAnswerMatchingDefinition($data['definition'], $data['picture'], $data['ident']);
306  array_push($this->definitions, $definition);
307  $definitionids[$data['def_id']] = $definition;
308  }
309  }
310 
311  $this->matchingpairs = array();
312  $result = $ilDB->queryF(
313  "SELECT * FROM qpl_a_matching WHERE question_fi = %s ORDER BY answer_id",
314  array('integer'),
315  array($question_id)
316  );
317  include_once "./Modules/TestQuestionPool/classes/class.assAnswerMatchingPair.php";
318  if ($result->numRows() > 0) {
319  while ($data = $ilDB->fetchAssoc($result)) {
320  array_push($this->matchingpairs, new assAnswerMatchingPair($termids[$data['term_fi']], $definitionids[$data['definition_fi']], $data['points']));
321  }
322  }
323  parent::loadFromDb($question_id);
324  }
Class for matching question terms.
Class for matching question pairs.
$result
global $DIC
Definition: saml.php:7
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.
$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.
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.
$data
Definition: bench.php:6
+ Here is the call graph for this function:

◆ rebuildThumbnails()

assMatchingQuestion::rebuildThumbnails ( )

Rebuild the thumbnail images with a new thumbnail size.

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

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

Referenced by saveAnswerSpecificDataToDb().

1311  {
1312  foreach ($this->terms as $term) {
1313  if (strlen($term->picture)) {
1314  $this->generateThumbForFile($this->getImagePath(), $term->picture);
1315  }
1316  }
1317  foreach ($this->definitions as $definition) {
1318  if (strlen($definition->picture)) {
1319  $this->generateThumbForFile($this->getImagePath(), $definition->picture);
1320  }
1321  }
1322  }
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 986 of file class.assMatchingQuestion.php.

References $index, and deleteImagefile().

987  {
988  $definition = $this->definitions[$index];
989  if (is_object($definition)) {
990  $this->deleteImagefile($definition->picture);
991  $definition->picture = null;
992  }
993  }
deleteImagefile($filename)
Deletes an imagefile from the system if the file is deleted manually.
$index
Definition: metadata.php:60
+ Here is the call graph for this function:

◆ removeTermImage()

assMatchingQuestion::removeTermImage (   $index)

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

References $index, and deleteImagefile().

978  {
979  $term = $this->terms[$index];
980  if (is_object($term)) {
981  $this->deleteImagefile($term->picture);
982  $term->picture = null;
983  }
984  }
deleteImagefile($filename)
Deletes an imagefile from the system if the file is deleted manually.
$index
Definition: metadata.php:60
+ 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 207 of file class.assMatchingQuestion.php.

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

Referenced by saveToDb().

208  {
209  global $DIC;
210  $ilDB = $DIC['ilDB'];
211 
212  // save additional data
213 
214  $ilDB->manipulateF(
215  "DELETE FROM " . $this->getAdditionalTableName() . " WHERE question_fi = %s",
216  array( "integer" ),
217  array( $this->getId() )
218  );
219 
220  $ilDB->insert($this->getAdditionalTableName(), array(
221  'question_fi' => array('integer', $this->getId()),
222  'shuffle' => array('text', $this->shuffle),
223  'matching_type' => array('text', $this->matching_type),
224  'thumb_geometry' => array('integer', $this->getThumbGeometry()),
225  'matching_mode' => array('text', $this->getMatchingMode())
226  ));
227  }
getThumbGeometry()
Get the thumbnail geometry.
getId()
Gets the id of the assQuestion object.
global $DIC
Definition: saml.php:7
getAdditionalTableName()
Returns the name of the additional question data table in the database.
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 137 of file class.assMatchingQuestion.php.

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

Referenced by saveToDb().

138  {
139  global $DIC;
140  $ilDB = $DIC['ilDB'];
141  // delete old terms
142  $ilDB->manipulateF(
143  "DELETE FROM qpl_a_mterm WHERE question_fi = %s",
144  array( 'integer' ),
145  array( $this->getId() )
146  );
147 
148  // delete old definitions
149  $ilDB->manipulateF(
150  "DELETE FROM qpl_a_mdef WHERE question_fi = %s",
151  array( 'integer' ),
152  array( $this->getId() )
153  );
154 
155  $termids = array();
156  // write terms
157  foreach ($this->terms as $key => $term) {
158  $next_id = $ilDB->nextId('qpl_a_mterm');
159  $ilDB->insert('qpl_a_mterm', array(
160  'term_id' => array('integer', $next_id),
161  'question_fi' => array('integer', $this->getId()),
162  'picture' => array('text', $term->picture),
163  'term' => array('text', $term->text),
164  'ident' => array('integer', $term->identifier)
165  ));
166  $termids[$term->identifier] = $next_id;
167  }
168 
169  $definitionids = array();
170  // write definitions
171  foreach ($this->definitions as $key => $definition) {
172  $next_id = $ilDB->nextId('qpl_a_mdef');
173  $ilDB->insert('qpl_a_mdef', array(
174  'def_id' => array('integer', $next_id),
175  'question_fi' => array('integer', $this->getId()),
176  'picture' => array('text', $definition->picture),
177  'definition' => array('text', $definition->text),
178  'ident' => array('integer', $definition->identifier)
179  ));
180  $definitionids[$definition->identifier] = $next_id;
181  }
182 
183  $ilDB->manipulateF(
184  "DELETE FROM qpl_a_matching WHERE question_fi = %s",
185  array( 'integer' ),
186  array( $this->getId() )
187  );
188  $matchingpairs = $this->getMatchingPairs();
189  foreach ($matchingpairs as $key => $pair) {
190  $next_id = $ilDB->nextId('qpl_a_matching');
191  $ilDB->manipulateF(
192  "INSERT INTO qpl_a_matching (answer_id, question_fi, points, term_fi, definition_fi) VALUES (%s, %s, %s, %s, %s)",
193  array( 'integer', 'integer', 'float', 'integer', 'integer' ),
194  array(
195  $next_id,
196  $this->getId(),
197  $pair->points,
198  $termids[$pair->term->identifier],
199  $definitionids[$pair->definition->identifier]
200  )
201  );
202  }
203 
204  $this->rebuildThumbnails();
205  }
getId()
Gets the id of the assQuestion object.
global $DIC
Definition: saml.php:7
rebuildThumbnails()
Rebuild the thumbnail images with a new thumbnail size.
global $ilDB
& getMatchingPairs()
Returns the matchingpairs array.
$key
Definition: croninfo.php:18
+ 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 1144 of file class.assMatchingQuestion.php.

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

1145  {
1146  $submittedMatchings = $this->fetchSubmittedMatchingsFromPost();
1147 
1148  if ($this->checkSubmittedMatchings($submittedMatchings)) {
1149  $previewSession->setParticipantsSolution($submittedMatchings);
1150  }
1151  }
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 124 of file class.assMatchingQuestion.php.

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

125  {
126  global $DIC;
127  $ilDB = $DIC['ilDB'];
128 
132 
133 
134  parent::saveToDb($original_id);
135  }
saveAdditionalQuestionDataToDb()
Saves a record to the question types additional data table.
global $DIC
Definition: saml.php:7
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 1100 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().

1101  {
1102  global $DIC;
1103  $ilDB = $DIC['ilDB'];
1104 
1105  $submittedMatchings = $this->fetchSubmittedMatchingsFromPost();
1106  $submittedMatchingsValid = $this->checkSubmittedMatchings($submittedMatchings);
1107 
1108  $matchingsExist = false;
1109 
1110  if ($submittedMatchingsValid) {
1111  if (is_null($pass)) {
1112  include_once "./Modules/Test/classes/class.ilObjTest.php";
1113  $pass = ilObjTest::_getPass($active_id);
1114  }
1115 
1116  $this->getProcessLocker()->executeUserSolutionUpdateLockOperation(function () use (&$matchingsExist, $submittedMatchings, $active_id, $pass, $authorized) {
1117  $this->removeCurrentSolution($active_id, $pass, $authorized);
1118 
1119  foreach ($submittedMatchings as $definition => $terms) {
1120  foreach ($terms as $i => $term) {
1121  $this->saveCurrentSolution($active_id, $pass, $term, $definition, $authorized);
1122  $matchingsExist = true;
1123  }
1124  }
1125  });
1126 
1127  $saveWorkingDataResult = true;
1128  } else {
1129  $saveWorkingDataResult = false;
1130  }
1131 
1132  include_once("./Modules/Test/classes/class.ilObjAssessmentFolder.php");
1134  if ($matchingsExist) {
1135  assQuestion::logAction($this->lng->txtlng("assessment", "log_user_entered_values", ilObjAssessmentFolder::_getLogLanguage()), $active_id, $this->getId());
1136  } else {
1137  assQuestion::logAction($this->lng->txtlng("assessment", "log_user_not_entered_values", ilObjAssessmentFolder::_getLogLanguage()), $active_id, $this->getId());
1138  }
1139  }
1140 
1141  return $saveWorkingDataResult;
1142  }
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.
global $DIC
Definition: saml.php:7
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)
checkSubmittedMatchings($submittedMatchings)
removeCurrentSolution($active_id, $pass, $authorized=true)
global $ilDB
$i
Definition: disco.tpl.php:19
+ Here is the call graph for this function:

◆ setExportDetailsXLS()

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

{}

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

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

1242  {
1243  parent::setExportDetailsXLS($worksheet, $startrow, $active_id, $pass);
1244 
1245  $solutions = $this->getSolutionValues($active_id, $pass);
1246 
1247  $imagepath = $this->getImagePath();
1248  $i = 1;
1249  foreach ($solutions as $solution) {
1250  $matches_written = false;
1251  foreach ($this->getMatchingPairs() as $idx => $pair) {
1252  if (!$matches_written) {
1253  $worksheet->setCell($startrow + $i, 1, $this->lng->txt("matches"));
1254  }
1255  $matches_written = true;
1256  if ($pair->definition->identifier == $solution["value2"]) {
1257  if (strlen($pair->definition->text)) {
1258  $worksheet->setCell($startrow + $i, 0, $pair->definition->text);
1259  } else {
1260  $worksheet->setCell($startrow + $i, 0, $pair->definition->picture);
1261  }
1262  }
1263  if ($pair->term->identifier == $solution["value1"]) {
1264  if (strlen($pair->term->text)) {
1265  $worksheet->setCell($startrow + $i, 2, $pair->term->text);
1266  } else {
1267  $worksheet->setCell($startrow + $i, 2, $pair->term->picture);
1268  }
1269  }
1270  }
1271  $i++;
1272  }
1273 
1274  return $startrow + $i + 1;
1275  }
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.
$i
Definition: disco.tpl.php:19
& getMatchingPairs()
Returns the matchingpairs array.
+ 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 1018 of file class.assMatchingQuestion.php.

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

1019  {
1020  $result = true;
1021  if (strlen($image_tempfilename)) {
1022  $image_filename = str_replace(" ", "_", $image_filename);
1023  $imagepath = $this->getImagePath();
1024  if (!file_exists($imagepath)) {
1025  ilUtil::makeDirParents($imagepath);
1026  }
1027  $savename = $image_filename;
1028  if (!ilUtil::moveUploadedFile($image_tempfilename, $savename, $imagepath . $savename)) {
1029  $result = false;
1030  } else {
1031  // create thumbnail file
1032  $thumbpath = $imagepath . $this->getThumbPrefix() . $savename;
1033  ilUtil::convertImage($imagepath . $savename, $thumbpath, "JPEG", $this->getThumbGeometry());
1034  }
1035  if ($result && (strcmp($image_filename, $previous_filename) != 0) && (strlen($previous_filename))) {
1036  $this->deleteImagefile($previous_filename);
1037  }
1038  }
1039  return $result;
1040  }
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 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 1448 of file class.assMatchingQuestion.php.

References $matchingMode.

Referenced by loadFromDb().

1449  {
1450  $this->matchingMode = $matchingMode;
1451  }
+ 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 1176 of file class.assMatchingQuestion.php.

References assQuestion\$shuffle.

Referenced by loadFromDb().

1177  {
1178  switch ($shuffle) {
1179  case 0:
1180  case 1:
1181  case 2:
1182  case 3:
1183  $this->shuffle = $shuffle;
1184  break;
1185  default:
1186  $this->shuffle = 1;
1187  break;
1188  }
1189  }
+ 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 836 of file class.assMatchingQuestion.php.

References $index.

837  {
838  $this->terms[$index] = $term;
839  }
$index
Definition: metadata.php:60

◆ setThumbGeometry()

assMatchingQuestion::setThumbGeometry (   $a_geometry)

Set the thumbnail geometry.

Parameters
integer$a_geometryGeometry

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

Referenced by loadFromDb().

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

◆ supportsJavascriptOutput()

assMatchingQuestion::supportsJavascriptOutput ( )

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

1439  {
1440  return true;
1441  }

◆ supportsNonJsOutput()

assMatchingQuestion::supportsNonJsOutput ( )

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

1444  {
1445  return false;
1446  }

◆ toJSON()

assMatchingQuestion::toJSON ( )

Returns a JSON representation of the question TODO.

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

References $def, $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().

1356  {
1357  $result = array();
1358 
1359  $result['id'] = (int) $this->getId();
1360  $result['type'] = (string) $this->getQuestionType();
1361  $result['title'] = (string) $this->getTitle();
1362  $result['question'] = $this->formatSAQuestion($this->getQuestion());
1363  $result['nr_of_tries'] = (int) $this->getNrOfTries();
1364  $result['matching_mode'] = $this->getMatchingMode();
1365  $result['shuffle'] = true;
1366  $result['feedback'] = array(
1367  'onenotcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), false)),
1368  'allcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), true))
1369  );
1370 
1371  require_once 'Services/Randomization/classes/class.ilArrayElementShuffler.php';
1372  $this->setShuffler(new ilArrayElementShuffler());
1373  $seed = $this->getShuffler()->getSeed();
1374 
1375  $terms = array();
1376  $this->getShuffler()->setSeed($this->getShuffler()->buildSeedFromString($seed . 'terms'));
1377  foreach ($this->getShuffler()->shuffle($this->getTerms()) as $term) {
1378  $terms[] = array(
1379  "text" => $this->formatSAQuestion($term->text),
1380  "id" => (int) $this->getId() . $term->identifier
1381  );
1382  }
1383  $result['terms'] = $terms;
1384 
1385  // alex 9.9.2010 as a fix for bug 6513 I added the question id
1386  // to the "def_id" in the array. The $pair->definition->identifier is not
1387  // unique, since it gets it value from the morder table field
1388  // this value is not changed, when a question is copied.
1389  // thus copying the same question on a page results in problems
1390  // when the second one (the copy) is answered.
1391 
1392  $definitions = array();
1393  $this->getShuffler()->setSeed($this->getShuffler()->buildSeedFromString($seed . 'definitions'));
1394  foreach ($this->getShuffler()->shuffle($this->getDefinitions()) as $def) {
1395  $definitions[] = array(
1396  "text" => $this->formatSAQuestion((string) $def->text),
1397  "id" => (int) $this->getId() . $def->identifier
1398  );
1399  }
1400  $result['definitions'] = $definitions;
1401 
1402  // #10353
1403  $matchings = array();
1404  foreach ($this->getMatchingPairs() as $pair) {
1405  // fau: fixLmMatchingPoints - ignore matching pairs with 0 or negative points
1406  if ($pair->points <= 0) {
1407  continue;
1408  }
1409  // fau.
1410 
1411  $pid = $pair->definition->identifier;
1412  if ($this->getMatchingMode() == self::MATCHING_MODE_N_ON_N) {
1413  $pid .= '::' . $pair->term->identifier;
1414  }
1415 
1416  if (!isset($matchings[$pid]) || $matchings[$pid]["points"] < $pair->points) {
1417  $matchings[$pid] = array(
1418  "term_id" => (int) $this->getId() . $pair->term->identifier,
1419  "def_id" => (int) $this->getId() . $pair->definition->identifier,
1420  "points" => (int) $pair->points
1421  );
1422  }
1423  }
1424 
1425  $result['matchingPairs'] = array_values($matchings);
1426 
1427  $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $this->getId());
1428  $result['mobs'] = $mobs;
1429 
1430  global $DIC;
1431  $lng = $DIC['lng'];
1432  $lng->loadLanguageModule('assessment');
1433  $result['reset_button_label'] = $lng->txt("reset_terms");
1434 
1435  return json_encode($result);
1436  }
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
global $DIC
Definition: saml.php:7
getQuestionType()
Returns the question type of the question.
getDefinitions()
Returns the definitions of the matching question.
$mobs
getQuestion()
Gets the question string of the question object.
getTerms()
Returns the terms of the matching question.
$def
Definition: croninfo.php:21
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 51 of file class.assMatchingQuestion.php.

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

◆ $element_height

assMatchingQuestion::$element_height

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

◆ $matching_type

assMatchingQuestion::$matching_type

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

Referenced by __construct().

◆ $matchingMode

assMatchingQuestion::$matchingMode = self::MATCHING_MODE_1_ON_1
protected

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

Referenced by getMatchingMode(), and setMatchingMode().

◆ $matchingpairs

assMatchingQuestion::$matchingpairs

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

Referenced by getMatchingPairs(), and saveAnswerSpecificDataToDb().

◆ $terms

assMatchingQuestion::$terms
protected

◆ $thumb_geometry

assMatchingQuestion::$thumb_geometry = 100

Definition at line 57 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: