ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
assTextQuestion Class Reference

Class for text questions. 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)
 {} 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 ()
 
 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
 __construct ( $title="", $comment="", $author="", $owner=-1, $question="")
 assQuestion constructor More...
 
 getShuffler ()
 
 setShuffler (ilArrayElementShuffler $shuffler)
 
 setProcessLocker ($processLocker)
 
 getProcessLocker ()
 
 fromXML (&$item, &$questionpool_id, &$tst_id, &$tst_object, &$question_counter, &$import_mapping)
 Receives parameters from a QTI parser and creates a valid ILIAS question object. More...
 
 toXML ($a_include_header=true, $a_include_binary=true, $a_shuffle=false, $test_output=false, $force_image_references=false)
 Returns a QTI xml representation of the question. More...
 
 isComplete ()
 Returns true, if a question is complete for use. More...
 
 questionTitleExists ($questionpool_id, $title)
 Returns TRUE if the question title exists in the database. More...
 
 setTitle ($title="")
 Sets the title string of the assQuestion object. More...
 
 setId ($id=-1)
 Sets the id of the assQuestion object. More...
 
 setTestId ($id=-1)
 Sets the test id of the assQuestion object. More...
 
 setComment ($comment="")
 Sets the comment string of the assQuestion object. More...
 
 setOutputType ($outputType=OUTPUT_HTML)
 Sets the output type. More...
 
 setShuffle ($shuffle=true)
 Sets the shuffle flag. More...
 
 setEstimatedWorkingTime ($hour=0, $min=0, $sec=0)
 Sets the estimated working time of a question from given hour, minute and second. More...
 
 setEstimatedWorkingTimeFromDurationString ($durationString)
 Sets the estimated working time of a question from a given datetime string. More...
 
 keyInArray ($searchkey, $array)
 returns TRUE if the key occurs in an array More...
 
 setAuthor ($author="")
 Sets the authors name of the assQuestion object. More...
 
 setOwner ($owner="")
 Sets the creator/owner ID of the assQuestion object. More...
 
 getTitle ()
 Gets the title string of the assQuestion object. More...
 
 getTitleFilenameCompliant ()
 returns the object title prepared to be used as a filename More...
 
 getId ()
 Gets the id of the assQuestion object. More...
 
 getShuffle ()
 Gets the shuffle flag. More...
 
 getTestId ()
 Gets the test id of the assQuestion object. More...
 
 getComment ()
 Gets the comment string of the assQuestion object. More...
 
 getOutputType ()
 Gets the output type. More...
 
 supportsJavascriptOutput ()
 Returns true if the question type supports JavaScript output. More...
 
 supportsNonJsOutput ()
 
 requiresJsSwitch ()
 
 getEstimatedWorkingTime ()
 Gets the estimated working time of a question. More...
 
 getAuthor ()
 Gets the authors name of the assQuestion object. More...
 
 getOwner ()
 Gets the creator/owner ID of the assQuestion object. More...
 
 getObjId ()
 Get the object id of the container object. More...
 
 setObjId ($obj_id=0)
 Set the object id of the container object. More...
 
 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...
 
 getQuestionType ()
 Returns the question type of the question. More...
 
 getQuestionTypeID ()
 Returns the question type of the question. More...
 
 cleanupMediaObjectUsage ()
 synchronises appearances of media objects in the question with media object usage table More...
 
getInstances ()
 Gets all instances of the question. More...
 
 getActiveUserData ($active_id)
 Returns the user id and the test id for a given active id. More...
 
 setExportDetailsXLS ($worksheet, $startrow, $active_id, $pass)
 Creates an Excel worksheet for the detailed cumulated results of this question. More...
 
 __get ($value)
 Object getter. More...
 
 __set ($key, $value)
 Object setter. More...
 
 getNrOfTries ()
 
 setNrOfTries ($a_nr_of_tries)
 
 setExportImagePath ($a_path)
 
 formatSAQuestion ($a_q)
 Format self assessment question. More...
 
 setPreventRteUsage ($a_val)
 Set prevent rte usage. More...
 
 getPreventRteUsage ()
 Get prevent rte usage. More...
 
 migrateContentForLearningModule (ilAssSelfAssessmentMigrator $migrator)
 
 setSelfAssessmentEditingMode ($a_selfassessmenteditingmode)
 Set Self-Assessment Editing Mode. More...
 
 getSelfAssessmentEditingMode ()
 Get Self-Assessment Editing Mode. More...
 
 setDefaultNrOfTries ($a_defaultnroftries)
 Set Default Nr of Tries. More...
 
 getDefaultNrOfTries ()
 Get Default Nr of Tries. More...
 
 syncSkillAssignments ($srcParentId, $srcQuestionId, $trgParentId, $trgQuestionId)
 
 isAnswered ($active_id, $pass=null)
 returns boolean wether the question is answered during test pass or not More...
 
 isAutosaveable ()
 
 getAdditionalContentEditingMode ()
 getter for additional content editing mode for this question More...
 
 setAdditionalContentEditingMode ($additinalContentEditingMode)
 setter for additional content editing mode for this question More...
 
 isAdditionalContentEditingModePageObject ()
 isser for additional "pageobject" content editing mode More...
 
 isValidAdditionalContentEditingMode ($additionalContentEditingMode)
 returns the fact wether the passed additional content mode is valid or not More...
 
 getValidAdditionalContentEditingModes ()
 getter for valid additional content editing modes More...
 
 addQuestionChangeListener (ilQuestionChangeListener $listener)
 
 getQuestionChangeListeners ()
 
 getHtmlUserSolutionPurifier ()
 
 getHtmlQuestionContentPurifier ()
 
 setLastChange ($lastChange)
 
 getLastChange ()
 
 removeIntermediateSolution ($active_id, $pass)
 
 removeCurrentSolution ($active_id, $pass, $authorized=true)
 
 saveCurrentSolution ($active_id, $pass, $value1, $value2, $authorized=true, $tstamp=null)
 
 updateCurrentSolution ($solutionId, $value1, $value2, $authorized=true)
 
 updateCurrentSolutionsAuthorization ($activeId, $pass, $authorized, $keepTime=false)
 
 setStep ($step)
 
 getStep ()
 
 toJSON ()
 
 duplicate ($for_test=true, $title="", $author="", $owner="", $testObjId=null)
 
 intermediateSolutionExists ($active_id, $pass)
 
 authorizedSolutionExists ($active_id, $pass)
 
 authorizedOrIntermediateSolutionExists ($active_id, $pass)
 
 isAddableAnswerOptionValue ($qIndex, $answerOptionValue)
 
 addAnswerOptionValue ($qIndex, $answerOptionValue, $points)
 
 removeAllExistingSolutions ()
 
 removeExistingSolutions ($activeId, $pass)
 
 resetUsersAnswer ($activeId, $pass)
 
 removeResultRecord ($activeId, $pass)
 
 fetchValuePairsFromIndexedValues (array $indexedValues)
 
 fetchIndexedValuesFromValuePairs (array $valuePairs)
 
 areObligationsToBeConsidered ()
 
 setObligationsToBeConsidered ($obligationsToBeConsidered)
 
 updateTimestamp ()
 
 getTestPresentationConfig ()
 Get the test question configuration (initialised once) More...
 
 savePartial ()
 
- Public Member Functions inherited from 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)
 Move this to a proper place. More...
 
static logAction ($logtext="", $active_id="", $question_id="")
 Logs an action into the Test&Assessment log. More...
 
static getQuestionTypeFromDb ($question_id)
 get question type for question id More...
 
static _getTotalRightAnswers ($a_q_id)
 get number of answers for question id (static) note: do not use $this inside this method More...
 
static _getTitle ($a_q_id)
 Returns the title of a question. More...
 
static _getQuestionText ($a_q_id)
 Returns question text. More...
 
static isFileAvailable ($file)
 
static _getQuestionType ($question_id)
 Returns the question type of a question with a given id. More...
 
static _getQuestionTitle ($question_id)
 Returns the question title of a question with a given id. More...
 
static saveOriginalId ($questionId, $originalId)
 
static resetOriginalId ($questionId)
 
static _getInternalLinkHref ($target="")
 
static _getOriginalId ($question_id)
 Returns the original id of a question. More...
 
static originalQuestionExists ($questionId)
 
static _instanciateQuestion ($question_id)
 Creates an instance of a question with a given question id. More...
 
static _instantiateQuestion ($question_id)
 
static _getSolutionMaxPass ($question_id, $active_id)
 Returns the maximum pass a users question solution. More...
 
static _isWriteable ($question_id, $user_id)
 Returns true if the question is writeable by a certain user. More...
 
static _isUsedInRandomTest ($question_id="")
 Checks whether the question is used in a random test or not. More...
 
static _isWorkedThrough ($active_id, $question_id, $pass=null)
 Returns true if the question was worked through in the given pass Worked through means that the user entered at least one value. More...
 
static _areAnswered ($a_user_id, $a_question_ids)
 Checks if an array of question ids is answered by an user or not. More...
 
static _setReachedPoints ($active_id, $question_id, $points, $maxpoints, $pass, $manualscoring, $obligationsEnabled)
 Sets the points, a learner has reached answering the question Additionally objective results are updated. More...
 
static _needsManualScoring ($question_id)
 
static _includeClass ($question_type, $gui=0)
 Include the php class file for a given question type. More...
 
static getGuiClassNameByQuestionType ($questionType)
 
static getObjectClassNameByQuestionType ($questionType)
 
static getFeedbackClassNameByQuestionType ($questionType)
 
static isCoreQuestionType ($questionType)
 
static includeCoreClass ($questionType, $withGuiClass)
 
static includePluginClass ($questionType, $withGuiClass)
 
static _getQuestionTypeName ($type_tag)
 Return the translation for a given question type tag. More...
 
static & _instanciateQuestionGUI ($question_id)
 Creates an instance of a question gui with a given question id. More...
 
static instantiateQuestionGUI ($a_question_id)
 Creates an instance of a question gui with a given question id. More...
 
static _questionExistsInTest ($question_id, $test_id)
 
static lookupParentObjId ($questionId)
 ilDBInterface $ilDB More...
 
static lookupOriginalParentObjId ($originalQuestionId)
 returns the parent object id for given original question id (should be a qpl id, but theoretically it can be a tst id, too) More...
 
static isObligationPossible ($questionId)
 returns boolean wether it is possible to set this question type as obligatory or not considering the current question configuration More...
 
static implodeKeyValues ($keyValues)
 
static explodeKeyValues ($keyValues)
 
static setResultGateway ($resultGateway)
 
static getResultGateway ()
 
static sumTimesInISO8601FormatH_i_s_Extended ($time1, $time2)
 
static convertISO8601FormatH_i_s_ExtendedToSeconds ($time)
 
static missingResultRecordExists ($activeId, $pass, $questionIds)
 
static getQuestionsMissingResultRecord ($activeId, $pass, $questionIds)
 
static lookupResultRecordExist ($activeId, $questionId, $pass)
 

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_DEFAULT = 'default'
 constant for additional content editing mode "default" More...
 
const ADDITIONAL_CONTENT_EDITING_MODE_PAGE_OBJECT = 'pageobject'
 constant for additional content editing mode "pageobject" More...
 
 $feedbackOBJ = null
 
 $prevent_rte_usage = false
 
 $selfassessmenteditingmode = false
 
 $defaultnroftries = 0
 
 $questionActionCmd = 'handleQuestionAction'
 
const KEY_VALUES_IMPLOSION_SEPARATOR = ':'
 

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)
 
 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
 
 $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

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 22 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 74 of file class.assTextQuestion.php.

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

80  {
82  $this->wordCounterEnabled = false;
83  $this->maxNumOfChars = 0;
84  $this->points = 1;
85  $this->answers = array();
86  $this->matchcondition = 0;
87  }
__construct(Container $dic, ilPlugin $plugin)
+ 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) public
See also
$answers
ASS_AnswerBinaryStateImage

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

References assQuestion\$points.

Referenced by loadFromDb(), and setAnswers().

859  {
860  include_once "./Modules/TestQuestionPool/classes/class.assAnswerMultipleResponseImage.php";
861 
862  // add answer
863  $answer = new ASS_AnswerMultipleResponseImage($answertext, $points);
864  $this->answers[] = $answer;
865  }
ASS_AnswerBinaryStateImage is a class for answers with a binary state indicator (checked/unchecked, set/unset) and an image file.
+ 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.

public

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

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

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

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

◆ calculateReachedPointsForSolution()

assTextQuestion::calculateReachedPointsForSolution (   $solution)
protected

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

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

Referenced by calculateReachedPoints().

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

public

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

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

241  {
242  if ($this->id <= 0) {
243  // The question has not been saved. It cannot be duplicated
244  return;
245  }
246  // duplicate the question in database
247  $clone = $this;
248  include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
250  $clone->id = -1;
251  $source_questionpool_id = $this->getObjId();
252  $clone->setObjId($target_questionpool_id);
253  if ($title) {
254  $clone->setTitle($title);
255  }
256  $clone->saveToDb();
257  // copy question page content
258  $clone->copyPageOfQuestion($original_id);
259  // copy XHTML media objects
260  $clone->copyXHTMLMediaObjectsOfQuestion($original_id);
261  // duplicate answers
262  #$clone->duplicateAnswers($original_id);
263 
264  $clone->onCopy($source_questionpool_id, $original_id, $clone->getObjId(), $clone->getId());
265 
266  return $clone->id;
267  }
static _getOriginalId($question_id)
Returns the original id of a question.
getObjId()
Get the object id of the container object.
+ Here is the call graph for this function:

◆ countLetters()

assTextQuestion::countLetters (   $text)

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

References ilStr\strLen().

1051  {
1052  $text = strip_tags($text);
1053 
1054  $text = str_replace('&gt;', '>', $text);
1055  $text = str_replace('&lt;', '<', $text);
1056  $text = str_replace('&nbsp;', ' ', $text);
1057  $text = str_replace('&amp;', '&', $text);
1058 
1059  $text = str_replace("\r\n", "\n", $text);
1060  $text = str_replace("\n", "", $text);
1061 
1062  return ilStr::strLen($text);
1063  }
static strLen($a_string)
Definition: class.ilStr.php:78
+ Here is the call graph for this function:

◆ countWords()

assTextQuestion::countWords (   $text)

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

1066  {
1067  $text = str_replace('&nbsp;', ' ', $text);
1068 
1069  $text = preg_replace('/[.,:;!?\-_#\'"+*\\/=()&%§$]/m', '', $text);
1070 
1071  $text = preg_replace('/^\s*/m', '', $text);
1072  $text = preg_replace('/\s*$/m', '', $text);
1073  $text = preg_replace('/\s+/m', ' ', $text);
1074 
1075  return count(explode(' ', $text));
1076  }

◆ createNewOriginalFromThisDuplicate()

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

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

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

270  {
271  if ($this->id <= 0) {
272  // The question has not been saved. It cannot be duplicated
273  return;
274  }
275 
276  include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
277 
278  $sourceQuestionId = $this->id;
279  $sourceParentId = $this->getObjId();
280 
281  // duplicate the question in database
282  $clone = $this;
283  $clone->id = -1;
284 
285  $clone->setObjId($targetParentId);
286 
287  if ($targetQuestionTitle) {
288  $clone->setTitle($targetQuestionTitle);
289  }
290 
291  $clone->saveToDb();
292  // copy question page content
293  $clone->copyPageOfQuestion($sourceQuestionId);
294  // copy XHTML media objects
295  $clone->copyXHTMLMediaObjectsOfQuestion($sourceQuestionId);
296  // duplicate answers
297  #$clone->duplicateAnswers($sourceQuestionId);
298 
299  $clone->onCopy($sourceParentId, $sourceQuestionId, $clone->getObjId(), $clone->getId());
300 
301  return $clone->id;
302  }
getObjId()
Get the object id of the container object.
+ 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 public
See also
$answers

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

References $i, and $index.

905  {
906  if ($index < 0) {
907  return;
908  }
909  if (count($this->answers) < 1) {
910  return;
911  }
912  if ($index >= count($this->answers)) {
913  return;
914  }
915  $answer = $this->answers[$index];
916  if (strlen($answer->getImage())) {
917  $this->deleteImage($answer->getImage());
918  }
919  unset($this->answers[$index]);
920  $this->answers = array_values($this->answers);
921  for ($i = 0; $i < count($this->answers); $i++) {
922  if ($this->answers[$i]->getOrder() > $index) {
923  $this->answers[$i]->setOrder($i);
924  }
925  }
926  }
$index
Definition: metadata.php:128
$i
Definition: metadata.php:24

◆ duplicate()

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

Duplicates an assTextQuestion.

public

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

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

189  {
190  if ($this->id <= 0) {
191  // The question has not been saved. It cannot be duplicated
192  return;
193  }
194  // duplicate the question in database
195  $this_id = $this->getId();
196  $thisObjId = $this->getObjId();
197 
198  $clone = $this;
199  include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
201  $clone->id = -1;
202 
203  if ((int) $testObjId > 0) {
204  $clone->setObjId($testObjId);
205  }
206 
207  if ($title) {
208  $clone->setTitle($title);
209  }
210 
211  if ($author) {
212  $clone->setAuthor($author);
213  }
214  if ($owner) {
215  $clone->setOwner($owner);
216  }
217 
218  if ($for_test) {
219  $clone->saveToDb($original_id);
220  } else {
221  $clone->saveToDb();
222  }
223 
224  // copy question page content
225  $clone->copyPageOfQuestion($this_id);
226  // copy XHTML media objects
227  $clone->copyXHTMLMediaObjectsOfQuestion($this_id);
228  #$clone->duplicateAnswers($this_id);
229 
230  $clone->onDuplicate($thisObjId, $this_id, $clone->getObjId(), $clone->getId());
231 
232  return $clone->id;
233  }
getId()
Gets the id of the assQuestion object.
static _getOriginalId($question_id)
Returns the original id of a question.
getObjId()
Get the object id of the container object.
+ Here is the call graph for this function:

◆ duplicateAnswers()

assTextQuestion::duplicateAnswers (   $original_id)

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

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

966  {
967  global $DIC;
968  $ilDB = $DIC['ilDB'];
969 
970  $result = $ilDB->queryF(
971  "SELECT * FROM qpl_a_essay WHERE question_fi = %s",
972  array('integer'),
973  array($original_id)
974  );
975  if ($result->numRows()) {
976  while ($row = $ilDB->fetchAssoc($result)) {
977  $next_id = $ilDB->nextId('qpl_a_essay');
978  $affectedRows = $ilDB->manipulateF(
979  "INSERT INTO qpl_a_essay (answer_id, question_fi, answertext, points)
980  VALUES (%s, %s, %s, %s)",
981  array('integer','integer','text','float'),
982  array($next_id, $this->getId(), $row["answertext"], $row["points"])
983  );
984  }
985  }
986  }
getId()
Gets the id of the assQuestion object.
$result
global $ilDB
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

◆ flushAnswers()

assTextQuestion::flushAnswers ( )

Deletes all answers.

public

See also
$answers

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

Referenced by loadFromDb(), and setAnswers().

940  {
941  $this->answers = array();
942  }
+ 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 public

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

Referenced by getSolutionSubmit(), and loadFromDb().

775  {
776  return "qpl_qst_essay";
777  }
+ 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 public
See also
$answers

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

References $index.

882  {
883  if ($index < 0) {
884  return null;
885  }
886  if (count($this->answers) < 1) {
887  return null;
888  }
889  if ($index >= count($this->answers)) {
890  return null;
891  }
892 
893  return $this->answers[$index];
894  }
$index
Definition: metadata.php:128

◆ getAnswerCount()

assTextQuestion::getAnswerCount ( )

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

836  {
837  return count($this->answers);
838  }

◆ getAnswers()

assTextQuestion::getAnswers ( )

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

References $answers.

Referenced by calculateReachedPointsForSolution().

868  {
869  return $this->answers;
870  }
+ Here is the caller graph for this function:

◆ getAnswerTableName()

assTextQuestion::getAnswerTableName ( )

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

929  {
930  return 'qpl_a_essay';
931  }

◆ getKeywordRelation()

assTextQuestion::getKeywordRelation ( )

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

References $keyword_relation.

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

989  {
991  }
+ Here is the caller graph for this function:

◆ getLatestAutosaveContent()

assTextQuestion::getLatestAutosaveContent (   $active_id)

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

References assQuestion\getId().

1079  {
1080  $question_fi = $this->getId();
1081 
1082  // Do we have an unauthorized result?
1083  $cntresult = $this->db->query('
1084  SELECT count(solution_id) cnt
1085  FROM tst_solutions
1086  WHERE active_fi = ' . $this->db->quote($active_id, 'int') . '
1087  AND question_fi = ' . $this->db->quote($this->getId(), 'int') . '
1088  AND authorized = ' . $this->db->quote(0, 'int')
1089  );
1090  $row = $this->db->fetchAssoc($cntresult);
1091  if($row['cnt'] > 0 ) {
1092  $tresult = $this->db->query('
1093  SELECT value1
1094  FROM tst_solutions
1095  WHERE active_fi = ' . $this->db->quote($active_id, 'int') . '
1096  AND question_fi = ' . $this->db->quote($this->getId(), 'int') . '
1097  AND authorized = ' . $this->db->quote(0, 'int')
1098  );
1099  $trow = $this->db->fetchAssoc($tresult);
1100  return $trow['value1'];
1101  }
1102  return '';
1103  }
getId()
Gets the id of the assQuestion object.
+ Here is the call graph for this function:

◆ getMaximumPoints()

assTextQuestion::getMaximumPoints ( )

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

public

See also
$points

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

References assQuestion\$points, and getKeywordRelation().

Referenced by calculateReachedPointsForSolution(), and isComplete().

355  {
356  if (in_array($this->getKeywordRelation(), self::getScoringModesWithPointsByQuestion())) {
357  return parent::getPoints();
358  }
359 
360  $points = 0;
361 
362  foreach ($this->answers as $answer) {
363  if ($answer->getPoints() > 0) {
364  $points = $points + $answer->getPoints();
365  }
366  }
367 
368  return $points;
369  }
+ 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 public
See also
$maxNumOfChars

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

References $maxNumOfChars.

Referenced by getSolutionSubmit(), and toJSON().

312  {
313  if (strcmp($this->maxNumOfChars, "") == 0) {
314  return 0;
315  } else {
316  return $this->maxNumOfChars;
317  }
318  }
+ Here is the caller graph for this function:

◆ getMinimumPoints()

assTextQuestion::getMinimumPoints ( )

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

References assQuestion\$points, and getKeywordRelation().

Referenced by calculateReachedPoints(), and calculateReachedPointsForSolution().

372  {
373  if (in_array($this->getKeywordRelation(), self::getScoringModesWithPointsByQuestion())) {
374  return 0;
375  }
376 
377  $points = 0;
378 
379  foreach ($this->answers as $answer) {
380  if ($answer->getPoints() < 0) {
381  $points = $points + $answer->getPoints();
382  }
383  }
384 
385  return $points;
386  }
+ 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 public

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

Referenced by toJSON().

727  {
728  return "assTextQuestion";
729  }
+ 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.

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

784  {
785  return parent::getRTETextWithMediaObjects();
786  }

◆ getScoringModesWithPointsByKeyword()

static assTextQuestion::getScoringModesWithPointsByKeyword ( )
static

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

Referenced by assTextQuestionGUI\getBestAnswer().

1013  {
1014  return array('any');
1015  }
+ Here is the caller graph for this function:

◆ getScoringModesWithPointsByQuestion()

static assTextQuestion::getScoringModesWithPointsByQuestion ( )
static

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

1008  {
1009  return array('non', 'all', 'one');
1010  }

◆ getSolutionSubmit()

assTextQuestion::getSolutionSubmit ( )
Returns
mixed|string

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

References $_POST, $DIC, $ilDB, getAdditionalTableName(), assQuestion\getHtmlUserSolutionPurifier(), assQuestion\getId(), getKeywordRelation(), getMaxNumOfChars(), getTextRating(), ilUtil\isHTML(), isWordCounterEnabled(), ilObjQuestionScoringAdjustable\saveAdditionalQuestionDataToDb(), ilObjAnswerScoringAdjustable\saveAnswerSpecificDataToDb(), and ilUtil\stripSlashes().

Referenced by saveWorkingData().

657  {
658  $text = ilUtil::stripSlashes($_POST["TEXT"], false);
659 
660  if (ilUtil::isHTML($text)) {
661  $text = $this->getHtmlUserSolutionPurifier()->purify($text);
662  }
663 
664  return $text;
665  }
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static isHTML($a_text)
Checks if a given string contains HTML or not.
$_POST["username"]
+ 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 User interface

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

References $text_rating.

Referenced by getSolutionSubmit(), and isKeywordMatching().

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

◆ getValidScoringModes()

static assTextQuestion::getValidScoringModes ( )
static

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

1003  {
1004  return array_merge(self::getScoringModesWithPointsByQuestion(), self::getScoringModesWithPointsByKeyword());
1005  }

◆ 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

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

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

1029  {
1030  $numExistingSolutionRecords = assQuestion::getNumExistingSolutionRecords($active_id, $pass, $this->getId());
1031 
1032  return $numExistingSolutionRecords > 0;
1033  }
getId()
Gets the id of the assQuestion object.
static getNumExistingSolutionRecords($activeId, $pass, $questionId)
returns the number of existing solution records for the given test active / pass and given question i...
+ 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

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

References getMaximumPoints().

95  {
96  if (strlen($this->title)
97  && $this->author
98  && $this->question
99  && $this->getMaximumPoints() > 0
100  ) {
101  return true;
102  }
103  return false;
104  }
getMaximumPoints()
Returns the maximum points, a learner can reach answering the question.
+ 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 private

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

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

442  {
443  $result = false;
444  $textrating = $this->getTextRating();
445  include_once "./Services/Utilities/classes/class.ilStr.php";
446  switch ($textrating) {
448  if (ilStr::strPos(ilStr::strToLower($answertext), ilStr::strToLower($a_keyword)) !== false) {
449  return true;
450  }
451  break;
453  if (ilStr::strPos($answertext, $a_keyword) !== false) {
454  return true;
455  }
456  break;
457  }
458 
459  // "<p>red</p>" would not match "red" even with distance of 5
460  $answertext = strip_tags($answertext);
461 
462  $answerwords = array();
463  if (preg_match_all("/([^\s.]+)/", $answertext, $matches)) {
464  foreach ($matches[1] as $answerword) {
465  array_push($answerwords, trim($answerword));
466  }
467  }
468  foreach ($answerwords as $a_original) {
469  switch ($textrating) {
471  if (levenshtein($a_original, $a_keyword) <= 1) {
472  return true;
473  }
474  break;
476  if (levenshtein($a_original, $a_keyword) <= 2) {
477  return true;
478  }
479  break;
481  if (levenshtein($a_original, $a_keyword) <= 3) {
482  return true;
483  }
484  break;
486  if (levenshtein($a_original, $a_keyword) <= 4) {
487  return true;
488  }
489  break;
491  if (levenshtein($a_original, $a_keyword) <= 5) {
492  return true;
493  }
494  break;
495  }
496  }
497  return $result;
498  }
const TEXTGAP_RATING_LEVENSHTEIN5
static strPos($a_haystack, $a_needle, $a_offset=null)
Definition: class.ilStr.php:30
$result
const TEXTGAP_RATING_LEVENSHTEIN2
const TEXTGAP_RATING_LEVENSHTEIN1
static strToLower($a_string)
Definition: class.ilStr.php:87
const TEXTGAP_RATING_LEVENSHTEIN3
const TEXTGAP_RATING_CASESENSITIVE
const TEXTGAP_RATING_LEVENSHTEIN4
getTextRating()
Returns the rating option for text comparisons.
const TEXTGAP_RATING_CASEINSENSITIVE
+ 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

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

1046  {
1047  return true;
1048  }

◆ isValidTextRating()

assTextQuestion::isValidTextRating (   $textRating)
private

Definition at line 417 of file class.assTextQuestion.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().

418  {
419  switch ($textRating) {
427  return true;
428  }
429 
430  return false;
431  }
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:

◆ isWordCounterEnabled()

assTextQuestion::isWordCounterEnabled ( )
Returns
bool

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

References $wordCounterEnabled.

Referenced by getSolutionSubmit().

336  {
338  }
+ Here is the caller graph for this function:

◆ 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 public

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

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.

127  {
128  global $DIC;
129  $ilDB = $DIC['ilDB'];
130 
131  $result = $ilDB->queryF(
132  "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",
133  array("integer"),
134  array($question_id)
135  );
136  if ($ilDB->numRows($result) == 1) {
137  $data = $ilDB->fetchAssoc($result);
138  $this->setId($question_id);
139  $this->setObjId($data["obj_fi"]);
140  $this->setTitle($data["title"]);
141  $this->setComment($data["description"]);
142  $this->setOriginalId($data["original_id"]);
143  $this->setNrOfTries($data['nr_of_tries']);
144  $this->setAuthor($data["author"]);
145  $this->setPoints((float) $data["points"]);
146  $this->setOwner($data["owner"]);
147  include_once("./Services/RTE/classes/class.ilRTE.php");
148  $this->setQuestion(ilRTE::_replaceMediaObjectImageSrc($data["question_text"], 1));
149  $this->setShuffle($data["shuffle"]);
150  $this->setWordCounterEnabled((bool) $data['word_cnt_enabled']);
151  $this->setMaxNumOfChars($data["maxnumofchars"]);
152  $this->setTextRating($this->isValidTextRating($data["textgap_rating"]) ? $data["textgap_rating"] : TEXTGAP_RATING_CASEINSENSITIVE);
153  $this->matchcondition = (strlen($data['matchcondition'])) ? $data['matchcondition'] : 0;
154  $this->setEstimatedWorkingTime(substr($data["working_time"], 0, 2), substr($data["working_time"], 3, 2), substr($data["working_time"], 6, 2));
155  $this->setKeywordRelation(($data['keyword_relation']));
156 
157  try {
161  }
162 
163  try {
164  $this->setAdditionalContentEditingMode($data['add_cont_edit_mode']);
165  } catch (ilTestQuestionPoolException $e) {
166  }
167  }
168 
169  $result = $ilDB->queryF(
170  "SELECT * FROM qpl_a_essay WHERE question_fi = %s",
171  array("integer"),
172  array($this->getId())
173  );
174 
175  $this->flushAnswers();
176  while ($row = $ilDB->fetchAssoc($result)) {
177  $this->addAnswer($row['answertext'], $row['points']);
178  }
179 
180  parent::loadFromDb($question_id);
181  }
getId()
Gets the id of the assQuestion object.
$data
Definition: storeScorm.php:23
$result
setId($id=-1)
Sets the id of the assQuestion object.
setEstimatedWorkingTime($hour=0, $min=0, $sec=0)
Sets the estimated working time of a question from given hour, minute and second. ...
setNrOfTries($a_nr_of_tries)
setAdditionalContentEditingMode($additinalContentEditingMode)
setter for additional content editing mode for this question
setShuffle($shuffle=true)
Sets the shuffle flag.
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...
setWordCounterEnabled($wordCounterEnabled)
setAuthor($author="")
Sets the authors name of the assQuestion object.
isValidTextRating($textRating)
flushAnswers()
Deletes all answers.
setKeywordRelation($a_relation)
This method implements a default behaviour.
setTextRating($a_text_rating)
Sets the rating option for text comparisons.
setMaxNumOfChars($maxchars=0)
Sets the maximum number of characters for the text solution.
getAdditionalTableName()
Returns the name of the additional question data table in the database.
setPoints($a_points)
Sets the maximum available points for the question.
addAnswer( $answertext="", $points=0.0, $points_unchecked=0.0, $order=0, $answerimage="")
Adds a possible answer for a multiple choice question.
setQuestion($question="")
Sets the question string of the question object.
global $ilDB
setOriginalId($original_id)
$DIC
Definition: xapitoken.php:46
setLifecycle(ilAssQuestionLifecycle $lifecycle)
setTitle($title="")
Sets the title string of the assQuestion object.
setObjId($obj_id=0)
Set the object id of the container object.
setComment($comment="")
Sets the comment string of the assQuestion object.
setOwner($owner="")
Sets the creator/owner ID of the assQuestion object.
const 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

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

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

112  {
116  parent::saveToDb($original_id);
117  }
saveAdditionalQuestionDataToDb()
Saves a record to the question types additional data table.
saveAnswerSpecificDataToDb()
Saves the answer specific records into a question types answer table.
saveQuestionDataToDb($original_id="")
+ 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.

public

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

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

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

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

◆ setAnswers()

assTextQuestion::setAnswers (   $answers)

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

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

945  {
946  if (isset($answers['answer'])) {
947  $count = count($answers['answer']);
948  $withPoints = true;
949  } else {
950  $count = count($answers);
951  $withPoints = false;
952  }
953 
954  $this->flushAnswers();
955 
956  for ($i = 0; $i < $count; $i++) {
957  if ($withPoints) {
958  $this->addAnswer($answers['answer'][$i], $answers['points'][$i]);
959  } else {
960  $this->addAnswer($answers[$i], 0);
961  }
962  }
963  }
flushAnswers()
Deletes all answers.
addAnswer( $answertext="", $points=0.0, $points_unchecked=0.0, $order=0, $answerimage="")
Adds a possible answer for a multiple choice question.
$i
Definition: metadata.php:24
+ Here is the call graph for this function:

◆ setExportDetailsXLS()

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

{}

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

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

792  {
793  parent::setExportDetailsXLS($worksheet, $startrow, $active_id, $pass);
794 
795  $solutions = $this->getSolutionValues($active_id, $pass);
796 
797  $i = 1;
798  $worksheet->setCell($startrow + $i, 0, $this->lng->txt("result"));
799  $worksheet->setBold($worksheet->getColumnCoord(0) . ($startrow + $i));
800 
801  require_once 'Modules/Test/classes/class.ilObjAssessmentFolder.php';
802  $assessment_folder = new ilObjAssessmentFolder();
803 
804  $string_escaping_org_value = $worksheet->getStringEscaping();
805  if ($assessment_folder->getExportEssayQuestionsWithHtml() == 1) {
806  $worksheet->setStringEscaping(false);
807  }
808 
809  if (strlen($solutions[0]["value1"])) {
810  $worksheet->setCell($startrow + $i, 1, $solutions[0]["value1"]);
811  }
812  $i++;
813 
814  $worksheet->setStringEscaping($string_escaping_org_value);
815  return $startrow + $i + 1;
816  }
getSolutionValues($active_id, $pass=null, $authorized=true)
Loads solutions of a given user from the database an returns it.
Class ilObjAssessmentFolder.
$i
Definition: metadata.php:24
+ 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 997 of file class.assTextQuestion.php.

Referenced by loadFromDb().

998  {
999  $this->keyword_relation = $a_relation;
1000  }
+ 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 public
See also
$maxNumOfChars

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

Referenced by loadFromDb().

328  {
329  $this->maxNumOfChars = $maxchars;
330  }
+ 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 public

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

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

397  {
398  global $DIC;
399  $ilDB = $DIC['ilDB'];
400 
401  if (($points > 0) && ($points <= $this->getPoints())) {
402  if (is_null($pass)) {
403  $pass = $this->getSolutionMaxPass($active_id);
404  }
405  $affectedRows = $ilDB->manipulateF(
406  "UPDATE tst_test_result SET points = %s WHERE active_fi = %s AND question_fi = %s AND pass = %s",
407  array('float','integer','integer','integer'),
408  array($points, $active_id, $this->getId(), $pass)
409  );
410  self::_updateTestPassResults($active_id, $pass);
411  return true;
412  } else {
413  return true;
414  }
415  }
getId()
Gets the id of the assQuestion object.
getPoints()
Returns the maximum available points for the question.
getSolutionMaxPass($active_id)
Returns the maximum pass a users question solution.
global $ilDB
$DIC
Definition: xapitoken.php:46
+ 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 User interface

Definition at line 750 of file class.assTextQuestion.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().

751  {
752  switch ($a_text_rating) {
760  $this->text_rating = $a_text_rating;
761  break;
762  default:
763  $this->text_rating = TEXTGAP_RATING_CASEINSENSITIVE;
764  break;
765  }
766  }
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:

◆ setWordCounterEnabled()

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

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

References $wordCounterEnabled.

Referenced by loadFromDb().

344  {
345  $this->wordCounterEnabled = $wordCounterEnabled;
346  }
+ Here is the caller graph for this function:

◆ toJSON()

assTextQuestion::toJSON ( )

Returns a JSON representation of the question.

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

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

822  {
823  include_once("./Services/RTE/classes/class.ilRTE.php");
824  $result = array();
825  $result['id'] = (int) $this->getId();
826  $result['type'] = (string) $this->getQuestionType();
827  $result['title'] = (string) $this->getTitle();
828  $result['question'] = $this->formatSAQuestion($this->getQuestion());
829  $result['nr_of_tries'] = (int) $this->getNrOfTries();
830  $result['shuffle'] = (bool) $this->getShuffle();
831  $result['maxlength'] = (int) $this->getMaxNumOfChars();
832  return json_encode($result);
833  }
getId()
Gets the id of the assQuestion object.
formatSAQuestion($a_q)
Format self assessment question.
$result
getShuffle()
Gets the shuffle flag.
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.
getTitle()
Gets the title string of the assQuestion object.
+ Here is the call graph for this function:

Field Documentation

◆ $answers

assTextQuestion::$answers

◆ $keyword_relation

assTextQuestion::$keyword_relation = 'any'

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

Referenced by getKeywordRelation().

◆ $keywords

assTextQuestion::$keywords

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

◆ $matchcondition

assTextQuestion::$matchcondition
private

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

◆ $maxNumOfChars

assTextQuestion::$maxNumOfChars

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

Referenced by getMaxNumOfChars().

◆ $text_rating

assTextQuestion::$text_rating

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

Referenced by getTextRating().

◆ $wordCounterEnabled

assTextQuestion::$wordCounterEnabled
protected

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

Referenced by isWordCounterEnabled(), and setWordCounterEnabled().


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