ILIAS  release_7 Revision v7.30-3-g800a261c036
assTextQuestion 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 assTextQuestion:
+ Collaboration diagram for assTextQuestion:

Public Member Functions

 __construct ( $title="", $comment="", $author="", $owner=-1, $question="")
 assTextQuestion constructor More...
 
 isComplete ()
 Returns true, if a multiple choice question is complete for use. More...
 
 saveToDb ($original_id="")
 Saves a assTextQuestion object to a database. More...
 
 loadFromDb ($question_id)
 Loads a assTextQuestion object from a database. More...
 
 duplicate ($for_test=true, $title="", $author="", $owner="", $testObjId=null)
 Duplicates an assTextQuestion. More...
 
 copyObject ($target_questionpool_id, $title="")
 Copies an assTextQuestion object. More...
 
 createNewOriginalFromThisDuplicate ($targetParentId, $targetQuestionTitle="")
 
 getMaxNumOfChars ()
 Gets the maximum number of characters for the text solution. More...
 
 setMaxNumOfChars ($maxchars=0)
 Sets the maximum number of characters for the text solution. More...
 
 isWordCounterEnabled ()
 
 setWordCounterEnabled ($wordCounterEnabled)
 
 getMaximumPoints ()
 Returns the maximum points, a learner can reach answering the question. More...
 
 getMinimumPoints ()
 
 setReachedPoints ($active_id, $points, $pass=null)
 Sets the points, a learner has reached answering the question. More...
 
 isKeywordMatching ($answertext, $a_keyword)
 Checks if one of the keywords matches the answertext. More...
 
 calculateReachedPoints ($active_id, $pass=null, $authorizedSolution=true, $returndetails=false)
 Returns the points, a learner has reached answering the question. More...
 
 saveWorkingData ($active_id, $pass=null, $authorized=true)
 Saves the learners input of the question to the database. More...
 
 getSolutionSubmit ()
 
 getQuestionType ()
 Returns the question type of the question. More...
 
 getTextRating ()
 Returns the rating option for text comparisons. More...
 
 setTextRating ($a_text_rating)
 Sets the rating option for text comparisons. More...
 
 getAdditionalTableName ()
 Returns the name of the additional question data table in the database. More...
 
 getRTETextWithMediaObjects ()
 Collects all text in the question which could contain media objects which were created with the Rich Text Editor. More...
 
 setExportDetailsXLS ($worksheet, $startrow, $active_id, $pass)
 {Creates an Excel worksheet for the detailed cumulated results of this question.
Parameters
object$worksheetReference to the parent excel worksheet
object$startrowStartrow of the output in the excel worksheet
object$active_idActive id of the participant
object$passTest pass
Returns
object
} More...
 
 toJSON ()
 Returns a JSON representation of the question. More...
 
 getAnswerCount ()
 
 addAnswer ( $answertext="", $points=0.0, $points_unchecked=0.0, $order=0, $answerimage="")
 Adds a possible answer for a multiple choice question. More...
 
 getAnswers ()
 
 getAnswer ($index=0)
 Returns an answer with a given index. More...
 
 deleteAnswer ($index=0)
 Deletes an answer with a given index. More...
 
 getAnswerTableName ()
 Returns the name of the answer table in the database. More...
 
 flushAnswers ()
 Deletes all answers. More...
 
 setAnswers ($answers)
 
 duplicateAnswers ($original_id)
 
 getKeywordRelation ()
 
 setKeywordRelation ($a_relation)
 This method implements a default behaviour. More...
 
 isAnswered ($active_id, $pass=null)
 returns boolean wether the question is answered during test pass or not More...
 
 countLetters ($text)
 
 countWords ($text)
 
 getLatestAutosaveContent ($active_id)
 
- Public Member Functions inherited from assQuestion
 getShuffler ()
 
 setShuffler (ilArrayElementShuffler $shuffler)
 
 setProcessLocker ($processLocker)
 
 getProcessLocker ()
 
 fromXML (&$item, &$questionpool_id, &$tst_id, &$tst_object, &$question_counter, &$import_mapping, array $solutionhints=[])
 Receives parameters from a QTI parser and creates a valid ILIAS question object. More...
 
 toXML ($a_include_header=true, $a_include_binary=true, $a_shuffle=false, $test_output=false, $force_image_references=false)
 Returns a QTI xml representation of the question. More...
 
 isComplete ()
 Returns true, if a question is complete for use. More...
 
 questionTitleExists ($questionpool_id, $title)
 Returns TRUE if the question title exists in the database. More...
 
 setTitle ($title="")
 Sets the title string of the assQuestion object. More...
 
 setId ($id=-1)
 Sets the id of the assQuestion object. More...
 
 setTestId ($id=-1)
 Sets the test id of the assQuestion object. More...
 
 setComment ($comment="")
 Sets the comment string of the assQuestion object. More...
 
 setOutputType ($outputType=OUTPUT_HTML)
 Sets the output type. More...
 
 setShuffle ($shuffle=true)
 Sets the shuffle flag. More...
 
 setEstimatedWorkingTime ($hour=0, $min=0, $sec=0)
 Sets the estimated working time of a question from given hour, minute and second. More...
 
 setEstimatedWorkingTimeFromDurationString ($durationString)
 Sets the estimated working time of a question from a given datetime string. More...
 
 keyInArray ($searchkey, $array)
 returns TRUE if the key occurs in an array More...
 
 setAuthor ($author="")
 Sets the authors name of the assQuestion object. More...
 
 setOwner ($owner="")
 Sets the creator/owner ID of the assQuestion object. More...
 
 getTitle ()
 Gets the title string of the assQuestion object. More...
 
 getTitleFilenameCompliant ()
 returns the object title prepared to be used as a filename More...
 
 getId ()
 Gets the id of the assQuestion object. More...
 
 getShuffle ()
 Gets the shuffle flag. More...
 
 getTestId ()
 Gets the test id of the assQuestion object. More...
 
 getComment ()
 Gets the comment string of the assQuestion object. More...
 
 getOutputType ()
 Gets the output type. More...
 
 getDescriptionForHTMLOutput ()
 
 supportsJavascriptOutput ()
 Returns true if the question type supports JavaScript output. More...
 
 supportsNonJsOutput ()
 
 requiresJsSwitch ()
 
 getEstimatedWorkingTime ()
 Gets the estimated working time of a question. More...
 
 getAuthor ()
 Gets the authors name of the assQuestion object. More...
 
 getAuthorForHTMLOutput ()
 
 getOwner ()
 Gets the creator/owner ID of the assQuestion object. More...
 
 getObjId ()
 Get the object id of the container object. More...
 
 setObjId ($obj_id=0)
 Set the object id of the container object. More...
 
 getLifecycle ()
 
 setLifecycle (ilAssQuestionLifecycle $lifecycle)
 
 setExternalId ($external_id)
 
 getExternalId ()
 
 getSuggestedSolutionOutput ()
 
_getSuggestedSolution ($question_id, $subquestion_index=0)
 Returns a suggested solution for a given subquestion index. More...
 
 getSuggestedSolutions ()
 Return the suggested solutions. More...
 
 getReachedPoints ($active_id, $pass=null)
 Returns the points, a learner has reached answering the question This is the fast way to get the points directly from the database. More...
 
 getMaximumPoints ()
 Returns the maximum points, a learner can reach answering the question. More...
 
 getAdjustedReachedPoints ($active_id, $pass=null, $authorizedSolution=true)
 returns the reached points ... More...
 
 calculateResultsFromSolution ($active_id, $pass=null, $obligationsEnabled=false)
 Calculates the question results from a previously saved question solution. More...
 
 persistWorkingState ($active_id, $pass=null, $obligationsEnabled=false, $authorized=true)
 persists the working state for current testactive and testpass More...
 
 persistPreviewState (ilAssQuestionPreviewSession $previewSession)
 persists the preview state for current user and question More...
 
 validateSolutionSubmit ()
 
 saveWorkingData ($active_id, $pass=null, $authorized=true)
 Saves the learners input of the question to the database. More...
 
 moveUploadedMediaFile ($file, $name)
 Move an uploaded media file to an public accessible temp dir to present it. More...
 
 getSuggestedSolutionPath ()
 Returns the path for a suggested solution. More...
 
 getJavaPath ()
 Returns the image path for web accessable images of a question. More...
 
 getImagePath ($question_id=null, $object_id=null)
 Returns the image path for web accessable images of a question. More...
 
 buildImagePath ($questionId, $parentObjectId)
 
 getFlashPath ()
 Returns the image path for web accessable flash files of a question. More...
 
 getJavaPathWeb ()
 Returns the web image path for web accessable java applets of a question. More...
 
 getSuggestedSolutionPathWeb ()
 Returns the web path for a suggested solution. More...
 
 getImagePathWeb ()
 Returns the web image path for web accessable images of a question. More...
 
 getFlashPathWeb ()
 Returns the web image path for web accessable flash applications of a question. More...
 
 getTestOutputSolutions ($activeId, $pass)
 
 getUserSolutionPreferingIntermediate ($active_id, $pass=null)
 
 getSolutionValues ($active_id, $pass=null, $authorized=true)
 Loads solutions of a given user from the database an returns it. More...
 
 isInUse ($question_id="")
 Checks whether the question is in use or not. More...
 
 isClone ($question_id="")
 Checks whether the question is a clone of another question or not. More...
 
 pcArrayShuffle ($array)
 Shuffles the values of a given array. More...
 
 getAdditionalTableName ()
 Returns the name of the additional question data table in the database. More...
 
 getAnswerTableName ()
 Returns the name of the answer table in the database. More...
 
 deleteAnswers ($question_id)
 Deletes datasets from answers tables. More...
 
 deleteAdditionalTableData ($question_id)
 Deletes datasets from the additional question table in the database. More...
 
 delete ($question_id)
 Deletes a question and all materials from the database. More...
 
 getTotalAnswers ()
 get total number of answers More...
 
 _getTotalAnswers ($a_q_id)
 get number of answers for question id (static) note: do not use $this inside this method More...
 
 copyXHTMLMediaObjectsOfQuestion ($a_q_id)
 
 syncXHTMLMediaObjectsOfQuestion ()
 
 createPageObject ()
 create page object of question More...
 
 copyPageOfQuestion ($a_q_id)
 
 getPageOfQuestion ()
 
 setOriginalId ($original_id)
 
 getOriginalId ()
 
 fixSvgToPng ($imageFilenameContainingString)
 
 fixUnavailableSkinImageSources ($html)
 
 loadFromDb ($question_id)
 Loads the question from the database. More...
 
 createNewQuestion ($a_create_page=true)
 Creates a new question without an owner when a new question is created This assures that an ID is given to the question if a file upload or something else occurs. More...
 
 saveQuestionDataToDb ($original_id="")
 
 saveToDb ($original_id="")
 Saves the question to the database. More...
 
 setNewOriginalId ($newId)
 
 deleteSuggestedSolutions ()
 Deletes all suggestes solutions in the database. More...
 
 getSuggestedSolution ($subquestion_index=0)
 Returns a suggested solution for a given subquestion index. More...
 
 getSuggestedSolutionTitle ($subquestion_index=0)
 Returns the title of a suggested solution at a given subquestion_index. More...
 
 setSuggestedSolution ($solution_id="", $subquestion_index=0, $is_import=false)
 Sets a suggested solution for the question. More...
 
 _resolveInternalLink ($internal_link)
 
 _resolveIntLinks ($question_id)
 
 syncWithOriginal ()
 
 _questionExists ($question_id)
 Returns true if the question already exists in the database. More...
 
 _questionExistsInPool ($question_id)
 Returns true if the question already exists in the database and is assigned to a question pool. More...
 
 getPoints ()
 Returns the maximum available points for the question. More...
 
 setPoints ($a_points)
 Sets the maximum available points for the question. More...
 
 getSolutionMaxPass ($active_id)
 Returns the maximum pass a users question solution. More...
 
 calculateReachedPoints ($active_id, $pass=null, $authorizedSolution=true, $returndetails=false)
 Returns the points, a learner has reached answering the question. More...
 
 deductHintPointsFromReachedPoints (ilAssQuestionPreviewSession $previewSession, $reachedPoints)
 
 calculateReachedPointsFromPreviewSession (ilAssQuestionPreviewSession $previewSession)
 
 isPreviewSolutionCorrect (ilAssQuestionPreviewSession $previewSession)
 
 adjustReachedPointsByScoringOptions ($points, $active_id, $pass=null)
 Adjust the given reached points by checks for all special scoring options in the test container. More...
 
 isHTML ($a_text)
 Checks if a given string contains HTML or not. More...
 
 prepareTextareaOutput ($txt_output, $prepare_for_latex_output=false, $omitNl2BrWhenTextArea=false)
 Prepares a string for a text area output in tests. More...
 
 QTIMaterialToString ($a_material)
 Reads an QTI material tag an creates a text string. More...
 
 addQTIMaterial (&$a_xml_writer, $a_material, $close_material_tag=true, $add_mobs=true)
 Creates a QTI material tag from a plain text or xhtml text. More...
 
 buildHashedImageFilename ($plain_image_filename, $unique=false)
 
 getQuestion ()
 Gets the question string of the question object. More...
 
 setQuestion ($question="")
 Sets the question string of the question object. More...
 
 getQuestionForHTMLOutput ()
 
 getQuestionType ()
 Returns the question type of the question. More...
 
 getQuestionTypeID ()
 Returns the question type of the question. More...
 
 cleanupMediaObjectUsage ()
 synchronises appearances of media objects in the question with media object usage table More...
 
getInstances ()
 Gets all instances of the question. More...
 
 getActiveUserData ($active_id)
 Returns the user id and the test id for a given active id. More...
 
 setExportDetailsXLS ($worksheet, $startrow, $active_id, $pass)
 Creates an Excel worksheet for the detailed cumulated results of this question. More...
 
 __get ($value)
 Object getter. More...
 
 __set ($key, $value)
 Object setter. More...
 
 getNrOfTries ()
 
 setNrOfTries ($a_nr_of_tries)
 
 setExportImagePath ($a_path)
 
 formatSAQuestion ($a_q)
 Format self assessment question. More...
 
 setPreventRteUsage ($a_val)
 Set prevent rte usage. More...
 
 getPreventRteUsage ()
 Get prevent rte usage. More...
 
 migrateContentForLearningModule (ilAssSelfAssessmentMigrator $migrator)
 
 setSelfAssessmentEditingMode ($a_selfassessmenteditingmode)
 Set Self-Assessment Editing Mode. More...
 
 getSelfAssessmentEditingMode ()
 Get Self-Assessment Editing Mode. More...
 
 setDefaultNrOfTries ($a_defaultnroftries)
 Set Default Nr of Tries. More...
 
 getDefaultNrOfTries ()
 Get Default Nr of Tries. More...
 
 syncSkillAssignments ($srcParentId, $srcQuestionId, $trgParentId, $trgQuestionId)
 
 isAnswered ($active_id, $pass=null)
 returns boolean wether the question is answered during test pass or not More...
 
 isAutosaveable ()
 
 getAdditionalContentEditingMode ()
 getter for additional content editing mode for this question More...
 
 setAdditionalContentEditingMode ($additinalContentEditingMode)
 setter for additional content editing mode for this question More...
 
 isAdditionalContentEditingModePageObject ()
 isser for additional "pageobject" content editing mode More...
 
 isValidAdditionalContentEditingMode ($additionalContentEditingMode)
 returns the fact wether the passed additional content mode is valid or not More...
 
 getValidAdditionalContentEditingModes ()
 getter for valid additional content editing modes More...
 
 addQuestionChangeListener (ilQuestionChangeListener $listener)
 
 getQuestionChangeListeners ()
 
 getHtmlUserSolutionPurifier ()
 
 getHtmlQuestionContentPurifier ()
 
 setLastChange ($lastChange)
 
 getLastChange ()
 
 removeIntermediateSolution ($active_id, $pass)
 
 removeCurrentSolution ($active_id, $pass, $authorized=true)
 
 saveCurrentSolution ($active_id, $pass, $value1, $value2, $authorized=true, $tstamp=null)
 
 updateCurrentSolution ($solutionId, $value1, $value2, $authorized=true)
 
 updateCurrentSolutionsAuthorization ($activeId, $pass, $authorized, $keepTime=false)
 
 setStep ($step)
 
 getStep ()
 
 toJSON ()
 
 duplicate ($for_test=true, $title="", $author="", $owner="", $testObjId=null)
 
 intermediateSolutionExists ($active_id, $pass)
 
 authorizedSolutionExists ($active_id, $pass)
 
 authorizedOrIntermediateSolutionExists ($active_id, $pass)
 
 isAddableAnswerOptionValue ($qIndex, $answerOptionValue)
 
 addAnswerOptionValue ($qIndex, $answerOptionValue, $points)
 
 removeAllExistingSolutions ()
 
 removeExistingSolutions ($activeId, $pass)
 
 resetUsersAnswer ($activeId, $pass)
 
 removeResultRecord ($activeId, $pass)
 
 fetchValuePairsFromIndexedValues (array $indexedValues)
 
 fetchIndexedValuesFromValuePairs (array $valuePairs)
 
 areObligationsToBeConsidered ()
 
 setObligationsToBeConsidered ($obligationsToBeConsidered)
 
 updateTimestamp ()
 
 getTestPresentationConfig ()
 Get the test question configuration (initialised once) More...
 
 savePartial ()
 
 isInActiveTest ()
 
- Public Member Functions inherited from ilObjQuestionScoringAdjustable
 saveAdditionalQuestionDataToDb ()
 Saves a record to the question types additional data table. More...
 
- Public Member Functions inherited from ilObjAnswerScoringAdjustable
 saveAnswerSpecificDataToDb ()
 Saves the answer specific records into a question types answer table. More...
 

Static Public Member Functions

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

Data Fields

 $maxNumOfChars
 
 $keywords
 
 $answers
 
 $text_rating
 
 $keyword_relation = 'any'
 
- Data Fields inherited from assQuestion
const IMG_MIME_TYPE_JPG = 'image/jpeg'
 
const IMG_MIME_TYPE_PNG = 'image/png'
 
const IMG_MIME_TYPE_GIF = 'image/gif'
 
const ADDITIONAL_CONTENT_EDITING_MODE_RTE = 'default'
 constant for additional content editing mode "default" More...
 
const ADDITIONAL_CONTENT_EDITING_MODE_IPE = 'pageobject'
 constant for additional content editing mode "pageobject" More...
 
 $feedbackOBJ = null
 
 $prevent_rte_usage = false
 
 $selfassessmenteditingmode = false
 
 $defaultnroftries = 0
 
 $questionActionCmd = 'handleQuestionAction'
 
const KEY_VALUES_IMPLOSION_SEPARATOR = ':'
 

Protected Member Functions

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

Protected Attributes

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

Private Member Functions

 isValidTextRating ($textRating)
 

Private Attributes

 $matchcondition
 

Additional Inherited Members

- Static Protected Member Functions inherited from assQuestion
static getNumExistingSolutionRecords ($activeId, $pass, $questionId)
 returns the number of existing solution records for the given test active / pass and given question id More...
 
static getKeyValuesImplosionSeparator ()
 
- Static Protected Attributes inherited from assQuestion
static $allowedFileExtensionsByMimeType
 
static $allowedCharsetsByMimeType
 
static $allowedImageMaterialFileExtensionsByMimeType
 
static $forcePassResultsUpdateEnabled = false
 
static $imageSourceFixReplaceMap
 

Detailed Description

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

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

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

assTextQuestion is a class for text questions

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

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

Constructor & Destructor Documentation

◆ __construct()

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

assTextQuestion constructor

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

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

Definition at line 89 of file class.assTextQuestion.php.

95 {
97 $this->wordCounterEnabled = false;
98 $this->maxNumOfChars = 0;
99 $this->points = 1;
100 $this->answers = array();
101 $this->matchcondition = 0;
102 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

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

+ Here is the call graph for this function:

Member Function Documentation

◆ addAnswer()

assTextQuestion::addAnswer (   $answertext = "",
  $points = 0.0,
  $points_unchecked = 0.0,
  $order = 0,
  $answerimage = "" 
)

Adds a possible answer for a multiple choice question.

A ASS_AnswerBinaryStateImage object will be created and assigned to the array $this->answers.

Parameters
string$answertextThe answer text
double$pointsThe points for selecting the answer (even negative points can be used)
boolean$stateDefines the answer as correct (TRUE) or incorrect (FALSE)
integer$orderA possible display order of the answer
double$pointsThe points for not selecting the answer (even negative points can be used) @access public
See also
$answers
ASS_AnswerBinaryStateImage

Definition at line 860 of file class.assTextQuestion.php.

866 {
867 include_once "./Modules/TestQuestionPool/classes/class.assAnswerMultipleResponseImage.php";
868
869 // add answer
870 $answer = new ASS_AnswerMultipleResponseImage($answertext, $points);
871 $this->answers[] = $answer;
872 }
ASS_AnswerBinaryStateImage is a class for answers with a binary state indicator (checked/unchecked,...

References assQuestion\$points.

Referenced by loadFromDb(), and setAnswers().

+ Here is the caller graph for this function:

◆ calculateReachedPoints()

assTextQuestion::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.

@access public

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

Reimplemented from assQuestion.

Definition at line 579 of file class.assTextQuestion.php.

580 {
581 if ($returndetails) {
582 throw new ilTestException('return details not implemented for ' . __METHOD__);
583 }
584
585 global $DIC;
586 $ilDB = $DIC['ilDB'];
587
588 $points = 0;
589 if (is_null($pass)) {
590 $pass = $this->getSolutionMaxPass($active_id);
591 }
592
593 $result = $this->getCurrentSolutionResultSet($active_id, $pass, $authorizedSolution);
594
595 // Return min points when no answer was given.
596 if ($ilDB->numRows($result) == 0) {
597 return $this->getMinimumPoints();
598 }
599
600 // Return points of points are already on the row.
601 $row = $ilDB->fetchAssoc($result);
602 if ($row["points"] != null) {
603 return $row["points"];
604 }
605
606 return $this->calculateReachedPointsForSolution($row['value1']);
607 }
$result
getCurrentSolutionResultSet($active_id, $pass, $authorized=true)
Get a restulset for the current user solution for a this question by active_id and pass.
getSolutionMaxPass($active_id)
Returns the maximum pass a users question solution.
calculateReachedPointsForSolution($solution)
Base Exception for all Exceptions relating to Modules/Test.
global $DIC
Definition: goto.php:24
global $ilDB

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

+ Here is the call graph for this function:

◆ calculateReachedPointsForSolution()

assTextQuestion::calculateReachedPointsForSolution (   $solution)
protected

Definition at line 514 of file class.assTextQuestion.php.

515 {
516 $solution = html_entity_decode($solution);
517 // Return min points when keyword relation is NON KEYWORDS
518 if ($this->getKeywordRelation() == 'non') {
519 return $this->getMinimumPoints();
520 }
521
522 // Return min points if there are no answers present.
523 $answers = $this->getAnswers();
524
525 if (count($answers) == 0) {
526 return $this->getMinimumPoints();
527 }
528
529 switch ($this->getKeywordRelation()) {
530 case 'any':
531 $points = 0;
532 foreach ($answers as $answer) {
533 $qst_answer = $answer->getAnswertext();
534 $user_answer = ' ' . $solution;
535 if ($this->isKeywordMatching($user_answer, $qst_answer)) {
536 $points += $answer->getPoints();
537 }
538 }
539 break;
540
541 case 'all':
542 $points = $this->getMaximumPoints();
543 foreach ($answers as $answer) {
544 $qst_answer = $answer->getAnswertext();
545 $user_answer = ' ' . $solution;
546 if (!$this->isKeywordMatching($user_answer, $qst_answer)) {
547 $points = 0;
548 break;
549 }
550 }
551 break;
552
553 case 'one':
554 $points = 0;
555 foreach ($answers as $answer) {
556 $qst_answer = $answer->getAnswertext();
557 $user_answer = ' ' . $solution;
558 if ($this->isKeywordMatching($user_answer, $qst_answer)) {
559 $points = $this->getMaximumPoints();
560 break;
561 }
562 }
563 break;
564 }
565
566 return $points;
567 }
isKeywordMatching($answertext, $a_keyword)
Checks if one of the keywords matches the answertext.
getMaximumPoints()
Returns the maximum points, a learner can reach answering the question.

References $answers, assQuestion\$points, getAnswers(), getKeywordRelation(), getMaximumPoints(), getMinimumPoints(), and isKeywordMatching().

Referenced by calculateReachedPoints().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copyObject()

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

Copies an assTextQuestion object.

@access public

Definition at line 255 of file class.assTextQuestion.php.

256 {
257 if ($this->id <= 0) {
258 // The question has not been saved. It cannot be duplicated
259 return;
260 }
261 // duplicate the question in database
262 $clone = $this;
263 include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
265 $clone->id = -1;
266 $source_questionpool_id = $this->getObjId();
267 $clone->setObjId($target_questionpool_id);
268 if ($title) {
269 $clone->setTitle($title);
270 }
271 $clone->saveToDb();
272 // copy question page content
273 $clone->copyPageOfQuestion($original_id);
274 // copy XHTML media objects
275 $clone->copyXHTMLMediaObjectsOfQuestion($original_id);
276 // duplicate answers
277 #$clone->duplicateAnswers($original_id);
278
279 $clone->onCopy($source_questionpool_id, $original_id, $clone->getObjId(), $clone->getId());
280
281 return $clone->id;
282 }
static _getOriginalId($question_id)
Returns the original id of a question.
getObjId()
Get the object id of the container object.

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

+ Here is the call graph for this function:

◆ countLetters()

assTextQuestion::countLetters (   $text)

Definition at line 1057 of file class.assTextQuestion.php.

1058 {
1059 $text = strip_tags($text);
1060
1061 $text = str_replace('&gt;', '>', $text);
1062 $text = str_replace('&lt;', '<', $text);
1063 $text = str_replace('&nbsp;', ' ', $text);
1064 $text = str_replace('&amp;', '&', $text);
1065
1066 $text = str_replace("\r\n", "\n", $text);
1067 $text = str_replace("\n", "", $text);
1068
1069 return ilStr::strLen($text);
1070 }
static strLen($a_string)
Definition: class.ilStr.php:78

References ilStr\strLen().

+ Here is the call graph for this function:

◆ countWords()

assTextQuestion::countWords (   $text)

Definition at line 1072 of file class.assTextQuestion.php.

1073 {
1074 $text = str_replace('&nbsp;', ' ', $text);
1075
1076 $text = preg_replace('/[.,:;!?\-_#\'"+*\\/=()&%§$]/m', '', $text);
1077
1078 $text = preg_replace('/^\s*/m', '', $text);
1079 $text = preg_replace('/\s*$/m', '', $text);
1080 $text = preg_replace('/\s+/m', ' ', $text);
1081
1082 return count(explode(' ', $text));
1083 }

◆ createNewOriginalFromThisDuplicate()

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

Definition at line 284 of file class.assTextQuestion.php.

285 {
286 if ($this->id <= 0) {
287 // The question has not been saved. It cannot be duplicated
288 return;
289 }
290
291 include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
292
293 $sourceQuestionId = $this->id;
294 $sourceParentId = $this->getObjId();
295
296 // duplicate the question in database
297 $clone = $this;
298 $clone->id = -1;
299
300 $clone->setObjId($targetParentId);
301
302 if ($targetQuestionTitle) {
303 $clone->setTitle($targetQuestionTitle);
304 }
305
306 $clone->saveToDb();
307 // copy question page content
308 $clone->copyPageOfQuestion($sourceQuestionId);
309 // copy XHTML media objects
310 $clone->copyXHTMLMediaObjectsOfQuestion($sourceQuestionId);
311 // duplicate answers
312 #$clone->duplicateAnswers($sourceQuestionId);
313
314 $clone->onCopy($sourceParentId, $sourceQuestionId, $clone->getObjId(), $clone->getId());
315
316 return $clone->id;
317 }

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

+ Here is the call graph for this function:

◆ deleteAnswer()

assTextQuestion::deleteAnswer (   $index = 0)

Deletes an answer with a given index.

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

Parameters
integer$indexA nonnegative index of the n-th answer @access public
See also
$answers

Definition at line 911 of file class.assTextQuestion.php.

912 {
913 if ($index < 0) {
914 return;
915 }
916 if (count($this->answers) < 1) {
917 return;
918 }
919 if ($index >= count($this->answers)) {
920 return;
921 }
922 $answer = $this->answers[$index];
923 if (strlen($answer->getImage())) {
924 $this->deleteImage($answer->getImage());
925 }
926 unset($this->answers[$index]);
927 $this->answers = array_values($this->answers);
928 for ($i = 0; $i < count($this->answers); $i++) {
929 if ($this->answers[$i]->getOrder() > $index) {
930 $this->answers[$i]->setOrder($i);
931 }
932 }
933 }
$index
Definition: metadata.php:128
$i
Definition: metadata.php:24

References $i, and $index.

◆ duplicate()

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

Duplicates an assTextQuestion.

@access public

Reimplemented from assQuestion.

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

204 {
205 if ($this->id <= 0) {
206 // The question has not been saved. It cannot be duplicated
207 return;
208 }
209 // duplicate the question in database
210 $this_id = $this->getId();
211 $thisObjId = $this->getObjId();
212
213 $clone = $this;
214 include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
216 $clone->id = -1;
217
218 if ((int) $testObjId > 0) {
219 $clone->setObjId($testObjId);
220 }
221
222 if ($title) {
223 $clone->setTitle($title);
224 }
225
226 if ($author) {
227 $clone->setAuthor($author);
228 }
229 if ($owner) {
230 $clone->setOwner($owner);
231 }
232
233 if ($for_test) {
234 $clone->saveToDb($original_id);
235 } else {
236 $clone->saveToDb();
237 }
238
239 // copy question page content
240 $clone->copyPageOfQuestion($this_id);
241 // copy XHTML media objects
242 $clone->copyXHTMLMediaObjectsOfQuestion($this_id);
243 #$clone->duplicateAnswers($this_id);
244
245 $clone->onDuplicate($thisObjId, $this_id, $clone->getObjId(), $clone->getId());
246
247 return $clone->id;
248 }
getId()
Gets the id of the assQuestion object.

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

+ Here is the call graph for this function:

◆ duplicateAnswers()

assTextQuestion::duplicateAnswers (   $original_id)

Definition at line 972 of file class.assTextQuestion.php.

973 {
974 global $DIC;
975 $ilDB = $DIC['ilDB'];
976
977 $result = $ilDB->queryF(
978 "SELECT * FROM qpl_a_essay WHERE question_fi = %s",
979 array('integer'),
980 array($original_id)
981 );
982 if ($result->numRows()) {
983 while ($row = $ilDB->fetchAssoc($result)) {
984 $next_id = $ilDB->nextId('qpl_a_essay');
985 $affectedRows = $ilDB->manipulateF(
986 "INSERT INTO qpl_a_essay (answer_id, question_fi, answertext, points)
987 VALUES (%s, %s, %s, %s)",
988 array('integer','integer','text','float'),
989 array($next_id, $this->getId(), $row["answertext"], $row["points"])
990 );
991 }
992 }
993 }

References $DIC, $ilDB, assQuestion\$original_id, $result, and assQuestion\getId().

+ Here is the call graph for this function:

◆ flushAnswers()

assTextQuestion::flushAnswers ( )

Deletes all answers.

@access public

See also
$answers

Definition at line 946 of file class.assTextQuestion.php.

947 {
948 $this->answers = array();
949 }

Referenced by loadFromDb(), and setAnswers().

+ Here is the caller graph for this function:

◆ getAdditionalTableName()

assTextQuestion::getAdditionalTableName ( )

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

Returns
string The additional table name @access public

Reimplemented from assQuestion.

Definition at line 781 of file class.assTextQuestion.php.

782 {
783 return "qpl_qst_essay";
784 }

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ getAnswer()

assTextQuestion::getAnswer (   $index = 0)

Returns an answer with a given index.

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

Parameters
integer$indexA nonnegative index of the n-th answer
Returns
object ASS_AnswerBinaryStateImage-Object containing the answer @access public
See also
$answers

Definition at line 888 of file class.assTextQuestion.php.

889 {
890 if ($index < 0) {
891 return null;
892 }
893 if (count($this->answers) < 1) {
894 return null;
895 }
896 if ($index >= count($this->answers)) {
897 return null;
898 }
899
900 return $this->answers[$index];
901 }

References $index.

◆ getAnswerCount()

assTextQuestion::getAnswerCount ( )

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

843 {
844 return count($this->answers);
845 }

◆ getAnswers()

assTextQuestion::getAnswers ( )

Definition at line 874 of file class.assTextQuestion.php.

875 {
876 return $this->answers;
877 }

References $answers.

Referenced by calculateReachedPointsForSolution().

+ Here is the caller graph for this function:

◆ getAnswerTableName()

assTextQuestion::getAnswerTableName ( )

Returns the name of the answer table in the database.

Returns
string The answer table name @access public

Reimplemented from assQuestion.

Definition at line 935 of file class.assTextQuestion.php.

936 {
937 return 'qpl_a_essay';
938 }

◆ getKeywordRelation()

assTextQuestion::getKeywordRelation ( )

Definition at line 995 of file class.assTextQuestion.php.

996 {
998 }

References $keyword_relation.

Referenced by calculateReachedPointsForSolution(), getMaximumPoints(), and getMinimumPoints().

+ Here is the caller graph for this function:

◆ getLatestAutosaveContent()

assTextQuestion::getLatestAutosaveContent (   $active_id)

Definition at line 1085 of file class.assTextQuestion.php.

1086 {
1087 $question_fi = $this->getId();
1088
1089 // Do we have an unauthorized result?
1090 $cntresult = $this->db->query(
1091 '
1092 SELECT count(solution_id) cnt
1093 FROM tst_solutions
1094 WHERE active_fi = ' . $this->db->quote($active_id, 'int') . '
1095 AND question_fi = ' . $this->db->quote($this->getId(), 'int') . '
1096 AND authorized = ' . $this->db->quote(0, 'int')
1097 );
1098 $row = $this->db->fetchAssoc($cntresult);
1099 if ($row['cnt'] > 0) {
1100 $tresult = $this->db->query(
1101 '
1102 SELECT value1
1103 FROM tst_solutions
1104 WHERE active_fi = ' . $this->db->quote($active_id, 'int') . '
1105 AND question_fi = ' . $this->db->quote($this->getId(), 'int') . '
1106 AND authorized = ' . $this->db->quote(0, 'int')
1107 );
1108 $trow = $this->db->fetchAssoc($tresult);
1109 return $trow['value1'];
1110 }
1111 return '';
1112 }

References assQuestion\getId().

+ Here is the call graph for this function:

◆ getMaximumPoints()

assTextQuestion::getMaximumPoints ( )

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

@access public

See also
$points

Reimplemented from assQuestion.

Definition at line 369 of file class.assTextQuestion.php.

370 {
371 if (in_array($this->getKeywordRelation(), self::getScoringModesWithPointsByQuestion())) {
372 return parent::getPoints();
373 }
374
375 $points = 0;
376
377 foreach ($this->answers as $answer) {
378 if ($answer->getPoints() > 0) {
379 $points = $points + $answer->getPoints();
380 }
381 }
382
383 return $points;
384 }

References assQuestion\$points, and getKeywordRelation().

Referenced by calculateReachedPointsForSolution(), and isComplete().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMaxNumOfChars()

assTextQuestion::getMaxNumOfChars ( )

Gets the maximum number of characters for the text solution.

Returns
integer The maximum number of characters for the text solution @access public
See also
$maxNumOfChars

Definition at line 326 of file class.assTextQuestion.php.

327 {
328 if (strcmp($this->maxNumOfChars, "") == 0) {
329 return 0;
330 } else {
332 }
333 }

References $maxNumOfChars.

Referenced by toJSON().

+ Here is the caller graph for this function:

◆ getMinimumPoints()

assTextQuestion::getMinimumPoints ( )

Definition at line 386 of file class.assTextQuestion.php.

387 {
388 if (in_array($this->getKeywordRelation(), self::getScoringModesWithPointsByQuestion())) {
389 return 0;
390 }
391
392 $points = 0;
393
394 foreach ($this->answers as $answer) {
395 if ($answer->getPoints() < 0) {
396 $points = $points + $answer->getPoints();
397 }
398 }
399
400 return $points;
401 }

References assQuestion\$points, and getKeywordRelation().

Referenced by calculateReachedPoints(), and calculateReachedPointsForSolution().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getQuestionType()

assTextQuestion::getQuestionType ( )

Returns the question type of the question.

Returns
integer The question type of the question @access public

Reimplemented from assQuestion.

Definition at line 733 of file class.assTextQuestion.php.

734 {
735 return "assTextQuestion";
736 }

Referenced by toJSON().

+ Here is the caller graph for this function:

◆ getRTETextWithMediaObjects()

assTextQuestion::getRTETextWithMediaObjects ( )

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

Reimplemented from assQuestion.

Definition at line 790 of file class.assTextQuestion.php.

791 {
792 return parent::getRTETextWithMediaObjects();
793 }

◆ getScoringModesWithPointsByKeyword()

static assTextQuestion::getScoringModesWithPointsByKeyword ( )
static

Definition at line 1019 of file class.assTextQuestion.php.

1020 {
1021 return array('any');
1022 }

Referenced by assTextQuestionGUI\getBestAnswer().

+ Here is the caller graph for this function:

◆ getScoringModesWithPointsByQuestion()

static assTextQuestion::getScoringModesWithPointsByQuestion ( )
static

Definition at line 1014 of file class.assTextQuestion.php.

1015 {
1016 return array('non', 'all', 'one');
1017 }

◆ getSolutionSubmit()

assTextQuestion::getSolutionSubmit ( )
Returns
mixed|string

Definition at line 659 of file class.assTextQuestion.php.

660 {
661 if (ilObjAdvancedEditing::_getRichTextEditor() === 'tinymce') {
662 $text = ilUtil::stripSlashes($_POST["TEXT"], false);
663 } else {
664 $text = htmlentities($_POST["TEXT"]);
665 }
666
667 if (ilUtil::isHTML($text)) {
668 $text = $this->getHtmlUserSolutionPurifier()->purify($text);
669 }
670
671 return $text;
672 }
$_POST["username"]
static _getRichTextEditor()
Returns the identifier for the Rich Text Editor.
static isHTML($a_text)
Checks if a given string contains HTML or not.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled

References $_POST, ilObjAdvancedEditing\_getRichTextEditor(), assQuestion\getHtmlUserSolutionPurifier(), ilUtil\isHTML(), and ilUtil\stripSlashes().

Referenced by saveWorkingData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTextRating()

assTextQuestion::getTextRating ( )

Returns the rating option for text comparisons.

Returns
string The rating option for text comparisons
See also
$text_rating @access User interface

Definition at line 745 of file class.assTextQuestion.php.

746 {
747 return $this->text_rating;
748 }

References $text_rating.

Referenced by isKeywordMatching().

+ Here is the caller graph for this function:

◆ getValidScoringModes()

static assTextQuestion::getValidScoringModes ( )
static

Definition at line 1009 of file class.assTextQuestion.php.

1010 {
1011 return array_merge(self::getScoringModesWithPointsByQuestion(), self::getScoringModesWithPointsByKeyword());
1012 }

◆ isAnswered()

assTextQuestion::isAnswered (   $active_id,
  $pass = null 
)

returns boolean wether the question is answered during test pass or not

(overwrites method in class assQuestion)

Parameters
integer$active_id
integer$pass
Returns
boolean $answered

Reimplemented from assQuestion.

Definition at line 1035 of file class.assTextQuestion.php.

1036 {
1037 $numExistingSolutionRecords = assQuestion::getNumExistingSolutionRecords($active_id, $pass, $this->getId());
1038
1039 return $numExistingSolutionRecords > 0;
1040 }
static getNumExistingSolutionRecords($activeId, $pass, $questionId)
returns the number of existing solution records for the given test active / pass and given question i...

References $pass, assQuestion\getId(), and assQuestion\getNumExistingSolutionRecords().

+ Here is the call graph for this function:

◆ isComplete()

assTextQuestion::isComplete ( )

Returns true, if a multiple choice question is complete for use.

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

Reimplemented from assQuestion.

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

110 {
111 if (strlen($this->title)
112 && $this->author
113 && $this->question
114 && $this->getMaximumPoints() > 0
115 ) {
116 return true;
117 }
118 return false;
119 }

References getMaximumPoints().

+ Here is the call graph for this function:

◆ isKeywordMatching()

assTextQuestion::isKeywordMatching (   $answertext,
  $a_keyword 
)

Checks if one of the keywords matches the answertext.

Parameters
string$answertextThe answertext of the user
string$a_keywordThe keyword which should be checked
Returns
boolean TRUE if the keyword matches, FALSE otherwise @access private

Definition at line 456 of file class.assTextQuestion.php.

457 {
458 global $DIC;
459 $refinery = $DIC->refinery();
460 $result = false;
461 $textrating = $this->getTextRating();
462 include_once "./Services/Utilities/classes/class.ilStr.php";
463
464 switch ($textrating) {
466 if (ilStr::strPos(ilStr::strToLower($answertext), ilStr::strToLower($a_keyword)) !== false) {
467 return true;
468 }
469 break;
471 if (ilStr::strPos($answertext, $a_keyword) !== false) {
472 return true;
473 }
474 break;
475 }
476
477 // "<p>red</p>" would not match "red" even with distance of 5
478 $answertext = strip_tags($answertext);
479 $answerwords = array();
480 if (preg_match_all("/([^\s.]+)/", $answertext, $matches)) {
481 foreach ($matches[1] as $answerword) {
482 array_push($answerwords, trim($answerword));
483 }
484 }
485
486 // create correct transformation
487 switch ($textrating) {
489 $transformation = $refinery->string()->levenshtein()->standard($a_keyword, 1);
490 break;
492 $transformation = $refinery->string()->levenshtein()->standard($a_keyword, 2);
493 break;
495 $transformation = $refinery->string()->levenshtein()->standard($a_keyword, 3);
496 break;
498 $transformation = $refinery->string()->levenshtein()->standard($a_keyword, 4);
499 break;
501 $transformation = $refinery->string()->levenshtein()->standard($a_keyword, 5);
502 break;
503 }
504
505 // run answers against Levenshtein methods
506 foreach ($answerwords as $a_original) {
507 if (isset($transformation) && $transformation->transform($a_original) >= 0) {
508 return true;
509 }
510 }
511 return $result;
512 }
getTextRating()
Returns the rating option for text comparisons.
static strPos($a_haystack, $a_needle, $a_offset=null)
Definition: class.ilStr.php:30
static strToLower($a_string)
Definition: class.ilStr.php:87
const TEXTGAP_RATING_LEVENSHTEIN5
const TEXTGAP_RATING_LEVENSHTEIN4
const TEXTGAP_RATING_LEVENSHTEIN3
const TEXTGAP_RATING_CASESENSITIVE
const TEXTGAP_RATING_LEVENSHTEIN2
const TEXTGAP_RATING_CASEINSENSITIVE
const TEXTGAP_RATING_LEVENSHTEIN1

References $DIC, assQuestion\$refinery, $result, getTextRating(), ilStr\strPos(), 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 calculateReachedPointsForSolution().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isObligationPossible()

static assTextQuestion::isObligationPossible (   $questionId)
static

returns boolean wether it is possible to set this question type as obligatory or not considering the current question configuration

(overwrites method in class assQuestion)

Parameters
integer$questionId
Returns
boolean $obligationPossible

Reimplemented from assQuestion.

Definition at line 1052 of file class.assTextQuestion.php.

1053 {
1054 return true;
1055 }

◆ isValidTextRating()

assTextQuestion::isValidTextRating (   $textRating)
private

◆ isWordCounterEnabled()

assTextQuestion::isWordCounterEnabled ( )
Returns
bool

Definition at line 350 of file class.assTextQuestion.php.

References $wordCounterEnabled.

◆ loadFromDb()

assTextQuestion::loadFromDb (   $question_id)

Loads a assTextQuestion object from a database.

Parameters
object$dbA pear DB object
integer$question_idA unique key which defines the text question in the database @access public

Reimplemented from assQuestion.

Definition at line 141 of file class.assTextQuestion.php.

142 {
143 global $DIC;
144 $ilDB = $DIC['ilDB'];
145
146 $result = $ilDB->queryF(
147 "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",
148 array("integer"),
149 array($question_id)
150 );
151 if ($ilDB->numRows($result) == 1) {
152 $data = $ilDB->fetchAssoc($result);
153 $this->setId($question_id);
154 $this->setObjId($data["obj_fi"]);
155 $this->setTitle($data["title"]);
156 $this->setComment($data["description"]);
157 $this->setOriginalId($data["original_id"]);
158 $this->setNrOfTries($data['nr_of_tries']);
159 $this->setAuthor($data["author"]);
160 $this->setPoints((float) $data["points"]);
161 $this->setOwner($data["owner"]);
162 include_once("./Services/RTE/classes/class.ilRTE.php");
163 $this->setQuestion(ilRTE::_replaceMediaObjectImageSrc($data["question_text"], 1));
164 $this->setShuffle($data["shuffle"]);
165 $this->setWordCounterEnabled((bool) $data['word_cnt_enabled']);
166 $this->setMaxNumOfChars($data["maxnumofchars"]);
167 $this->setTextRating($this->isValidTextRating($data["textgap_rating"]) ? $data["textgap_rating"] : TEXTGAP_RATING_CASEINSENSITIVE);
168 $this->matchcondition = (strlen($data['matchcondition'])) ? $data['matchcondition'] : 0;
169 $this->setEstimatedWorkingTime(substr($data["working_time"], 0, 2), substr($data["working_time"], 3, 2), substr($data["working_time"], 6, 2));
170 $this->setKeywordRelation(($data['keyword_relation']));
171
172 try {
176 }
177
178 try {
179 $this->setAdditionalContentEditingMode($data['add_cont_edit_mode']);
181 }
182 }
183
184 $result = $ilDB->queryF(
185 "SELECT * FROM qpl_a_essay WHERE question_fi = %s",
186 array("integer"),
187 array($this->getId())
188 );
189
190 $this->flushAnswers();
191 while ($row = $ilDB->fetchAssoc($result)) {
192 $this->addAnswer($row['answertext'], $row['points']);
193 }
194
195 parent::loadFromDb($question_id);
196 }
setShuffle($shuffle=true)
Sets the shuffle flag.
setId($id=-1)
Sets the id of the assQuestion object.
setOriginalId($original_id)
setObjId($obj_id=0)
Set the object id of the container object.
setTitle($title="")
Sets the title string of the assQuestion object.
setOwner($owner="")
Sets the creator/owner ID of the assQuestion object.
setEstimatedWorkingTime($hour=0, $min=0, $sec=0)
Sets the estimated working time of a question from given hour, minute and second.
setAuthor($author="")
Sets the authors name of the assQuestion object.
setLifecycle(ilAssQuestionLifecycle $lifecycle)
setPoints($a_points)
Sets the maximum available points for the question.
setComment($comment="")
Sets the comment string of the assQuestion object.
setNrOfTries($a_nr_of_tries)
setAdditionalContentEditingMode($additinalContentEditingMode)
setter for additional content editing mode for this question
setQuestion($question="")
Sets the question string of the question object.
setMaxNumOfChars($maxchars=0)
Sets the maximum number of characters for the text solution.
addAnswer( $answertext="", $points=0.0, $points_unchecked=0.0, $order=0, $answerimage="")
Adds a possible answer for a multiple choice question.
setKeywordRelation($a_relation)
This method implements a default behaviour.
getAdditionalTableName()
Returns the name of the additional question data table in the database.
setWordCounterEnabled($wordCounterEnabled)
flushAnswers()
Deletes all answers.
setTextRating($a_text_rating)
Sets the rating option for text comparisons.
isValidTextRating($textRating)
static _replaceMediaObjectImageSrc($a_text, $a_direction=0, $nic=IL_INST_ID)
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
$data
Definition: storeScorm.php:23

References $data, $DIC, Vendor\Package\$e, $ilDB, $result, ilRTE\_replaceMediaObjectImageSrc(), addAnswer(), flushAnswers(), getAdditionalTableName(), ilAssQuestionLifecycle\getDraftInstance(), assQuestion\getId(), ilAssQuestionLifecycle\getInstance(), isValidTextRating(), assQuestion\setAdditionalContentEditingMode(), assQuestion\setAuthor(), assQuestion\setComment(), assQuestion\setEstimatedWorkingTime(), assQuestion\setId(), setKeywordRelation(), assQuestion\setLifecycle(), setMaxNumOfChars(), assQuestion\setNrOfTries(), assQuestion\setObjId(), assQuestion\setOriginalId(), assQuestion\setOwner(), assQuestion\setPoints(), assQuestion\setQuestion(), assQuestion\setShuffle(), setTextRating(), assQuestion\setTitle(), setWordCounterEnabled(), and TEXTGAP_RATING_CASEINSENSITIVE.

+ Here is the call graph for this function:

◆ saveToDb()

assTextQuestion::saveToDb (   $original_id = "")

Saves a assTextQuestion object to a database.

Parameters
string$original_id

Reimplemented from assQuestion.

Definition at line 126 of file class.assTextQuestion.php.

127 {
131 parent::saveToDb($original_id);
132 }
saveQuestionDataToDb($original_id="")
saveAnswerSpecificDataToDb()
Saves the answer specific records into a question types answer table.
saveAdditionalQuestionDataToDb()
Saves a record to the question types additional data table.

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

+ Here is the call graph for this function:

◆ saveWorkingData()

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

Saves the learners input of the question to the database.

@access public

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

Reimplemented from assQuestion.

Definition at line 617 of file class.assTextQuestion.php.

618 {
619 global $DIC;
620 $ilDB = $DIC['ilDB'];
621 $ilUser = $DIC['ilUser'];
622
623 include_once "./Services/Utilities/classes/class.ilStr.php";
624 if (is_null($pass)) {
625 include_once "./Modules/Test/classes/class.ilObjTest.php";
626 $pass = ilObjTest::_getPass($active_id);
627 }
628
629 $entered_values = 0;
630 $text = $this->getSolutionSubmit();
631
632 $this->getProcessLocker()->executeUserSolutionUpdateLockOperation(function () use (&$entered_values, $active_id, $pass, $authorized, $text) {
633 $this->removeCurrentSolution($active_id, $pass, $authorized);
634
635 if (strlen($text)) {
636 $this->saveCurrentSolution($active_id, $pass, trim($text), null, $authorized);
637 $entered_values++;
638 }
639 });
640
641 if ($entered_values) {
642 include_once("./Modules/Test/classes/class.ilObjAssessmentFolder.php");
644 assQuestion::logAction($this->lng->txtlng("assessment", "log_user_entered_values", ilObjAssessmentFolder::_getLogLanguage()), $active_id, $this->getId());
645 }
646 } else {
647 include_once("./Modules/Test/classes/class.ilObjAssessmentFolder.php");
649 assQuestion::logAction($this->lng->txtlng("assessment", "log_user_not_entered_values", ilObjAssessmentFolder::_getLogLanguage()), $active_id, $this->getId());
650 }
651 }
652
653 return true;
654 }
saveCurrentSolution($active_id, $pass, $value1, $value2, $authorized=true, $tstamp=null)
static logAction($logtext="", $active_id="", $question_id="")
Logs an action into the Test&Assessment log.
removeCurrentSolution($active_id, $pass, $authorized=true)
static _getLogLanguage()
retrieve the log language for assessment logging
static _enabledAssessmentLogging()
check wether assessment logging is enabled or not
static _getPass($active_id)
Retrieves the actual pass of a given user for a given test.
$ilUser
Definition: imgupload.php:18

References $DIC, $ilDB, $ilUser, $pass, ilObjAssessmentFolder\_enabledAssessmentLogging(), ilObjAssessmentFolder\_getLogLanguage(), ilObjTest\_getPass(), assQuestion\getProcessLocker(), getSolutionSubmit(), assQuestion\logAction(), assQuestion\removeCurrentSolution(), and assQuestion\saveCurrentSolution().

+ Here is the call graph for this function:

◆ setAnswers()

assTextQuestion::setAnswers (   $answers)

Definition at line 951 of file class.assTextQuestion.php.

952 {
953 if (isset($answers['answer'])) {
954 $count = count($answers['answer']);
955 $withPoints = true;
956 } else {
957 $count = count($answers);
958 $withPoints = false;
959 }
960
961 $this->flushAnswers();
962
963 for ($i = 0; $i < $count; $i++) {
964 if ($withPoints) {
965 $this->addAnswer($answers['answer'][$i], $answers['points'][$i]);
966 } else {
967 $this->addAnswer($answers[$i], 0);
968 }
969 }
970 }

References $answers, $i, addAnswer(), and flushAnswers().

+ Here is the call graph for this function:

◆ setExportDetailsXLS()

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

{Creates an Excel worksheet for the detailed cumulated results of this question.

Parameters
object$worksheetReference to the parent excel worksheet
object$startrowStartrow of the output in the excel worksheet
object$active_idActive id of the participant
object$passTest pass
Returns
object
}

Reimplemented from assQuestion.

Definition at line 798 of file class.assTextQuestion.php.

799 {
800 parent::setExportDetailsXLS($worksheet, $startrow, $active_id, $pass);
801
802 $solutions = $this->getSolutionValues($active_id, $pass);
803
804 $i = 1;
805 $worksheet->setCell($startrow + $i, 0, $this->lng->txt("result"));
806 $worksheet->setBold($worksheet->getColumnCoord(0) . ($startrow + $i));
807
808 require_once 'Modules/Test/classes/class.ilObjAssessmentFolder.php';
809 $assessment_folder = new ilObjAssessmentFolder();
810
811 $string_escaping_org_value = $worksheet->getStringEscaping();
812 if ($assessment_folder->getExportEssayQuestionsWithHtml() == 1) {
813 $worksheet->setStringEscaping(false);
814 }
815
816 if (strlen($solutions[0]["value1"])) {
817 $worksheet->setCell($startrow + $i, 2, html_entity_decode($solutions[0]["value1"]));
818 }
819 $i++;
820
821 $worksheet->setStringEscaping($string_escaping_org_value);
822 return $startrow + $i + 1;
823 }
getSolutionValues($active_id, $pass=null, $authorized=true)
Loads solutions of a given user from the database an returns it.
Class ilObjAssessmentFolder.

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

+ Here is the call graph for this function:

◆ setKeywordRelation()

assTextQuestion::setKeywordRelation (   $a_relation)

This method implements a default behaviour.

During the creation of a text question, the record which holds the keyword relation is not existing, so keyword_relation defaults to 'one'.

Definition at line 1004 of file class.assTextQuestion.php.

1005 {
1006 $this->keyword_relation = $a_relation;
1007 }

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setMaxNumOfChars()

assTextQuestion::setMaxNumOfChars (   $maxchars = 0)

Sets the maximum number of characters for the text solution.

Parameters
integer$maxcharsThe maximum number of characters for the text solution @access public
See also
$maxNumOfChars

Definition at line 342 of file class.assTextQuestion.php.

343 {
344 $this->maxNumOfChars = $maxchars;
345 }

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setReachedPoints()

assTextQuestion::setReachedPoints (   $active_id,
  $points,
  $pass = null 
)

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

Parameters
integer$user_idThe database ID of the learner
integer$test_idThe database Id of the test containing the question
integer$pointsThe points the user has reached answering the question
Returns
boolean true on success, otherwise false @access public

Definition at line 411 of file class.assTextQuestion.php.

412 {
413 global $DIC;
414 $ilDB = $DIC['ilDB'];
415
416 if (($points > 0) && ($points <= $this->getPoints())) {
417 if (is_null($pass)) {
418 $pass = $this->getSolutionMaxPass($active_id);
419 }
420 $affectedRows = $ilDB->manipulateF(
421 "UPDATE tst_test_result SET points = %s WHERE active_fi = %s AND question_fi = %s AND pass = %s",
422 array('float','integer','integer','integer'),
423 array($points, $active_id, $this->getId(), $pass)
424 );
425 self::_updateTestPassResults($active_id, $pass);
426 return true;
427 } else {
428 return true;
429 }
430 }
getPoints()
Returns the maximum available points for the question.

References $DIC, $ilDB, $pass, assQuestion\$points, assQuestion\getId(), assQuestion\getPoints(), and assQuestion\getSolutionMaxPass().

+ Here is the call graph for this function:

◆ setTextRating()

assTextQuestion::setTextRating (   $a_text_rating)

Sets the rating option for text comparisons.

Parameters
string$a_textgap_ratingThe rating option for text comparisons
See also
$textgap_rating @access User interface

Definition at line 757 of file class.assTextQuestion.php.

758 {
759 switch ($a_text_rating) {
767 $this->text_rating = $a_text_rating;
768 break;
769 default:
770 $this->text_rating = TEXTGAP_RATING_CASEINSENSITIVE;
771 break;
772 }
773 }

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().

+ Here is the caller graph for this function:

◆ setWordCounterEnabled()

assTextQuestion::setWordCounterEnabled (   $wordCounterEnabled)
Parameters
bool$wordCounterEnabled

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

359 {
360 $this->wordCounterEnabled = $wordCounterEnabled;
361 }

References $wordCounterEnabled.

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ toJSON()

assTextQuestion::toJSON ( )

Returns a JSON representation of the question.

Reimplemented from assQuestion.

Definition at line 828 of file class.assTextQuestion.php.

829 {
830 include_once("./Services/RTE/classes/class.ilRTE.php");
831 $result = array();
832 $result['id'] = (int) $this->getId();
833 $result['type'] = (string) $this->getQuestionType();
834 $result['title'] = (string) $this->getTitle();
835 $result['question'] = $this->formatSAQuestion($this->getQuestion());
836 $result['nr_of_tries'] = (int) $this->getNrOfTries();
837 $result['shuffle'] = (bool) $this->getShuffle();
838 $result['maxlength'] = (int) $this->getMaxNumOfChars();
839 return json_encode($result);
840 }
formatSAQuestion($a_q)
Format self assessment question.
getShuffle()
Gets the shuffle flag.
getTitle()
Gets the title string of the assQuestion object.
getQuestion()
Gets the question string of the question object.
getQuestionType()
Returns the question type of the question.
getMaxNumOfChars()
Gets the maximum number of characters for the text solution.

References $result, assQuestion\formatSAQuestion(), assQuestion\getId(), getMaxNumOfChars(), assQuestion\getNrOfTries(), assQuestion\getQuestion(), getQuestionType(), assQuestion\getShuffle(), and assQuestion\getTitle().

+ Here is the call graph for this function:

Field Documentation

◆ $answers

assTextQuestion::$answers

◆ $keyword_relation

assTextQuestion::$keyword_relation = 'any'

Definition at line 75 of file class.assTextQuestion.php.

Referenced by getKeywordRelation().

◆ $keywords

assTextQuestion::$keywords

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

◆ $matchcondition

assTextQuestion::$matchcondition
private

Definition at line 73 of file class.assTextQuestion.php.

◆ $maxNumOfChars

assTextQuestion::$maxNumOfChars

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

Referenced by getMaxNumOfChars().

◆ $text_rating

assTextQuestion::$text_rating

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

Referenced by getTextRating().

◆ $wordCounterEnabled

assTextQuestion::$wordCounterEnabled
protected

Definition at line 51 of file class.assTextQuestion.php.

Referenced by isWordCounterEnabled(), and setWordCounterEnabled().


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