ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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)
 
 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...
 
- 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)
 
 reworkWorkingData ($active_id, $pass, $obligationsAnswered, $authorized)
 {} More...
 
 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)
 
 reworkWorkingData ($active_id, $pass, $obligationsAnswered, $authorized)
 Reworks the allready saved working data if neccessary. More...
 
 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)
 
 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, assQuestion\$title, and array.

93  {
94  parent::__construct($title, $comment, $author, $owner, $question);
95  $this->matchingpairs = array();
96  $this->matching_type = $matching_type;
97  $this->terms = array();
98  $this->definitions = array();
99  }
Create styles array
The data for the language used.

Member Function Documentation

◆ addDefinition()

assMatchingQuestion::addDefinition (   $definition)

Adds a definition.

Parameters
object$definitionThe definition
See also
$definitions

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

784  {
785  array_push($this->definitions, $definition);
786  }

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

References assQuestion\$points.

612  {
613  require_once './Modules/TestQuestionPool/classes/class.assAnswerMatchingPair.php';
614  require_once './Modules/TestQuestionPool/classes/class.assAnswerMatchingTerm.php';
615  require_once './Modules/TestQuestionPool/classes/class.assAnswerMatchingDefinition.php';
616  if (is_null($term))
617  {
618  $term = new assAnswerMatchingTerm();
619  }
620  if (is_null($definition))
621  {
622  $definition = new assAnswerMatchingDefinition();
623  }
624  $pair = new assAnswerMatchingPair($term, $definition, $points);
625  array_push($this->matchingpairs, $pair);
626  }
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 772 of file class.assMatchingQuestion.php.

773  {
774  array_push($this->terms, $term);
775  }

◆ afterSyncWithOriginal()

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

{}

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

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

1731  {
1732  parent::afterSyncWithOriginal($origQuestionId, $dupQuestionId, $origParentObjId, $dupParentObjId);
1733 
1734  $origImagePath = $this->buildImagePath($origQuestionId, $origParentObjId);
1735  $dupImagePath = $this->buildImagePath($dupQuestionId, $dupParentObjId);
1736 
1737  ilUtil::delDir($origImagePath);
1738  if(is_dir($dupImagePath))
1739  {
1740  ilUtil::makeDirParents($origImagePath);
1741  ilUtil::rCopy($dupImagePath, $origImagePath);
1742  }
1743  }
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 902 of file class.assMatchingQuestion.php.

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

Referenced by getExpressionTypes().

903  {
904  if( $returndetails )
905  {
906  throw new ilTestException('return details not implemented for '.__METHOD__);
907  }
908 
909  global $ilDB;
910 
911  $found_values = array();
912  if (is_null($pass))
913  {
914  $pass = $this->getSolutionMaxPass($active_id);
915  }
916  $result = $this->getCurrentSolutionResultSet($active_id, $pass, $authorizedSolution);
917  while ($data = $ilDB->fetchAssoc($result))
918  {
919  if (strcmp($data["value1"], "") != 0)
920  {
921  if( !isset($found_values[$data['value2']]) )
922  {
923  $found_values[$data['value2']] = array();
924  }
925 
926  $found_values[$data['value2']][] = $data['value1'];
927  }
928  }
929 
930  $points = $this->calculateReachedPointsForSolution($found_values);
931 
932  return $points;
933  }
$result
getSolutionMaxPass($active_id)
Returns the maximum pass a users question solution.
calculateReachedPointsForSolution($found_values)
Base Exception for all Exceptions relating to Modules/Test.
Create styles array
The data for the language used.
global $ilDB
getCurrentSolutionResultSet($active_id, $pass, $authorized=true)
Get a restulset for the current user solution for a this question by active_id and pass...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calculateReachedPointsForSolution()

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

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

References assQuestion\$points, and $terms.

Referenced by calculateReachedPoints().

1587  {
1588  $points = 0;
1589  foreach($found_values as $definition => $terms)
1590  {
1591  foreach($terms as $term)
1592  {
1593  foreach($this->matchingpairs as $pair)
1594  {
1595  if($pair->definition->identifier == $definition && $pair->term->identifier == $term)
1596  {
1597  $points += $pair->points;
1598  }
1599  }
1600  }
1601  }
1602  return $points;
1603  }
+ Here is the caller graph for this function:

◆ checkSubmittedMatchings()

assMatchingQuestion::checkSubmittedMatchings (   $submittedMatchings)
private

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

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

Referenced by savePreviewData(), and saveWorkingData().

1148  {
1149  if( $this->getMatchingMode() == self::MATCHING_MODE_N_ON_N )
1150  {
1151  return true;
1152  }
1153 
1154  $handledTerms = array();
1155 
1156  foreach( $submittedMatchings as $definition => $terms )
1157  {
1158  if( count($terms) > 1 )
1159  {
1160  ilUtil::sendFailure($this->lng->txt("multiple_matching_values_selected"), true);
1161  return false;
1162  }
1163 
1164  foreach( $terms as $i => $term )
1165  {
1166  if( isset($handledTerms[$term]) )
1167  {
1168  ilUtil::sendFailure($this->lng->txt("duplicate_matching_values_selected"), true);
1169  return false;
1170  }
1171 
1172  $handledTerms[$term] = $term;
1173  }
1174  }
1175 
1176  return true;
1177  }
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ 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 513 of file class.assMatchingQuestion.php.

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

514  {
515  global $ilLog;
516 
517  $imagepath = $this->getImagePath();
518  $imagepath_original = str_replace("/$this->id/images", "/$question_id/images", $imagepath);
519  $imagepath_original = str_replace("/$this->obj_id/", "/$source_questionpool/", $imagepath_original);
520  foreach ($this->terms as $term)
521  {
522  if (strlen($term->picture))
523  {
524  if (!file_exists($imagepath))
525  {
526  ilUtil::makeDirParents($imagepath);
527  }
528  $filename = $term->picture;
529  if (!@copy($imagepath_original . $filename, $imagepath . $filename))
530  {
531  $ilLog->write("matching question image could not be copied: $imagepath_original$filename");
532  }
533  if (!@copy($imagepath_original . $this->getThumbPrefix() . $filename, $imagepath . $this->getThumbPrefix() . $filename))
534  {
535  $ilLog->write("matching question image thumbnail could not be copied: $imagepath_original" . $this->getThumbPrefix() . $filename);
536  }
537  }
538  }
539  foreach ($this->definitions as $definition)
540  {
541  if (strlen($definition->picture))
542  {
543  $filename = $definition->picture;
544  if (!file_exists($imagepath))
545  {
546  ilUtil::makeDirParents($imagepath);
547  }
548 
549  if( assQuestion::isFileAvailable($imagepath_original . $filename) )
550  {
551  copy($imagepath_original . $filename, $imagepath . $filename);
552  }
553  else
554  {
555  $ilLog->write("matching question image could not be copied: $imagepath_original$filename");
556  }
557 
558  if( assQuestion::isFileAvailable($imagepath_original . $this->getThumbPrefix() . $filename) )
559  {
560  copy($imagepath_original . $this->getThumbPrefix() . $filename, $imagepath . $this->getThumbPrefix() . $filename);
561  }
562  else
563  {
564  $ilLog->write("matching question image thumbnail could not be copied: $imagepath_original" . $this->getThumbPrefix() . $filename);
565  }
566  }
567  }
568  }
static makeDirParents($a_dir)
Create a new directory and all parent directories.
static isFileAvailable($file)
getImagePath($question_id=null, $object_id=null)
Returns the image path for web accessable images of a question.
+ Here is the call graph for this function:

◆ copyObject()

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

Copies an assMatchingQuestion.

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

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

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

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

420  {
421  if ($this->id <= 0)
422  {
423  // The question has not been saved. It cannot be duplicated
424  return;
425  }
426 
427  include_once ("./Modules/TestQuestionPool/classes/class.assQuestion.php");
428 
429  $sourceQuestionId = $this->id;
430  $sourceParentId = $this->getObjId();
431 
432  // duplicate the question in database
433  $clone = $this;
434  $clone->id = -1;
435 
436  $clone->setObjId($targetParentId);
437 
438  if ($targetQuestionTitle)
439  {
440  $clone->setTitle($targetQuestionTitle);
441  }
442 
443  $clone->saveToDb();
444  // copy question page content
445  $clone->copyPageOfQuestion($sourceQuestionId);
446  // copy XHTML media objects
447  $clone->copyXHTMLMediaObjectsOfQuestion($sourceQuestionId);
448  // duplicate the image
449  $clone->copyImages($sourceQuestionId, $sourceParentId);
450 
451  $clone->onCopy($sourceParentId, $sourceQuestionId, $clone->getObjId(), $clone->getId());
452 
453  return $clone->id;
454  }
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 874 of file class.assMatchingQuestion.php.

875  {
876  unset($this->definitions[$position]);
877  $this->definitions = array_values($this->definitions);
878  }

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

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

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

1074  {
1075  $deletename = $filename;
1076  $result = @unlink($this->getImagePath().$deletename);
1077  $result = $result & @unlink($this->getImagePath().$this->getThumbPrefix() . $deletename);
1078  return $result;
1079  }
$result
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:

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

685  {
686  if ($index < 0)
687  {
688  return;
689  }
690  if (count($this->matchingpairs) < 1)
691  {
692  return;
693  }
694  if ($index >= count($this->matchingpairs))
695  {
696  return;
697  }
698  unset($this->matchingpairs[$index]);
699  $this->matchingpairs = array_values($this->matchingpairs);
700  }

◆ deleteTerm()

assMatchingQuestion::deleteTerm (   $position)

Deletes a term.

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

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

863  {
864  unset($this->terms[$position]);
865  $this->terms = array_values($this->terms);
866  }

◆ duplicate()

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

Duplicates an assMatchingQuestion.

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

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

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

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

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

◆ fetchIndexedValuesFromValuePairs()

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

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

References array.

1012  {
1013  $indexedValues = array();
1014 
1015  foreach($valuePairs as $valuePair)
1016  {
1017  if( !isset($indexedValues[$valuePair['value2']]) )
1018  {
1019  $indexedValues[$valuePair['value2']] = array();
1020  }
1021 
1022  $indexedValues[$valuePair['value2']][] = $valuePair['value1'];
1023  }
1024 
1025  return $indexedValues;
1026  }
Create styles array
The data for the language used.

◆ fetchSubmittedMatchingsFromPost()

assMatchingQuestion::fetchSubmittedMatchingsFromPost ( )
private

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

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

Referenced by savePreviewData(), and saveWorkingData().

1120  {
1121  $postData = $_POST['matching'][$this->getId()];
1122 
1123  $matchings = array();
1124 
1125  foreach( $this->getDefinitions() as $definition )
1126  {
1127  if( isset($postData[$definition->identifier]) )
1128  {
1129  foreach( $this->getTerms() as $term )
1130  {
1131  if( isset($postData[$definition->identifier][$term->identifier]) )
1132  {
1133  if( !is_array($postData[$definition->identifier]) )
1134  {
1135  $postData[$definition->identifier] = array();
1136  }
1137 
1138  $matchings[$definition->identifier][] = $term->identifier;
1139  }
1140  }
1141  }
1142  }
1143 
1144  return $matchings;
1145  }
getId()
Gets the id of the assQuestion object.
getDefinitions()
Returns the definitions of the matching question.
Create styles array
The data for the language used.
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 851 of file class.assMatchingQuestion.php.

References array.

852  {
853  $this->definitions = array();
854  }
Create styles array
The data for the language used.

◆ flushMatchingPairs()

assMatchingQuestion::flushMatchingPairs ( )

Deletes all matching pairs.

See also
$matchingpairs

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

References array.

707  {
708  $this->matchingpairs = array();
709  }
Create styles array
The data for the language used.

◆ flushTerms()

assMatchingQuestion::flushTerms ( )

Deletes all terms.

See also
$terms

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

References array.

843  {
844  $this->terms = array();
845  }
Create styles array
The data for the language used.

◆ generateThumbForFile()

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

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

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

Referenced by rebuildThumbnails().

1447  {
1448  $filename = $path . $file;
1449  if (@file_exists($filename))
1450  {
1451  $thumbpath = $path . $this->getThumbPrefix() . $file;
1452  $path_info = @pathinfo($filename);
1453  $ext = "";
1454  switch (strtoupper($path_info['extension']))
1455  {
1456  case 'PNG':
1457  $ext = 'PNG';
1458  break;
1459  case 'GIF':
1460  $ext = 'GIF';
1461  break;
1462  default:
1463  $ext = 'JPEG';
1464  break;
1465  }
1466  ilUtil::convertImage($filename, $thumbpath, $ext, $this->getThumbGeometry());
1467  }
1468  }
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
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
+ 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 1317 of file class.assMatchingQuestion.php.

Referenced by saveAdditionalQuestionDataToDb().

1318  {
1319  return "qpl_qst_matching";
1320  }
+ 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 1327 of file class.assMatchingQuestion.php.

References array.

1328  {
1329  return array("qpl_a_matching", "qpl_a_mterm");
1330  }
Create styles array
The data for the language used.

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

References getMatchingPair(), and getMatchingPairs().

1716  {
1717  if($index !== null)
1718  {
1719  return $this->getMatchingPair($index);
1720  }
1721  else
1722  {
1723  return $this->getMatchingPairs();
1724  }
1725  }
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 761 of file class.assMatchingQuestion.php.

762  {
763  return count($this->definitions);
764  }

◆ getDefinitions()

assMatchingQuestion::getDefinitions ( )

Returns the definitions of the matching question.

Returns
array An array containing the definitions
See also
$terms

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

References $definitions.

Referenced by fetchSubmittedMatchingsFromPost(), and toJSON().

740  {
741  return $this->definitions;
742  }
+ Here is the caller graph for this function:

◆ getDefinitionWithIdentifier()

assMatchingQuestion::getDefinitionWithIdentifier (   $a_identifier)

Returns a definition with a given identifier.

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

644  {
645  foreach ($this->definitions as $definition)
646  {
647  if ($definition->identifier == $a_identifier) return $definition;
648  }
649  return null;
650  }

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

References $filename.

1037  {
1038  $extension = "";
1039  if (preg_match("/.*\\.(\\w+)$/", $filename, $matches))
1040  {
1041  $extension = $matches[1];
1042  }
1043  return md5($filename) . "." . $extension;
1044  }

◆ getExpressionTypes()

◆ getMatchingMode()

assMatchingQuestion::getMatchingMode ( )

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

References $matchingMode.

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

1578  {
1579  return $this->matchingMode;
1580  }
+ 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 660 of file class.assMatchingQuestion.php.

Referenced by getAvailableAnswerOptions().

661  {
662  if ($index < 0)
663  {
664  return NULL;
665  }
666  if (count($this->matchingpairs) < 1)
667  {
668  return NULL;
669  }
670  if ($index >= count($this->matchingpairs))
671  {
672  return NULL;
673  }
674  return $this->matchingpairs[$index];
675  }
+ 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 717 of file class.assMatchingQuestion.php.

718  {
719  return count($this->matchingpairs);
720  }

◆ getMatchingPairs()

& assMatchingQuestion::getMatchingPairs ( )

Returns the matchingpairs array.

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

References $matchingpairs.

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

1345  {
1346  return $this->matchingpairs;
1347  }
+ 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 938 of file class.assMatchingQuestion.php.

References assQuestion\$points, and getMaximumScoringMatchingPairs().

Referenced by getExpressionTypes(), and isComplete().

939  {
940  $points = 0;
941 
942  foreach( $this->getMaximumScoringMatchingPairs() as $pair )
943  {
944  $points += $pair->points;
945  }
946 
947  return $points;
948  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMaximumScoringMatchingPairs()

assMatchingQuestion::getMaximumScoringMatchingPairs ( )

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

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

Referenced by getMaximumPoints().

951  {
952  if( $this->getMatchingMode() == self::MATCHING_MODE_N_ON_N )
953  {
954  return $this->getPositiveScoredMatchingPairs();
955  }
956  elseif( $this->getMatchingMode() == self::MATCHING_MODE_1_ON_1 )
957  {
959  }
960 
961  return array();
962  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMostPositiveScoredUniqueTermMatchingPairs()

assMatchingQuestion::getMostPositiveScoredUniqueTermMatchingPairs ( )
private

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

References array.

Referenced by getMaximumScoringMatchingPairs().

982  {
983  $matchingPairsByDefinition = array();
984 
985  foreach( $this->matchingpairs as $pair )
986  {
987  if( $pair->points <= 0 )
988  {
989  continue;
990  }
991 
992  $defId = $pair->definition->identifier;
993 
994  if( !isset($matchingPairsByDefinition[$defId]) )
995  {
996  $matchingPairsByDefinition[$defId] = $pair;
997  }
998  elseif( $pair->points > $matchingPairsByDefinition[$defId]->points )
999  {
1000  $matchingPairsByDefinition[$defId] = $pair;
1001  }
1002  }
1003 
1004  return $matchingPairsByDefinition;
1005  }
Create styles array
The data for the language used.
+ 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 1613 of file class.assMatchingQuestion.php.

References ilOperatorsExpressionMapping\getOperatorsByExpression().

1614  {
1615  require_once "./Modules/TestQuestionPool/classes/class.ilOperatorsExpressionMapping.php";
1617  }
+ Here is the call graph for this function:

◆ getPositiveScoredMatchingPairs()

assMatchingQuestion::getPositiveScoredMatchingPairs ( )
private

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

References array.

Referenced by getMaximumScoringMatchingPairs().

965  {
966  $matchingPairs = array();
967 
968  foreach( $this->matchingpairs as $pair )
969  {
970  if( $pair->points <= 0 )
971  {
972  continue;
973  }
974 
975  $matchingPairs[] = $pair;
976  }
977 
978  return $matchingPairs;
979  }
Create styles array
The data for the language used.
+ 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 1307 of file class.assMatchingQuestion.php.

Referenced by toJSON().

1308  {
1309  return "assMatchingQuestion";
1310  }
+ Here is the caller graph for this function:

◆ getRandomId()

assMatchingQuestion::getRandomId ( )

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

1261  {
1262  mt_srand((double)microtime()*1000000);
1263  $random_number = mt_rand(1, 100000);
1264  $found = FALSE;
1265  while ($found)
1266  {
1267  $found = FALSE;
1268  foreach ($this->matchingpairs as $key => $pair)
1269  {
1270  if (($pair->term->identifier == $random_number) || ($pair->definition->identifier == $random_number))
1271  {
1272  $found = TRUE;
1273  $random_number++;
1274  }
1275  }
1276  }
1277  return $random_number;
1278  }

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

1337  {
1338  return parent::getRTETextWithMediaObjects();
1339  }

◆ getTermCount()

assMatchingQuestion::getTermCount ( )

Returns the number of terms.

Returns
integer The number of terms
See also
$terms

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

751  {
752  return count($this->terms);
753  }

◆ getTerms()

assMatchingQuestion::getTerms ( )

Returns the terms of the matching question.

Returns
array An array containing the terms
See also
$terms

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

References $terms.

Referenced by fetchSubmittedMatchingsFromPost(), and toJSON().

729  {
730  return $this->terms;
731  }
+ Here is the caller graph for this function:

◆ getTermWithIdentifier()

assMatchingQuestion::getTermWithIdentifier (   $a_identifier)

Returns a term with a given identifier.

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

632  {
633  foreach ($this->terms as $term)
634  {
635  if ($term->identifier == $a_identifier) return $term;
636  }
637  return null;
638  }

◆ getThumbGeometry()

assMatchingQuestion::getThumbGeometry ( )

Get the thumbnail geometry.

Returns
integer Geometry

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

References $thumb_geometry.

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

1402  {
1403  return $this->thumb_geometry;
1404  }
+ Here is the caller graph for this function:

◆ getThumbPrefix()

assMatchingQuestion::getThumbPrefix ( )

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

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

1442  {
1443  return "thumb.";
1444  }
+ Here is the caller graph for this function:

◆ getThumbSize()

assMatchingQuestion::getThumbSize ( )

Get the thumbnail geometry.

Returns
integer Geometry

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

References getThumbGeometry().

1412  {
1413  return $this->getThumbGeometry();
1414  }
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 819 of file class.assMatchingQuestion.php.

References array.

820  {
821  if (is_null($definition))
822  {
823  include_once "./Modules/TestQuestionPool/classes/class.assAnswerMatchingDefinition.php";
824  $definition = new assAnswerMatchingDefinition();
825  }
826  if ($position < count($this->definitions))
827  {
828  $part1 = array_slice($this->definitions, 0, $position);
829  $part2 = array_slice($this->definitions, $position);
830  $this->definitions = array_merge($part1, array($definition), $part2);
831  }
832  else
833  {
834  array_push($this->definitions, $definition);
835  }
836  }
Create styles array
The data for the language used.
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 580 of file class.assMatchingQuestion.php.

References assQuestion\$points, and array.

581  {
582  include_once "./Modules/TestQuestionPool/classes/class.assAnswerMatchingPair.php";
583  include_once "./Modules/TestQuestionPool/classes/class.assAnswerMatchingTerm.php";
584  include_once "./Modules/TestQuestionPool/classes/class.assAnswerMatchingDefinition.php";
585  if (is_null($term)) $term = new assAnswerMatchingTerm();
586  if (is_null($definition)) $definition = new assAnswerMatchingDefinition();
587  $pair = new assAnswerMatchingPair($term, $definition, $points);
588  if ($position < count($this->matchingpairs))
589  {
590  $part1 = array_slice($this->matchingpairs, 0, $position);
591  $part2 = array_slice($this->matchingpairs, $position);
592  $this->matchingpairs = array_merge($part1, array($pair), $part2);
593  }
594  else
595  {
596  array_push($this->matchingpairs, $pair);
597  }
598  }
Class for matching question terms.
Class for matching question pairs.
Create styles array
The data for the language used.
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 794 of file class.assMatchingQuestion.php.

References array.

795  {
796  if (is_null($term))
797  {
798  include_once "./Modules/TestQuestionPool/classes/class.assAnswerMatchingTerm.php";
799  $term = new assAnswerMatchingTerm();
800  }
801  if ($position < count($this->terms))
802  {
803  $part1 = array_slice($this->terms, 0, $position);
804  $part2 = array_slice($this->terms, $position);
805  $this->terms = array_merge($part1, array($term), $part2);
806  }
807  else
808  {
809  array_push($this->terms, $term);
810  }
811  }
Class for matching question terms.
Create styles array
The data for the language used.

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

References getMaximumPoints().

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

References $data, $ilDB, $query, $result, ilRTE\_replaceMediaObjectImageSrc(), array, 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().

233  {
234  global $ilDB;
235 
236  $query = "
237  SELECT qpl_questions.*,
238  {$this->getAdditionalTableName()}.*
239  FROM qpl_questions
240  LEFT JOIN {$this->getAdditionalTableName()}
241  ON {$this->getAdditionalTableName()}.question_fi = qpl_questions.question_id
242  WHERE qpl_questions.question_id = %s
243  ";
244 
245  $result = $ilDB->queryF(
246  $query, array('integer'), array($question_id)
247  );
248 
249  if ($result->numRows() == 1)
250  {
251  $data = $ilDB->fetchAssoc($result);
252  $this->setId($question_id);
253  $this->setObjId($data["obj_fi"]);
254  $this->setTitle($data["title"]);
255  $this->setComment($data["description"]);
256  $this->setOriginalId($data["original_id"]);
257  $this->setNrOfTries($data['nr_of_tries']);
258  $this->setAuthor($data["author"]);
259  $this->setPoints($data["points"]);
260  $this->setOwner($data["owner"]);
261  include_once("./Services/RTE/classes/class.ilRTE.php");
262  $this->setQuestion(ilRTE::_replaceMediaObjectImageSrc($data["question_text"], 1));
263  $this->setThumbGeometry($data["thumb_geometry"]);
264  $this->setShuffle($data["shuffle"]);
265  $this->setMatchingMode($data['matching_mode'] === null ? self::MATCHING_MODE_1_ON_1 : $data['matching_mode']);
266  $this->setEstimatedWorkingTime(substr($data["working_time"], 0, 2), substr($data["working_time"], 3, 2), substr($data["working_time"], 6, 2));
267 
268  try
269  {
270  $this->setAdditionalContentEditingMode($data['add_cont_edit_mode']);
271  }
273  {
274  }
275  }
276 
277  $termids = array();
278  $result = $ilDB->queryF("SELECT * FROM qpl_a_mterm WHERE question_fi = %s ORDER BY term_id ASC",
279  array('integer'),
280  array($question_id)
281  );
282  include_once "./Modules/TestQuestionPool/classes/class.assAnswerMatchingTerm.php";
283  $this->terms = array();
284  if ($result->numRows() > 0)
285  {
286  while ($data = $ilDB->fetchAssoc($result))
287  {
288  $term = new assAnswerMatchingTerm($data['term'], $data['picture'], $data['ident']);
289  array_push($this->terms, $term);
290  $termids[$data['term_id']] = $term;
291  }
292  }
293 
294  $definitionids = array();
295  $result = $ilDB->queryF("SELECT * FROM qpl_a_mdef WHERE question_fi = %s ORDER BY def_id ASC",
296  array('integer'),
297  array($question_id)
298  );
299  include_once "./Modules/TestQuestionPool/classes/class.assAnswerMatchingDefinition.php";
300  $this->definitions = array();
301  if ($result->numRows() > 0)
302  {
303  while ($data = $ilDB->fetchAssoc($result))
304  {
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("SELECT * FROM qpl_a_matching WHERE question_fi = %s ORDER BY answer_id",
313  array('integer'),
314  array($question_id)
315  );
316  include_once "./Modules/TestQuestionPool/classes/class.assAnswerMatchingPair.php";
317  if ($result->numRows() > 0)
318  {
319  while ($data = $ilDB->fetchAssoc($result))
320  {
321  array_push($this->matchingpairs, new assAnswerMatchingPair($termids[$data['term_fi']], $definitionids[$data['definition_fi']], $data['points']));
322  }
323  }
324  parent::loadFromDb($question_id);
325  }
Class for matching question terms.
Class for matching question pairs.
$result
setId($id=-1)
Sets the id of the assQuestion object.
setEstimatedWorkingTime($hour=0, $min=0, $sec=0)
Sets the estimated working time of a question from given hour, minute and second. ...
setNrOfTries($a_nr_of_tries)
setAdditionalContentEditingMode($additinalContentEditingMode)
setter for additional content editing mode for this question
static _replaceMediaObjectImageSrc($a_text, $a_direction=0, $nic=IL_INST_ID)
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
setAuthor($author="")
Sets the authors name of the assQuestion object.
setShuffle($shuffle=true)
Sets the shuffle flag.
Create styles array
The data for the language used.
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.
+ Here is the call graph for this function:

◆ rebuildThumbnails()

assMatchingQuestion::rebuildThumbnails ( )

Rebuild the thumbnail images with a new thumbnail size.

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

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

Referenced by saveAnswerSpecificDataToDb().

1430  {
1431  foreach ($this->terms as $term)
1432  {
1433  if (strlen($term->picture)) $this->generateThumbForFile($this->getImagePath(), $term->picture);
1434  }
1435  foreach ($this->definitions as $definition)
1436  {
1437  if (strlen($definition->picture)) $this->generateThumbForFile($this->getImagePath(), $definition->picture);
1438  }
1439  }
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 1056 of file class.assMatchingQuestion.php.

References deleteImagefile().

1057  {
1058  $definition = $this->definitions[$index];
1059  if (is_object($definition))
1060  {
1061  $this->deleteImagefile($definition->picture);
1062  $definition->picture = null;
1063  }
1064  }
deleteImagefile($filename)
Deletes an imagefile from the system if the file is deleted manually.
+ Here is the call graph for this function:

◆ removeTermImage()

assMatchingQuestion::removeTermImage (   $index)

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

References deleteImagefile().

1047  {
1048  $term = $this->terms[$index];
1049  if (is_object($term))
1050  {
1051  $this->deleteImagefile($term->picture);
1052  $term->picture = null;
1053  }
1054  }
deleteImagefile($filename)
Deletes an imagefile from the system if the file is deleted manually.
+ Here is the call graph for this function:

◆ reworkWorkingData()

assMatchingQuestion::reworkWorkingData (   $active_id,
  $pass,
  $obligationsAnswered,
  $authorized 
)
protected

{}

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

1256  {
1257  // nothing to rework!
1258  }

◆ saveAdditionalQuestionDataToDb()

assMatchingQuestion::saveAdditionalQuestionDataToDb ( )

Saves a record to the question types additional data table.

Returns
mixed

Implements ilObjQuestionScoringAdjustable.

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

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

Referenced by saveToDb().

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

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

Referenced by saveToDb().

139  {
140  global $ilDB;
141  // delete old terms
142  $ilDB->manipulateF( "DELETE FROM qpl_a_mterm WHERE question_fi = %s",
143  array( 'integer' ),
144  array( $this->getId() )
145  );
146 
147  // delete old definitions
148  $ilDB->manipulateF( "DELETE FROM qpl_a_mdef WHERE question_fi = %s",
149  array( 'integer' ),
150  array( $this->getId() )
151  );
152 
153  $termids = array();
154  // write terms
155  foreach ($this->terms as $key => $term)
156  {
157  $next_id = $ilDB->nextId( 'qpl_a_mterm' );
158  $ilDB->insert('qpl_a_mterm', array(
159  'term_id' => array('integer', $next_id),
160  'question_fi' => array('integer', $this->getId()),
161  'picture' => array('text', $term->picture),
162  'term' => array('text', $term->text),
163  'ident' => array('integer', $term->identifier)
164  ));
165  $termids[$term->identifier] = $next_id;
166  }
167 
168  $definitionids = array();
169  // write definitions
170  foreach ($this->definitions as $key => $definition)
171  {
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( "DELETE FROM qpl_a_matching WHERE question_fi = %s",
184  array( 'integer' ),
185  array( $this->getId() )
186  );
187  $matchingpairs = $this->getMatchingPairs();
188  foreach ($matchingpairs as $key => $pair)
189  {
190  $next_id = $ilDB->nextId( 'qpl_a_matching' );
191  $ilDB->manipulateF( "INSERT INTO qpl_a_matching (answer_id, question_fi, points, term_fi, definition_fi) VALUES (%s, %s, %s, %s, %s)",
192  array( 'integer', 'integer', 'float', 'integer', 'integer' ),
193  array(
194  $next_id,
195  $this->getId(),
196  $pair->points,
197  $termids[$pair->term->identifier],
198  $definitionids[$pair->definition->identifier]
199  )
200  );
201  }
202 
203  $this->rebuildThumbnails();
204  }
getId()
Gets the id of the assQuestion object.
rebuildThumbnails()
Rebuild the thumbnail images with a new thumbnail size.
Create styles array
The data for the language used.
global $ilDB
& getMatchingPairs()
Returns the matchingpairs array.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ savePreviewData()

assMatchingQuestion::savePreviewData ( ilAssQuestionPreviewSession  $previewSession)
protected

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

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

1243  {
1244  $submittedMatchings = $this->fetchSubmittedMatchingsFromPost();
1245 
1246  if( $this->checkSubmittedMatchings($submittedMatchings) )
1247  {
1248  $previewSession->setParticipantsSolution($submittedMatchings);
1249  }
1250  }
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 126 of file class.assMatchingQuestion.php.

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

127  {
128  global $ilDB;
129 
132  $this->saveAnswerSpecificDataToDb( $ilDB );
133 
134 
135  parent::saveToDb($original_id);
136  }
saveAdditionalQuestionDataToDb()
Saves a record to the question types additional data table.
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 1187 of file class.assMatchingQuestion.php.

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

1188  {
1189  global $ilDB;
1190 
1191  $submittedMatchings = $this->fetchSubmittedMatchingsFromPost();
1192  $submittedMatchingsValid = $this->checkSubmittedMatchings($submittedMatchings);
1193 
1194  $matchingsExist = false;
1195 
1196  if ($submittedMatchingsValid)
1197  {
1198  if (is_null($pass))
1199  {
1200  include_once "./Modules/Test/classes/class.ilObjTest.php";
1201  $pass = ilObjTest::_getPass($active_id);
1202  }
1203 
1204  $this->getProcessLocker()->executeUserSolutionUpdateLockOperation(function() use (&$matchingsExist, $submittedMatchings, $active_id, $pass, $authorized) {
1205 
1206  $this->removeCurrentSolution($active_id, $pass, $authorized);
1207 
1208  foreach($submittedMatchings as $definition => $terms)
1209  {
1210  foreach($terms as $i => $term)
1211  {
1212  $this->saveCurrentSolution($active_id, $pass, $term, $definition, $authorized);
1213  $matchingsExist = true;
1214  }
1215  }
1216 
1217  });
1218 
1219  $saveWorkingDataResult = true;
1220  }
1221  else
1222  {
1223  $saveWorkingDataResult = false;
1224  }
1225 
1226  include_once ("./Modules/Test/classes/class.ilObjAssessmentFolder.php");
1228  {
1229  if( $matchingsExist )
1230  {
1231  assQuestion::logAction($this->lng->txtlng("assessment", "log_user_entered_values", ilObjAssessmentFolder::_getLogLanguage()), $active_id, $this->getId());
1232  }
1233  else
1234  {
1235  assQuestion::logAction($this->lng->txtlng("assessment", "log_user_not_entered_values", ilObjAssessmentFolder::_getLogLanguage()), $active_id, $this->getId());
1236  }
1237  }
1238 
1239  return $saveWorkingDataResult;
1240  }
static logAction($logtext="", $active_id="", $question_id="")
Logs an action into the Test&Assessment log.
getId()
Gets the id of the assQuestion object.
static _getPass($active_id)
Retrieves the actual pass of a given user for a given test.
static _getLogLanguage()
retrieve the log language for assessment logging
static _enabledAssessmentLogging()
check wether assessment logging is enabled or not
saveCurrentSolution($active_id, $pass, $value1, $value2, $authorized=true, $tstamp=null)
checkSubmittedMatchings($submittedMatchings)
removeCurrentSolution($active_id, $pass, $authorized=true)
global $ilDB
+ Here is the call graph for this function:

◆ setExportDetailsXLS()

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

{}

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

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

1353  {
1354  parent::setExportDetailsXLS($worksheet, $startrow, $active_id, $pass);
1355 
1356  $solutions = $this->getSolutionValues($active_id, $pass);
1357 
1358  $imagepath = $this->getImagePath();
1359  $i = 1;
1360  foreach ($solutions as $solution)
1361  {
1362  $matches_written = FALSE;
1363  foreach ($this->getMatchingPairs() as $idx => $pair)
1364  {
1365  if (!$matches_written) $worksheet->setCell($startrow + $i, 1, $this->lng->txt("matches"));
1366  $matches_written = TRUE;
1367  if ($pair->definition->identifier == $solution["value2"])
1368  {
1369  if (strlen($pair->definition->text))
1370  {
1371  $worksheet->setCell($startrow + $i, 0, $pair->definition->text);
1372  }
1373  else
1374  {
1375  $worksheet->setCell($startrow + $i, 0, $pair->definition->picture);
1376  }
1377  }
1378  if ($pair->term->identifier == $solution["value1"])
1379  {
1380  if (strlen($pair->term->text))
1381  {
1382  $worksheet->setCell($startrow + $i, 2, $pair->term->text);
1383  }
1384  else
1385  {
1386  $worksheet->setCell($startrow + $i, 2, $pair->term->picture);
1387  }
1388  }
1389  }
1390  $i++;
1391  }
1392 
1393  return $startrow + $i + 1;
1394  }
$worksheet
getImagePath($question_id=null, $object_id=null)
Returns the image path for web accessable images of a question.
getSolutionValues($active_id, $pass=NULL, $authorized=true)
Loads solutions of a given user from the database an returns it.
& 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 1089 of file class.assMatchingQuestion.php.

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

1090  {
1091  $result = TRUE;
1092  if (strlen($image_tempfilename))
1093  {
1094  $image_filename = str_replace(" ", "_", $image_filename);
1095  $imagepath = $this->getImagePath();
1096  if (!file_exists($imagepath))
1097  {
1098  ilUtil::makeDirParents($imagepath);
1099  }
1100  $savename = $image_filename;
1101  if (!ilUtil::moveUploadedFile($image_tempfilename, $savename, $imagepath.$savename))
1102  {
1103  $result = FALSE;
1104  }
1105  else
1106  {
1107  // create thumbnail file
1108  $thumbpath = $imagepath . $this->getThumbPrefix() . $savename;
1109  ilUtil::convertImage($imagepath.$savename, $thumbpath, "JPEG", $this->getThumbGeometry());
1110  }
1111  if ($result && (strcmp($image_filename, $previous_filename) != 0) && (strlen($previous_filename)))
1112  {
1113  $this->deleteImagefile($previous_filename);
1114  }
1115  }
1116  return $result;
1117  }
static makeDirParents($a_dir)
Create a new directory and all parent directories.
$result
deleteImagefile($filename)
Deletes an imagefile from the system if the file is deleted manually.
getImagePath($question_id=null, $object_id=null)
Returns the image path for web accessable images of a question.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
static convertImage($a_from, $a_to, $a_target_format="", $a_geometry="", $a_background_color="")
convert image
+ Here is the call graph for this function:

◆ setMatchingMode()

assMatchingQuestion::setMatchingMode (   $matchingMode)

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

References $matchingMode.

Referenced by loadFromDb().

1573  {
1574  $this->matchingMode = $matchingMode;
1575  }
+ 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 1286 of file class.assMatchingQuestion.php.

References assQuestion\$shuffle.

Referenced by loadFromDb().

1287  {
1288  switch ($shuffle)
1289  {
1290  case 0:
1291  case 1:
1292  case 2:
1293  case 3:
1294  $this->shuffle = $shuffle;
1295  break;
1296  default:
1297  $this->shuffle = 1;
1298  break;
1299  }
1300  }
+ 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 887 of file class.assMatchingQuestion.php.

888  {
889  $this->terms[$index] = $term;
890  }

◆ setThumbGeometry()

assMatchingQuestion::setThumbGeometry (   $a_geometry)

Set the thumbnail geometry.

Parameters
integer$a_geometryGeometry

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

Referenced by loadFromDb().

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

◆ supportsJavascriptOutput()

assMatchingQuestion::supportsJavascriptOutput ( )

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

1563  {
1564  return true;
1565  }

◆ supportsNonJsOutput()

assMatchingQuestion::supportsNonJsOutput ( )

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

1568  {
1569  return false;
1570  }

◆ toJSON()

assMatchingQuestion::toJSON ( )

Returns a JSON representation of the question TODO.

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

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

1475  {
1476  $result = array();
1477 
1478  $result['id'] = (int) $this->getId();
1479  $result['type'] = (string) $this->getQuestionType();
1480  $result['title'] = (string) $this->getTitle();
1481  $result['question'] = $this->formatSAQuestion($this->getQuestion());
1482  $result['nr_of_tries'] = (int) $this->getNrOfTries();
1483  $result['matching_mode'] = $this->getMatchingMode();
1484  $result['shuffle'] = true;
1485  $result['feedback'] = array(
1486  'onenotcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), false)),
1487  'allcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), true))
1488  );
1489 
1490  require_once 'Services/Randomization/classes/class.ilArrayElementShuffler.php';
1491  $this->setShuffler(new ilArrayElementShuffler());
1492  $seed = $this->getShuffler()->getSeed();
1493 
1494  $terms = array();
1495  $this->getShuffler()->setSeed($this->getShuffler()->buildSeedFromString($seed.'terms'));
1496  foreach ($this->getShuffler()->shuffle($this->getTerms()) as $term)
1497  {
1498  $terms[] = array(
1499  "text" => $this->formatSAQuestion($term->text),
1500  "id" =>(int)$this->getId().$term->identifier
1501  );
1502  }
1503  $result['terms'] = $terms;
1504 
1505  // alex 9.9.2010 as a fix for bug 6513 I added the question id
1506  // to the "def_id" in the array. The $pair->definition->identifier is not
1507  // unique, since it gets it value from the morder table field
1508  // this value is not changed, when a question is copied.
1509  // thus copying the same question on a page results in problems
1510  // when the second one (the copy) is answered.
1511 
1512  $definitions = array();
1513  $this->getShuffler()->setSeed($this->getShuffler()->buildSeedFromString($seed.'definitions'));
1514  foreach ($this->getShuffler()->shuffle($this->getDefinitions()) as $def)
1515  {
1516  $definitions[] = array(
1517  "text" => $this->formatSAQuestion((string) $def->text),
1518  "id" => (int) $this->getId().$def->identifier
1519  );
1520  }
1521  $result['definitions'] = $definitions;
1522 
1523  // #10353
1524  $matchings = array();
1525  foreach ($this->getMatchingPairs() as $pair)
1526  {
1527 // fau: fixLmMatchingPoints - ignore matching pairs with 0 or negative points
1528  if ($pair->points <= 0)
1529  {
1530  continue;
1531  }
1532 // fau.
1533 
1534  $pid = $pair->definition->identifier;
1535  if( $this->getMatchingMode() == self::MATCHING_MODE_N_ON_N )
1536  {
1537  $pid .= '::'.$pair->term->identifier;
1538  }
1539 
1540  if( !isset($matchings[$pid]) || $matchings[$pid]["points"] < $pair->points )
1541  {
1542  $matchings[$pid] = array(
1543  "term_id" => (int) $this->getId().$pair->term->identifier,
1544  "def_id" => (int) $this->getId().$pair->definition->identifier,
1545  "points" => (int) $pair->points
1546  );
1547  }
1548  }
1549 
1550  $result['matchingPairs'] = array_values($matchings);
1551 
1552  $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $this->getId());
1553  $result['mobs'] = $mobs;
1554 
1555  global $lng;
1556  $lng->loadLanguageModule('assessment');
1557  $result['reset_button_label'] = $lng->txt("reset_terms");
1558 
1559  return json_encode($result);
1560  }
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
getQuestionType()
Returns the question type of the question.
Add rich text string
The name of the decorator.
getDefinitions()
Returns the definitions of the matching question.
$mobs
getQuestion()
Gets the question string of the question object.
Create styles array
The data for the language used.
getTerms()
Returns the terms of the matching question.
getTitle()
Gets the title string of the assQuestion object.
& getMatchingPairs()
Returns the matchingpairs array.
setShuffler(ilArrayElementShuffler $shuffler)
+ Here is the call graph for this function:

Field Documentation

◆ $definitions

assMatchingQuestion::$definitions
protected

Definition at line 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().

◆ $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: