ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
assClozeTest Class Reference

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

+ Inheritance diagram for assClozeTest:
+ Collaboration diagram for assClozeTest:

Public Member Functions

 __construct ( $title="", $comment="", $author="", $owner=-1, $question="")
 assClozeTest constructor More...
 
 isComplete ()
 Returns TRUE, if a cloze test is complete for use. More...
 
 cleanQuestiontext ($text)
 Cleans cloze question text to remove attributes or tags from older ILIAS versions. More...
 
 replaceFirstGap ($gaptext, $content)
 Replace the first gap in a string without treating backreferences. More...
 
 loadFromDb ($question_id)
 Loads a assClozeTest object from a database. More...
 
 saveToDb ($original_id="")
 Saves a assClozeTest object to a database. More...
 
 saveAnswerSpecificDataToDb ()
 Save all gaps to the database. More...
 
 saveAdditionalQuestionDataToDb ()
 Saves the data for the additional data table. More...
 
 getGaps ()
 Returns the array of gaps. More...
 
 flushGaps ()
 Deletes all gaps without changing the cloze text. More...
 
 setClozeText ($cloze_text="")
 Evaluates the text gap solutions from the cloze text. More...
 
 setClozeTextValue ($cloze_text="")
 
 getClozeText ()
 Returns the cloze text. More...
 
 getClozeTextForHTMLOutput ()
 Returns the cloze text as HTML (with optional nl2br) Fix for Mantis 29987: We assume Tiny embeds any text in tags, so if no tags are present, we derive it's non-HTML content and apply nl2br. More...
 
 getStartTag ()
 Returns the start tag of a cloze gap. More...
 
 setStartTag ($start_tag="[gap]")
 Sets the start tag of a cloze gap. More...
 
 getEndTag ()
 Returns the end tag of a cloze gap. More...
 
 setEndTag ($end_tag="[/gap]")
 Sets the end tag of a cloze gap. More...
 
 getFeedbackMode ()
 
 setFeedbackMode ($feedbackMode)
 
 createGapsFromQuestiontext ()
 Create gap entries by parsing the question text. More...
 
 setGapType ($gap_index, $gap_type)
 Set the type of a gap with a given index. More...
 
 setGapShuffle ($gap_index=0, $shuffle=1)
 Sets the shuffle state of a gap with a given index. More...
 
 clearGapAnswers ()
 Removes all answers from the gaps. More...
 
 getGapCount ()
 Returns the number of gaps. More...
 
 addGapAnswer ($gap_index, $order, $answer)
 Sets the answer text of a gap with a given index. More...
 
 getGap ($gap_index=0)
 Returns the gap at a given index. More...
 
 setGapSize ($gap_index, $size)
 
 setGapAnswerPoints ($gap_index, $order, $points)
 Sets the points of a gap with a given index and an answer with a given order. More...
 
 addGapText ($gap_index)
 Adds a new answer text value to a text gap with a given index. More...
 
 addGapAtIndex ($gap, $index)
 Adds a ClozeGap object at a given index. More...
 
 setGapAnswerLowerBound ($gap_index, $order, $bound)
 Sets the lower bound of a gap with a given index and an answer with a given order. More...
 
 setGapAnswerUpperBound ($gap_index, $order, $bound)
 Sets the upper bound of a gap with a given index and an answer with a given order. More...
 
 getMaximumPoints ()
 Returns the maximum points, a learner can reach answering the question. More...
 
 duplicate (bool $for_test=true, string $title="", string $author="", string $owner="", $testObjId=null)
 Duplicates an assClozeTest. More...
 
 copyObject ($target_questionpool_id, $title="")
 Copies an assClozeTest object. More...
 
 createNewOriginalFromThisDuplicate ($targetParentId, $targetQuestionTitle="")
 
 copyGapCombination ($orgID, $newID)
 
 updateClozeTextFromGaps ()
 Updates the gap parameters in the cloze text from the form input. More...
 
 deleteAnswerText ($gap_index, $answer_index)
 Deletes the answer text of a gap with a given index and an answer with a given order. More...
 
 deleteGap ($gap_index)
 Deletes a gap with a given index. More...
 
 getTextgapPoints ($a_original, $a_entered, $max_points)
 Returns the points for a text gap and compares the given solution with the entered solution using the text gap rating options. More...
 
 getNumericgapPoints ($a_original, $a_entered, $max_points, $lowerBound, $upperBound)
 Returns the points for a text gap and compares the given solution with the entered solution using the text gap rating options. More...
 
 checkForValidFormula ($value)
 
 calculateReachedPoints ($active_id, $pass=null, $authorizedSolution=true, $returndetails=false)
 Returns the points, a learner has reached answering the question. More...
 
 validateSolutionSubmit ()
 
 fetchSolutionSubmit ($submit)
 
 getSolutionSubmitValidation ()
 
 getSolutionSubmit ()
 
 saveWorkingData ($active_id, $pass=null, $authorized=true)
 Saves the learners input of the question to the database. More...
 
 getQuestionType ()
 Returns the question type of the question. More...
 
 getTextgapRating ()
 Returns the rating option for text gaps. More...
 
 setTextgapRating ($a_textgap_rating)
 Sets the rating option for text gaps. More...
 
 getIdenticalScoring ()
 Returns the identical scoring status of the question. More...
 
 setIdenticalScoring ($a_identical_scoring)
 Sets the identical scoring option for cloze questions. More...
 
 getAdditionalTableName ()
 Returns the name of the additional question data table in the database. More...
 
 getAnswerTableName ()
 
 setFixedTextLength ($a_text_len)
 Sets a fixed text length for all text fields in the cloze question. More...
 
 getFixedTextLength ()
 Gets the fixed text length for all text fields in the cloze question. More...
 
 getMaximumGapPoints ($gap_index)
 Returns the maximum points for a gap. More...
 
 getRTETextWithMediaObjects ()
 Collects all text in the question which could contain media objects which were created with the Rich Text Editor. More...
 
 getGapCombinationsExists ()
 
 getGapCombinations ()
 
 setGapCombinationsExists ($value)
 
 setGapCombinations ($value)
 
 setExportDetailsXLS (ilAssExcelFormatHelper $worksheet, int $startrow, int $active_id, int $pass)
 {} More...
 
 toJSON ()
 Returns a JSON representation of the question. More...
 
 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...
 
 calculateCombinationResult ($user_result)
 
 calculateReachedPointsFromPreviewSession (ilAssQuestionPreviewSession $preview_session)
 
 fetchAnswerValueForGap ($userSolution, $gapIndex)
 
 isAddableAnswerOptionValue (int $qIndex, string $answerOptionValue)
 
 addAnswerOptionValue (int $qIndex, string $answerOptionValue, float $points)
 
 savePartial ()
 
- Public Member Functions inherited from assQuestion
 __construct (string $title="", string $comment="", string $author="", int $owner=-1, string $question="")
 assQuestion constructor More...
 
 getShuffler ()
 
 setShuffler (Transformation $shuffler)
 
 setProcessLocker (ilAssQuestionProcessLocker $processLocker)
 
 getProcessLocker ()
 
 fromXML ($item, int $questionpool_id, ?int $tst_id, &$tst_object, int &$question_counter, array $import_mapping, array &$solutionhints=[])
 Receives parameters from a QTI parser and creates a valid ILIAS question object. More...
 
 toXML (bool $a_include_header=true, bool $a_include_binary=true, bool $a_shuffle=false, bool $test_output=false, bool $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 (int $questionpool_id, string $title)
 Returns TRUE if the question title exists in a question pool in the database. More...
 
 setTitle (string $title="")
 
 setId (int $id=-1)
 
 setTestId (int $id=-1)
 
 setComment (string $comment="")
 
 setOutputType (int $outputType=OUTPUT_HTML)
 
 setShuffle (?bool $shuffle=true)
 
 setAuthor (string $author="")
 
 setOwner (int $owner=-1)
 
 getTitle ()
 
 getTitleForHTMLOutput ()
 
 getTitleFilenameCompliant ()
 
 getId ()
 
 getShuffle ()
 
 getTestId ()
 
 getComment ()
 
 getDescriptionForHTMLOutput ()
 
 getThumbSize ()
 
 setThumbSize (int $a_size)
 
 getMinimumThumbSize ()
 
 getMaximumThumbSize ()
 
 getOutputType ()
 
 supportsJavascriptOutput ()
 
 supportsNonJsOutput ()
 
 requiresJsSwitch ()
 
 getAuthor ()
 
 getAuthorForHTMLOutput ()
 
 getOwner ()
 
 getObjId ()
 
 setObjId (int $obj_id=0)
 
 getLifecycle ()
 
 setLifecycle (ilAssQuestionLifecycle $lifecycle)
 
 setExternalId (?string $external_id)
 
 getExternalId ()
 
 getSuggestedSolutionOutput ()
 
 _getSuggestedSolution (int $question_id, int $subquestion_index=0)
 
 loadSuggestedSolution (int $question_id, int $subquestion_index=0)
 Returns a suggested solution for a given subquestion index. More...
 
 getSuggestedSolutions ()
 
 getReachedPoints (int $active_id, int $pass)
 
 getMaximumPoints ()
 
 getAdjustedReachedPoints (int $active_id, int $pass, bool $authorizedSolution=true)
 returns the reached points ... More...
 
 calculateResultsFromSolution (int $active_id, int $pass, bool $obligationsEnabled=false)
 Calculates the question results from a previously saved question solution. More...
 
 persistWorkingState (int $active_id, $pass, bool $obligationsEnabled=false, bool $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 (int $active_id, int $pass, bool $authorized=true)
 Saves the learners input of the question to the database. More...
 
 moveUploadedMediaFile (string $file, string $name)
 Move an uploaded media file to an public accessible temp dir to present it. More...
 
 getSuggestedSolutionPath ()
 
 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...
 
 getSuggestedSolutionPathWeb ()
 
 getImagePathWeb ()
 Returns the web image path for web accessable images of a question. More...
 
 getTestOutputSolutions (int $activeId, int $pass)
 
 getUserSolutionPreferingIntermediate (int $active_id, $pass=null)
 
 getSolutionValues ($active_id, $pass=null, bool $authorized=true)
 Loads solutions of a given user from the database an returns it. More...
 
 isInUse (int $question_id=0)
 Checks whether the question is in use or not in pools or tests. More...
 
 usageNumber (int $question_id=0)
 Returns the number of place the question is in use in pools or tests. More...
 
 isClone (int $question_id=0)
 Checks whether the question is a clone of another question or not. More...
 
 getAdditionalTableName ()
 
 getAnswerTableName ()
 
 deleteAnswers (int $question_id)
 
 deleteAdditionalTableData (int $question_id)
 
 delete (int $question_id)
 
 getTotalAnswers ()
 
 copyXHTMLMediaObjectsOfQuestion (int $a_q_id)
 
 syncXHTMLMediaObjectsOfQuestion ()
 
 createPageObject ()
 
 copyPageOfQuestion (int $a_q_id)
 
 getPageOfQuestion ()
 
 setOriginalId (?int $original_id)
 
 getOriginalId ()
 
 fixSvgToPng (string $imageFilenameContainingString)
 
 fixUnavailableSkinImageSources (string $html)
 
 loadFromDb (int $question_id)
 
 createNewQuestion (bool $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 (int $original_id=-1)
 
 saveToDb ()
 
 setNewOriginalId (int $newId)
 
 deleteSuggestedSolutions ()
 
 getSuggestedSolution (int $subquestion_index=0)
 Returns a suggested solution for a given subquestion index. More...
 
 getSuggestedSolutionTitle (int $subquestion_index=0)
 Returns the title of a suggested solution at a given subquestion_index. More...
 
 setSuggestedSolution (string $solution_id="", int $subquestion_index=0, bool $is_import=false)
 Sets a suggested solution for the question. More...
 
 updateSuggestedSolutions (int $original_id=-1, int $original_obj_id=-1)
 
 _resolveInternalLink (string $internal_link)
 
 _resolveIntLinks (int $question_id)
 
 syncWithOriginal ()
 
 _questionExists ($question_id)
 Returns true if the question already exists in the database. More...
 
 _questionExistsInPool (int $question_id)
 
 getPoints ()
 
 setPoints (float $points)
 
 getSolutionMaxPass (int $active_id)
 
 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 (string $txt_output, bool $prepare_for_latex_output=false, bool $omitNl2BrWhenTextArea=false)
 
 QTIMaterialToString (ilQTIMaterial $a_material)
 Reads an QTI material tag and creates a text or XHTML string. More...
 
 addQTIMaterial (ilXmlWriter $a_xml_writer, string $a_material, bool $close_material_tag=true, bool $add_mobs=true)
 
 buildHashedImageFilename (string $plain_image_filename, bool $unique=false)
 
 getQuestion ()
 
 getQuestionForHTMLOutput ()
 
 setQuestion (string $question="")
 
 getQuestionType ()
 Returns the question type of the question. More...
 
 getQuestionTypeID ()
 
 syncHints ()
 
 cleanupMediaObjectUsage ()
 
 getInstances ()
 
 getActiveUserData (int $active_id)
 Returns the user id and the test id for a given active id. More...
 
 hasSpecificFeedback ()
 
 setExportDetailsXLS (ilAssExcelFormatHelper $worksheet, int $startrow, int $active_id, int $pass)
 
 __get ($value)
 Object getter. More...
 
 __set ($key, $value)
 Object setter. More...
 
 __isset ($key)
 Object issetter. More...
 
 getNrOfTries ()
 
 setNrOfTries (int $a_nr_of_tries)
 
 setExportImagePath (string $path)
 
 formatSAQuestion ($a_q)
 
 setPreventRteUsage (bool $prevent_rte_usage)
 
 getPreventRteUsage ()
 
 migrateContentForLearningModule (ilAssSelfAssessmentMigrator $migrator)
 
 setSelfAssessmentEditingMode (bool $selfassessmenteditingmode)
 
 getSelfAssessmentEditingMode ()
 
 setDefaultNrOfTries (int $defaultnroftries)
 
 getDefaultNrOfTries ()
 
 syncSkillAssignments (int $srcParentId, int $srcQuestionId, int $trgParentId, int $trgQuestionId)
 
 ensureHintPageObjectExists ($pageObjectId)
 
 isAnswered (int $active_id, int $pass)
 
 isAutosaveable ()
 
 getAdditionalContentEditingMode ()
 
 setAdditionalContentEditingMode (?string $additionalContentEditingMode)
 
 isAdditionalContentEditingModePageObject ()
 
 isValidAdditionalContentEditingMode (string $additionalContentEditingMode)
 
 getValidAdditionalContentEditingModes ()
 
 getHtmlUserSolutionPurifier ()
 
 getHtmlQuestionContentPurifier ()
 
 setLastChange ($lastChange)
 
 getLastChange ()
 
 removeIntermediateSolution (int $active_id, int $pass)
 
 removeCurrentSolution (int $active_id, int $pass, bool $authorized=true)
 
 saveCurrentSolution (int $active_id, int $pass, $value1, $value2, bool $authorized=true, $tstamp=0)
 
 updateCurrentSolution (int $solutionId, $value1, $value2, bool $authorized=true)
 
 updateCurrentSolutionsAuthorization (int $activeId, int $pass, bool $authorized, bool $keepTime=false)
 
 setStep ($step)
 
 getStep ()
 
 toJSON ()
 
 duplicate (bool $for_test=true, string $title="", string $author="", string $owner="", $testObjId=null)
 
 intermediateSolutionExists (int $active_id, int $pass)
 
 authorizedSolutionExists (int $active_id, ?int $pass)
 
 authorizedOrIntermediateSolutionExists (int $active_id, int $pass)
 
 lookupForExistingSolutions (int $activeId, int $pass)
 Lookup if an authorized or intermediate solution exists. More...
 
 isAddableAnswerOptionValue (int $qIndex, string $answerOptionValue)
 
 addAnswerOptionValue (int $qIndex, string $answerOptionValue, float $points)
 
 removeAllExistingSolutions ()
 
 removeExistingSolutions (int $activeId, int $pass)
 
 resetUsersAnswer (int $activeId, int $pass)
 
 removeResultRecord (int $activeId, int $pass)
 
 fetchValuePairsFromIndexedValues (array $indexedValues)
 
 fetchIndexedValuesFromValuePairs (array $valuePairs)
 
 areObligationsToBeConsidered ()
 
 setObligationsToBeConsidered (bool $obligationsToBeConsidered)
 
 updateTimestamp ()
 
 getTestPresentationConfig ()
 
 savePartial ()
 
 isInActiveTest ()
 
- Public Member Functions inherited from iQuestionCondition
 getUserQuestionResult ($active_id, $pass)
 Get the user solution for a question by active_id and the test pass. More...
 

Data Fields

array $gaps = []
 
 $gap_combinations
 
 $gap_combinations_exists
 
 $start_tag
 
 $end_tag
 
 $textgap_rating
 
 $identical_scoring
 
 $fixedTextLength
 
 $cloze_text
 
ilAssQuestionFeedback $feedbackOBJ
 
- 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 TRIM_PATTERN = '/^[\p{C}\p{Z}]+|[\p{C}\p{Z}]+$/u'
 
const ADDITIONAL_CONTENT_EDITING_MODE_RTE = 'default'
 
const ADDITIONAL_CONTENT_EDITING_MODE_IPE = 'pageobject'
 
ilAssQuestionFeedback $feedbackOBJ
 
bool $prevent_rte_usage = false
 
bool $selfassessmenteditingmode = false
 
int $defaultnroftries = 0
 
string $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

 saveClozeGapItemsToDb ($gap, $key)
 Save all items belonging to one cloze gap to the db. More...
 
 saveClozeTextGapRecordToDb ($next_id, $key, $item, $gap)
 Saves a gap-item record. More...
 
 saveClozeSelectGapRecordToDb ($next_id, $key, $item, $gap)
 Saves a gap-item record. More...
 
 saveClozeNumericGapRecordToDb ($next_id, $key, $item, $gap)
 Saves a gap-item record. More...
 
 isValidNumericSubmitValue ($submittedValue)
 
 lmMigrateQuestionTypeSpecificContent (ilAssSelfAssessmentMigrator $migrator)
 
 calculateReachedPointsForSolution ($user_result, &$detailed=null)
 
- Protected Member Functions inherited from assQuestion
 getQuestionAction ()
 
 isNonEmptyItemListPostSubmission (string $postSubmissionFieldname)
 
 ensureCurrentTestPass (int $active_id, int $pass)
 
 lookupCurrentTestPass (int $active_id, int $pass)
 
 lookupTestId (int $active_id)
 Move to ilObjTest or similar More...
 
 log (int $active_id, string $langVar)
 
 savePreviewData (ilAssQuestionPreviewSession $previewSession)
 
 deletePageOfQuestion (int $question_id)
 
 onDuplicate (int $originalParentId, int $originalQuestionId, int $duplicateParentId, int $duplicateQuestionId)
 
 beforeSyncWithOriginal (int $origQuestionId, int $dupQuestionId, int $origParentObjId, int $dupParentObjId)
 
 afterSyncWithOriginal (int $origQuestionId, int $dupQuestionId, int $origParentObjId, int $dupParentObjId)
 
 onCopy (int $sourceParentId, int $sourceQuestionId, int $targetParentId, int $targetQuestionId)
 
 duplicateSuggestedSolutionFiles (int $parent_id, int $question_id)
 Duplicates the files of a suggested solution if the question is duplicated. More...
 
 syncSuggestedSolutionFiles (int $target_question_id, int $target_obj_id)
 
 copySuggestedSolutionFiles (int $source_questionpool_id, int $source_question_id)
 
 ensureNonNegativePoints ($points)
 
 purifyAndPrepareTextAreaOutput (string $content)
 
 getRTETextWithMediaObjects ()
 
 getSelfAssessmentFormatter ()
 
 lmMigrateQuestionTypeGenericContent (ilAssSelfAssessmentMigrator $migrator)
 
 lmMigrateQuestionTypeSpecificContent (ilAssSelfAssessmentMigrator $migrator)
 
 duplicateQuestionHints (int $originalQuestionId, int $duplicateQuestionId)
 
 duplicateSkillAssignments (int $srcParentId, int $srcQuestionId, int $trgParentId, int $trgQuestionId)
 
 buildQuestionDataQuery ()
 
 getCurrentSolutionResultSet (int $active_id, int $pass, bool $authorized=true)
 
 removeSolutionRecordById (int $solutionId)
 
 getSolutionRecordById (int $solutionId)
 
 deleteDummySolutionRecord (int $activeId, int $passIndex)
 
 isDummySolutionRecord (array $solutionRecord)
 
 deleteSolutionRecordByValues (int $activeId, int $passIndex, bool $authorized, array $matchValues)
 
 duplicateIntermediateSolutionAuthorized (int $activeId, int $passIndex)
 
 forceExistingIntermediateSolution (int $activeId, int $passIndex, bool $considerDummyRecordCreation)
 
 lookupMaxStep (int $active_id, int $pass)
 
 buildTestPresentationConfig ()
 build basic test question configuration instance More...
 

Protected Attributes

 $feedbackMode = ilAssClozeTestFeedback::FB_MODE_GAP_QUESTION
 
- Protected Attributes inherited from assQuestion
const HAS_SPECIFIC_FEEDBACK = true
 
ILIAS HTTP Services $http
 
ILIAS Refinery Factory $refinery
 
ILIAS DI LoggingServices $ilLog
 
int $id
 
string $title
 
string $comment
 
string $owner
 
string $author
 
int $thumb_size
 
string $question
 The question text. More...
 
float $points
 The maximum available points for the question. More...
 
bool $shuffle
 Indicates whether the answers will be shuffled or not. More...
 
int $test_id
 The database id of a test in which the question is contained. More...
 
int $obj_id = 0
 Object id of the container object. More...
 
 $ilias
 
ilGlobalPageTemplate $tpl
 
ilLanguage $lng
 
ilDBInterface $db
 
Container $dic
 
int $outputType = OUTPUT_JAVASCRIPT
 Contains the output type of a question. More...
 
array $suggested_solutions
 
int $original_id = null
 
 $page
 
string $external_id = null
 
ilAssQuestionProcessLocker $processLocker
 
 $step
 
 $lastChange
 
Transformation $shuffler
 
ilTestQuestionConfig $testQuestionConfig
 
ilAssQuestionLifecycle $lifecycle
 
ilObjUser $current_user
 

Private Attributes

RandomGroup $randomGroup
 

Additional Inherited Members

- Static Public Member Functions inherited from assQuestion
static setForcePassResultUpdateEnabled (bool $forcePassResultsUpdateEnabled)
 
static isForcePassResultUpdateEnabled ()
 
static isAllowedImageMimeType ($mimeType)
 
static fetchMimeTypeIdentifier (string $contentType)
 
static getAllowedFileExtensionsForMimeType (string $mimeType)
 
static isAllowedImageFileExtension (string $mimeType, string $fileExtension)
 
static getAllowedImageMaterialFileExtensions ()
 
static _getMaximumPoints (int $question_id)
 Returns the maximum points, a learner can reach answering the question. More...
 
static _getQuestionInfo (int $question_id)
 
static _getSuggestedSolutionCount (int $question_id)
 
static _getSuggestedSolutionOutput (int $question_id)
 
static _getReachedPoints (int $active_id, int $question_id, int $pass)
 
static _updateTestResultCache (int $active_id, ilAssQuestionProcessLocker $processLocker=null)
 Move this to a proper place. More...
 
static logAction (string $logtext, int $active_id, int $question_id)
 
static getQuestionTypeFromDb (int $question_id)
 
static _getTotalRightAnswers (int $a_q_id)
 
static _getTitle (int $a_q_id)
 
static _getQuestionText (int $a_q_id)
 
static isFileAvailable (string $file)
 
static _getQuestionType (int $question_id)
 
static _getQuestionTitle (int $question_id)
 
static saveOriginalId (int $questionId, int $originalId)
 
static resetOriginalId (int $questionId)
 
static _getInternalLinkHref (string $target="")
 
static _getOriginalId (int $question_id)
 
static originalQuestionExists (int $questionId)
 
static _instanciateQuestion (int $question_id)
 
static _instantiateQuestion (int $question_id)
 
static instantiateQuestion (int $question_id)
 
static _getSolutionMaxPass (int $question_id, int $active_id)
 Returns the maximum pass a users question solution. More...
 
static _isWriteable (int $question_id, int $user_id)
 
static _isUsedInRandomTest (int $question_id)
 
static _isWorkedThrough (int $active_id, int $question_id, int $pass)
 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 (int $a_user_id, array $a_question_ids)
 Checks if an array of question ids is answered by a user or not. More...
 
static _setReachedPoints (int $active_id, int $question_id, float $points, float $maxpoints, int $pass, bool $manualscoring, bool $obligationsEnabled)
 Sets the points, a learner has reached answering the question Additionally objective results are updated. More...
 
static _needsManualScoring (int $question_id)
 
static _includeClass (string $question_type, int $gui=0)
 
static getFeedbackClassNameByQuestionType (string $questionType)
 
static isCoreQuestionType (string $questionType)
 
static includeCoreClass ($questionType, $withGuiClass)
 
static _getQuestionTypeName ($type_tag)
 
static _instanciateQuestionGUI (int $question_id)
 
static instantiateQuestionGUI (int $a_question_id)
 
static _questionExistsInTest (int $question_id, int $test_id)
 
static lookupParentObjId (int $questionId)
 
static lookupOriginalParentObjId (int $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 (int $questionId)
 
static implodeKeyValues (array $keyValues)
 
static explodeKeyValues (string $keyValues)
 
static convertISO8601FormatH_i_s_ExtendedToSeconds (string $time)
 
static missingResultRecordExists (int $activeId, int $pass, array $questionIds)
 
static getQuestionsMissingResultRecord (int $activeId, int $pass, array $questionIds)
 
static lookupResultRecordExist (int $activeId, int $questionId, int $pass)
 
static extendedTrim (string $value)
 Trim non-printable characters from the beginning and end of a string. More...
 
- Static Protected Member Functions inherited from assQuestion
static getNumExistingSolutionRecords (int $activeId, int $pass, int $questionId)
 
- Static Protected Attributes inherited from assQuestion
static $allowedFileExtensionsByMimeType
 
static $allowedCharsetsByMimeType
 
static $allowedImageMaterialFileExtensionsByMimeType
 
static $forcePassResultsUpdateEnabled = false
 
static $imageSourceFixReplaceMap
 

Detailed Description

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

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

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

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 34 of file class.assClozeTest.php.

Constructor & Destructor Documentation

◆ __construct()

assClozeTest::__construct (   $title = "",
  $comment = "",
  $author = "",
  $owner = -1,
  $question = "" 
)

assClozeTest constructor

The constructor takes possible arguments an creates an instance of the assClozeTest 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$question

Definition at line 124 of file class.assClozeTest.php.

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

130  {
131  global $DIC;
132 
134  $this->start_tag = "[gap]";
135  $this->end_tag = "[/gap]";
136  $this->gaps = [];
137  $this->setQuestion($question); // @TODO: Should this be $question?? See setter for why this is not trivial.
138  $this->fixedTextLength = "";
139  $this->identical_scoring = 1;
140  $this->gap_combinations_exists = false;
141  $this->gap_combinations = [];
142  $this->randomGroup = $DIC->refinery()->random();
143  }
global $DIC
Definition: feed.php:28
string $question
The question text.
__construct(Container $dic, ilPlugin $plugin)
setQuestion(string $question="")
+ Here is the call graph for this function:

Member Function Documentation

◆ addAnswerOptionValue()

assClozeTest::addAnswerOptionValue ( int  $qIndex,
string  $answerOptionValue,
float  $points 
)

Definition at line 2031 of file class.assClozeTest.php.

References getGap().

2031  : void
2032  {
2033  $gap = $this->getGap($qIndex); /* @var assClozeGap $gap */
2034 
2035  $item = new assAnswerCloze($answerOptionValue, $points);
2036  $item->setOrder($gap->getItemCount());
2037 
2038  $gap->addItem($item);
2039  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getGap($gap_index=0)
Returns the gap at a given index.
float $points
The maximum available points for the question.
+ Here is the call graph for this function:

◆ addGapAnswer()

assClozeTest::addGapAnswer (   $gap_index,
  $order,
  $answer 
)

Sets the answer text of a gap with a given index.

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

Parameters
integer$gap_indexA nonnegative index of the n-th gap
integer$orderThe order of the answer text
string$answerThe answer text public
See also
$gaps

Definition at line 771 of file class.assClozeTest.php.

References CLOZE_NUMERIC.

771  : void
772  {
773  if (array_key_exists($gap_index, $this->gaps)) {
774  if ($this->gaps[$gap_index]->getType() == CLOZE_NUMERIC) {
775  // only allow notation with "." for real numbers
776  $answer = str_replace(",", ".", $answer);
777  }
778  $this->gaps[$gap_index]->addItem(new assAnswerCloze(trim($answer), 0, $order));
779  }
780  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const CLOZE_NUMERIC

◆ addGapAtIndex()

assClozeTest::addGapAtIndex (   $gap,
  $index 
)

Adds a ClozeGap object at a given index.

Parameters
object$gapThe gap object
integer$indexA nonnegative index of the n-th gap public
See also
$gaps

Definition at line 850 of file class.assClozeTest.php.

References $index.

850  : void
851  {
852  $this->gaps[$index] = $gap;
853  }
$index
Definition: metadata.php:145

◆ addGapText()

assClozeTest::addGapText (   $gap_index)

Adds a new answer text value to a text gap with a given index.

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

Parameters
integer$gap_indexA nonnegative index of the n-th gap public
See also
$gaps

Definition at line 829 of file class.assClozeTest.php.

829  : void
830  {
831  if (array_key_exists($gap_index, $this->gaps)) {
832  include_once "./Modules/TestQuestionPool/classes/class.assAnswerCloze.php";
833  $answer = new assAnswerCloze(
834  "",
835  0,
836  $this->gaps[$gap_index]->getItemCount()
837  );
838  $this->gaps[$gap_index]->addItem($answer);
839  }
840  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ calculateCombinationResult()

assClozeTest::calculateCombinationResult (   $user_result)

Definition at line 1806 of file class.assClozeTest.php.

References assQuestion\$points, CLOZE_NUMERIC, CLOZE_SELECT, CLOZE_TEXT, assQuestion\getId(), getNumericgapPoints(), and getTextgapPoints().

Referenced by calculateReachedPointsForSolution().

1806  : array
1807  {
1808  $points = 0;
1809 
1810  $assClozeGapCombinationObj = new assClozeGapCombination();
1811  $gap_used_in_combination = [];
1812  if ($assClozeGapCombinationObj->combinationExistsForQid($this->getId())) {
1813  $combinations_for_question = $assClozeGapCombinationObj->getCleanCombinationArray($this->getId());
1814  $gap_answers = [];
1815 
1816  foreach ($user_result as $user_result_build_list) {
1817  if (is_array($user_result_build_list)) {
1818  $gap_answers[$user_result_build_list['gap_id']] = $user_result_build_list['value'];
1819  }
1820  }
1821 
1822  foreach ($combinations_for_question as $combination) {
1823  foreach ($combination as $row_key => $row_answers) {
1824  $combination_fulfilled = true;
1825  $points_for_combination = $row_answers['points'];
1826  foreach ($row_answers as $gap_key => $combination_gap_answer) {
1827  if ($gap_key !== 'points') {
1828  $gap_used_in_combination[$gap_key] = $gap_key;
1829  }
1830  if ($combination_fulfilled && array_key_exists($gap_key, $gap_answers)) {
1831  switch ($combination_gap_answer['type']) {
1832  case CLOZE_TEXT:
1833  $is_text_gap_correct = $this->getTextgapPoints($gap_answers[$gap_key], $combination_gap_answer['answer'], 1);
1834  if ($is_text_gap_correct != 1) {
1835  $combination_fulfilled = false;
1836  }
1837  break;
1838  case CLOZE_SELECT:
1839  $answer = $this->gaps[$gap_key]->getItem($gap_answers[$gap_key]);
1840  $answertext = '';
1841  if ($answer !== null) {
1842  $answertext = $answer->getAnswertext();
1843  }
1844 
1845  if ($answertext != $combination_gap_answer['answer']) {
1846  $combination_fulfilled = false;
1847  }
1848  break;
1849  case CLOZE_NUMERIC:
1850  $answer = $this->gaps[$gap_key]->getItem(0);
1851  if ($combination_gap_answer['answer'] != 'out_of_bound') {
1852  $is_numeric_gap_correct = $this->getNumericgapPoints($answer->getAnswertext(), $gap_answers[$gap_key], 1, $answer->getLowerBound(), $answer->getUpperBound());
1853  if ($is_numeric_gap_correct != 1) {
1854  $combination_fulfilled = false;
1855  }
1856  } else {
1857  $wrong_is_the_new_right = $this->getNumericgapPoints($answer->getAnswertext(), $gap_answers[$gap_key], 1, $answer->getLowerBound(), $answer->getUpperBound());
1858  if ($wrong_is_the_new_right == 1) {
1859  $combination_fulfilled = false;
1860  }
1861  }
1862  break;
1863  }
1864  } else {
1865  if ($gap_key !== 'points') {
1866  $combination_fulfilled = false;
1867  }
1868  }
1869  }
1870  if ($combination_fulfilled) {
1871  $points += $points_for_combination;
1872  }
1873  }
1874  }
1875  }
1876  return array($points, $gap_used_in_combination);
1877  }
const CLOZE_TEXT
Cloze question constants.
float $points
The maximum available points for the question.
getNumericgapPoints($a_original, $a_entered, $max_points, $lowerBound, $upperBound)
Returns the points for a text gap and compares the given solution with the entered solution using the...
getTextgapPoints($a_original, $a_entered, $max_points)
Returns the points for a text gap and compares the given solution with the entered solution using the...
const CLOZE_SELECT
const CLOZE_NUMERIC
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calculateReachedPoints()

assClozeTest::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 !!)

Definition at line 1261 of file class.assClozeTest.php.

References $data, assQuestion\$db, $ilDB, calculateReachedPointsForSolution(), assQuestion\getCurrentSolutionResultSet(), and assQuestion\getSolutionMaxPass().

Referenced by getExpressionTypes().

1262  {
1263  $ilDB = $this->db;
1264 
1265  if (is_null($pass)) {
1266  $pass = $this->getSolutionMaxPass($active_id);
1267  }
1268 
1269  $result = $this->getCurrentSolutionResultSet($active_id, $pass, $authorizedSolution);
1270  $user_result = [];
1271  while ($data = $ilDB->fetchAssoc($result)) {
1272  if (strcmp($data["value2"], "") != 0) {
1273  $user_result[$data["value1"]] = array(
1274  "gap_id" => $data["value1"],
1275  "value" => $data["value2"]
1276  );
1277  }
1278  }
1279 
1280  ksort($user_result); // this is required when identical scoring for same solutions is disabled
1281 
1282  if ($returndetails) {
1283  $detailed = [];
1284  $this->calculateReachedPointsForSolution($user_result, $detailed);
1285  return $detailed;
1286  }
1287 
1288  return $this->calculateReachedPointsForSolution($user_result);
1289  }
getSolutionMaxPass(int $active_id)
ilDBInterface $db
getCurrentSolutionResultSet(int $active_id, int $pass, bool $authorized=true)
calculateReachedPointsForSolution($user_result, &$detailed=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calculateReachedPointsForSolution()

assClozeTest::calculateReachedPointsForSolution (   $user_result,
$detailed = null 
)
protected
Parameters
array$user_result
array$detailed

Definition at line 1882 of file class.assClozeTest.php.

References assQuestion\$points, calculateCombinationResult(), CLOZE_NUMERIC, CLOZE_SELECT, CLOZE_TEXT, getIdenticalScoring(), getMaximumGapPoints(), getNumericgapPoints(), and getTextgapPoints().

Referenced by calculateReachedPoints(), and calculateReachedPointsFromPreviewSession().

1882  : float
1883  {
1884  if ($detailed === null) {
1885  $detailed = [];
1886  }
1887 
1888  $points = 0;
1889 
1890  $assClozeGapCombinationObj = new assClozeGapCombination();
1891  $combinations[1] = [];
1892  if ($assClozeGapCombinationObj->combinationExistsForQid($this->getId())) {
1893  $combinations = $this->calculateCombinationResult($user_result);
1894  $points = $combinations[0];
1895  }
1896  $counter = 0;
1897  $solution_values_text = []; // for identical scoring checks
1898  $solution_values_select = []; // for identical scoring checks
1899  $solution_values_numeric = []; // for identical scoring checks
1900  foreach ($user_result as $gap_id => $value) {
1901  if (is_string($value)) {
1902  $value = array("value" => $value);
1903  }
1904 
1905  if (array_key_exists($gap_id, $this->gaps) && !array_key_exists($gap_id, $combinations[1])) {
1906  switch ($this->gaps[$gap_id]->getType()) {
1907  case CLOZE_TEXT:
1908  $gappoints = 0;
1909  for ($order = 0; $order < $this->gaps[$gap_id]->getItemCount(); $order++) {
1910  $answer = $this->gaps[$gap_id]->getItem($order);
1911  $gotpoints = $this->getTextgapPoints($answer->getAnswertext(), $value["value"], $answer->getPoints());
1912  if ($gotpoints > $gappoints) {
1913  $gappoints = $gotpoints;
1914  }
1915  }
1916  if (!$this->getIdenticalScoring()) {
1917  // check if the same solution text was already entered
1918  if ((in_array($value["value"], $solution_values_text)) && ($gappoints > 0)) {
1919  $gappoints = 0;
1920  }
1921  }
1922  $points += $gappoints;
1923  $detailed[$gap_id] = array("points" => $gappoints, "best" => ($this->getMaximumGapPoints($gap_id) == $gappoints) ? true : false, "positive" => ($gappoints > 0) ? true : false);
1924  array_push($solution_values_text, $value["value"]);
1925  break;
1926  case CLOZE_NUMERIC:
1927  $gappoints = 0;
1928  for ($order = 0; $order < $this->gaps[$gap_id]->getItemCount(); $order++) {
1929  $answer = $this->gaps[$gap_id]->getItem($order);
1930  $gotpoints = $this->getNumericgapPoints($answer->getAnswertext(), $value["value"], $answer->getPoints(), $answer->getLowerBound(), $answer->getUpperBound());
1931  if ($gotpoints > $gappoints) {
1932  $gappoints = $gotpoints;
1933  }
1934  }
1935  if (!$this->getIdenticalScoring()) {
1936  // check if the same solution value was already entered
1937  include_once "./Services/Math/classes/class.EvalMath.php";
1938  $eval = new EvalMath();
1939  $eval->suppress_errors = true;
1940  $found_value = false;
1941  foreach ($solution_values_numeric as $solval) {
1942  if ($eval->e($solval) == $eval->e($value["value"])) {
1943  $found_value = true;
1944  }
1945  }
1946  if ($found_value && ($gappoints > 0)) {
1947  $gappoints = 0;
1948  }
1949  }
1950  $points += $gappoints;
1951  $detailed[$gap_id] = array("points" => $gappoints, "best" => ($this->getMaximumGapPoints($gap_id) == $gappoints) ? true : false, "positive" => ($gappoints > 0) ? true : false);
1952  array_push($solution_values_numeric, $value["value"]);
1953  break;
1954  case CLOZE_SELECT:
1955  if ($value["value"] >= 0) {
1956  for ($order = 0; $order < $this->gaps[$gap_id]->getItemCount(); $order++) {
1957  $answer = $this->gaps[$gap_id]->getItem($order);
1958  if ($value["value"] == $answer->getOrder()) {
1959  $answerpoints = $answer->getPoints();
1960  if (!$this->getIdenticalScoring()) {
1961  // check if the same solution value was already entered
1962  if ((in_array($answer->getAnswertext(), $solution_values_select)) && ($answerpoints > 0)) {
1963  $answerpoints = 0;
1964  }
1965  }
1966  $points += $answerpoints;
1967  $detailed[$gap_id] = array("points" => $answerpoints, "best" => ($this->getMaximumGapPoints($gap_id) == $answerpoints) ? true : false, "positive" => ($answerpoints > 0) ? true : false);
1968  array_push($solution_values_select, $answer->getAnswertext());
1969  }
1970  }
1971  }
1972  break;
1973  }
1974  }
1975  }
1976 
1977  return $points;
1978  }
getMaximumGapPoints($gap_index)
Returns the maximum points for a gap.
const CLOZE_TEXT
Cloze question constants.
calculateCombinationResult($user_result)
float $points
The maximum available points for the question.
getNumericgapPoints($a_original, $a_entered, $max_points, $lowerBound, $upperBound)
Returns the points for a text gap and compares the given solution with the entered solution using the...
getTextgapPoints($a_original, $a_entered, $max_points)
Returns the points for a text gap and compares the given solution with the entered solution using the...
const CLOZE_SELECT
const CLOZE_NUMERIC
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getIdenticalScoring()
Returns the identical scoring status of the question.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calculateReachedPointsFromPreviewSession()

assClozeTest::calculateReachedPointsFromPreviewSession ( ilAssQuestionPreviewSession  $preview_session)

Definition at line 1980 of file class.assClozeTest.php.

References ILIAS\LTI\ToolProvider\$key, calculateReachedPointsForSolution(), assQuestion\deductHintPointsFromReachedPoints(), assQuestion\ensureNonNegativePoints(), and ilAssQuestionPreviewSession\getParticipantsSolution().

1981  {
1982  $participant_session = $preview_session->getParticipantsSolution();
1983 
1984  if (!is_array($participant_session)) {
1985  return 0;
1986  }
1987 
1988  $user_solution = [];
1989 
1990  foreach ($participant_session as $key => $val) {
1991  $user_solution[$key] = array('gap_id' => $key, 'value' => $val);
1992  }
1993 
1994  $reached_points = $this->calculateReachedPointsForSolution($user_solution);
1995  $reached_points = $this->deductHintPointsFromReachedPoints($preview_session, $reached_points);
1996 
1997  return $this->ensureNonNegativePoints($reached_points);
1998  }
ensureNonNegativePoints($points)
string $key
Consumer key/client ID value.
Definition: System.php:193
deductHintPointsFromReachedPoints(ilAssQuestionPreviewSession $previewSession, $reachedPoints)
calculateReachedPointsForSolution($user_result, &$detailed=null)
+ Here is the call graph for this function:

◆ checkForValidFormula()

assClozeTest::checkForValidFormula (   $value)
Parameters
$value
Returns
int

Definition at line 1248 of file class.assClozeTest.php.

1248  : int
1249  {
1250  return preg_match("/^-?(\\d*)(,|\\.|\\/){0,1}(\\d*)$/", $value, $matches);
1251  }

◆ cleanQuestiontext()

assClozeTest::cleanQuestiontext (   $text)

Cleans cloze question text to remove attributes or tags from older ILIAS versions.

Parameters
string$textThe cloze question text
Returns
string The cleaned cloze question text

Definition at line 169 of file class.assClozeTest.php.

Referenced by loadFromDb(), and setClozeText().

169  : string
170  {
171  // fau: fixGapReplace - mask dollars for replacement
172  $text = str_replace('$', 'GAPMASKEDDOLLAR', $text);
173  $text = preg_replace("/\[gap[^\]]*?\]/", "[gap]", $text);
174  $text = preg_replace("/<gap([^>]*?)>/", "[gap]", $text);
175  $text = str_replace("</gap>", "[/gap]", $text);
176  $text = str_replace('GAPMASKEDDOLLAR', '$', $text);
177  // fau.
178  return $text;
179  }
+ Here is the caller graph for this function:

◆ clearGapAnswers()

assClozeTest::clearGapAnswers ( )

Removes all answers from the gaps.

public

See also
$gaps

Definition at line 738 of file class.assClozeTest.php.

738  : void
739  {
740  foreach ($this->gaps as $gap_index => $gap) {
741  $this->gaps[$gap_index]->clearItems();
742  }
743  }

◆ copyGapCombination()

assClozeTest::copyGapCombination (   $orgID,
  $newID 
)

Definition at line 1070 of file class.assClozeTest.php.

Referenced by copyObject(), createNewOriginalFromThisDuplicate(), and duplicate().

1070  : void
1071  {
1072  $assClozeGapCombinationObj = new assClozeGapCombination();
1073  $array = $assClozeGapCombinationObj->loadFromDb($orgID);
1074  $assClozeGapCombinationObj->importGapCombinationToDb($newID, $array);
1075  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the caller graph for this function:

◆ copyObject()

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

Copies an assClozeTest object.

public

Definition at line 998 of file class.assClozeTest.php.

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

998  : int
999  {
1000  if ($this->getId() <= 0) {
1001  throw new RuntimeException('The question has not been saved. It cannot be duplicated');
1002  }
1003 
1004  $thisId = $this->getId();
1005  $thisObjId = $this->getObjId();
1006 
1007  $clone = $this;
1008  include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
1010  $clone->id = -1;
1011  $clone->setObjId($target_questionpool_id);
1012  if ($title) {
1013  $clone->setTitle($title);
1014  }
1015 
1016  $clone->saveToDb();
1017 
1018  if ($this->gap_combinations_exists) {
1019  $this->copyGapCombination($original_id, $clone->getId());
1020  $clone->saveToDb();
1021  }
1022 
1023  // copy question page content
1024  $clone->copyPageOfQuestion($original_id);
1025  // copy XHTML media objects
1026  $clone->copyXHTMLMediaObjectsOfQuestion($original_id);
1027 
1028  $clone->onCopy($thisObjId, $thisId, $clone->getObjId(), $clone->getId());
1029 
1030  return $clone->getId();
1031  }
static _getOriginalId(int $question_id)
copyGapCombination($orgID, $newID)
+ Here is the call graph for this function:

◆ createGapsFromQuestiontext()

assClozeTest::createGapsFromQuestiontext ( )

Create gap entries by parsing the question text.

public

See also
$gaps

Definition at line 683 of file class.assClozeTest.php.

References ILIAS\LTI\ToolProvider\$key, CLOZE_TEXT, and getClozeText().

Referenced by setClozeText().

683  : void
684  {
685  include_once "./Modules/TestQuestionPool/classes/class.assClozeGap.php";
686  include_once "./Modules/TestQuestionPool/classes/class.assAnswerCloze.php";
687  $search_pattern = "|\[gap\](.*?)\[/gap\]|i";
688  preg_match_all($search_pattern, $this->getClozeText(), $found);
689  $this->gaps = [];
690  if (count($found[0])) {
691  foreach ($found[1] as $gap_index => $answers) {
692  // create text gaps by default
693  $gap = new assClozeGap(CLOZE_TEXT);
694  $textparams = preg_split("/(?<!\\\\),/", $answers);
695  foreach ($textparams as $key => $value) {
696  $answer = new assAnswerCloze($value, 0, $key);
697  $gap->addItem($answer);
698  }
699  $this->gaps[$gap_index] = $gap;
700  }
701  }
702  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const CLOZE_TEXT
Cloze question constants.
Class for cloze question gaps.
string $key
Consumer key/client ID value.
Definition: System.php:193
getClozeText()
Returns the cloze text.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createNewOriginalFromThisDuplicate()

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

Definition at line 1033 of file class.assClozeTest.php.

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

1033  : int
1034  {
1035  if ($this->getId() <= 0) {
1036  throw new RuntimeException('The question has not been saved. It cannot be duplicated');
1037  }
1038 
1039  include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
1040 
1041  $sourceQuestionId = $this->id;
1042  $sourceParentId = $this->getObjId();
1043 
1044  // duplicate the question in database
1045  $clone = $this;
1046  $clone->id = -1;
1047 
1048  $clone->setObjId($targetParentId);
1049 
1050  if ($targetQuestionTitle) {
1051  $clone->setTitle($targetQuestionTitle);
1052  }
1053 
1054  $clone->saveToDb();
1055 
1056  if ($this->gap_combinations_exists) {
1057  $this->copyGapCombination($sourceQuestionId, $clone->getId());
1058  $clone->saveToDb();
1059  }
1060  // copy question page content
1061  $clone->copyPageOfQuestion($sourceQuestionId);
1062  // copy XHTML media objects
1063  $clone->copyXHTMLMediaObjectsOfQuestion($sourceQuestionId);
1064 
1065  $clone->onCopy($sourceParentId, $sourceQuestionId, $clone->getObjId(), $clone->getId());
1066 
1067  return $clone->id;
1068  }
copyGapCombination($orgID, $newID)
+ Here is the call graph for this function:

◆ deleteAnswerText()

assClozeTest::deleteAnswerText (   $gap_index,
  $answer_index 
)

Deletes the answer text of a gap with a given index and an answer with a given order.

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

Parameters
integer$gap_indexA nonnegative index of the n-th gap
integer$answer_indexThe order of the answer text public
See also
$gaps

Definition at line 1107 of file class.assClozeTest.php.

References deleteGap(), and updateClozeTextFromGaps().

1107  : void
1108  {
1109  if (array_key_exists($gap_index, $this->gaps)) {
1110  if ($this->gaps[$gap_index]->getItemCount() == 1) {
1111  // this is the last answer text => remove the gap
1112  $this->deleteGap($gap_index);
1113  } else {
1114  // remove the answer text
1115  $this->gaps[$gap_index]->deleteItem($answer_index);
1116  $this->updateClozeTextFromGaps();
1117  }
1118  }
1119  }
deleteGap($gap_index)
Deletes a gap with a given index.
updateClozeTextFromGaps()
Updates the gap parameters in the cloze text from the form input.
+ Here is the call graph for this function:

◆ deleteGap()

assClozeTest::deleteGap (   $gap_index)

Deletes a gap with a given index.

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

Parameters
integer$gap_indexA nonnegative index of the n-th gap public
See also
$gaps

Definition at line 1129 of file class.assClozeTest.php.

References getClozeText(), getGaps(), and replaceFirstGap().

Referenced by deleteAnswerText().

1129  : void
1130  {
1131  if (array_key_exists($gap_index, $this->gaps)) {
1132  $output = $this->getClozeText();
1133  foreach ($this->getGaps() as $replace_gap_index => $gap) {
1134  $answers = [];
1135  foreach ($gap->getItemsRaw() as $item) {
1136  array_push($answers, str_replace(",", "\\,", $item->getAnswerText()));
1137  }
1138  if ($replace_gap_index == $gap_index) {
1139  // fau: fixGapReplace - use replace function
1140  $output = $this->replaceFirstGap($output, '');
1141  // fau.
1142  } else {
1143  // fau: fixGapReplace - use replace function
1144  $output = $this->replaceFirstGap($output, "[_gap]" . join(",", $answers) . "[/_gap]");
1145  // fau.
1146  }
1147  }
1148  $output = str_replace("_gap]", "gap]", $output);
1149  $this->cloze_text = $output;
1150  unset($this->gaps[$gap_index]);
1151  $this->gaps = array_values($this->gaps);
1152  }
1153  }
getGaps()
Returns the array of gaps.
replaceFirstGap($gaptext, $content)
Replace the first gap in a string without treating backreferences.
getClozeText()
Returns the cloze text.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ duplicate()

assClozeTest::duplicate ( bool  $for_test = true,
string  $title = "",
string  $author = "",
string  $owner = "",
  $testObjId = null 
)

Duplicates an assClozeTest.

public

Definition at line 942 of file class.assClozeTest.php.

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

942  : int
943  {
944  if ($this->id <= 0) {
945  // The question has not been saved. It cannot be duplicated
946  return -1;
947  }
948  // duplicate the question in database
949  $this_id = $this->getId();
950  $thisObjId = $this->getObjId();
951 
952  $clone = $this;
953  include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
955  $clone->id = -1;
956 
957  if ((int) $testObjId > 0) {
958  $clone->setObjId($testObjId);
959  }
960 
961  if ($title) {
962  $clone->setTitle($title);
963  }
964  if ($author) {
965  $clone->setAuthor($author);
966  }
967  if ($owner) {
968  $clone->setOwner($owner);
969  }
970  if ($for_test) {
971  $clone->saveToDb($original_id);
972  } else {
973  $clone->saveToDb();
974  }
975  if ($this->gap_combinations_exists) {
976  $this->copyGapCombination($this_id, $clone->getId());
977  }
978  if ($for_test) {
979  $clone->saveToDb($original_id);
980  } else {
981  $clone->saveToDb();
982  }
983  // copy question page content
984  $clone->copyPageOfQuestion($this_id);
985  // copy XHTML media objects
986  $clone->copyXHTMLMediaObjectsOfQuestion($this_id);
987 
988  $clone->onDuplicate($thisObjId, $this_id, $clone->getObjId(), $clone->getId());
989 
990  return $clone->getId();
991  }
static _getOriginalId(int $question_id)
copyGapCombination($orgID, $newID)
+ Here is the call graph for this function:

◆ fetchAnswerValueForGap()

assClozeTest::fetchAnswerValueForGap (   $userSolution,
  $gapIndex 
)

Definition at line 2000 of file class.assClozeTest.php.

2000  : string
2001  {
2002  $answerValue = '';
2003 
2004  foreach ($userSolution as $value1 => $value2) {
2005  if ($value1 == $gapIndex) {
2006  $answerValue = $value2;
2007  break;
2008  }
2009  }
2010 
2011  return $answerValue;
2012  }

◆ fetchSolutionSubmit()

assClozeTest::fetchSolutionSubmit (   $submit)

Definition at line 1322 of file class.assClozeTest.php.

References $index, CLOZE_NUMERIC, CLOZE_SELECT, getGaps(), and ILIAS\Repository\int().

Referenced by getSolutionSubmit().

1322  : array
1323  {
1324  $solutionSubmit = [];
1325  $post_wrapper = $this->dic->http()->wrapper()->post();
1326  foreach ($this->getGaps() as $index => $gap) {
1327  if (!$post_wrapper->has("gap_$index")) {
1328  continue;
1329  }
1330  $value = trim($post_wrapper->retrieve(
1331  "gap_$index",
1332  $this->dic->refinery()->kindlyTo()->string()
1333  ));
1334  if ($value === '') {
1335  continue;
1336  }
1337 
1338  if (!(($gap->getType() === (int) CLOZE_SELECT) && ($value === -1))) {
1339  if (
1340  $gap->getType() === (int) CLOZE_NUMERIC
1341  && !is_numeric(str_replace(",", ".", $value))
1342  ) {
1343  $value = null;
1344  } elseif ($gap->getType() === (int) CLOZE_NUMERIC) {
1345  $value = str_replace(",", ".", $value);
1346  }
1347  $solutionSubmit[$index] = $value;
1348  }
1349  }
1350 
1351  return $solutionSubmit;
1352  }
$index
Definition: metadata.php:145
getGaps()
Returns the array of gaps.
const CLOZE_SELECT
const CLOZE_NUMERIC
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ flushGaps()

assClozeTest::flushGaps ( )

Deletes all gaps without changing the cloze text.

See also
$gaps

Definition at line 547 of file class.assClozeTest.php.

547  : void
548  {
549  $this->gaps = [];
550  }

◆ getAdditionalTableName()

assClozeTest::getAdditionalTableName ( )

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

Returns
string The additional table name public

Definition at line 1517 of file class.assClozeTest.php.

Referenced by loadFromDb(), and saveAdditionalQuestionDataToDb().

1517  : string
1518  {
1519  return "qpl_qst_cloze";
1520  }
+ Here is the caller graph for this function:

◆ getAnswerTableName()

assClozeTest::getAnswerTableName ( )

Definition at line 1522 of file class.assClozeTest.php.

1522  : array
1523  {
1524  return array("qpl_a_cloze",'qpl_a_cloze_combi_res');
1525  }

◆ getAvailableAnswerOptions()

assClozeTest::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 1797 of file class.assClozeTest.php.

References $index, getGap(), and getGaps().

1798  {
1799  if ($index !== null) {
1800  return $this->getGap($index);
1801  } else {
1802  return $this->getGaps();
1803  }
1804  }
getGap($gap_index=0)
Returns the gap at a given index.
$index
Definition: metadata.php:145
getGaps()
Returns the array of gaps.
+ Here is the call graph for this function:

◆ getClozeText()

assClozeTest::getClozeText ( )

Returns the cloze text.

Returns
string The cloze text string public
See also
$cloze_text

Definition at line 580 of file class.assClozeTest.php.

References $cloze_text.

Referenced by createGapsFromQuestiontext(), deleteGap(), getClozeTextForHTMLOutput(), getRTETextWithMediaObjects(), isComplete(), lmMigrateQuestionTypeSpecificContent(), saveAdditionalQuestionDataToDb(), toJSON(), and updateClozeTextFromGaps().

580  : string
581  {
582  return $this->cloze_text;
583  }
+ Here is the caller graph for this function:

◆ getClozeTextForHTMLOutput()

assClozeTest::getClozeTextForHTMLOutput ( )

Returns the cloze text as HTML (with optional nl2br) Fix for Mantis 29987: We assume Tiny embeds any text in tags, so if no tags are present, we derive it's non-HTML content and apply nl2br.

Returns
string The cloze text string as HTML
See also
$cloze_text

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

References getClozeText(), assQuestion\getHtmlQuestionContentPurifier(), assQuestion\isAdditionalContentEditingModePageObject(), and assQuestion\prepareTextareaOutput().

593  : string
594  {
595  $gaps = [];
596  preg_match_all('/\[gap\].*?\[\/gap\]/', $this->getClozeText(), $gaps);
597  $string_with_replaced_gaps = str_replace($gaps[0], '######GAP######', $this->getClozeText());
598  $cleaned_text = $this->getHtmlQuestionContentPurifier()->purify(
599  $string_with_replaced_gaps
600  );
601  $cleaned_text_with_gaps = preg_replace_callback('/######GAP######/', function ($match) use (&$gaps) {
602  return array_shift($gaps[0]);
603  }, $cleaned_text);
604 
606  || !(new ilSetting('advanced_editing'))->get('advanced_editing_javascript_editor') === 'tinymce') {
607  $cleaned_text_with_gaps = nl2br($cleaned_text_with_gaps);
608  }
609 
610  return $this->prepareTextareaOutput($cleaned_text_with_gaps, true);
611  }
isAdditionalContentEditingModePageObject()
prepareTextareaOutput(string $txt_output, bool $prepare_for_latex_output=false, bool $omitNl2BrWhenTextArea=false)
getClozeText()
Returns the cloze text.
+ Here is the call graph for this function:

◆ getEndTag()

assClozeTest::getEndTag ( )

Returns the end tag of a cloze gap.

Returns
string The end tag of a cloze gap public
See also
$end_tag

Definition at line 644 of file class.assClozeTest.php.

References $end_tag.

644  : string
645  {
646  return $this->end_tag;
647  }

◆ getExpressionTypes()

assClozeTest::getExpressionTypes ( )

Get all available expression types for a specific question.

Returns
array

Implements iQuestionCondition.

Definition at line 1720 of file class.assClozeTest.php.

References $data, $DIC, $ilDB, assQuestion\$points, calculateReachedPoints(), iQuestionCondition\EmptyAnswerExpression, assQuestion\getId(), getMaximumPoints(), iQuestionCondition\getUserQuestionResult(), assQuestion\lookupMaxStep(), iQuestionCondition\NumberOfResultExpression, iQuestionCondition\NumericResultExpression, iQuestionCondition\PercentageResultExpression, and iQuestionCondition\StringResultExpression.

+ Here is the call graph for this function:

◆ getFeedbackMode()

assClozeTest::getFeedbackMode ( )
Returns
string

Definition at line 664 of file class.assClozeTest.php.

References $feedbackMode.

Referenced by saveAdditionalQuestionDataToDb().

664  : string
665  {
666  return $this->feedbackMode;
667  }
+ Here is the caller graph for this function:

◆ getFixedTextLength()

assClozeTest::getFixedTextLength ( )

Gets the fixed text length for all text fields in the cloze question.

Returns
integer The text field length public

Definition at line 1544 of file class.assClozeTest.php.

References $fixedTextLength.

Referenced by saveAdditionalQuestionDataToDb().

1545  {
1546  return $this->fixedTextLength;
1547  }
+ Here is the caller graph for this function:

◆ getGap()

assClozeTest::getGap (   $gap_index = 0)

Returns the gap at a given index.

Parameters
integer$gap_indexA nonnegative index of the n-th gap
See also
$gaps

Definition at line 788 of file class.assClozeTest.php.

Referenced by addAnswerOptionValue(), getAvailableAnswerOptions(), getSolutionSubmitValidation(), isAddableAnswerOptionValue(), saveWorkingData(), and validateSolutionSubmit().

789  {
790  if (array_key_exists($gap_index, $this->gaps)) {
791  return $this->gaps[$gap_index];
792  } else {
793  return null;
794  }
795  }
+ Here is the caller graph for this function:

◆ getGapCombinations()

assClozeTest::getGapCombinations ( )

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

References $gap_combinations.

1586  : array
1587  {
1588  return $this->gap_combinations;
1589  }

◆ getGapCombinationsExists()

assClozeTest::getGapCombinationsExists ( )

Definition at line 1581 of file class.assClozeTest.php.

References $gap_combinations_exists.

1581  : bool
1582  {
1584  }

◆ getGapCount()

assClozeTest::getGapCount ( )

Returns the number of gaps.

Returns
integer The number of gaps public
See also
$gaps

Definition at line 752 of file class.assClozeTest.php.

752  : int
753  {
754  if (is_array($this->gaps)) {
755  return count($this->gaps);
756  } else {
757  return 0;
758  }
759  }

◆ getGaps()

assClozeTest::getGaps ( )

Returns the array of gaps.

Returns
array<int, assClozeGap> A map containing the gap objects of the cloze question gaps mapped to the respective gap id.

Definition at line 537 of file class.assClozeTest.php.

References $gaps.

Referenced by deleteGap(), fetchSolutionSubmit(), getAvailableAnswerOptions(), isComplete(), setExportDetailsXLS(), toJSON(), and updateClozeTextFromGaps().

537  : array
538  {
539  return $this->gaps;
540  }
+ Here is the caller graph for this function:

◆ getIdenticalScoring()

assClozeTest::getIdenticalScoring ( )

Returns the identical scoring status of the question.

Returns
boolean The identical scoring status
See also
$identical_scoring public

Definition at line 1494 of file class.assClozeTest.php.

Referenced by calculateReachedPointsForSolution(), and saveAdditionalQuestionDataToDb().

1495  {
1496  return ($this->identical_scoring) ? 1 : 0;
1497  }
+ Here is the caller graph for this function:

◆ getMaximumGapPoints()

assClozeTest::getMaximumGapPoints (   $gap_index)

Returns the maximum points for a gap.

Parameters
integer$gap_indexThe index of the gap
Returns
double The maximum points for the gap public
See also
$points

Definition at line 1557 of file class.assClozeTest.php.

References assQuestion\$points.

Referenced by calculateReachedPointsForSolution().

1558  {
1559  $points = 0;
1560  $gap_max_points = 0;
1561  if (array_key_exists($gap_index, $this->gaps)) {
1562  $gap = &$this->gaps[$gap_index];
1563  foreach ($gap->getItems($this->getShuffler()) as $answer) {
1564  if ($answer->getPoints() > $gap_max_points) {
1565  $gap_max_points = $answer->getPoints();
1566  }
1567  }
1568  $points += $gap_max_points;
1569  }
1570  return $points;
1571  }
float $points
The maximum available points for the question.
+ Here is the caller graph for this function:

◆ getMaximumPoints()

assClozeTest::getMaximumPoints ( )

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

public

See also
$points

Definition at line 895 of file class.assClozeTest.php.

References assQuestion\$points, CLOZE_NUMERIC, CLOZE_SELECT, CLOZE_TEXT, and assQuestion\getId().

Referenced by getExpressionTypes(), and isComplete().

895  : float
896  {
897  $assClozeGapCombinationObj = new assClozeGapCombination();
898  $points = 0;
899  $gaps_used_in_combination = [];
900  if ($assClozeGapCombinationObj->combinationExistsForQid($this->getId())) {
901  $points = $assClozeGapCombinationObj->getMaxPointsForCombination($this->getId());
902  $gaps_used_in_combination = $assClozeGapCombinationObj->getGapsWhichAreUsedInCombination($this->getId());
903  }
904  foreach ($this->gaps as $gap_index => $gap) {
905  if (!array_key_exists($gap_index, $gaps_used_in_combination)) {
906  if ($gap->getType() == CLOZE_TEXT) {
907  $gap_max_points = 0;
908  foreach ($gap->getItems($this->getShuffler()) as $item) {
909  if ($item->getPoints() > $gap_max_points) {
910  $gap_max_points = $item->getPoints();
911  }
912  }
913  $points += $gap_max_points;
914  } elseif ($gap->getType() == CLOZE_SELECT) {
915  $srpoints = 0;
916  foreach ($gap->getItems($this->getShuffler()) as $item) {
917  if ($item->getPoints() > $srpoints) {
918  $srpoints = $item->getPoints();
919  }
920  }
921  $points += $srpoints;
922  } elseif ($gap->getType() == CLOZE_NUMERIC) {
923  $numpoints = 0;
924  foreach ($gap->getItems($this->getShuffler()) as $item) {
925  if ($item->getPoints() > $numpoints) {
926  $numpoints = $item->getPoints();
927  }
928  }
929  $points += $numpoints;
930  }
931  }
932  }
933 
934  return $points;
935  }
const CLOZE_TEXT
Cloze question constants.
float $points
The maximum available points for the question.
const CLOZE_SELECT
const CLOZE_NUMERIC
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNumericgapPoints()

assClozeTest::getNumericgapPoints (   $a_original,
  $a_entered,
  $max_points,
  $lowerBound,
  $upperBound 
)

Returns the points for a text gap and compares the given solution with the entered solution using the text gap rating options.

Parameters
string$a_originalThe original (correct) text
string$a_enteredThe text entered by the user
float$max_pointsThe maximum number of points for the solution public

Definition at line 1217 of file class.assClozeTest.php.

Referenced by calculateCombinationResult(), and calculateReachedPointsForSolution().

1217  : float
1218  {
1219  include_once "./Services/Math/classes/class.EvalMath.php";
1220  $eval = new EvalMath();
1221  $eval->suppress_errors = true;
1222  $result = 0.0;
1223 
1224  if ($eval->e($a_entered) === false) {
1225  return 0.0;
1226  } elseif (($eval->e($lowerBound) !== false) && ($eval->e($upperBound) !== false)) {
1227  if (($eval->e($a_entered) >= $eval->e($lowerBound)) && ($eval->e($a_entered) <= $eval->e($upperBound))) {
1228  $result = $max_points;
1229  }
1230  } elseif ($eval->e($lowerBound) !== false) {
1231  if (($eval->e($a_entered) >= $eval->e($lowerBound)) && ($eval->e($a_entered) <= $eval->e($a_original))) {
1232  $result = $max_points;
1233  }
1234  } elseif ($eval->e($upperBound) !== false) {
1235  if (($eval->e($a_entered) >= $eval->e($a_original)) && ($eval->e($a_entered) <= $eval->e($upperBound))) {
1236  $result = $max_points;
1237  }
1238  } elseif ($eval->e($a_entered) == $eval->e($a_original)) {
1239  $result = $max_points;
1240  }
1241  return $result;
1242  }
+ Here is the caller graph for this function:

◆ getOperators()

assClozeTest::getOperators (   $expression)

Get all available operations for a specific question.

Parameters
string$expression

Implements iQuestionCondition.

Definition at line 1711 of file class.assClozeTest.php.

References ilOperatorsExpressionMapping\getOperatorsByExpression().

1711  : array
1712  {
1714  }
+ Here is the call graph for this function:

◆ getQuestionType()

assClozeTest::getQuestionType ( )

Returns the question type of the question.

Returns
integer The question type of the question public

Definition at line 1445 of file class.assClozeTest.php.

Referenced by toJSON().

1445  : string
1446  {
1447  return "assClozeTest";
1448  }
+ Here is the caller graph for this function:

◆ getRTETextWithMediaObjects()

assClozeTest::getRTETextWithMediaObjects ( )

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

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

References getClozeText().

1577  : string
1578  {
1579  return parent::getRTETextWithMediaObjects() . $this->getClozeText();
1580  }
getClozeText()
Returns the cloze text.
+ Here is the call graph for this function:

◆ getSolutionSubmit()

assClozeTest::getSolutionSubmit ( )

Definition at line 1378 of file class.assClozeTest.php.

References fetchSolutionSubmit().

Referenced by saveWorkingData().

1378  : array
1379  {
1380  return $this->fetchSolutionSubmit($_POST);
1381  }
fetchSolutionSubmit($submit)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSolutionSubmitValidation()

assClozeTest::getSolutionSubmitValidation ( )

Definition at line 1354 of file class.assClozeTest.php.

References ILIAS\LTI\ToolProvider\$key, CLOZE_NUMERIC, CLOZE_SELECT, and getGap().

Referenced by validateSolutionSubmit().

1354  : array
1355  {
1356  $submit = $_POST;
1357  $solutionSubmit = [];
1358 
1359  foreach ($submit as $key => $value) {
1360  if (preg_match("/^gap_(\d+)/", $key, $matches)) {
1361  if ($value !== null && $value !== '') {
1362  $gap = $this->getGap($matches[1]);
1363  if (is_object($gap)) {
1364  if (!(($gap->getType() == CLOZE_SELECT) && ($value == -1))) {
1365  if ($gap->getType() == CLOZE_NUMERIC) {
1366  $value = str_replace(",", ".", $value);
1367  }
1368  $solutionSubmit[trim($matches[1])] = $value;
1369  }
1370  }
1371  }
1372  }
1373  }
1374 
1375  return $solutionSubmit;
1376  }
getGap($gap_index=0)
Returns the gap at a given index.
const CLOZE_SELECT
string $key
Consumer key/client ID value.
Definition: System.php:193
const CLOZE_NUMERIC
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getStartTag()

assClozeTest::getStartTag ( )

Returns the start tag of a cloze gap.

Returns
string The start tag of a cloze gap public
See also
$start_tag

Definition at line 620 of file class.assClozeTest.php.

References $start_tag.

620  : string
621  {
622  return $this->start_tag;
623  }

◆ getTextgapPoints()

assClozeTest::getTextgapPoints (   $a_original,
  $a_entered,
  $max_points 
)

Returns the points for a text gap and compares the given solution with the entered solution using the text gap rating options.

Parameters
string$a_originalThe original (correct) text
string$a_enteredThe text entered by the user
integer$max_pointsThe maximum number of points for the solution public

Definition at line 1164 of file class.assClozeTest.php.

References $DIC, assQuestion\$refinery, getTextgapRating(), ilStr\strToLower(), TEXTGAP_RATING_CASEINSENSITIVE, TEXTGAP_RATING_CASESENSITIVE, TEXTGAP_RATING_LEVENSHTEIN1, TEXTGAP_RATING_LEVENSHTEIN2, TEXTGAP_RATING_LEVENSHTEIN3, TEXTGAP_RATING_LEVENSHTEIN4, and TEXTGAP_RATING_LEVENSHTEIN5.

Referenced by calculateCombinationResult(), and calculateReachedPointsForSolution().

1164  : float
1165  {
1166  include_once "./Services/Utilities/classes/class.ilStr.php";
1167  global $DIC;
1168  $refinery = $DIC->refinery();
1169  $result = 0;
1170  $gaprating = $this->getTextgapRating();
1171 
1172  switch ($gaprating) {
1174  if (strcmp(ilStr::strToLower($a_original), ilStr::strToLower($a_entered)) == 0) {
1175  $result = $max_points;
1176  }
1177  break;
1179  if (strcmp($a_original, $a_entered) == 0) {
1180  $result = $max_points;
1181  }
1182  break;
1184  $transformation = $refinery->string()->levenshtein()->standard($a_original, 1);
1185  break;
1187  $transformation = $refinery->string()->levenshtein()->standard($a_original, 2);
1188  break;
1190  $transformation = $refinery->string()->levenshtein()->standard($a_original, 3);
1191  break;
1193  $transformation = $refinery->string()->levenshtein()->standard($a_original, 4);
1194  break;
1196  $transformation = $refinery->string()->levenshtein()->standard($a_original, 5);
1197  break;
1198  }
1199 
1200  // run answers against Levenshtein2 methods
1201  if (isset($transformation) && $transformation->transform($a_entered) >= 0) {
1202  $result = $max_points;
1203  }
1204  return $result;
1205  }
const TEXTGAP_RATING_LEVENSHTEIN5
const TEXTGAP_RATING_LEVENSHTEIN2
const TEXTGAP_RATING_LEVENSHTEIN1
getTextgapRating()
Returns the rating option for text gaps.
global $DIC
Definition: feed.php:28
const TEXTGAP_RATING_LEVENSHTEIN3
const TEXTGAP_RATING_CASESENSITIVE
const TEXTGAP_RATING_LEVENSHTEIN4
static strToLower(string $a_string)
Definition: class.ilStr.php:72
ILIAS Refinery Factory $refinery
const TEXTGAP_RATING_CASEINSENSITIVE
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTextgapRating()

assClozeTest::getTextgapRating ( )

Returns the rating option for text gaps.

Returns
string The rating option for text gaps
See also
$textgap_rating public

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

References $textgap_rating.

Referenced by getTextgapPoints(), and saveAdditionalQuestionDataToDb().

1457  : string
1458  {
1459  return $this->textgap_rating;
1460  }
+ Here is the caller graph for this function:

◆ isAddableAnswerOptionValue()

assClozeTest::isAddableAnswerOptionValue ( int  $qIndex,
string  $answerOptionValue 
)

Definition at line 2014 of file class.assClozeTest.php.

References CLOZE_TEXT, and getGap().

2014  : bool
2015  {
2016  $gap = $this->getGap($qIndex);
2017 
2018  if ($gap->getType() != CLOZE_TEXT) {
2019  return false;
2020  }
2021 
2022  foreach ($gap->getItems($this->randomGroup->dontShuffle()) as $item) {
2023  if ($item->getAnswertext() === $answerOptionValue) {
2024  return false;
2025  }
2026  }
2027 
2028  return true;
2029  }
const CLOZE_TEXT
Cloze question constants.
getGap($gap_index=0)
Returns the gap at a given index.
+ Here is the call graph for this function:

◆ isComplete()

assClozeTest::isComplete ( )

Returns TRUE, if a cloze test is complete for use.

Returns
boolean TRUE, if the cloze test is complete for use, otherwise FALSE

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

References assQuestion\getAuthor(), getClozeText(), getGaps(), getMaximumPoints(), and assQuestion\getTitle().

150  : bool
151  {
152  if (strlen($this->getTitle())
153  && $this->getAuthor()
154  && $this->getClozeText()
155  && count($this->getGaps())
156  && $this->getMaximumPoints() > 0) {
157  return true;
158  }
159  return false;
160  }
getMaximumPoints()
Returns the maximum points, a learner can reach answering the question.
getGaps()
Returns the array of gaps.
getClozeText()
Returns the cloze text.
+ Here is the call graph for this function:

◆ isValidNumericSubmitValue()

assClozeTest::isValidNumericSubmitValue (   $submittedValue)
protected

Definition at line 1291 of file class.assClozeTest.php.

Referenced by validateSolutionSubmit().

1291  : bool
1292  {
1293  if (is_numeric($submittedValue)) {
1294  return true;
1295  }
1296 
1297  if (preg_match('/^[-+]{0,1}\d+\/\d+$/', $submittedValue)) {
1298  return true;
1299  }
1300 
1301  return false;
1302  }
+ Here is the caller graph for this function:

◆ lmMigrateQuestionTypeSpecificContent()

assClozeTest::lmMigrateQuestionTypeSpecificContent ( ilAssSelfAssessmentMigrator  $migrator)
protected
Parameters
ilAssSelfAssessmentMigrator$migrator

Definition at line 1643 of file class.assClozeTest.php.

References getClozeText(), and ilAssSelfAssessmentMigrator\migrateToLmContent().

1643  : void
1644  {
1645  // DO NOT USE SETTER FOR CLOZE TEXT -> SETTER DOES RECREATE GAP OBJECTS without having gap type info ^^
1646  //$this->setClozeText( $migrator->migrateToLmContent($this->getClozeText()) );
1647  $this->cloze_text = $migrator->migrateToLmContent($this->getClozeText());
1648  // DO NOT USE SETTER FOR CLOZE TEXT -> SETTER DOES RECREATE GAP OBJECTS without having gap type info ^^
1649  }
getClozeText()
Returns the cloze text.
+ Here is the call graph for this function:

◆ loadFromDb()

assClozeTest::loadFromDb (   $question_id)

Loads a assClozeTest object from a database.

Parameters
integer$question_idA unique key which defines the cloze test in the database

Definition at line 203 of file class.assClozeTest.php.

References $data, $DIC, Vendor\Package\$e, $ilDB, ilRTE\_replaceMediaObjectImageSrc(), cleanQuestiontext(), CLOZE_NUMERIC, CLOZE_SELECT, CLOZE_TEXT, ilAssClozeTestFeedback\FB_MODE_GAP_QUESTION, getAdditionalTableName(), ilAssQuestionLifecycle\getDraftInstance(), ilAssQuestionLifecycle\getInstance(), assQuestion\setAdditionalContentEditingMode(), assQuestion\setAuthor(), setClozeText(), assQuestion\setComment(), setFeedbackMode(), setFixedTextLength(), setGapCombinations(), setGapCombinationsExists(), assQuestion\setId(), setIdenticalScoring(), assQuestion\setLifecycle(), assQuestion\setNrOfTries(), assQuestion\setObjId(), assQuestion\setOriginalId(), assQuestion\setOwner(), assQuestion\setPoints(), assQuestion\setQuestion(), setTextgapRating(), and assQuestion\setTitle().

203  : void
204  {
205  global $DIC;
206  $ilDB = $DIC['ilDB'];
207  $result = $ilDB->queryF(
208  "SELECT qpl_questions.*, " . $this->getAdditionalTableName() . ".* FROM qpl_questions LEFT JOIN " . $this->getAdditionalTableName() . " ON " . $this->getAdditionalTableName() . ".question_fi = qpl_questions.question_id WHERE qpl_questions.question_id = %s",
209  array("integer"),
210  array($question_id)
211  );
212  if ($result->numRows() == 1) {
213  $data = $ilDB->fetchAssoc($result);
214  $this->setId($question_id);
215  $this->setNrOfTries($data['nr_of_tries']);
216  $this->setObjId($data["obj_fi"]);
217  $this->setTitle((string) $data["title"]);
218  $this->setComment((string) $data["description"]);
219  $this->setOriginalId($data["original_id"]);
220  $this->setAuthor($data["author"]);
221  $this->setPoints($data["points"]);
222  $this->setOwner($data["owner"]);
223  $this->setQuestion($this->cleanQuestiontext($data["question_text"]));
224  $this->setClozeText($data['cloze_text']);
225  $this->setFixedTextLength($data["fixed_textlen"]);
226  $this->setIdenticalScoring(($data['tstamp'] == 0) ? true : $data["identical_scoring"]);
227  $this->setFeedbackMode($data['feedback_mode'] === null ? ilAssClozeTestFeedback::FB_MODE_GAP_QUESTION : $data['feedback_mode']);
228 
229  try {
233  }
234 
235  // replacement of old syntax with new syntax
236  include_once("./Services/RTE/classes/class.ilRTE.php");
237  $this->question = ilRTE::_replaceMediaObjectImageSrc($this->question, 1);
238  $this->cloze_text = ilRTE::_replaceMediaObjectImageSrc($this->cloze_text, 1);
239  $this->setTextgapRating($data["textgap_rating"]);
240 
241  try {
242  $this->setAdditionalContentEditingMode($data['add_cont_edit_mode']);
243  } catch (ilTestQuestionPoolException $e) {
244  }
245 
246  // open the cloze gaps with all answers
247  include_once "./Modules/TestQuestionPool/classes/class.assAnswerCloze.php";
248  include_once "./Modules/TestQuestionPool/classes/class.assClozeGap.php";
249  $result = $ilDB->queryF(
250  "SELECT * FROM qpl_a_cloze WHERE question_fi = %s ORDER BY gap_id, aorder ASC",
251  array("integer"),
252  array($question_id)
253  );
254  if ($result->numRows() > 0) {
255  $this->gaps = [];
256  while ($data = $ilDB->fetchAssoc($result)) {
257  switch ($data["cloze_type"]) {
258  case CLOZE_TEXT:
259  if (!array_key_exists($data["gap_id"], $this->gaps)) {
260  $this->gaps[$data["gap_id"]] = new assClozeGap(CLOZE_TEXT);
261  }
262  $answer = new assAnswerCloze(
263  $data["answertext"],
264  $data["points"],
265  $data["aorder"]
266  );
267  $this->gaps[$data["gap_id"]]->setGapSize((int) $data['gap_size']);
268 
269  $this->gaps[$data["gap_id"]]->addItem($answer);
270  break;
271  case CLOZE_SELECT:
272  if (!array_key_exists($data["gap_id"], $this->gaps)) {
273  $this->gaps[$data["gap_id"]] = new assClozeGap(CLOZE_SELECT);
274  $this->gaps[$data["gap_id"]]->setShuffle($data["shuffle"]);
275  }
276  $answer = new assAnswerCloze(
277  $data["answertext"],
278  $data["points"],
279  $data["aorder"]
280  );
281  $this->gaps[$data["gap_id"]]->addItem($answer);
282  break;
283  case CLOZE_NUMERIC:
284  if (!array_key_exists($data["gap_id"], $this->gaps)) {
285  $this->gaps[$data["gap_id"]] = new assClozeGap(CLOZE_NUMERIC);
286  }
287  $answer = new assAnswerCloze(
288  $data["answertext"],
289  $data["points"],
290  $data["aorder"]
291  );
292  $this->gaps[$data["gap_id"]]->setGapSize((int) $data['gap_size']);
293  $answer->setLowerBound($data["lowerlimit"]);
294  $answer->setUpperBound($data["upperlimit"]);
295  $this->gaps[$data["gap_id"]]->addItem($answer);
296  break;
297  }
298  }
299  }
300  }
301  $assClozeGapCombinationObj = new assClozeGapCombination();
302  $check_for_gap_combinations = $assClozeGapCombinationObj->loadFromDb($question_id);
303  if (count($check_for_gap_combinations) != 0) {
304  $this->setGapCombinationsExists(true);
305  $this->setGapCombinations($check_for_gap_combinations);
306  }
307  parent::loadFromDb($question_id);
308  }
static _replaceMediaObjectImageSrc(string $a_text, int $a_direction=0, string $nic='')
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
setNrOfTries(int $a_nr_of_tries)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getAdditionalTableName()
Returns the name of the additional question data table in the database.
const CLOZE_TEXT
Cloze question constants.
setOwner(int $owner=-1)
Class for cloze question gaps.
setComment(string $comment="")
global $DIC
Definition: feed.php:28
setGapCombinationsExists($value)
const CLOZE_SELECT
setFixedTextLength($a_text_len)
Sets a fixed text length for all text fields in the cloze question.
setPoints(float $points)
setObjId(int $obj_id=0)
setClozeText($cloze_text="")
Evaluates the text gap solutions from the cloze text.
cleanQuestiontext($text)
Cleans cloze question text to remove attributes or tags from older ILIAS versions.
setFeedbackMode($feedbackMode)
setTextgapRating($a_textgap_rating)
Sets the rating option for text gaps.
setId(int $id=-1)
setOriginalId(?int $original_id)
setTitle(string $title="")
setLifecycle(ilAssQuestionLifecycle $lifecycle)
const CLOZE_NUMERIC
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setAuthor(string $author="")
setIdenticalScoring($a_identical_scoring)
Sets the identical scoring option for cloze questions.
setAdditionalContentEditingMode(?string $additionalContentEditingMode)
const FB_MODE_GAP_QUESTION
constants for different feedback modes (per gap or per gap-answers/options)
setQuestion(string $question="")
+ Here is the call graph for this function:

◆ replaceFirstGap()

assClozeTest::replaceFirstGap (   $gaptext,
  $content 
)

Replace the first gap in a string without treating backreferences.

Parameters
string$gaptexttext with gap tags
string$contentcontent for the first gap
Returns
string

Definition at line 188 of file class.assClozeTest.php.

Referenced by deleteGap(), and updateClozeTextFromGaps().

188  : string
189  {
190  $content = str_replace('$', 'GAPMASKEDDOLLAR', $content);
191  $output = preg_replace("/\[gap\].*?\[\/gap\]/", $content, $gaptext, 1);
192  $output = str_replace('GAPMASKEDDOLLAR', '$', $output);
193 
194  return $output;
195  }
+ Here is the caller graph for this function:

◆ saveAdditionalQuestionDataToDb()

assClozeTest::saveAdditionalQuestionDataToDb ( )

Saves the data for the additional data table.

This method uses the ugly DELETE-INSERT. Here, this does no harm.

Implements ilObjQuestionScoringAdjustable.

Definition at line 358 of file class.assClozeTest.php.

References $DIC, ilRTE\_replaceMediaObjectImageSrc(), getAdditionalTableName(), getClozeText(), getFeedbackMode(), getFixedTextLength(), assQuestion\getId(), getIdenticalScoring(), and getTextgapRating().

Referenced by saveToDb().

359  {
360  global $DIC; /* @var ILIAS\DI\Container $DIC */
361 
362 
363  $DIC->database()->manipulateF(
364  "DELETE FROM " . $this->getAdditionalTableName() . " WHERE question_fi = %s",
365  array( "integer" ),
366  array( $this->getId() )
367  );
368 
369  $DIC->database()->insert($this->getAdditionalTableName(), array(
370  'question_fi' => array('integer', $this->getId()),
371  'textgap_rating' => array('text', $this->getTextgapRating()),
372  'identical_scoring' => array('text', $this->getIdenticalScoring()),
373  'fixed_textlen' => array('integer', $this->getFixedTextLength() ? $this->getFixedTextLength() : null),
374  'cloze_text' => array('text', ilRTE::_replaceMediaObjectImageSrc($this->getClozeText(), 0)),
375  'feedback_mode' => array('text', $this->getFeedbackMode())
376  ));
377  }
static _replaceMediaObjectImageSrc(string $a_text, int $a_direction=0, string $nic='')
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
getAdditionalTableName()
Returns the name of the additional question data table in the database.
getTextgapRating()
Returns the rating option for text gaps.
global $DIC
Definition: feed.php:28
getFixedTextLength()
Gets the fixed text length for all text fields in the cloze question.
getClozeText()
Returns the cloze text.
getIdenticalScoring()
Returns the identical scoring status of the question.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveAnswerSpecificDataToDb()

assClozeTest::saveAnswerSpecificDataToDb ( )

Save all gaps to the database.

Implements ilObjAnswerScoringAdjustable.

Definition at line 337 of file class.assClozeTest.php.

References $DIC, $ilDB, ILIAS\LTI\ToolProvider\$key, assQuestion\getId(), and saveClozeGapItemsToDb().

Referenced by saveToDb().

338  {
339  global $DIC;
340  $ilDB = $DIC['ilDB'];
341 
342  $ilDB->manipulateF(
343  "DELETE FROM qpl_a_cloze WHERE question_fi = %s",
344  array( "integer" ),
345  array( $this->getId() )
346  );
347 
348  foreach ($this->gaps as $key => $gap) {
349  $this->saveClozeGapItemsToDb($gap, $key);
350  }
351  }
global $DIC
Definition: feed.php:28
string $key
Consumer key/client ID value.
Definition: System.php:193
saveClozeGapItemsToDb($gap, $key)
Save all items belonging to one cloze gap to the db.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveClozeGapItemsToDb()

assClozeTest::saveClozeGapItemsToDb (   $gap,
  $key 
)
protected

Save all items belonging to one cloze gap to the db.

Parameters
$gap
$key

Definition at line 385 of file class.assClozeTest.php.

References $DIC, $ilDB, ILIAS\LTI\ToolProvider\$key, $query, CLOZE_NUMERIC, CLOZE_SELECT, CLOZE_TEXT, saveClozeNumericGapRecordToDb(), saveClozeSelectGapRecordToDb(), and saveClozeTextGapRecordToDb().

Referenced by saveAnswerSpecificDataToDb().

385  : void
386  {
387  global $DIC;
388  $ilDB = $DIC['ilDB'];
389  foreach ($gap->getItems($this->getShuffler()) as $item) {
390  $query = "";
391  $next_id = $ilDB->nextId('qpl_a_cloze');
392  switch ($gap->getType()) {
393  case CLOZE_TEXT:
394  $this->saveClozeTextGapRecordToDb($next_id, $key, $item, $gap);
395  break;
396  case CLOZE_SELECT:
397  $this->saveClozeSelectGapRecordToDb($next_id, $key, $item, $gap);
398  break;
399  case CLOZE_NUMERIC:
400  $this->saveClozeNumericGapRecordToDb($next_id, $key, $item, $gap);
401  break;
402  }
403  }
404  }
const CLOZE_TEXT
Cloze question constants.
global $DIC
Definition: feed.php:28
const CLOZE_SELECT
string $key
Consumer key/client ID value.
Definition: System.php:193
$query
saveClozeTextGapRecordToDb($next_id, $key, $item, $gap)
Saves a gap-item record.
saveClozeNumericGapRecordToDb($next_id, $key, $item, $gap)
Saves a gap-item record.
saveClozeSelectGapRecordToDb($next_id, $key, $item, $gap)
Saves a gap-item record.
const CLOZE_NUMERIC
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveClozeNumericGapRecordToDb()

assClozeTest::saveClozeNumericGapRecordToDb (   $next_id,
  $key,
  $item,
  $gap 
)
protected

Saves a gap-item record.

Parameters
$next_idint Next Id for the record.
$keyint Gap Id
$itemmixed Gap item data object.
$gapmixed Gap data object.

Definition at line 488 of file class.assClozeTest.php.

References $DIC, $ilDB, ILIAS\LTI\ToolProvider\$key, assQuestion\getId(), and ILIAS\Repository\int().

Referenced by saveClozeGapItemsToDb().

488  : void
489  {
490  global $DIC;
491  $ilDB = $DIC['ilDB'];
492 
493  include_once "./Services/Math/classes/class.EvalMath.php";
494  $eval = new EvalMath();
495  $eval->suppress_errors = true;
496  $ilDB->manipulateF(
497  "INSERT INTO qpl_a_cloze (answer_id, question_fi, gap_id, answertext, points, aorder, cloze_type, lowerlimit, upperlimit, gap_size) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
498  array(
499  "integer",
500  "integer",
501  "integer",
502  "text",
503  "float",
504  "integer",
505  "text",
506  "text",
507  "text",
508  "integer"
509  ),
510  array(
511  $next_id,
512  $this->getId(),
513  $key,
514  strlen($item->getAnswertext()) ? $item->getAnswertext() : "",
515  $item->getPoints(),
516  $item->getOrder(),
517  $gap->getType(),
518  ($eval->e($item->getLowerBound() !== false) && strlen(
519  $item->getLowerBound()
520  ) > 0) ? $item->getLowerBound() : $item->getAnswertext(),
521  ($eval->e($item->getUpperBound() !== false) && strlen(
522  $item->getUpperBound()
523  ) > 0) ? $item->getUpperBound() : $item->getAnswertext(),
524  (int) $gap->getGapSize()
525  )
526  );
527  }
global $DIC
Definition: feed.php:28
string $key
Consumer key/client ID value.
Definition: System.php:193
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveClozeSelectGapRecordToDb()

assClozeTest::saveClozeSelectGapRecordToDb (   $next_id,
  $key,
  $item,
  $gap 
)
protected

Saves a gap-item record.

Parameters
$next_idint Next Id for the record.
$keyint Gap Id
$itemmixed Gap item data object.
$gapmixed Gap data object.

Definition at line 451 of file class.assClozeTest.php.

References $DIC, $ilDB, ILIAS\LTI\ToolProvider\$key, and assQuestion\getId().

Referenced by saveClozeGapItemsToDb().

451  : void
452  {
453  global $DIC;
454  $ilDB = $DIC['ilDB'];
455  $ilDB->manipulateF(
456  "INSERT INTO qpl_a_cloze (answer_id, question_fi, gap_id, answertext, points, aorder, cloze_type, shuffle) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)",
457  [
458  "integer",
459  "integer",
460  "integer",
461  "text",
462  "float",
463  "integer",
464  "text",
465  "text"
466  ],
467  [
468  $next_id,
469  $this->getId(),
470  $key,
471  strlen($item->getAnswertext()) ? $item->getAnswertext() : "",
472  $item->getPoints(),
473  $item->getOrder(),
474  $gap->getType(),
475  ($gap->getShuffle()) ? "1" : "0"
476  ]
477  );
478  }
global $DIC
Definition: feed.php:28
string $key
Consumer key/client ID value.
Definition: System.php:193
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveClozeTextGapRecordToDb()

assClozeTest::saveClozeTextGapRecordToDb (   $next_id,
  $key,
  $item,
  $gap 
)
protected

Saves a gap-item record.

Parameters
$next_idint Next Id for the record.
$keyint Gap Id
$itemmixed Gap item data object.
$gapmixed Gap data object.

Definition at line 414 of file class.assClozeTest.php.

References $DIC, $ilDB, ILIAS\LTI\ToolProvider\$key, assQuestion\getId(), and ILIAS\Repository\int().

Referenced by saveClozeGapItemsToDb().

414  : void
415  {
416  global $DIC;
417  $ilDB = $DIC['ilDB'];
418  $ilDB->manipulateF(
419  "INSERT INTO qpl_a_cloze (answer_id, question_fi, gap_id, answertext, points, aorder, cloze_type, gap_size) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)",
420  array(
421  "integer",
422  "integer",
423  "integer",
424  "text",
425  "float",
426  "integer",
427  "text",
428  "integer"
429  ),
430  array(
431  $next_id,
432  $this->getId(),
433  $key,
434  strlen($item->getAnswertext()) ? $item->getAnswertext() : "",
435  $item->getPoints(),
436  $item->getOrder(),
437  $gap->getType(),
438  (int) $gap->getGapSize()
439  )
440  );
441  }
global $DIC
Definition: feed.php:28
string $key
Consumer key/client ID value.
Definition: System.php:193
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ savePartial()

assClozeTest::savePartial ( )

Definition at line 2041 of file class.assClozeTest.php.

2041  : bool
2042  {
2043  return true;
2044  }

◆ saveToDb()

assClozeTest::saveToDb (   $original_id = "")

Saves a assClozeTest object to a database.

Parameters
int | string$original_idID of the original question
Returns
mixed|void

public

Definition at line 321 of file class.assClozeTest.php.

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

321  : void
322  {
323  if ($original_id == "") {
324  $this->saveQuestionDataToDb();
325  } else {
327  }
330 
331  parent::saveToDb();
332  }
saveAnswerSpecificDataToDb()
Save all gaps to the database.
saveAdditionalQuestionDataToDb()
Saves the data for the additional data table.
saveQuestionDataToDb(int $original_id=-1)
+ Here is the call graph for this function:

◆ saveWorkingData()

assClozeTest::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 1391 of file class.assClozeTest.php.

References ILIAS\LTI\ToolProvider\$key, ilObjAssessmentFolder\_enabledAssessmentLogging(), ilObjAssessmentFolder\_getLogLanguage(), ilObjTest\_getPass(), CLOZE_SELECT, getGap(), assQuestion\getId(), assQuestion\getProcessLocker(), getSolutionSubmit(), ILIAS\Repository\lng(), assQuestion\logAction(), assQuestion\removeCurrentSolution(), assQuestion\saveCurrentSolution(), and ilUtil\stripSlashes().

1391  : bool
1392  {
1393  if (is_null($pass)) {
1394  include_once "./Modules/Test/classes/class.ilObjTest.php";
1395  $pass = ilObjTest::_getPass($active_id);
1396  }
1397 
1398  $entered_values = 0;
1399 
1400  $this->getProcessLocker()->executeUserSolutionUpdateLockOperation(function () use (&$entered_values, $active_id, $pass, $authorized) {
1401  $this->removeCurrentSolution($active_id, $pass, $authorized);
1402 
1403  foreach ($this->getSolutionSubmit() as $key => $value) {
1404  if ($value !== null && $value !== '') {
1405  $gap = $this->getGap(trim(ilUtil::stripSlashes($key)));
1406  if (is_object($gap)) {
1407  if (!(($gap->getType() == CLOZE_SELECT) && ($value == -1))) {
1408  $this->saveCurrentSolution($active_id, $pass, $key, $value, $authorized);
1409  $entered_values++;
1410  }
1411  }
1412  }
1413  }
1414  });
1415 
1416  if ($entered_values) {
1417  include_once("./Modules/Test/classes/class.ilObjAssessmentFolder.php");
1419  assQuestion::logAction($this->lng->txtlng(
1420  "assessment",
1421  "log_user_entered_values",
1423  ), $active_id, $this->getId());
1424  }
1425  } else {
1426  include_once("./Modules/Test/classes/class.ilObjAssessmentFolder.php");
1428  assQuestion::logAction($this->lng->txtlng(
1429  "assessment",
1430  "log_user_not_entered_values",
1432  ), $active_id, $this->getId());
1433  }
1434  }
1435 
1436  return true;
1437  }
static _getPass($active_id)
Retrieves the actual pass of a given user for a given test.
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
getGap($gap_index=0)
Returns the gap at a given index.
saveCurrentSolution(int $active_id, int $pass, $value1, $value2, bool $authorized=true, $tstamp=0)
const CLOZE_SELECT
static logAction(string $logtext, int $active_id, int $question_id)
string $key
Consumer key/client ID value.
Definition: System.php:193
removeCurrentSolution(int $active_id, int $pass, bool $authorized=true)
+ Here is the call graph for this function:

◆ setClozeText()

assClozeTest::setClozeText (   $cloze_text = "")

Evaluates the text gap solutions from the cloze text.

A single or multiple text gap solutions could be entered using the following syntax in the cloze text: solution1 [, solution2, ..., solutionN] enclosed in the text gap selector gap[]

Parameters
string$cloze_textThe cloze text with all gaps and gap gaps public
See also
$cloze_text

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

References $cloze_text, cleanQuestiontext(), and createGapsFromQuestiontext().

Referenced by loadFromDb().

561  : void
562  {
563  $this->gaps = [];
564  $this->cloze_text = $this->cleanQuestiontext($cloze_text);
566  }
createGapsFromQuestiontext()
Create gap entries by parsing the question text.
cleanQuestiontext($text)
Cleans cloze question text to remove attributes or tags from older ILIAS versions.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setClozeTextValue()

assClozeTest::setClozeTextValue (   $cloze_text = "")

Definition at line 568 of file class.assClozeTest.php.

References $cloze_text.

568  : void
569  {
570  $this->cloze_text = $cloze_text;
571  }

◆ setEndTag()

assClozeTest::setEndTag (   $end_tag = "[/gap]")

Sets the end tag of a cloze gap.

Parameters
string$end_tagThe end tag for a cloze gap public
See also
$end_tag

Definition at line 656 of file class.assClozeTest.php.

References $end_tag.

656  : void
657  {
658  $this->end_tag = $end_tag;
659  }

◆ setExportDetailsXLS()

assClozeTest::setExportDetailsXLS ( ilAssExcelFormatHelper  $worksheet,
int  $startrow,
int  $active_id,
int  $pass 
)

{}

Definition at line 1604 of file class.assClozeTest.php.

References $i, CLOZE_NUMERIC, CLOZE_SELECT, CLOZE_TEXT, ilExcel\getColumnCoord(), getGaps(), assQuestion\getSolutionValues(), ilAssExcelFormatHelper\getStringEscaping(), ILIAS\Repository\lng(), ilExcel\setBold(), ilAssExcelFormatHelper\setCell(), and ilAssExcelFormatHelper\setStringEscaping().

1604  : int
1605  {
1606  parent::setExportDetailsXLS($worksheet, $startrow, $active_id, $pass);
1607 
1608  $solution = $this->getSolutionValues($active_id, $pass);
1609  $i = 1;
1610  foreach ($this->getGaps() as $gap_index => $gap) {
1611  $worksheet->setCell($startrow + $i, 0, $this->lng->txt("gap") . " $i");
1612  $worksheet->setBold($worksheet->getColumnCoord(0) . ($startrow + $i));
1613  $checked = false;
1614  foreach ($solution as $solutionvalue) {
1615  if ($gap_index == $solutionvalue["value1"]) {
1616  $string_escaping_org_value = $worksheet->getStringEscaping();
1617  try {
1618  $worksheet->setStringEscaping(false);
1619 
1620  switch ($gap->getType()) {
1621  case CLOZE_SELECT:
1622  $worksheet->setCell($startrow + $i, 2, $gap->getItem($solutionvalue["value2"])->getAnswertext());
1623  break;
1624  case CLOZE_NUMERIC:
1625  case CLOZE_TEXT:
1626  $worksheet->setCell($startrow + $i, 2, $solutionvalue["value2"]);
1627  break;
1628  }
1629  } finally {
1630  $worksheet->setStringEscaping($string_escaping_org_value);
1631  }
1632  }
1633  }
1634  $i++;
1635  }
1636 
1637  return $startrow + $i + 1;
1638  }
getSolutionValues($active_id, $pass=null, bool $authorized=true)
Loads solutions of a given user from the database an returns it.
const CLOZE_TEXT
Cloze question constants.
getColumnCoord(int $a_col)
Get column "name" from number.
setCell($a_row, $a_col, $a_value, $datatype=null)
getGaps()
Returns the array of gaps.
setBold(string $a_coords)
Set cell(s) to bold.
const CLOZE_SELECT
const CLOZE_NUMERIC
$i
Definition: metadata.php:41
+ Here is the call graph for this function:

◆ setFeedbackMode()

assClozeTest::setFeedbackMode (   $feedbackMode)
Parameters
string$feedbackMode

Definition at line 672 of file class.assClozeTest.php.

References $feedbackMode.

Referenced by loadFromDb().

672  : void
673  {
674  $this->feedbackMode = $feedbackMode;
675  }
+ Here is the caller graph for this function:

◆ setFixedTextLength()

assClozeTest::setFixedTextLength (   $a_text_len)

Sets a fixed text length for all text fields in the cloze question.

Parameters
integer$a_text_lenThe text field length public

Definition at line 1533 of file class.assClozeTest.php.

Referenced by loadFromDb().

1533  : void
1534  {
1535  $this->fixedTextLength = $a_text_len;
1536  }
+ Here is the caller graph for this function:

◆ setGapAnswerLowerBound()

assClozeTest::setGapAnswerLowerBound (   $gap_index,
  $order,
  $bound 
)

Sets the lower bound of a gap with a given index and an answer with a given order.

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

Parameters
integer$gap_indexA nonnegative index of the n-th gap
integer$orderThe order of the answer text
string$answerThe lower bound of the answer public
See also
$gaps

Definition at line 865 of file class.assClozeTest.php.

865  : void
866  {
867  if (array_key_exists($gap_index, $this->gaps)) {
868  $this->gaps[$gap_index]->setItemLowerBound($order, $bound);
869  }
870  }

◆ setGapAnswerPoints()

assClozeTest::setGapAnswerPoints (   $gap_index,
  $order,
  $points 
)

Sets the points of a gap with a given index and an answer with a given order.

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

Parameters
integer$gap_indexA nonnegative index of the n-th gap
integer$orderThe order of the answer text
string$answerThe points of the answer public
See also
$gaps

Definition at line 814 of file class.assClozeTest.php.

References assQuestion\$points.

814  : void
815  {
816  if (array_key_exists($gap_index, $this->gaps)) {
817  $this->gaps[$gap_index]->setItemPoints($order, $points);
818  }
819  }
float $points
The maximum available points for the question.

◆ setGapAnswerUpperBound()

assClozeTest::setGapAnswerUpperBound (   $gap_index,
  $order,
  $bound 
)

Sets the upper bound of a gap with a given index and an answer with a given order.

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

Parameters
integer$gap_indexA nonnegative index of the n-th gap
integer$orderThe order of the answer text
string$answerThe upper bound of the answer public
See also
$gaps

Definition at line 882 of file class.assClozeTest.php.

882  : void
883  {
884  if (array_key_exists($gap_index, $this->gaps)) {
885  $this->gaps[$gap_index]->setItemUpperBound($order, $bound);
886  }
887  }

◆ setGapCombinations()

assClozeTest::setGapCombinations (   $value)

Definition at line 1596 of file class.assClozeTest.php.

Referenced by loadFromDb().

1596  : void
1597  {
1598  $this->gap_combinations = $value;
1599  }
+ Here is the caller graph for this function:

◆ setGapCombinationsExists()

assClozeTest::setGapCombinationsExists (   $value)

Definition at line 1591 of file class.assClozeTest.php.

Referenced by loadFromDb().

1591  : void
1592  {
1593  $this->gap_combinations_exists = $value;
1594  }
+ Here is the caller graph for this function:

◆ setGapShuffle()

assClozeTest::setGapShuffle (   $gap_index = 0,
  $shuffle = 1 
)

Sets the shuffle state of a gap with a given index.

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

Parameters
integer$indexA nonnegative index of the n-th gap
integer$shuffleTurn shuffle on (=1) or off (=0) public
See also
$gaps

Definition at line 725 of file class.assClozeTest.php.

References assQuestion\$shuffle.

725  : void
726  {
727  if (array_key_exists($gap_index, $this->gaps)) {
728  $this->gaps[$gap_index]->setShuffle($shuffle);
729  }
730  }
bool $shuffle
Indicates whether the answers will be shuffled or not.

◆ setGapSize()

assClozeTest::setGapSize (   $gap_index,
  $size 
)

Definition at line 797 of file class.assClozeTest.php.

797  : void
798  {
799  if (array_key_exists($gap_index, $this->gaps)) {
800  $this->gaps[$gap_index]->setGapSize((int) $size);
801  }
802  }

◆ setGapType()

assClozeTest::setGapType (   $gap_index,
  $gap_type 
)

Set the type of a gap with a given index.

private

Definition at line 709 of file class.assClozeTest.php.

709  : void
710  {
711  if (array_key_exists($gap_index, $this->gaps)) {
712  $this->gaps[$gap_index]->setType($gap_type);
713  }
714  }

◆ setIdenticalScoring()

assClozeTest::setIdenticalScoring (   $a_identical_scoring)

Sets the identical scoring option for cloze questions.

Parameters
boolean$a_identical_scoringThe identical scoring option for cloze questions
See also
$identical_scoring public

Definition at line 1506 of file class.assClozeTest.php.

Referenced by loadFromDb().

1506  : void
1507  {
1508  $this->identical_scoring = ($a_identical_scoring) ? 1 : 0;
1509  }
+ Here is the caller graph for this function:

◆ setStartTag()

assClozeTest::setStartTag (   $start_tag = "[gap]")

Sets the start tag of a cloze gap.

Parameters
string$start_tagThe start tag for a cloze gap public
See also
$start_tag

Definition at line 632 of file class.assClozeTest.php.

References $start_tag.

632  : void
633  {
634  $this->start_tag = $start_tag;
635  }

◆ setTextgapRating()

assClozeTest::setTextgapRating (   $a_textgap_rating)

Sets the rating option for text gaps.

Parameters
string$a_textgap_ratingThe rating option for text gaps
See also
$textgap_rating public

Definition at line 1469 of file class.assClozeTest.php.

References TEXTGAP_RATING_CASEINSENSITIVE, TEXTGAP_RATING_CASESENSITIVE, TEXTGAP_RATING_LEVENSHTEIN1, TEXTGAP_RATING_LEVENSHTEIN2, TEXTGAP_RATING_LEVENSHTEIN3, TEXTGAP_RATING_LEVENSHTEIN4, and TEXTGAP_RATING_LEVENSHTEIN5.

Referenced by loadFromDb().

1469  : void
1470  {
1471  switch ($a_textgap_rating) {
1479  $this->textgap_rating = $a_textgap_rating;
1480  break;
1481  default:
1482  $this->textgap_rating = TEXTGAP_RATING_CASEINSENSITIVE;
1483  break;
1484  }
1485  }
const TEXTGAP_RATING_LEVENSHTEIN5
const TEXTGAP_RATING_LEVENSHTEIN2
const TEXTGAP_RATING_LEVENSHTEIN1
const TEXTGAP_RATING_LEVENSHTEIN3
const TEXTGAP_RATING_CASESENSITIVE
const TEXTGAP_RATING_LEVENSHTEIN4
const TEXTGAP_RATING_CASEINSENSITIVE
+ Here is the caller graph for this function:

◆ toJSON()

assClozeTest::toJSON ( )

Returns a JSON representation of the question.

Definition at line 1654 of file class.assClozeTest.php.

References $gaps, ILIAS\LTI\ToolProvider\$key, $mobs, ilObjMediaObject\_getMobsOfObject(), CLOZE_NUMERIC, CLOZE_TEXT, assQuestion\formatSAQuestion(), getClozeText(), getGaps(), assQuestion\getId(), assQuestion\getNrOfTries(), assQuestion\getQuestion(), getQuestionType(), assQuestion\getShuffle(), and assQuestion\getTitleForHTMLOutput().

1654  : string
1655  {
1656  include_once("./Services/RTE/classes/class.ilRTE.php");
1657  $result = [];
1658  $result['id'] = $this->getId();
1659  $result['type'] = (string) $this->getQuestionType();
1660  $result['title'] = $this->getTitleForHTMLOutput();
1661  $result['question'] = $this->formatSAQuestion($this->getQuestion());
1662  $result['clozetext'] = $this->formatSAQuestion($this->getClozeText());
1663  $result['nr_of_tries'] = $this->getNrOfTries();
1664  $result['shuffle'] = $this->getShuffle();
1665  $result['feedback'] = array(
1666  'onenotcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), false)),
1667  'allcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), true))
1668  );
1669 
1670  $gaps = [];
1671  foreach ($this->getGaps() as $key => $gap) {
1672  $items = [];
1673  foreach ($gap->getItems($this->getShuffler()) as $item) {
1674  $jitem = [];
1675  $jitem['points'] = $item->getPoints();
1676  $jitem['value'] = $this->formatSAQuestion($item->getAnswertext());
1677  $jitem['order'] = $item->getOrder();
1678  if ($gap->getType() == CLOZE_NUMERIC) {
1679  $jitem['lowerbound'] = $item->getLowerBound();
1680  $jitem['upperbound'] = $item->getUpperBound();
1681  } else {
1682  $jitem['value'] = trim($jitem['value']);
1683  }
1684  array_push($items, $jitem);
1685  }
1686 
1687  if ($gap->getGapSize() && ($gap->getType() == CLOZE_TEXT || $gap->getType() == CLOZE_NUMERIC)) {
1688  $jgap['size'] = $gap->getGapSize();
1689  }
1690 
1691  $jgap['shuffle'] = $gap->getShuffle();
1692  $jgap['type'] = $gap->getType();
1693  $jgap['item'] = $items;
1694 
1695  array_push($gaps, $jgap);
1696  }
1697  $result['gaps'] = $gaps;
1698  $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $this->getId());
1699  $result['mobs'] = $mobs;
1700  return json_encode($result);
1701  }
getQuestionType()
Returns the question type of the question.
$mobs
Definition: imgupload.php:70
const CLOZE_TEXT
Cloze question constants.
getGaps()
Returns the array of gaps.
string $key
Consumer key/client ID value.
Definition: System.php:193
static _getMobsOfObject(string $a_type, int $a_id, int $a_usage_hist_nr=0, string $a_lang="-")
getClozeText()
Returns the cloze text.
const CLOZE_NUMERIC
+ Here is the call graph for this function:

◆ updateClozeTextFromGaps()

assClozeTest::updateClozeTextFromGaps ( )

Updates the gap parameters in the cloze text from the form input.

private

Definition at line 1082 of file class.assClozeTest.php.

References getClozeText(), getGaps(), assQuestion\prepareTextareaOutput(), and replaceFirstGap().

Referenced by deleteAnswerText().

1082  : void
1083  {
1084  $output = $this->getClozeText();
1085  foreach ($this->getGaps() as $gap_index => $gap) {
1086  $answers = [];
1087  foreach ($gap->getItemsRaw() as $item) {
1088  array_push($answers, str_replace([',', '['], ["\\,", '[&hairsp;'], $item->getAnswerText()));
1089  }
1090  // fau: fixGapReplace - use replace function
1091  $output = $this->replaceFirstGap($output, "[_gap]" . $this->prepareTextareaOutput(join(",", $answers), true) . "[/_gap]");
1092  // fau.
1093  }
1094  $output = str_replace("_gap]", "gap]", $output);
1095  $this->cloze_text = $output;
1096  }
getGaps()
Returns the array of gaps.
replaceFirstGap($gaptext, $content)
Replace the first gap in a string without treating backreferences.
prepareTextareaOutput(string $txt_output, bool $prepare_for_latex_output=false, bool $omitNl2BrWhenTextArea=false)
getClozeText()
Returns the cloze text.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ validateSolutionSubmit()

assClozeTest::validateSolutionSubmit ( )

Definition at line 1304 of file class.assClozeTest.php.

References CLOZE_NUMERIC, getGap(), getSolutionSubmitValidation(), isValidNumericSubmitValue(), and ILIAS\Repository\lng().

1304  : bool
1305  {
1306  foreach ($this->getSolutionSubmitValidation() as $gapIndex => $value) {
1307  $gap = $this->getGap($gapIndex);
1308 
1309  if ($gap->getType() != CLOZE_NUMERIC) {
1310  continue;
1311  }
1312 
1313  if (strlen($value) && !$this->isValidNumericSubmitValue($value)) {
1314  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("err_no_numeric_value"), true);
1315  return false;
1316  }
1317  }
1318 
1319  return true;
1320  }
getGap($gap_index=0)
Returns the gap at a given index.
isValidNumericSubmitValue($submittedValue)
const CLOZE_NUMERIC
+ Here is the call graph for this function:

Field Documentation

◆ $cloze_text

assClozeTest::$cloze_text

Definition at line 102 of file class.assClozeTest.php.

Referenced by getClozeText(), setClozeText(), and setClozeTextValue().

◆ $end_tag

assClozeTest::$end_tag

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

Referenced by getEndTag(), and setEndTag().

◆ $feedbackMode

assClozeTest::$feedbackMode = ilAssClozeTestFeedback::FB_MODE_GAP_QUESTION
protected

Definition at line 109 of file class.assClozeTest.php.

Referenced by getFeedbackMode(), and setFeedbackMode().

◆ $feedbackOBJ

ilAssQuestionFeedback assClozeTest::$feedbackOBJ

Definition at line 107 of file class.assClozeTest.php.

◆ $fixedTextLength

assClozeTest::$fixedTextLength

Definition at line 100 of file class.assClozeTest.php.

Referenced by getFixedTextLength().

◆ $gap_combinations

assClozeTest::$gap_combinations

Definition at line 49 of file class.assClozeTest.php.

Referenced by getGapCombinations().

◆ $gap_combinations_exists

assClozeTest::$gap_combinations_exists

Definition at line 52 of file class.assClozeTest.php.

Referenced by getGapCombinationsExists().

◆ $gaps

array assClozeTest::$gaps = []

Definition at line 40 of file class.assClozeTest.php.

Referenced by getGaps(), and toJSON().

◆ $identical_scoring

assClozeTest::$identical_scoring

Definition at line 93 of file class.assClozeTest.php.

◆ $randomGroup

RandomGroup assClozeTest::$randomGroup
private

Definition at line 111 of file class.assClozeTest.php.

◆ $start_tag

assClozeTest::$start_tag

Definition at line 61 of file class.assClozeTest.php.

Referenced by getStartTag(), and setStartTag().

◆ $textgap_rating

assClozeTest::$textgap_rating

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

Referenced by getTextgapRating().


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