ILIAS  release_8 Revision v8.24
assErrorText 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 assErrorText:
+ Collaboration diagram for assErrorText:

Public Member Functions

 __construct ( $title='', $comment='', $author='', $owner=-1, $question='')
 assErorText constructor More...
 
 isComplete ()
 Returns true, if a single choice question is complete for use. More...
 
 saveToDb ($original_id="")
 Saves a the object to the database. More...
 
 saveAnswerSpecificDataToDb ()
 Saves the answer specific records into a question types answer table. More...
 
 saveAdditionalQuestionDataToDb ()
 Saves the data for the additional data table. More...
 
 loadFromDb ($question_id)
 Loads the object from the database. More...
 
 duplicate (bool $for_test=true, string $title="", string $author="", string $owner="", $testObjId=null)
 Duplicates the object. More...
 
 copyObject ($target_questionpool_id, $title="")
 Copies an object. More...
 
 createNewOriginalFromThisDuplicate ($targetParentId, $targetQuestionTitle="")
 
 getMaximumPoints ()
 Returns the maximum points, a learner can reach answering the question. More...
 
 calculateReachedPoints ($active_id, $pass=null, $authorizedSolution=true, $returndetails=false)
 Returns the points, a learner has reached answering the question. More...
 
 calculateReachedPointsFromPreviewSession (ilAssQuestionPreviewSession $preview_session)
 
 saveWorkingData ($active_id, $pass=null, $authorized=true)
 Saves the learners input of the question to the database. More...
 
 savePreviewData (ilAssQuestionPreviewSession $previewSession)
 
 getQuestionType ()
 Returns the question type of the question. More...
 
 getAdditionalTableName ()
 
 getAnswerTableName ()
 
 setExportDetailsXLS (ilAssExcelFormatHelper $worksheet, int $startrow, int $active_id, int $pass)
 {} More...
 
 fromXML ($item, int $questionpool_id, ?int $tst_id, &$tst_object, int &$question_counter, array $import_mapping, array &$solutionhints=[])
 Receives parameters from a QTI parser and creates a valid ILIAS question object. More...
 
 toXML ($a_include_header=true, $a_include_binary=true, $a_shuffle=false, $test_output=false, $force_image_references=false)
 
 setErrorsFromParsedErrorText ()
 
 setErrorData (array $errors)
 
 removeErrorDataWithoutPosition ()
 
 assembleErrorTextOutput (array $selections, bool $graphical_output=false, bool $show_correct_solution=false, bool $use_link_tags=true, array $correctness_icons=[])
 
 createErrorTextExport (array $selections)
 
 getBestSelection ($withPositivePointsOnly=true)
 
 flushErrorData ()
 
 getErrorData ()
 
 getErrorText ()
 
 setErrorText (?string $text)
 
 getParsedErrorText ()
 
 setParsedErrorText (array $parsed_errortext)
 
 getTextSize ()
 
 setTextSize ($a_value)
 
 getPointsWrong ()
 
 setPointsWrong ($a_value)
 
 toJSON ()
 
 getOperators ($expression)
 Get all available operations for a specific question. More...
 
 getExpressionTypes ()
 Get all available expression types for a specific question. More...
 
 getUserQuestionResult ($active_id, $pass)
 Get the user solution for a question by active_id and the test pass. More...
 
 parseErrorText ()
 
 getAvailableAnswerOptions ($index=null)
 If index is null, the function returns an array with all anwser options Else it returns the specific answer option. More...
 
- Public Member Functions inherited from assQuestion
 __construct (string $title="", string $comment="", string $author="", int $owner=-1, string $question="")
 assQuestion constructor More...
 
 getShuffler ()
 
 setShuffler (Transformation $shuffler)
 
 setProcessLocker (ilAssQuestionProcessLocker $processLocker)
 
 getProcessLocker ()
 
 fromXML ($item, int $questionpool_id, ?int $tst_id, &$tst_object, int &$question_counter, array $import_mapping, array &$solutionhints=[])
 Receives parameters from a QTI parser and creates a valid ILIAS question object. More...
 
 toXML (bool $a_include_header=true, bool $a_include_binary=true, bool $a_shuffle=false, bool $test_output=false, bool $force_image_references=false)
 Returns a QTI xml representation of the question. More...
 
 isComplete ()
 Returns true, if a question is complete for use. More...
 
 questionTitleExists (int $questionpool_id, string $title)
 Returns TRUE if the question title exists in a question pool in the database. More...
 
 setTitle (string $title="")
 
 setId (int $id=-1)
 
 setTestId (int $id=-1)
 
 setComment (string $comment="")
 
 setOutputType (int $outputType=OUTPUT_HTML)
 
 setShuffle (?bool $shuffle=true)
 
 setAuthor (string $author="")
 
 setOwner (int $owner=-1)
 
 getTitle ()
 
 getTitleForHTMLOutput ()
 
 getTitleFilenameCompliant ()
 
 getId ()
 
 getShuffle ()
 
 getTestId ()
 
 getComment ()
 
 getDescriptionForHTMLOutput ()
 
 getThumbSize ()
 
 setThumbSize (int $a_size)
 
 getMinimumThumbSize ()
 
 getMaximumThumbSize ()
 
 getOutputType ()
 
 supportsJavascriptOutput ()
 
 supportsNonJsOutput ()
 
 requiresJsSwitch ()
 
 getAuthor ()
 
 getAuthorForHTMLOutput ()
 
 getOwner ()
 
 getObjId ()
 
 setObjId (int $obj_id=0)
 
 getLifecycle ()
 
 setLifecycle (ilAssQuestionLifecycle $lifecycle)
 
 setExternalId (?string $external_id)
 
 getExternalId ()
 
 getSuggestedSolutionOutput ()
 
 _getSuggestedSolution (int $question_id, int $subquestion_index=0)
 
 loadSuggestedSolution (int $question_id, int $subquestion_index=0)
 Returns a suggested solution for a given subquestion index. More...
 
 getSuggestedSolutions ()
 
 getReachedPoints (int $active_id, int $pass)
 
 getMaximumPoints ()
 
 getAdjustedReachedPoints (int $active_id, int $pass, bool $authorizedSolution=true)
 returns the reached points ... More...
 
 calculateResultsFromSolution (int $active_id, int $pass, bool $obligationsEnabled=false)
 Calculates the question results from a previously saved question solution. More...
 
 persistWorkingState (int $active_id, $pass, bool $obligationsEnabled=false, bool $authorized=true)
 persists the working state for current testactive and testpass More...
 
 persistPreviewState (ilAssQuestionPreviewSession $previewSession)
 persists the preview state for current user and question More...
 
 validateSolutionSubmit ()
 
 saveWorkingData (int $active_id, int $pass, bool $authorized=true)
 Saves the learners input of the question to the database. More...
 
 moveUploadedMediaFile (string $file, string $name)
 Move an uploaded media file to an public accessible temp dir to present it. More...
 
 getSuggestedSolutionPath ()
 
 getImagePath ($question_id=null, $object_id=null)
 Returns the image path for web accessable images of a question. More...
 
 buildImagePath ($questionId, $parentObjectId)
 
 getFlashPath ()
 Returns the image path for web accessable flash files of a question. More...
 
 getSuggestedSolutionPathWeb ()
 
 getImagePathWeb ()
 Returns the web image path for web accessable images of a question. More...
 
 getTestOutputSolutions (int $activeId, int $pass)
 
 getUserSolutionPreferingIntermediate (int $active_id, $pass=null)
 
 getSolutionValues ($active_id, $pass=null, bool $authorized=true)
 Loads solutions of a given user from the database an returns it. More...
 
 isInUse (int $question_id=0)
 Checks whether the question is in use or not in pools or tests. More...
 
 usageNumber (int $question_id=0)
 Returns the number of place the question is in use in pools or tests. More...
 
 isClone (int $question_id=0)
 Checks whether the question is a clone of another question or not. More...
 
 getAdditionalTableName ()
 
 getAnswerTableName ()
 
 deleteAnswers (int $question_id)
 
 deleteAdditionalTableData (int $question_id)
 
 delete (int $question_id)
 
 getTotalAnswers ()
 
 copyXHTMLMediaObjectsOfQuestion (int $a_q_id)
 
 syncXHTMLMediaObjectsOfQuestion ()
 
 createPageObject ()
 
 copyPageOfQuestion (int $a_q_id)
 
 getPageOfQuestion ()
 
 setOriginalId (?int $original_id)
 
 getOriginalId ()
 
 fixSvgToPng (string $imageFilenameContainingString)
 
 fixUnavailableSkinImageSources (string $html)
 
 loadFromDb (int $question_id)
 
 createNewQuestion (bool $a_create_page=true)
 Creates a new question without an owner when a new question is created This assures that an ID is given to the question if a file upload or something else occurs. More...
 
 saveQuestionDataToDb (int $original_id=-1)
 
 saveToDb ()
 
 setNewOriginalId (int $newId)
 
 deleteSuggestedSolutions ()
 
 getSuggestedSolution (int $subquestion_index=0)
 Returns a suggested solution for a given subquestion index. More...
 
 getSuggestedSolutionTitle (int $subquestion_index=0)
 Returns the title of a suggested solution at a given subquestion_index. More...
 
 setSuggestedSolution (string $solution_id="", int $subquestion_index=0, bool $is_import=false)
 Sets a suggested solution for the question. More...
 
 updateSuggestedSolutions (int $original_id=-1, int $original_obj_id=-1)
 
 _resolveInternalLink (string $internal_link)
 
 _resolveIntLinks (int $question_id)
 
 syncWithOriginal ()
 
 _questionExists ($question_id)
 Returns true if the question already exists in the database. More...
 
 _questionExistsInPool (int $question_id)
 
 getPoints ()
 
 setPoints (float $points)
 
 getSolutionMaxPass (int $active_id)
 
 calculateReachedPoints ($active_id, $pass=null, $authorizedSolution=true, $returndetails=false)
 Returns the points, a learner has reached answering the question. More...
 
 deductHintPointsFromReachedPoints (ilAssQuestionPreviewSession $previewSession, $reachedPoints)
 
 calculateReachedPointsFromPreviewSession (ilAssQuestionPreviewSession $previewSession)
 
 isPreviewSolutionCorrect (ilAssQuestionPreviewSession $previewSession)
 
 adjustReachedPointsByScoringOptions ($points, $active_id, $pass=null)
 Adjust the given reached points by checks for all special scoring options in the test container. More...
 
 isHTML ($a_text)
 Checks if a given string contains HTML or not. More...
 
 prepareTextareaOutput (string $txt_output, bool $prepare_for_latex_output=false, bool $omitNl2BrWhenTextArea=false)
 
 QTIMaterialToString (ilQTIMaterial $a_material)
 Reads an QTI material tag and creates a text or XHTML string. More...
 
 addQTIMaterial (ilXmlWriter $a_xml_writer, string $a_material, bool $close_material_tag=true, bool $add_mobs=true)
 
 buildHashedImageFilename (string $plain_image_filename, bool $unique=false)
 
 getQuestion ()
 
 getQuestionForHTMLOutput ()
 
 setQuestion (string $question="")
 
 getQuestionType ()
 Returns the question type of the question. More...
 
 getQuestionTypeID ()
 
 syncHints ()
 
 cleanupMediaObjectUsage ()
 
 getInstances ()
 
 getActiveUserData (int $active_id)
 Returns the user id and the test id for a given active id. More...
 
 hasSpecificFeedback ()
 
 setExportDetailsXLS (ilAssExcelFormatHelper $worksheet, int $startrow, int $active_id, int $pass)
 
 __get ($value)
 Object getter. More...
 
 __set ($key, $value)
 Object setter. More...
 
 __isset ($key)
 Object issetter. More...
 
 getNrOfTries ()
 
 setNrOfTries (int $a_nr_of_tries)
 
 setExportImagePath (string $path)
 
 formatSAQuestion ($a_q)
 
 setPreventRteUsage (bool $prevent_rte_usage)
 
 getPreventRteUsage ()
 
 migrateContentForLearningModule (ilAssSelfAssessmentMigrator $migrator)
 
 setSelfAssessmentEditingMode (bool $selfassessmenteditingmode)
 
 getSelfAssessmentEditingMode ()
 
 setDefaultNrOfTries (int $defaultnroftries)
 
 getDefaultNrOfTries ()
 
 syncSkillAssignments (int $srcParentId, int $srcQuestionId, int $trgParentId, int $trgQuestionId)
 
 ensureHintPageObjectExists ($pageObjectId)
 
 isAnswered (int $active_id, int $pass)
 
 isAutosaveable ()
 
 getAdditionalContentEditingMode ()
 
 setAdditionalContentEditingMode (?string $additionalContentEditingMode)
 
 isAdditionalContentEditingModePageObject ()
 
 isValidAdditionalContentEditingMode (string $additionalContentEditingMode)
 
 getValidAdditionalContentEditingModes ()
 
 getHtmlUserSolutionPurifier ()
 
 getHtmlQuestionContentPurifier ()
 
 setLastChange ($lastChange)
 
 getLastChange ()
 
 removeIntermediateSolution (int $active_id, int $pass)
 
 removeCurrentSolution (int $active_id, int $pass, bool $authorized=true)
 
 saveCurrentSolution (int $active_id, int $pass, $value1, $value2, bool $authorized=true, $tstamp=0)
 
 updateCurrentSolution (int $solutionId, $value1, $value2, bool $authorized=true)
 
 updateCurrentSolutionsAuthorization (int $activeId, int $pass, bool $authorized, bool $keepTime=false)
 
 setStep ($step)
 
 getStep ()
 
 toJSON ()
 
 duplicate (bool $for_test=true, string $title="", string $author="", string $owner="", $testObjId=null)
 
 intermediateSolutionExists (int $active_id, int $pass)
 
 authorizedSolutionExists (int $active_id, ?int $pass)
 
 authorizedOrIntermediateSolutionExists (int $active_id, int $pass)
 
 lookupForExistingSolutions (int $activeId, int $pass)
 Lookup if an authorized or intermediate solution exists. More...
 
 isAddableAnswerOptionValue (int $qIndex, string $answerOptionValue)
 
 addAnswerOptionValue (int $qIndex, string $answerOptionValue, float $points)
 
 removeAllExistingSolutions ()
 
 removeExistingSolutions (int $activeId, int $pass)
 
 resetUsersAnswer (int $activeId, int $pass)
 
 removeResultRecord (int $activeId, int $pass)
 
 fetchValuePairsFromIndexedValues (array $indexedValues)
 
 fetchIndexedValuesFromValuePairs (array $valuePairs)
 
 areObligationsToBeConsidered ()
 
 setObligationsToBeConsidered (bool $obligationsToBeConsidered)
 
 updateTimestamp ()
 
 getTestPresentationConfig ()
 
 savePartial ()
 
 isInActiveTest ()
 
 saveAdditionalQuestionDataToDb ()
 Saves a record to the question types additional data table. More...
 
 saveAnswerSpecificDataToDb ()
 Saves the answer specific records into a question types answer table. More...
 
 getOperators ($expression)
 Get all available operations for a specific question. More...
 
 getExpressionTypes ()
 Get all available expression types for a specific question. More...
 
 getUserQuestionResult ($active_id, $pass)
 Get the user solution for a question by active_id and the test pass. More...
 
 getAvailableAnswerOptions ($index=null)
 If index is null, the function returns an array with all anwser options Else it returns the specific answer option. More...
 

Protected Member Functions

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

Protected Attributes

const ERROR_TYPE_WORD = 1
 
const ERROR_TYPE_PASSAGE = 2
 
const DEFAULT_TEXT_SIZE = 100.0
 
const ERROR_MAX_LENGTH = 150
 
const PARAGRAPH_SPLIT_REGEXP = '/[\n\r]+/'
 
const WORD_SPLIT_REGEXP = '/\s+/'
 
const FIND_PUNCTUATION_REGEXP = '/\p{P}/'
 
const ERROR_WORD_MARKER = '#'
 
const ERROR_PARAGRAPH_DELIMITERS
 
string $errortext = ''
 
array $parsed_errortext = []
 
array $errordata = []
 
float $textsize
 
float $points_wrong
 
- Protected Attributes inherited from assQuestion
const HAS_SPECIFIC_FEEDBACK = true
 
ILIAS HTTP Services $http
 
ILIAS Refinery Factory $refinery
 
ILIAS DI LoggingServices $ilLog
 
int $id
 
string $title
 
string $comment
 
string $owner
 
string $author
 
int $thumb_size
 
string $question
 The question text. More...
 
float $points
 The maximum available points for the question. More...
 
bool $shuffle
 Indicates whether the answers will be shuffled or not. More...
 
int $test_id
 The database id of a test in which the question is contained. More...
 
int $obj_id = 0
 Object id of the container object. More...
 
 $ilias
 
ilGlobalPageTemplate $tpl
 
ilLanguage $lng
 
ilDBInterface $db
 
Container $dic
 
int $outputType = OUTPUT_JAVASCRIPT
 Contains the output type of a question. More...
 
array $suggested_solutions
 
int $original_id = null
 
 $page
 
string $external_id = null
 
ilAssQuestionProcessLocker $processLocker
 
 $step
 
 $lastChange
 
Transformation $shuffler
 
ilTestQuestionConfig $testQuestionConfig
 
ilAssQuestionLifecycle $lifecycle
 
ilObjUser $current_user
 

Private Member Functions

 correctDataAfterParserUpdate ()
 
 logUserAction (bool $user_entered_values, int $active_id)
 
 getAnswersFromRequest ()
 
 addPositionToErrorAnswer (assAnswerErrorText $error)
 
 completeParsedErrorTextFromErrorData ()
 
 getAdditionalInformationFromExistingErrorDataByErrorText (array $current_error_data, string $text_wrong)
 
 generateOutputStringFromPosition (int $position, array $selections, array $paragraph, bool $graphical_output, bool $show_correct_solution, bool $use_link_tags, array $correctness_icons)
 
 getTextForPosition (int $position, array $paragraph, bool $show_correct_solution)
 
 getClassForPosition (int $position, bool $show_correct_solution, array $selections)
 
 getCorrectnessIconForPosition (int $position, bool $graphical_output, array $selections, array $correctness_icons)
 
 getErrorDataAsArrayForJS ()
 
 getParsedErrorTextForJS ()
 
 addErrorInformationToTextParagraphArray (array $paragraph, int $offset)
 
 parsePassageEndWord (string $word)
 
 generateArrayByPositionFromErrorData ()
 
 getErrorTokenHtml ($item, $class, $useLinkTags)
 

Additional Inherited Members

- Static Public Member Functions inherited from assQuestion
static setForcePassResultUpdateEnabled (bool $forcePassResultsUpdateEnabled)
 
static isForcePassResultUpdateEnabled ()
 
static isAllowedImageMimeType ($mimeType)
 
static fetchMimeTypeIdentifier (string $contentType)
 
static getAllowedFileExtensionsForMimeType (string $mimeType)
 
static isAllowedImageFileExtension (string $mimeType, string $fileExtension)
 
static getAllowedImageMaterialFileExtensions ()
 
static _getMaximumPoints (int $question_id)
 Returns the maximum points, a learner can reach answering the question. More...
 
static _getQuestionInfo (int $question_id)
 
static _getSuggestedSolutionCount (int $question_id)
 
static _getSuggestedSolutionOutput (int $question_id)
 
static _getReachedPoints (int $active_id, int $question_id, int $pass)
 
static _updateTestResultCache (int $active_id, ilAssQuestionProcessLocker $processLocker=null)
 @TODO Move this to a proper place. More...
 
static logAction (string $logtext, int $active_id, int $question_id)
 
static getQuestionTypeFromDb (int $question_id)
 
static _getTotalRightAnswers (int $a_q_id)
 
static _getTitle (int $a_q_id)
 
static _getQuestionText (int $a_q_id)
 
static isFileAvailable (string $file)
 
static _getQuestionType (int $question_id)
 
static _getQuestionTitle (int $question_id)
 
static saveOriginalId (int $questionId, int $originalId)
 
static resetOriginalId (int $questionId)
 
static _getInternalLinkHref (string $target="")
 
static _getOriginalId (int $question_id)
 
static originalQuestionExists (int $questionId)
 
static _instanciateQuestion (int $question_id)
 
static _instantiateQuestion (int $question_id)
 
static instantiateQuestion (int $question_id)
 
static _getSolutionMaxPass (int $question_id, int $active_id)
 Returns the maximum pass a users question solution. More...
 
static _isWriteable (int $question_id, int $user_id)
 
static _isUsedInRandomTest (int $question_id)
 
static _isWorkedThrough (int $active_id, int $question_id, int $pass)
 Returns true if the question was worked through in the given pass Worked through means that the user entered at least one value. More...
 
static _areAnswered (int $a_user_id, array $a_question_ids)
 Checks if an array of question ids is answered by a user or not. More...
 
static _setReachedPoints (int $active_id, int $question_id, float $points, float $maxpoints, int $pass, bool $manualscoring, bool $obligationsEnabled)
 Sets the points, a learner has reached answering the question Additionally objective results are updated. More...
 
static _needsManualScoring (int $question_id)
 
static _includeClass (string $question_type, int $gui=0)
 
static getFeedbackClassNameByQuestionType (string $questionType)
 
static isCoreQuestionType (string $questionType)
 
static includeCoreClass ($questionType, $withGuiClass)
 
static _getQuestionTypeName ($type_tag)
 
static _instanciateQuestionGUI (int $question_id)
 
static instantiateQuestionGUI (int $a_question_id)
 
static _questionExistsInTest (int $question_id, int $test_id)
 
static lookupParentObjId (int $questionId)
 
static lookupOriginalParentObjId (int $originalQuestionId)
 returns the parent object id for given original question id (should be a qpl id, but theoretically it can be a tst id, too) More...
 
static isObligationPossible (int $questionId)
 
static implodeKeyValues (array $keyValues)
 
static explodeKeyValues (string $keyValues)
 
static convertISO8601FormatH_i_s_ExtendedToSeconds (string $time)
 
static missingResultRecordExists (int $activeId, int $pass, array $questionIds)
 
static getQuestionsMissingResultRecord (int $activeId, int $pass, array $questionIds)
 
static lookupResultRecordExist (int $activeId, int $questionId, int $pass)
 
static extendedTrim (string $value)
 Trim non-printable characters from the beginning and end of a string. More...
 
- Data Fields inherited from assQuestion
const IMG_MIME_TYPE_JPG = 'image/jpeg'
 
const IMG_MIME_TYPE_PNG = 'image/png'
 
const IMG_MIME_TYPE_GIF = 'image/gif'
 
const TRIM_PATTERN = '/^[\p{C}\p{Z}]+|[\p{C}\p{Z}]+$/u'
 
const ADDITIONAL_CONTENT_EDITING_MODE_RTE = 'default'
 
const ADDITIONAL_CONTENT_EDITING_MODE_IPE = 'pageobject'
 
ilAssQuestionFeedback $feedbackOBJ
 
bool $prevent_rte_usage = false
 
bool $selfassessmenteditingmode = false
 
int $defaultnroftries = 0
 
string $questionActionCmd = 'handleQuestionAction'
 
const KEY_VALUES_IMPLOSION_SEPARATOR = ':'
 
- Data Fields inherited from iQuestionCondition
const StringResultExpression = '~TEXT~'
 
const PercentageResultExpression = '%n%'
 
const NumericResultExpression = '#n#'
 
const MatchingResultExpression = ';n:m;'
 
const OrderingResultExpression = '$n,m,o,p$'
 
const NumberOfResultExpression = '+n+'
 
const ExclusiveResultExpression = '*n,m,o,p*'
 
const EmptyAnswerExpression = "?"
 
- Static Protected Member Functions inherited from assQuestion
static getNumExistingSolutionRecords (int $activeId, int $pass, int $questionId)
 
- Static Protected Attributes inherited from assQuestion
static $allowedFileExtensionsByMimeType
 
static $allowedCharsetsByMimeType
 
static $allowedImageMaterialFileExtensionsByMimeType
 
static $forcePassResultsUpdateEnabled = false
 
static $imageSourceFixReplaceMap
 

Detailed Description

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

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

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class for error 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
Grégory Saive gsaiv.nosp@m.e@da.nosp@m.tabay.nosp@m..de
Maximilian Becker mbeck.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

assErrorText::__construct (   $title = '',
  $comment = '',
  $author = '',
  $owner = -1,
  $question = '' 
)

assErorText constructor

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 single choice question.

Definition at line 65 of file class.assErrorText.php.

71 {
73 $this->textsize = self::DEFAULT_TEXT_SIZE;
74 }
string $question
The question text.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

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

+ Here is the call graph for this function:

Member Function Documentation

◆ addErrorInformationToTextParagraphArray()

assErrorText::addErrorInformationToTextParagraphArray ( array  $paragraph,
int  $offset 
)
private
Parameters
list<string>$paragraph
Returns
array<string|array>

Definition at line 1024 of file class.assErrorText.php.

1024 : array
1025 {
1026 $paragraph_with_error_info = [];
1027 $passage_start = null;
1028 foreach ($paragraph as $position => $word) {
1029 $actual_position = $position + $offset;
1030 if ($passage_start !== null
1031 && (mb_strrpos($word, self::ERROR_PARAGRAPH_DELIMITERS['end']) === mb_strlen($word) - 2
1032 || mb_strrpos($word, self::ERROR_PARAGRAPH_DELIMITERS['end']) === mb_strlen($word) - 3
1033 && preg_match(self::FIND_PUNCTUATION_REGEXP, mb_substr($word, -1)) === 1)) {
1034
1035 $actual_word = $this->parsePassageEndWord($word);
1036
1037 $paragraph_with_error_info[$passage_start]['text_wrong'] .=
1038 ' ' . $actual_word;
1039 $paragraph_with_error_info[$actual_position] = [
1040 'text' => $actual_word,
1041 'error_type' => 'passage_end'
1042 ];
1043 $passage_start = null;
1044 continue;
1045 }
1046 if ($passage_start !== null) {
1047 $paragraph_with_error_info[$passage_start]['text_wrong'] .= ' ' . $word;
1048 $paragraph_with_error_info[$actual_position] = [
1049 'text' => $word,
1050 'error_type' => 'in_passage'
1051 ];
1052 continue;
1053 }
1054 if (mb_strpos($word, self::ERROR_PARAGRAPH_DELIMITERS['start']) === 0) {
1055 $paragraph_with_error_info[$actual_position] = [
1056 'text' => substr($word, 2),
1057 'text_wrong' => substr($word, 2),
1058 'error_type' => 'passage_start',
1059 'error_position' => $actual_position,
1060 ];
1061 $passage_start = $actual_position;
1062 continue;
1063 }
1064 if (mb_strpos($word, self::ERROR_WORD_MARKER) === 0) {
1065 $paragraph_with_error_info[$actual_position] = [
1066 'text' => substr($word, 1),
1067 'text_wrong' => substr($word, 1),
1068 'error_type' => 'word',
1069 'error_position' => $actual_position,
1070 ];
1071 continue;
1072 }
1073
1074 $paragraph_with_error_info[$actual_position] = [
1075 'text' => $word,
1076 'error_type' => 'none',
1077 'points' => $this->getPointsWrong()
1078 ];
1079 }
1080
1081 return $paragraph_with_error_info;
1082 }
parsePassageEndWord(string $word)

◆ addPositionToErrorAnswer()

assErrorText::addPositionToErrorAnswer ( assAnswerErrorText  $error)
private

Definition at line 553 of file class.assErrorText.php.

554 {
555 foreach ($this->getParsedErrorText() as $paragraph) {
556 foreach ($paragraph as $position => $word) {
557 if (isset($word['text_wrong'])
558 && ($word['text_wrong'] === $error->getTextWrong()
559 || mb_substr($word['text_wrong'], 0, -1) === $error->getTextWrong()
560 && preg_match(self::FIND_PUNCTUATION_REGEXP, mb_substr($word['text_wrong'], -1)) === 1)
561 && !array_key_exists($position, $this->generateArrayByPositionFromErrorData())
562 ) {
563 return $error->withPosition($position);
564 }
565
566 }
567 }
568
569 return $error;
570 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References generateArrayByPositionFromErrorData(), getParsedErrorText(), assAnswerErrorText\getTextWrong(), and assAnswerErrorText\withPosition().

Referenced by correctDataAfterParserUpdate(), and setErrorData().

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

◆ assembleErrorTextOutput()

assErrorText::assembleErrorTextOutput ( array  $selections,
bool  $graphical_output = false,
bool  $show_correct_solution = false,
bool  $use_link_tags = true,
array  $correctness_icons = [] 
)

Definition at line 633 of file class.assErrorText.php.

639 : string {
640 $output_array = [];
641 foreach ($this->getParsedErrorText() as $paragraph) {
642 $array_reduce_function = fn (?string $carry, int $position)
643 => $carry . $this->generateOutputStringFromPosition(
644 $position,
645 $selections,
646 $paragraph,
647 $graphical_output,
648 $show_correct_solution,
649 $use_link_tags,
650 $correctness_icons
651 );
652 $output_array[] = '<p>' . trim(array_reduce(array_keys($paragraph), $array_reduce_function)) . '</p>';
653 }
654
655 return implode("\n", $output_array);
656 }
generateOutputStringFromPosition(int $position, array $selections, array $paragraph, bool $graphical_output, bool $show_correct_solution, bool $use_link_tags, array $correctness_icons)

◆ calculateReachedPoints()

assErrorText::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 385 of file class.assErrorText.php.

385 : float
386 {
387 if ($returndetails) {
388 throw new ilTestException('return details not implemented for ' . __METHOD__);
389 }
390
391 /* First get the positions which were selected by the user. */
392 $positions = [];
393 if (is_null($pass)) {
394 $pass = $this->getSolutionMaxPass($active_id);
395 }
396 $result = $this->getCurrentSolutionResultSet($active_id, $pass, $authorizedSolution);
397
398 while ($row = $this->db->fetchAssoc($result)) {
399 $positions[] = $row['value1'];
400 }
401 $points = $this->getPointsForSelectedPositions($positions);
402 return $points;
403 }
getPointsForSelectedPositions(array $selected_word_positions)
float $points
The maximum available points for the question.
getCurrentSolutionResultSet(int $active_id, int $pass, bool $authorized=true)
getSolutionMaxPass(int $active_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References assQuestion\$points, assQuestion\getCurrentSolutionResultSet(), getPointsForSelectedPositions(), and assQuestion\getSolutionMaxPass().

+ Here is the call graph for this function:

◆ calculateReachedPointsFromPreviewSession()

assErrorText::calculateReachedPointsFromPreviewSession ( ilAssQuestionPreviewSession  $preview_session)

Reimplemented from assQuestion.

Definition at line 405 of file class.assErrorText.php.

406 {
407 $reached_points = $this->getPointsForSelectedPositions($preview_session->getParticipantsSolution() ?? []);
408 $reached_points = $this->deductHintPointsFromReachedPoints($preview_session, $reached_points);
409 return $this->ensureNonNegativePoints($reached_points);
410 }
deductHintPointsFromReachedPoints(ilAssQuestionPreviewSession $previewSession, $reachedPoints)
ensureNonNegativePoints($points)

References assQuestion\deductHintPointsFromReachedPoints(), assQuestion\ensureNonNegativePoints(), ilAssQuestionPreviewSession\getParticipantsSolution(), and getPointsForSelectedPositions().

+ Here is the call graph for this function:

◆ completeParsedErrorTextFromErrorData()

assErrorText::completeParsedErrorTextFromErrorData ( )
private

Definition at line 572 of file class.assErrorText.php.

572 : void
573 {
574 foreach ($this->errordata as $error) {
575 $position = $error->getPosition();
576 foreach ($this->getParsedErrorText() as $key => $paragraph) {
577 if (array_key_exists($position, $paragraph)) {
578 $this->parsed_errortext[$key][$position]['text_correct'] =
579 $error->getTextCorrect();
580 $this->parsed_errortext[$key][$position]['points'] =
581 $error->getPoints();
582 break;
583 }
584 }
585 }
586 }
string $key
Consumer key/client ID value.
Definition: System.php:193

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

Referenced by correctDataAfterParserUpdate(), and setErrorData().

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

◆ copyObject()

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

Copies an object.

Definition at line 300 of file class.assErrorText.php.

300 : int
301 {
302 if ($this->getId() <= 0) {
303 throw new RuntimeException('The question has not been saved. It cannot be duplicated');
304 }
305 // duplicate the question in database
306
307 $thisId = $this->getId();
308 $thisObjId = $this->getObjId();
309
310 $clone = $this;
312 $clone->id = -1;
313 $clone->setObjId($target_questionpool_id);
314 if ($title) {
315 $clone->setTitle($title);
316 }
317 $clone->saveToDb();
318
319 // copy question page content
320 $clone->copyPageOfQuestion($original_id);
321 // copy XHTML media objects
322 $clone->copyXHTMLMediaObjectsOfQuestion($original_id);
323
324 $clone->onCopy($thisObjId, $thisId, $clone->getObjId(), $clone->getId());
325
326 return $clone->id;
327 }
static _getOriginalId(int $question_id)

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

+ Here is the call graph for this function:

◆ correctDataAfterParserUpdate()

assErrorText::correctDataAfterParserUpdate ( )
private

Definition at line 226 of file class.assErrorText.php.

226 : void
227 {
228 if ($this->getErrorText() === '') {
229 return;
230 }
231 $needs_finalizing = false;
232 if ($this->getParsedErrorText() === []) {
233 $needs_finalizing = true;
234 $this->parseErrorText();
235 }
236
237 if (isset($this->errordata[0])
238 && $this->errordata[0]->getPosition() === null) {
239 foreach ($this->errordata as $key => $error) {
240 $this->errordata[$key] = $this->addPositionToErrorAnswer($error);
241 }
243 }
244
245 if ($needs_finalizing) {
248 }
249 }
completeParsedErrorTextFromErrorData()
addPositionToErrorAnswer(assAnswerErrorText $error)
saveAnswerSpecificDataToDb()
Saves the answer specific records into a question types answer table.
saveAdditionalQuestionDataToDb()
Saves the data for the additional data table.

References ILIAS\LTI\ToolProvider\$key, addPositionToErrorAnswer(), completeParsedErrorTextFromErrorData(), getErrorText(), getParsedErrorText(), parseErrorText(), saveAdditionalQuestionDataToDb(), and saveAnswerSpecificDataToDb().

Referenced by loadFromDb().

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

◆ createErrorTextExport()

assErrorText::createErrorTextExport ( array  $selections)

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

740 : string
741 {
742 if (!is_array($selections)) {
743 $selections = [];
744 }
745
746 foreach ($this->getParsedErrorText() as $paragraph) {
747 $array_reduce_function = function ($carry, $k) use ($paragraph, $selections) {
748 $text = $paragraph[$k]['text'];
749 if (in_array($k, $selections)) {
750 $text = self::ERROR_WORD_MARKER . $paragraph[$k]['text'] . self::ERROR_WORD_MARKER;
751 }
752 return $carry . ' ' . $text;
753 };
754 $output_array[] = trim(array_reduce(array_keys($paragraph), $array_reduce_function));
755 }
756 return implode("\n", $output_array);
757 }

Referenced by setExportDetailsXLS().

+ Here is the caller graph for this function:

◆ createNewOriginalFromThisDuplicate()

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

Definition at line 329 of file class.assErrorText.php.

329 : int
330 {
331 if ($this->getId() <= 0) {
332 throw new RuntimeException('The question has not been saved. It cannot be duplicated');
333 }
334
335 $sourceQuestionId = $this->id;
336 $sourceParentId = $this->getObjId();
337
338 // duplicate the question in database
339 $clone = $this;
340 $clone->id = -1;
341
342 $clone->setObjId($targetParentId);
343
344 if ($targetQuestionTitle) {
345 $clone->setTitle($targetQuestionTitle);
346 }
347
348 $clone->saveToDb();
349 // copy question page content
350 $clone->copyPageOfQuestion($sourceQuestionId);
351 // copy XHTML media objects
352 $clone->copyXHTMLMediaObjectsOfQuestion($sourceQuestionId);
353
354 $clone->onCopy($sourceParentId, $sourceQuestionId, $clone->getObjId(), $clone->getId());
355
356 return $clone->id;
357 }

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

+ Here is the call graph for this function:

◆ duplicate()

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

Duplicates the object.

Reimplemented from assQuestion.

Definition at line 254 of file class.assErrorText.php.

254 : int
255 {
256 if ($this->id <= 0) {
257 // The question has not been saved. It cannot be duplicated
258 return -1;
259 }
260 // duplicate the question in database
261 $this_id = $this->getId();
262 $thisObjId = $this->getObjId();
263
264 $clone = $this;
266 $clone->id = -1;
267
268 if ((int) $testObjId > 0) {
269 $clone->setObjId($testObjId);
270 }
271
272 if ($title) {
273 $clone->setTitle($title);
274 }
275
276 if ($author) {
277 $clone->setAuthor($author);
278 }
279 if ($owner) {
280 $clone->setOwner($owner);
281 }
282
283 if ($for_test) {
284 $clone->saveToDb($original_id);
285 } else {
286 $clone->saveToDb();
287 }
288 // copy question page content
289 $clone->copyPageOfQuestion($this_id);
290 // copy XHTML media objects
291 $clone->copyXHTMLMediaObjectsOfQuestion($this_id);
292
293 $clone->onDuplicate($thisObjId, $this_id, $clone->getObjId(), $clone->getId());
294 return $clone->id;
295 }

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:

◆ flushErrorData()

assErrorText::flushErrorData ( )

Definition at line 827 of file class.assErrorText.php.

827 : void
828 {
829 $this->errordata = [];
830 }

◆ fromXML()

assErrorText::fromXML (   $item,
int  $questionpool_id,
?int  $tst_id,
$tst_object,
int &  $question_counter,
array  $import_mapping,
array &  $solutionhints = [] 
)

Receives parameters from a QTI parser and creates a valid ILIAS question object.

Parameters
object$itemThe QTI item object
integer$questionpool_idThe id of the parent questionpool
integer$tst_idThe id of the parent test if the question is part of a test
object$tst_objectA reference to the parent test object
integer$question_counterA reference to a question counter to count the questions of an imported question pool
array$import_mappingAn array containing references to included ILIAS objects

Reimplemented from assQuestion.

Definition at line 507 of file class.assErrorText.php.

507 : array
508 {
509 $import = new assErrorTextImport($this);
510 return $import->fromXML($item, $questionpool_id, $tst_id, $tst_object, $question_counter, $import_mapping);
511 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ generateArrayByPositionFromErrorData()

assErrorText::generateArrayByPositionFromErrorData ( )
private

Definition at line 1117 of file class.assErrorText.php.

1117 : array
1118 {
1119 $array_by_position = [];
1120 foreach ($this->errordata as $error) {
1121 $array_by_position[$error->getPosition()] = [
1122 'length' => $error->getLength(),
1123 'points' => $error->getPoints(),
1124 'text' => $error->getTextWrong(),
1125 'text_correct' => $error->getTextCorrect()
1126 ];
1127 }
1128 ksort($array_by_position);
1129 return $array_by_position;
1130 }

Referenced by addPositionToErrorAnswer().

+ Here is the caller graph for this function:

◆ generateOutputStringFromPosition()

assErrorText::generateOutputStringFromPosition ( int  $position,
array  $selections,
array  $paragraph,
bool  $graphical_output,
bool  $show_correct_solution,
bool  $use_link_tags,
array  $correctness_icons 
)
private

Definition at line 658 of file class.assErrorText.php.

666 : string {
667 $text = $this->getTextForPosition($position, $paragraph, $show_correct_solution);
668 if ($text === '') {
669 return '';
670 }
671 $class = $this->getClassForPosition($position, $show_correct_solution, $selections);
673 $position,
674 $graphical_output,
675 $selections,
676 $correctness_icons
677 );
678
679 return ' ' . $this->getErrorTokenHtml($text, $class, $use_link_tags) . $img;
680 }
getClassForPosition(int $position, bool $show_correct_solution, array $selections)
getTextForPosition(int $position, array $paragraph, bool $show_correct_solution)
getErrorTokenHtml($item, $class, $useLinkTags)
getCorrectnessIconForPosition(int $position, bool $graphical_output, array $selections, array $correctness_icons)
$img
Definition: imgupload.php:83

◆ getAdditionalInformationFromExistingErrorDataByErrorText()

assErrorText::getAdditionalInformationFromExistingErrorDataByErrorText ( array  $current_error_data,
string  $text_wrong 
)
private
Parameters
array<assAnswerErrorText>$current_error_data
Returns
array<mixed>

Definition at line 618 of file class.assErrorText.php.

621 : array {
622 foreach ($current_error_data as $answer_object) {
623 if (strcmp($answer_object->getTextWrong(), $text_wrong) === 0) {
624 return[
625 $answer_object->getTextCorrect(),
626 $answer_object->getPoints()
627 ];
628 }
629 }
630 return ['', 0.0];
631 }

Referenced by setErrorsFromParsedErrorText().

+ Here is the caller graph for this function:

◆ getAdditionalTableName()

assErrorText::getAdditionalTableName ( )
Returns
string|array Or Array?
See also
Deletion methods here

Reimplemented from assQuestion.

Definition at line 474 of file class.assErrorText.php.

474 : string
475 {
476 return 'qpl_qst_errortext';
477 }

Referenced by loadFromDb(), and saveAdditionalQuestionDataToDb().

+ Here is the caller graph for this function:

◆ getAnswersFromRequest()

assErrorText::getAnswersFromRequest ( )
private

Definition at line 460 of file class.assErrorText.php.

460 : array
461 {
462 if (mb_strlen($_POST["qst_" . $this->getId()])) {
463 return explode(',', $_POST["qst_{$this->getId()}"]);
464 }
465
466 return [];
467 }

References assQuestion\getId().

Referenced by savePreviewData(), and saveWorkingData().

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

◆ getAnswerTableName()

assErrorText::getAnswerTableName ( )
Returns
string|array Or Array?
See also
Deletion methods here

Reimplemented from assQuestion.

Definition at line 479 of file class.assErrorText.php.

479 : string
480 {
481 return 'qpl_a_errortext';
482 }

◆ getAvailableAnswerOptions()

assErrorText::getAvailableAnswerOptions (   $index = null)

If index is null, the function returns an array with all anwser options Else it returns the specific answer option.

Parameters
null | int$index

Implements iQuestionCondition.

Definition at line 1099 of file class.assErrorText.php.

1099 : ?int
1100 {
1101 $error_text_array = array_reduce(
1102 $this->parsed_errortext,
1103 fn ($c, $v) => $c + $v
1104 );
1105
1106 if ($index === null) {
1107 return $error_text_array;
1108 }
1109
1110 if (array_key_exists($index, $error_text_array)) {
1111 return $error_text_array[$index];
1112 }
1113
1114 return null;
1115 }
$c
Definition: cli.php:38
$index
Definition: metadata.php:145

References $c, and $index.

◆ getBestSelection()

assErrorText::getBestSelection (   $withPositivePointsOnly = true)

Definition at line 759 of file class.assErrorText.php.

759 : array
760 {
761 $positions_array = $this->generateArrayByPositionFromErrorData();
762 $selections = [];
763 foreach ($positions_array as $position => $position_data) {
764 if ($position === ''
765 || $withPositivePointsOnly && $position_data['points'] < 1) {
766 continue;
767 }
768
769 $selections[] = $position;
770 if ($position_data['length'] > 1) {
771 for ($i = 1;$i < $position_data['length'];$i++) {
772 $selections[] = $position + $i;
773 }
774 }
775 }
776
777 return $selections;
778 }
$i
Definition: metadata.php:41

References $i.

◆ getClassForPosition()

assErrorText::getClassForPosition ( int  $position,
bool  $show_correct_solution,
array  $selections 
)
private

Definition at line 702 of file class.assErrorText.php.

706 : string {
707 if ($show_correct_solution !== true
708 && in_array($position, $selections['user'])) {
709 return 'ilc_qetitem_ErrorTextSelected';
710 }
711
712 if ($show_correct_solution === true
713 && in_array($position, $selections['best'])) {
714 return 'ilc_qetitem_ErrorTextSelected';
715 }
716
717 return 'ilc_qetitem_ErrorTextItem';
718 }

◆ getCorrectnessIconForPosition()

assErrorText::getCorrectnessIconForPosition ( int  $position,
bool  $graphical_output,
array  $selections,
array  $correctness_icons 
)
private

Definition at line 720 of file class.assErrorText.php.

725 : string {
726 if ($graphical_output === true
727 && (in_array($position, $selections['user']) && !in_array($position, $selections['best'])
728 || !in_array($position, $selections['user']) && in_array($position, $selections['best']))) {
729 return $correctness_icons['not_correct'];
730 }
731
732 if ($graphical_output === true
733 && in_array($position, $selections['user']) && in_array($position, $selections['best'])) {
734 return $correctness_icons['correct'];
735 }
736
737 return '';
738 }

◆ getErrorData()

assErrorText::getErrorData ( )
Returns
array<assAnswerErrorText>

Definition at line 836 of file class.assErrorText.php.

836 : array
837 {
838 return $this->errordata;
839 }

Referenced by removeErrorDataWithoutPosition(), and setErrorsFromParsedErrorText().

+ Here is the caller graph for this function:

◆ getErrorDataAsArrayForJS()

assErrorText::getErrorDataAsArrayForJS ( )
private
Returns
array<mixed>

Definition at line 845 of file class.assErrorText.php.

845 : array
846 {
847 $correct_answers = [];
848 foreach ($this->getErrorData() as $index => $answer_obj) {
849 $correct_answers[] = [
850 'answertext_wrong' => $answer_obj->getTextWrong(),
851 'answertext_correct' => $answer_obj->getTextCorrect(),
852 'points' => $answer_obj->getPoints(),
853 'length' => $answer_obj->getLength(),
854 'pos' => $this->getId() . '_' . $answer_obj->getPosition()
855 ];
856 }
857 return $correct_answers;
858 }

References $index, and ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ getErrorText()

assErrorText::getErrorText ( )

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

860 : string
861 {
862 return $this->errortext ?? '';
863 }

Referenced by correctDataAfterParserUpdate(), and saveAdditionalQuestionDataToDb().

+ Here is the caller graph for this function:

◆ getErrorTokenHtml()

assErrorText::getErrorTokenHtml (   $item,
  $class,
  $useLinkTags 
)
private
Parameters
$item
$class
Returns
string

Definition at line 1137 of file class.assErrorText.php.

1137 : string
1138 {
1139 if ($useLinkTags) {
1140 return '<a class="' . $class . '" href="#">' . ($item == '&nbsp;' ? $item : ilLegacyFormElementsUtil::prepareFormOutput(
1141 $item
1142 )) . '</a>';
1143 }
1144
1145 return '<span class="' . $class . '">' . ($item == '&nbsp;' ? $item : ilLegacyFormElementsUtil::prepareFormOutput(
1146 $item
1147 )) . '</span>';
1148 }
static prepareFormOutput($a_str, bool $a_strip=false)

References ilLegacyFormElementsUtil\prepareFormOutput().

+ Here is the call graph for this function:

◆ getExpressionTypes()

◆ getMaximumPoints()

assErrorText::getMaximumPoints ( )

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

See also
$points

Reimplemented from assQuestion.

Definition at line 364 of file class.assErrorText.php.

364 : float
365 {
366 $maxpoints = 0.0;
367 foreach ($this->errordata as $error) {
368 if ($error->getPoints() > 0) {
369 $maxpoints += $error->getPoints();
370 }
371 }
372 return $maxpoints;
373 }

Referenced by isComplete().

+ Here is the caller graph for this function:

◆ getOperators()

assErrorText::getOperators (   $expression)

Get all available operations for a specific question.

Parameters
string$expression

Implements iQuestionCondition.

Definition at line 955 of file class.assErrorText.php.

955 : array
956 {
958 }

References ilOperatorsExpressionMapping\getOperatorsByExpression().

+ Here is the call graph for this function:

◆ getParsedErrorText()

assErrorText::getParsedErrorText ( )

Definition at line 870 of file class.assErrorText.php.

870 : array
871 {
873 }

Referenced by addPositionToErrorAnswer(), completeParsedErrorTextFromErrorData(), correctDataAfterParserUpdate(), saveAdditionalQuestionDataToDb(), and setErrorsFromParsedErrorText().

+ Here is the caller graph for this function:

◆ getParsedErrorTextForJS()

assErrorText::getParsedErrorTextForJS ( )
private

Definition at line 875 of file class.assErrorText.php.

875 : array
876 {
877 $answers = [];
878 foreach ($this->parsed_errortext as $paragraph) {
879 foreach ($paragraph as $position => $word) {
880 $answers[] = [
881 'answertext' => $word['text'],
882 'order' => $this->getId() . '_' . $position
883 ];
884 }
885 $answers[] = [
886 'answertext' => '###'
887 ];
888 }
889 array_pop($answers);
890
891 return $answers;
892 }

References ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ getPointsForSelectedPositions()

assErrorText::getPointsForSelectedPositions ( array  $selected_word_positions)
protected
Parameters
list<string>|null$selected_words Positions of Selected Words Counting from 0

Definition at line 784 of file class.assErrorText.php.

784 : float
785 {
786 $points = 0;
787 $correct_positions = $this->generateArrayByPositionFromErrorData();
788
789 foreach ($correct_positions as $correct_position => $correct_position_data) {
790 $selected_word_key = array_search($correct_position, $selected_word_positions);
791 if ($selected_word_key === false) {
792 continue;
793 }
794
795 if ($correct_position_data['length'] === 1) {
796 $points += $correct_position_data['points'];
797 unset($selected_word_positions[$selected_word_key]);
798 continue;
799 }
800
801 $passage_complete = true;
802 for ($i = 1;$i < $correct_position_data['length'];$i++) {
803 $selected_passage_element_key = array_search($correct_position + $i, $selected_word_positions);
804 if ($selected_passage_element_key === false) {
805 $passage_complete = false;
806 continue;
807 }
808 unset($selected_word_positions[$selected_passage_element_key]);
809 }
810
811 if ($passage_complete) {
812 $points += $correct_position_data['points'];
813 unset($selected_word_positions[$selected_word_key]);
814 }
815 }
816
817 foreach ($selected_word_positions as $word_position) {
818 if (!array_key_exists($word_position, $correct_positions)) {
819 $points += $this->getPointsWrong();
820 continue;
821 }
822 }
823
824 return $points;
825 }

References $i.

Referenced by calculateReachedPoints(), and calculateReachedPointsFromPreviewSession().

+ Here is the caller graph for this function:

◆ getPointsWrong()

assErrorText::getPointsWrong ( )

Definition at line 913 of file class.assErrorText.php.

913 : ?float
914 {
915 return $this->points_wrong;
916 }

Referenced by saveAdditionalQuestionDataToDb().

+ Here is the caller graph for this function:

◆ getQuestionType()

assErrorText::getQuestionType ( )

Returns the question type of the question.

Returns
string The question type of the question

Reimplemented from assQuestion.

Definition at line 469 of file class.assErrorText.php.

469 : string
470 {
471 return 'assErrorText';
472 }

◆ getTextForPosition()

assErrorText::getTextForPosition ( int  $position,
array  $paragraph,
bool  $show_correct_solution 
)
private

Definition at line 682 of file class.assErrorText.php.

686 : string {
687 $v = $paragraph[$position];
688 if ($show_correct_solution === true
689 && ($v['error_type'] === 'in_passage'
690 || $v['error_type'] === 'passage_end')) {
691 return '';
692 }
693 if ($show_correct_solution
694 && ($v['error_type'] === 'passage_start'
695 || $v['error_type'] === 'word')) {
696 return $v['text_correct'] ?? '';
697 }
698
699 return $v['text'];
700 }

◆ getTextSize()

assErrorText::getTextSize ( )

Definition at line 899 of file class.assErrorText.php.

899 : float
900 {
901 return $this->textsize;
902 }

Referenced by saveAdditionalQuestionDataToDb().

+ Here is the caller graph for this function:

◆ getUserQuestionResult()

assErrorText::getUserQuestionResult (   $active_id,
  $pass 
)

Get the user solution for a question by active_id and the test pass.

Parameters
int$active_id
int$pass

Implements iQuestionCondition.

Definition at line 980 of file class.assErrorText.php.

981 {
982 $result = new ilUserQuestionResult($this, $active_id, $pass);
983
984 $data = $this->db->queryF(
985 "SELECT value1+1 as value1 FROM tst_solutions WHERE active_fi = %s AND pass = %s AND question_fi = %s AND step = (
986 SELECT MAX(step) FROM tst_solutions WHERE active_fi = %s AND pass = %s AND question_fi = %s
987 )",
988 ["integer", "integer", "integer","integer", "integer", "integer"],
989 [$active_id, $pass, $this->getId(), $active_id, $pass, $this->getId()]
990 );
991
992 while ($row = $this->db->fetchAssoc($data)) {
993 $result->addKeyValue($row["value1"], $row["value1"]);
994 }
995
996 $points = $this->calculateReachedPoints($active_id, $pass);
997 $max_points = $this->getMaximumPoints();
998
999 $result->setReachedPercentage(($points / $max_points) * 100);
1000
1001 return $result;
1002 }
calculateReachedPoints($active_id, $pass=null, $authorizedSolution=true, $returndetails=false)
Returns the points, a learner has reached answering the question.
getMaximumPoints()
Returns the maximum points, a learner can reach answering the question.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References $data, and ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ isComplete()

assErrorText::isComplete ( )

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

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

Reimplemented from assQuestion.

Definition at line 81 of file class.assErrorText.php.

81 : bool
82 {
83 if (mb_strlen($this->title)
84 && ($this->author)
85 && ($this->question)
86 && ($this->getMaximumPoints() > 0)) {
87 return true;
88 } else {
89 return false;
90 }
91 }

References getMaximumPoints().

+ Here is the call graph for this function:

◆ loadFromDb()

assErrorText::loadFromDb (   $question_id)

Loads the object from the database.

Parameters
object$dbA pear DB object
integer$question_idA unique key which defines the multiple choice test in the database

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

169 : void
170 {
171 $db_question = $this->db->queryF(
172 "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",
173 ["integer"],
174 [$question_id]
175 );
176 if ($db_question->numRows() === 1) {
177 $data = $this->db->fetchAssoc($db_question);
178 $this->setId($question_id);
179 $this->setObjId($data["obj_fi"]);
180 $this->setTitle((string) $data["title"]);
181 $this->setComment((string) $data["description"]);
182 $this->setOriginalId($data["original_id"]);
183 $this->setNrOfTries($data['nr_of_tries']);
184 $this->setAuthor($data["author"]);
185 $this->setPoints($data["points"]);
186 $this->setOwner($data["owner"]);
187 $this->setQuestion(ilRTE::_replaceMediaObjectImageSrc((string) $data["question_text"], 1));
188 $this->setErrorText((string) $data["errortext"]);
189 $this->setParsedErrorText(json_decode($data['parsed_errortext'], true) ?? []);
190 $this->setTextSize($data["textsize"]);
191 $this->setPointsWrong($data["points_wrong"]);
192
193 try {
197 }
198
199 try {
200 $this->setAdditionalContentEditingMode($data['add_cont_edit_mode']);
202 }
203 }
204
205 $db_error_text = $this->db->queryF(
206 "SELECT * FROM qpl_a_errortext WHERE question_fi = %s ORDER BY sequence ASC",
207 ['integer'],
208 [$question_id]
209 );
210 if ($db_error_text->numRows() > 0) {
211 while ($data = $this->db->fetchAssoc($db_error_text)) {
212 $this->errordata[] = new assAnswerErrorText(
213 (string) $data['text_wrong'],
214 (string) $data['text_correct'],
215 (float) $data['points'],
216 $data['position']
217 );
218 }
219 }
220
222
223 parent::loadFromDb($question_id);
224 }
setParsedErrorText(array $parsed_errortext)
setPointsWrong($a_value)
setErrorText(?string $text)
setOriginalId(?int $original_id)
setId(int $id=-1)
setAdditionalContentEditingMode(?string $additionalContentEditingMode)
setQuestion(string $question="")
setAuthor(string $author="")
setComment(string $comment="")
setObjId(int $obj_id=0)
setOwner(int $owner=-1)
setNrOfTries(int $a_nr_of_tries)
setLifecycle(ilAssQuestionLifecycle $lifecycle)
setTitle(string $title="")
setPoints(float $points)
static _replaceMediaObjectImageSrc(string $a_text, int $a_direction=0, string $nic='')
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...

References $data, Vendor\Package\$e, ilRTE\_replaceMediaObjectImageSrc(), correctDataAfterParserUpdate(), getAdditionalTableName(), ilAssQuestionLifecycle\getDraftInstance(), ilAssQuestionLifecycle\getInstance(), assQuestion\setAdditionalContentEditingMode(), assQuestion\setAuthor(), assQuestion\setComment(), setErrorText(), assQuestion\setId(), assQuestion\setLifecycle(), assQuestion\setNrOfTries(), assQuestion\setObjId(), assQuestion\setOriginalId(), assQuestion\setOwner(), setParsedErrorText(), assQuestion\setPoints(), setPointsWrong(), assQuestion\setQuestion(), setTextSize(), and assQuestion\setTitle().

+ Here is the call graph for this function:

◆ logUserAction()

assErrorText::logUserAction ( bool  $user_entered_values,
int  $active_id 
)
private

Definition at line 450 of file class.assErrorText.php.

450 : void
451 {
452 $log_text = $this->lng->txtlng(
453 "assessment",
454 $user_entered_values ? 'log_user_entered_values' : 'log_user_not_entered_values',
456 );
457 assQuestion::logAction($log_text, $active_id, $this->getId());
458 }
static logAction(string $logtext, int $active_id, int $question_id)

References ilObjAssessmentFolder\_getLogLanguage(), assQuestion\getId(), ILIAS\Repository\lng(), and assQuestion\logAction().

Referenced by saveWorkingData().

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

◆ parseErrorText()

assErrorText::parseErrorText ( )

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

1004 : void
1005 {
1006 $text_by_paragraphs = preg_split(self::PARAGRAPH_SPLIT_REGEXP, $this->getErrorText());
1007 $text_array = [];
1008 $offset = 0;
1009 foreach ($text_by_paragraphs as $paragraph) {
1010 $text_array[] = $this->addErrorInformationToTextParagraphArray(
1011 preg_split(self::WORD_SPLIT_REGEXP, trim($paragraph)),
1012 $offset
1013 );
1014 $offset += count(end($text_array));
1015 }
1016 $this->setParsedErrorText($text_array);
1017 }
addErrorInformationToTextParagraphArray(array $paragraph, int $offset)

Referenced by correctDataAfterParserUpdate().

+ Here is the caller graph for this function:

◆ parsePassageEndWord()

assErrorText::parsePassageEndWord ( string  $word)
private

Definition at line 1084 of file class.assErrorText.php.

1084 : string
1085 {
1086 if (mb_substr($word, -2) === self::ERROR_PARAGRAPH_DELIMITERS['end']) {
1087 return mb_substr($word, 0, -2);
1088 }
1089 return mb_substr($word, 0, -3) . mb_substr($word, -1);
1090 }

◆ removeErrorDataWithoutPosition()

assErrorText::removeErrorDataWithoutPosition ( )

Definition at line 603 of file class.assErrorText.php.

603 : void
604 {
605 foreach ($this->getErrorData() as $index => $error) {
606 if ($error->getPosition() === null) {
607 unset($this->errordata[$index]);
608 }
609 }
610 $this->errordata = array_values($this->errordata);
611 }

References $index, and getErrorData().

+ Here is the call graph for this function:

◆ saveAdditionalQuestionDataToDb()

assErrorText::saveAdditionalQuestionDataToDb ( )

Saves the data for the additional data table.

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

Implements ilObjQuestionScoringAdjustable.

Definition at line 142 of file class.assErrorText.php.

143 {
144 $this->db->manipulateF(
145 "DELETE FROM " . $this->getAdditionalTableName() . " WHERE question_fi = %s",
146 ["integer"],
147 [$this->getId()]
148 );
149
150 $this->db->manipulateF(
151 "INSERT INTO " . $this->getAdditionalTableName() . " (question_fi, errortext, parsed_errortext, textsize, points_wrong) VALUES (%s, %s, %s, %s, %s)",
152 ["integer", "text", "text", "float", "float"],
153 [
154 $this->getId(),
155 $this->getErrorText(),
156 json_encode($this->getParsedErrorText()),
157 $this->getTextSize(),
158 $this->getPointsWrong()
159 ]
160 );
161 }

References getAdditionalTableName(), getErrorText(), assQuestion\getId(), getParsedErrorText(), getPointsWrong(), and getTextSize().

Referenced by correctDataAfterParserUpdate(), and saveToDb().

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

◆ saveAnswerSpecificDataToDb()

assErrorText::saveAnswerSpecificDataToDb ( )

Saves the answer specific records into a question types answer table.

Returns
mixed

Implements ilObjAnswerScoringAdjustable.

Definition at line 110 of file class.assErrorText.php.

111 {
112 $this->db->manipulateF(
113 "DELETE FROM qpl_a_errortext WHERE question_fi = %s",
114 ['integer'],
115 [$this->getId()]
116 );
117
118 $sequence = 0;
119 foreach ($this->errordata as $error) {
120 $next_id = $this->db->nextId('qpl_a_errortext');
121 $this->db->manipulateF(
122 "INSERT INTO qpl_a_errortext (answer_id, question_fi, text_wrong, text_correct, points, sequence, position) VALUES (%s, %s, %s, %s, %s, %s, %s)",
123 ['integer', 'integer', 'text', 'text', 'float', 'integer', 'integer'],
124 [
125 $next_id,
126 $this->getId(),
127 $error->getTextWrong(),
128 $error->getTextCorrect(),
129 $error->getPoints(),
130 $sequence++,
131 $error->getPosition()
132 ]
133 );
134 }
135 }

References assQuestion\getId().

Referenced by correctDataAfterParserUpdate(), and saveToDb().

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

◆ savePreviewData()

assErrorText::savePreviewData ( ilAssQuestionPreviewSession  $previewSession)

Reimplemented from assQuestion.

Definition at line 444 of file class.assErrorText.php.

444 : void
445 {
446 $selection = $this->getAnswersFromRequest();
447 $previewSession->setParticipantsSolution($selection);
448 }

References getAnswersFromRequest(), and ilAssQuestionPreviewSession\setParticipantsSolution().

+ Here is the call graph for this function:

◆ saveToDb()

assErrorText::saveToDb (   $original_id = "")

Saves a the object to the database.

Definition at line 97 of file class.assErrorText.php.

97 : void
98 {
99 if ($original_id == '') {
100 $this->saveQuestionDataToDb();
101 } else {
103 }
104
107 parent::saveToDb();
108 }
saveQuestionDataToDb(int $original_id=-1)

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

+ Here is the call graph for this function:

◆ saveWorkingData()

assErrorText::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

Definition at line 420 of file class.assErrorText.php.

420 : bool
421 {
422 if (is_null($pass)) {
423 $pass = ilObjTest::_getPass($active_id);
424 }
425
426 $selected = $this->getAnswersFromRequest();
427 $this->getProcessLocker()->executeUserSolutionUpdateLockOperation(
428 function () use ($selected, $active_id, $pass, $authorized) {
429 $this->removeCurrentSolution($active_id, $pass, $authorized);
430
431 foreach ($selected as $position) {
432 $this->saveCurrentSolution($active_id, $pass, $position, null, $authorized);
433 }
434 }
435 );
436
438 $this->logUserAction($selected !== [], (int) $active_id);
439 }
440
441 return true;
442 }
logUserAction(bool $user_entered_values, int $active_id)
saveCurrentSolution(int $active_id, int $pass, $value1, $value2, bool $authorized=true, $tstamp=0)
removeCurrentSolution(int $active_id, int $pass, bool $authorized=true)
static _getPass($active_id)
Retrieves the actual pass of a given user for a given test.

References ilObjAssessmentFolder\_enabledAssessmentLogging(), ilObjTest\_getPass(), getAnswersFromRequest(), assQuestion\getProcessLocker(), logUserAction(), assQuestion\removeCurrentSolution(), and assQuestion\saveCurrentSolution().

+ Here is the call graph for this function:

◆ setErrorData()

assErrorText::setErrorData ( array  $errors)
Parameters
array<assAnswerErrorText>$errors

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

592 : void
593 {
594 $this->errordata = [];
595
596 foreach ($errors as $error) {
597 $answer = $this->addPositionToErrorAnswer($error);
598 $this->errordata[] = $answer;
599 }
601 }
$errors
Definition: imgupload.php:65

References $errors, addPositionToErrorAnswer(), and completeParsedErrorTextFromErrorData().

+ Here is the call graph for this function:

◆ setErrorsFromParsedErrorText()

assErrorText::setErrorsFromParsedErrorText ( )

Definition at line 519 of file class.assErrorText.php.

519 : void
520 {
521 $current_error_data = $this->getErrorData();
522 $this->errordata = [];
523
524 $has_too_long_errors = false;
525 foreach ($this->getParsedErrorText() as $paragraph) {
526 foreach ($paragraph as $position => $word) {
527 if ($word['error_type'] === 'in_passage'
528 || $word['error_type'] === 'passage_end'
529 || $word['error_type'] === 'none') {
530 continue;
531 }
532
533 $text_wrong = $word['text_wrong'];
534 if (mb_strlen($text_wrong) > self::ERROR_MAX_LENGTH) {
535 $has_too_long_errors = true;
536 continue;
537 }
538
539 list($text_correct, $points) =
540 $this->getAdditionalInformationFromExistingErrorDataByErrorText($current_error_data, $text_wrong);
541 $this->errordata[] = new assAnswerErrorText($text_wrong, $text_correct, $points, $position);
542 }
543 }
544
545 if ($has_too_long_errors) {
546 $this->tpl->setOnScreenMessage(
547 'failure',
548 $this->lng->txt('qst_error_text_too_long')
549 );
550 }
551 }
getAdditionalInformationFromExistingErrorDataByErrorText(array $current_error_data, string $text_wrong)

References assQuestion\$points, getAdditionalInformationFromExistingErrorDataByErrorText(), getErrorData(), getParsedErrorText(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ setErrorText()

assErrorText::setErrorText ( ?string  $text)

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

865 : void
866 {
867 $this->errortext = $text ?? '';
868 }

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setExportDetailsXLS()

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

{}

Reimplemented from assQuestion.

Definition at line 487 of file class.assErrorText.php.

487 : int
488 {
489 parent::setExportDetailsXLS($worksheet, $startrow, $active_id, $pass);
490
491 $i = 0;
492 $selections = [];
493 $solutions = $this->getSolutionValues($active_id, $pass);
494 if (is_array($solutions)) {
495 foreach ($solutions as $solution) {
496 $selections[] = $solution['value1'];
497 }
498 }
499 $errortext = $this->createErrorTextExport($selections);
500 $i++;
501 $worksheet->setCell($startrow + $i, 2, $errortext);
502 $i++;
503
504 return $startrow + $i + 1;
505 }
createErrorTextExport(array $selections)
getSolutionValues($active_id, $pass=null, bool $authorized=true)
Loads solutions of a given user from the database an returns it.
setCell($a_row, $a_col, $a_value, $datatype=null)

References $errortext, $i, createErrorTextExport(), assQuestion\getSolutionValues(), and ilAssExcelFormatHelper\setCell().

+ Here is the call graph for this function:

◆ setParsedErrorText()

assErrorText::setParsedErrorText ( array  $parsed_errortext)

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

894 : void
895 {
896 $this->parsed_errortext = $parsed_errortext;
897 }

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setPointsWrong()

assErrorText::setPointsWrong (   $a_value)

Definition at line 918 of file class.assErrorText.php.

918 : void
919 {
920 $this->points_wrong = $a_value;
921 }

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setTextSize()

assErrorText::setTextSize (   $a_value)

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

904 : void
905 {
906 // in self-assesment-mode value should always be set (and must not be null)
907 if ($a_value === null) {
908 $a_value = 100;
909 }
910 $this->textsize = $a_value;
911 }

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ toJSON()

assErrorText::toJSON ( )

Reimplemented from assQuestion.

Definition at line 923 of file class.assErrorText.php.

923 : string
924 {
925 $result = [];
926 $result['id'] = $this->getId();
927 $result['type'] = (string) $this->getQuestionType();
928 $result['title'] = $this->getTitleForHTMLOutput();
929 $result['question'] = $this->formatSAQuestion($this->getQuestion());
930 $result['text'] = ilRTE::_replaceMediaObjectImageSrc($this->getErrorText(), 0);
931 $result['nr_of_tries'] = $this->getNrOfTries();
932 $result['shuffle'] = $this->getShuffle();
933 $result['feedback'] = [
934 'onenotcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), false)),
935 'allcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), true))
936 ];
937
938 $result['correct_answers'] = $this->getErrorDataAsArrayForJS();
939 $result['answers'] = $this->getParsedErrorTextForJS();
940
941 $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $this->getId());
942 $result['mobs'] = $mobs;
943
944 return json_encode($result);
945 }
getQuestionType()
Returns the question type of the question.
static _getMobsOfObject(string $a_type, int $a_id, int $a_usage_hist_nr=0, string $a_lang="-")
$mobs
Definition: imgupload.php:70

References $mobs, ilObjMediaObject\_getMobsOfObject(), ilRTE\_replaceMediaObjectImageSrc(), and ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ toXML()

assErrorText::toXML (   $a_include_header = true,
  $a_include_binary = true,
  $a_shuffle = false,
  $test_output = false,
  $force_image_references = false 
)

Definition at line 513 of file class.assErrorText.php.

513 : string
514 {
515 $export = new assErrorTextExport($this);
516 return $export->toXML($a_include_header, $a_include_binary, $a_shuffle, $test_output, $force_image_references);
517 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

Field Documentation

◆ $errordata

list< assAnswerErrorText > assErrorText::$errordata = []
protected

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

◆ $errortext

string assErrorText::$errortext = ''
protected

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

Referenced by setExportDetailsXLS().

◆ $parsed_errortext

array assErrorText::$parsed_errortext = []
protected

Definition at line 50 of file class.assErrorText.php.

◆ $points_wrong

float assErrorText::$points_wrong
protected

Definition at line 54 of file class.assErrorText.php.

◆ $textsize

float assErrorText::$textsize
protected

Definition at line 53 of file class.assErrorText.php.

◆ DEFAULT_TEXT_SIZE

const assErrorText::DEFAULT_TEXT_SIZE = 100.0
protected

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

Referenced by __construct().

◆ ERROR_MAX_LENGTH

const assErrorText::ERROR_MAX_LENGTH = 150
protected

Definition at line 38 of file class.assErrorText.php.

◆ ERROR_PARAGRAPH_DELIMITERS

const assErrorText::ERROR_PARAGRAPH_DELIMITERS
protected
Initial value:
= [
'start' => '((',
'end' => '))'
]

Definition at line 44 of file class.assErrorText.php.

◆ ERROR_TYPE_PASSAGE

const assErrorText::ERROR_TYPE_PASSAGE = 2
protected

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

◆ ERROR_TYPE_WORD

const assErrorText::ERROR_TYPE_WORD = 1
protected

Definition at line 35 of file class.assErrorText.php.

◆ ERROR_WORD_MARKER

const assErrorText::ERROR_WORD_MARKER = '#'
protected

Definition at line 43 of file class.assErrorText.php.

◆ FIND_PUNCTUATION_REGEXP

const assErrorText::FIND_PUNCTUATION_REGEXP = '/\p{P}/'
protected

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

◆ PARAGRAPH_SPLIT_REGEXP

const assErrorText::PARAGRAPH_SPLIT_REGEXP = '/[\n\r]+/'
protected

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

◆ WORD_SPLIT_REGEXP

const assErrorText::WORD_SPLIT_REGEXP = '/\s+/'
protected

Definition at line 41 of file class.assErrorText.php.


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