ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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="", int $owner=-1, $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 ()
 
 getAdditionalTableName ()
 
 getAnswerTableName ()
 
 setExportDetailsXLSX (ilAssExcelFormatHelper $worksheet, int $startrow, int $col, int $active_id, int $pass)
 {} More...
 
 fromXML ($item, int $questionpool_id, ?int $tst_id, &$tst_object, int &$question_counter, array $import_mapping, array &$solutionhints=[])
 
 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...
 
 setTitle (string $title="")
 
 setId (int $id=-1)
 
 setTestId (int $id=-1)
 
 setComment (string $comment="")
 
 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 ()
 
 getAuthor ()
 
 getAuthorForHTMLOutput ()
 
 getOwner ()
 
 getObjId ()
 
 setObjId (int $obj_id=0)
 
 getLifecycle ()
 
 setLifecycle (ilAssQuestionLifecycle $lifecycle)
 
 setExternalId (?string $external_id)
 
 getExternalId ()
 
 getSuggestedSolutionOutput ()
 
 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...
 
 getSuggestedSolutionPath ()
 
 getImagePath ($question_id=null, $object_id=null)
 Returns the image path for web accessable images 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...
 
 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 ()
 
 deleteSuggestedSolutions ()
 
 getSuggestedSolution (int $subquestion_index=0)
 
 resolveInternalLink (string $internal_link)
 
 resolveSuggestedSolutionLinks ()
 
 syncWithOriginal ()
 
 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...
 
 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 ()
 
 setExportDetailsXLSX (ilAssExcelFormatHelper $worksheet, int $startrow, int $col, int $active_id, int $pass)
 
 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)
 
 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="", int $owner=-1, $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 ()
 
- Public Member Functions inherited from assQuestionInterface
 validateSolutionSubmit ()
 

Protected Member Functions

 getPointsForSelectedPositions (array $selected_word_positions)
 
- Protected Member Functions inherited from assQuestion
 getQuestionAction ()
 
 isNonEmptyItemListPostSubmission (string $postSubmissionFieldname)
 
 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)
 
 duplicateComments (int $parent_source_id, int $source_id, int $parent_target_id, int $target_id)
 
 deleteComments ()
 
 getNotesManager ()
 
 getNotesDataService ()
 
 getNotesRepo ()
 
 syncSuggestedSolutions (int $target_question_id, int $target_obj_id)
 
 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)
 
 copySuggestedSolutions (int $target_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...
 
 getSuggestedSolutionsRepo ()
 
 loadSuggestedSolutions ()
 

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
 
const string $errortext = ''
 
array $parsed_errortext = []
 
array $errordata = []
 
float $textsize
 
float $points_wrong
 
- Protected Attributes inherited from assQuestion
const HAS_SPECIFIC_FEEDBACK = true
 
ILIAS TestQuestionPool QuestionInfoService $questioninfo
 
ILIAS Test TestParticipantInfoService $testParticipantInfo
 
ILIAS HTTP Services $http
 
ILIAS Refinery Factory $refinery
 
ILIAS TestQuestionPool QuestionFilesService $questionFilesService
 
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
 
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
 
SkillUsageService $skillUsageService
 
assQuestionSuggestedSolutionsDatabaseRepository $suggestedsolution_repo = null
 

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 _getSuggestedSolutionOutput (int $question_id)
 
static _getReachedPoints (int $active_id, int $question_id, int $pass)
 
static logAction (string $logtext, int $active_id, int $question_id)
 
static isFileAvailable (string $file)
 
static saveOriginalId (int $questionId, int $originalId)
 
static resetOriginalId (int $questionId)
 
static _getInternalLinkHref (string $target="")
 
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 _setReachedPoints (int $active_id, int $question_id, float $points, float $maxpoints, int $pass, bool $manualscoring, bool $obligationsEnabled, ?int $test_id=null)
 Sets the points, a learner has reached answering the question Additionally objective results are updated. More...
 
static _needsManualScoring (int $question_id)
 
static getFeedbackClassNameByQuestionType (string $questionType)
 
static instantiateQuestionGUI (int $a_question_id)
 
static _questionExistsInTest (int $question_id, int $test_id)
 
static lookupParentObjId (int $questionId)
 
static isObligationPossible (int $questionId)
 
static implodeKeyValues (array $keyValues)
 
static explodeKeyValues (string $keyValues)
 
static convertISO8601FormatH_i_s_ExtendedToSeconds (string $time)
 
static extendedTrim (string $value)
 Trim non-printable characters from the beginning and end of a string. More...
 
- Data Fields inherited from assQuestion
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 $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.

References assQuestion\$author, assQuestion\$comment, assQuestion\$owner, assQuestion\$question, assQuestion\$title, and ILIAS\MetaData\Repository\Validation\Data\__construct().

71  {
73  $this->textsize = self::DEFAULT_TEXT_SIZE;
74  }
__construct(VocabulariesInterface $vocabularies)
string $question
The question text.
+ 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 1026 of file class.assErrorText.php.

References getPointsWrong(), and parsePassageEndWord().

Referenced by parseErrorText().

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

◆ addPositionToErrorAnswer()

assErrorText::addPositionToErrorAnswer ( assAnswerErrorText  $error)
private

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

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

Referenced by correctDataAfterParserUpdate(), and setErrorData().

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

◆ 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 635 of file class.assErrorText.php.

References generateOutputStringFromPosition(), and getParsedErrorText().

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

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

public

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

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

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

Referenced by getUserQuestionResult().

388  : float
389  {
390  if ($returndetails) {
391  throw new ilTestException('return details not implemented for ' . __METHOD__);
392  }
393 
394  /* First get the positions which were selected by the user. */
395  $positions = [];
396  if (is_null($pass)) {
397  $pass = $this->getSolutionMaxPass($active_id);
398  }
399  $result = $this->getCurrentSolutionResultSet($active_id, $pass, $authorizedSolution);
400 
401  while ($row = $this->db->fetchAssoc($result)) {
402  $positions[] = $row['value1'];
403  }
404  $points = $this->getPointsForSelectedPositions($positions);
405  return $points;
406  }
getPointsForSelectedPositions(array $selected_word_positions)
float $points
The maximum available points for the question.
Base Exception for all Exceptions relating to Modules/Test.
getSolutionMaxPass(int $active_id)
getCurrentSolutionResultSet(int $active_id, int $pass, bool $authorized=true)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calculateReachedPointsFromPreviewSession()

assErrorText::calculateReachedPointsFromPreviewSession ( ilAssQuestionPreviewSession  $preview_session)

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

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

409  {
410  $reached_points = $this->getPointsForSelectedPositions($preview_session->getParticipantsSolution() ?? []);
411  $reached_points = $this->deductHintPointsFromReachedPoints($preview_session, $reached_points);
412  return $this->ensureNonNegativePoints($reached_points);
413  }
getPointsForSelectedPositions(array $selected_word_positions)
ensureNonNegativePoints($points)
deductHintPointsFromReachedPoints(ilAssQuestionPreviewSession $previewSession, $reachedPoints)
+ Here is the call graph for this function:

◆ completeParsedErrorTextFromErrorData()

assErrorText::completeParsedErrorTextFromErrorData ( )
private

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

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

Referenced by correctDataAfterParserUpdate(), and setErrorData().

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

◆ copyObject()

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

Copies an object.

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

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

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

◆ correctDataAfterParserUpdate()

assErrorText::correctDataAfterParserUpdate ( )
private

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

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

Referenced by loadFromDb().

227  : void
228  {
229  if ($this->getErrorText() === '') {
230  return;
231  }
232  $needs_finalizing = false;
233  if ($this->getParsedErrorText() === []) {
234  $needs_finalizing = true;
235  $this->parseErrorText();
236  }
237 
238  if (isset($this->errordata[0])
239  && $this->errordata[0]->getPosition() === null) {
240  foreach ($this->errordata as $key => $error) {
241  $this->errordata[$key] = $this->addPositionToErrorAnswer($error);
242  }
244  }
245 
246  if ($needs_finalizing) {
249  }
250  }
saveAnswerSpecificDataToDb()
Saves the answer specific records into a question types answer table.
string $key
Consumer key/client ID value.
Definition: System.php:193
addPositionToErrorAnswer(assAnswerErrorText $error)
saveAdditionalQuestionDataToDb()
Saves the data for the additional data table.
completeParsedErrorTextFromErrorData()
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createErrorTextExport()

assErrorText::createErrorTextExport ( array  $selections)

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

References getParsedErrorText().

Referenced by setExportDetailsXLSX().

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

◆ createNewOriginalFromThisDuplicate()

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

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

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

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

◆ duplicate()

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

Duplicates the object.

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

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

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

◆ flushErrorData()

assErrorText::flushErrorData ( )

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

829  : void
830  {
831  $this->errordata = [];
832  }

◆ fromXML()

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

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

510  : array
511  {
512  $import = new assErrorTextImport($this);
513  return $import->fromXML($item, $questionpool_id, $tst_id, $tst_object, $question_counter, $import_mapping);
514  }
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 1118 of file class.assErrorText.php.

Referenced by addPositionToErrorAnswer(), getBestSelection(), and getPointsForSelectedPositions().

1118  : array
1119  {
1120  $array_by_position = [];
1121  foreach ($this->errordata as $error) {
1122  $array_by_position[$error->getPosition()] = [
1123  'length' => $error->getLength(),
1124  'points' => $error->getPoints(),
1125  'text' => $error->getTextWrong(),
1126  'text_correct' => $error->getTextCorrect()
1127  ];
1128  }
1129  ksort($array_by_position);
1130  return $array_by_position;
1131  }
+ 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 660 of file class.assErrorText.php.

References getClassForPosition(), getCorrectnessIconForPosition(), getErrorTokenHtml(), and getTextForPosition().

Referenced by assembleErrorTextOutput().

668  : string {
669  $text = $this->getTextForPosition($position, $paragraph, $show_correct_solution);
670  if ($text === '') {
671  return '';
672  }
673  $class = $this->getClassForPosition($position, $show_correct_solution, $selections);
674  $img = $this->getCorrectnessIconForPosition(
675  $position,
676  $graphical_output,
677  $selections,
678  $correctness_icons
679  );
680 
681  return ' ' . $this->getErrorTokenHtml($text, $class, $use_link_tags) . $img;
682  }
getClassForPosition(int $position, bool $show_correct_solution, array $selections)
getTextForPosition(int $position, array $paragraph, bool $show_correct_solution)
getCorrectnessIconForPosition(int $position, bool $graphical_output, array $selections, array $correctness_icons)
getErrorTokenHtml($item, $class, $useLinkTags)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAdditionalInformationFromExistingErrorDataByErrorText()

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

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

Referenced by setErrorsFromParsedErrorText().

623  : array {
624  foreach ($current_error_data as $answer_object) {
625  if (strcmp($answer_object->getTextWrong(), $text_wrong) === 0) {
626  return[
627  $answer_object->getTextCorrect(),
628  $answer_object->getPoints()
629  ];
630  }
631  }
632  return ['', 0.0];
633  }
+ Here is the caller graph for this function:

◆ getAdditionalTableName()

assErrorText::getAdditionalTableName ( )

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

Referenced by loadFromDb(), and saveAdditionalQuestionDataToDb().

477  : string
478  {
479  return 'qpl_qst_errortext';
480  }
+ Here is the caller graph for this function:

◆ getAnswersFromRequest()

assErrorText::getAnswersFromRequest ( )
private

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

References assQuestion\getId().

Referenced by savePreviewData(), and saveWorkingData().

463  : array
464  {
465  if (mb_strlen($_POST["qst_" . $this->getId()])) {
466  return explode(',', $_POST["qst_{$this->getId()}"]);
467  }
468 
469  return [];
470  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAnswerTableName()

assErrorText::getAnswerTableName ( )

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

482  : string
483  {
484  return 'qpl_a_errortext';
485  }

◆ 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 1100 of file class.assErrorText.php.

References Vendor\Package\$c.

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

◆ getBestSelection()

assErrorText::getBestSelection (   $withPositivePointsOnly = true)

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

References generateArrayByPositionFromErrorData().

761  : array
762  {
763  $positions_array = $this->generateArrayByPositionFromErrorData();
764  $selections = [];
765  foreach ($positions_array as $position => $position_data) {
766  if ($position === ''
767  || $withPositivePointsOnly && $position_data['points'] <= 0) {
768  continue;
769  }
770 
771  $selections[] = $position;
772  if ($position_data['length'] > 1) {
773  for ($i = 1;$i < $position_data['length'];$i++) {
774  $selections[] = $position + $i;
775  }
776  }
777  }
778 
779  return $selections;
780  }
+ Here is the call graph for this function:

◆ getClassForPosition()

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

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

Referenced by generateOutputStringFromPosition().

708  : string {
709  if ($show_correct_solution !== true
710  && in_array($position, $selections['user'])) {
711  return 'ilc_qetitem_ErrorTextSelected';
712  }
713 
714  if ($show_correct_solution === true
715  && in_array($position, $selections['best'])) {
716  return 'ilc_qetitem_ErrorTextSelected';
717  }
718 
719  return 'ilc_qetitem_ErrorTextItem';
720  }
+ Here is the caller graph for this function:

◆ getCorrectnessIconForPosition()

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

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

Referenced by generateOutputStringFromPosition().

727  : string {
728  if ($graphical_output === true
729  && (in_array($position, $selections['user']) && !in_array($position, $selections['best'])
730  || !in_array($position, $selections['user']) && in_array($position, $selections['best']))) {
731  return $correctness_icons['not_correct'];
732  }
733 
734  if ($graphical_output === true
735  && in_array($position, $selections['user']) && in_array($position, $selections['best'])) {
736  return $correctness_icons['correct'];
737  }
738 
739  return '';
740  }
+ Here is the caller graph for this function:

◆ getErrorData()

assErrorText::getErrorData ( )
Returns
array<assAnswerErrorText>

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

References $errordata.

Referenced by getErrorDataAsArrayForJS(), removeErrorDataWithoutPosition(), and setErrorsFromParsedErrorText().

838  : array
839  {
840  return $this->errordata;
841  }
+ Here is the caller graph for this function:

◆ getErrorDataAsArrayForJS()

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

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

References getErrorData(), and assQuestion\getId().

Referenced by toJSON().

847  : array
848  {
849  $correct_answers = [];
850  foreach ($this->getErrorData() as $index => $answer_obj) {
851  $correct_answers[] = [
852  'answertext_wrong' => $answer_obj->getTextWrong(),
853  'answertext_correct' => $answer_obj->getTextCorrect(),
854  'points' => $answer_obj->getPoints(),
855  'length' => $answer_obj->getLength(),
856  'pos' => $this->getId() . '_' . $answer_obj->getPosition()
857  ];
858  }
859  return $correct_answers;
860  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getErrorText()

assErrorText::getErrorText ( )

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

Referenced by correctDataAfterParserUpdate(), parseErrorText(), saveAdditionalQuestionDataToDb(), and toJSON().

862  : string
863  {
864  return $this->errortext ?? '';
865  }
+ Here is the caller graph for this function:

◆ getErrorTokenHtml()

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

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

References ilLegacyFormElementsUtil\prepareFormOutput().

Referenced by generateOutputStringFromPosition().

1138  : string
1139  {
1140  if ($useLinkTags) {
1141  return '<a class="' . $class . '" href="#">' . ($item == '&nbsp;' ? $item : ilLegacyFormElementsUtil::prepareFormOutput(
1142  $item
1143  )) . '</a>';
1144  }
1145 
1146  return '<span class="' . $class . '">' . ($item == '&nbsp;' ? $item : ilLegacyFormElementsUtil::prepareFormOutput(
1147  $item
1148  )) . '</span>';
1149  }
static prepareFormOutput($a_str, bool $a_strip=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getExpressionTypes()

◆ getMaximumPoints()

assErrorText::getMaximumPoints ( )

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

See also
$points

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

Referenced by getUserQuestionResult(), and isComplete().

367  : float
368  {
369  $maxpoints = 0.0;
370  foreach ($this->errordata as $error) {
371  if ($error->getPoints() > 0) {
372  $maxpoints += $error->getPoints();
373  }
374  }
375  return $maxpoints;
376  }
+ 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 957 of file class.assErrorText.php.

References ilOperatorsExpressionMapping\getOperatorsByExpression().

957  : array
958  {
960  }
+ Here is the call graph for this function:

◆ getParsedErrorText()

assErrorText::getParsedErrorText ( )

◆ getParsedErrorTextForJS()

assErrorText::getParsedErrorTextForJS ( )
private

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

References assQuestion\getId().

Referenced by toJSON().

877  : array
878  {
879  $answers = [];
880  foreach ($this->parsed_errortext as $paragraph) {
881  foreach ($paragraph as $position => $word) {
882  $answers[] = [
883  'answertext' => $word['text'],
884  'order' => $this->getId() . '_' . $position
885  ];
886  }
887  $answers[] = [
888  'answertext' => '###'
889  ];
890  }
891  array_pop($answers);
892 
893  return $answers;
894  }
+ Here is the call graph for this function:
+ Here is the caller 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 786 of file class.assErrorText.php.

References assQuestion\$points, generateArrayByPositionFromErrorData(), and getPointsWrong().

Referenced by calculateReachedPoints(), and calculateReachedPointsFromPreviewSession().

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

◆ getPointsWrong()

assErrorText::getPointsWrong ( )

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

References $points_wrong.

Referenced by addErrorInformationToTextParagraphArray(), getPointsForSelectedPositions(), and saveAdditionalQuestionDataToDb().

915  : ?float
916  {
917  return $this->points_wrong;
918  }
+ Here is the caller graph for this function:

◆ getQuestionType()

assErrorText::getQuestionType ( )

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

Referenced by toJSON().

472  : string
473  {
474  return 'assErrorText';
475  }
+ Here is the caller graph for this function:

◆ getTextForPosition()

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

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

Referenced by generateOutputStringFromPosition().

688  : string {
689  $v = $paragraph[$position];
690  if ($show_correct_solution === true
691  && ($v['error_type'] === 'in_passage'
692  || $v['error_type'] === 'passage_end')) {
693  return '';
694  }
695  if ($show_correct_solution
696  && ($v['error_type'] === 'passage_start'
697  || $v['error_type'] === 'word')) {
698  return $v['text_correct'] ?? '';
699  }
700 
701  return $v['text'];
702  }
+ Here is the caller graph for this function:

◆ getTextSize()

assErrorText::getTextSize ( )

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

References $textsize.

Referenced by saveAdditionalQuestionDataToDb().

901  : float
902  {
903  return $this->textsize;
904  }
+ 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 982 of file class.assErrorText.php.

References $data, assQuestion\$points, calculateReachedPoints(), assQuestion\getId(), and getMaximumPoints().

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

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

References getMaximumPoints().

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  }
getMaximumPoints()
Returns the maximum points, a learner can reach answering the question.
+ 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.

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

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'] ?? json_encode([]), 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']);
201  } catch (ilTestQuestionPoolException $e) {
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 
211  if ($db_error_text->numRows() > 0) {
212  while ($data = $this->db->fetchAssoc($db_error_text)) {
213  $this->errordata[] = new assAnswerErrorText(
214  (string) $data['text_wrong'],
215  (string) $data['text_correct'],
216  (float) $data['points'],
217  $data['position']
218  );
219  }
220  }
221 
223 
224  parent::loadFromDb($question_id);
225  }
static _replaceMediaObjectImageSrc(string $a_text, int $a_direction=0, string $nic='')
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
setNrOfTries(int $a_nr_of_tries)
setOwner(int $owner=-1)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setComment(string $comment="")
setPointsWrong($a_value)
setErrorText(?string $text)
setPoints(float $points)
setObjId(int $obj_id=0)
setId(int $id=-1)
setOriginalId(?int $original_id)
setTitle(string $title="")
setLifecycle(ilAssQuestionLifecycle $lifecycle)
setAuthor(string $author="")
setParsedErrorText(array $parsed_errortext)
setAdditionalContentEditingMode(?string $additionalContentEditingMode)
setQuestion(string $question="")
+ Here is the call graph for this function:

◆ logUserAction()

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

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

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

Referenced by saveWorkingData().

453  : void
454  {
455  $log_text = $this->lng->txtlng(
456  "assessment",
457  $user_entered_values ? 'log_user_entered_values' : 'log_user_not_entered_values',
459  );
460  assQuestion::logAction($log_text, $active_id, $this->getId());
461  }
static logAction(string $logtext, int $active_id, int $question_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseErrorText()

assErrorText::parseErrorText ( )

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

References addErrorInformationToTextParagraphArray(), getErrorText(), and setParsedErrorText().

Referenced by correctDataAfterParserUpdate().

1006  : void
1007  {
1008  $text_by_paragraphs = preg_split(self::PARAGRAPH_SPLIT_REGEXP, $this->getErrorText());
1009  $text_array = [];
1010  $offset = 0;
1011  foreach ($text_by_paragraphs as $paragraph) {
1012  $text_array[] = $this->addErrorInformationToTextParagraphArray(
1013  preg_split(self::WORD_SPLIT_REGEXP, trim($paragraph)),
1014  $offset
1015  );
1016  $offset += count(end($text_array));
1017  }
1018  $this->setParsedErrorText($text_array);
1019  }
addErrorInformationToTextParagraphArray(array $paragraph, int $offset)
setParsedErrorText(array $parsed_errortext)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parsePassageEndWord()

assErrorText::parsePassageEndWord ( string  $word)
private

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

Referenced by addErrorInformationToTextParagraphArray().

1085  : string
1086  {
1087  if (mb_substr($word, -2) === self::ERROR_PARAGRAPH_DELIMITERS['end']) {
1088  return mb_substr($word, 0, -2);
1089  }
1090  return mb_substr($word, 0, -3) . mb_substr($word, -1);
1091  }
+ Here is the caller graph for this function:

◆ removeErrorDataWithoutPosition()

assErrorText::removeErrorDataWithoutPosition ( )

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

References getErrorData().

605  : void
606  {
607  foreach ($this->getErrorData() as $index => $error) {
608  if ($error->getPosition() === null) {
609  unset($this->errordata[$index]);
610  }
611  }
612  $this->errordata = array_values($this->errordata);
613  }
+ 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.

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

Referenced by correctDataAfterParserUpdate(), and saveToDb().

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  }
+ 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.

References assQuestion\getId().

Referenced by correctDataAfterParserUpdate(), and saveToDb().

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  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ savePreviewData()

assErrorText::savePreviewData ( ilAssQuestionPreviewSession  $previewSession)

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

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

447  : void
448  {
449  $selection = $this->getAnswersFromRequest();
450  $previewSession->setParticipantsSolution($selection);
451  }
+ 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.

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

97  : void
98  {
99  if ($original_id == '') {
100  $this->saveQuestionDataToDb();
101  } else {
103  }
104 
107  parent::saveToDb();
108  }
saveAnswerSpecificDataToDb()
Saves the answer specific records into a question types answer table.
saveQuestionDataToDb(int $original_id=-1)
saveAdditionalQuestionDataToDb()
Saves the data for the additional data table.
+ 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.

public

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

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

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

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

◆ setErrorData()

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

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

References addPositionToErrorAnswer(), and completeParsedErrorTextFromErrorData().

594  : void
595  {
596  $this->errordata = [];
597 
598  foreach ($errors as $error) {
599  $answer = $this->addPositionToErrorAnswer($error);
600  $this->errordata[] = $answer;
601  }
603  }
addPositionToErrorAnswer(assAnswerErrorText $error)
completeParsedErrorTextFromErrorData()
+ Here is the call graph for this function:

◆ setErrorsFromParsedErrorText()

assErrorText::setErrorsFromParsedErrorText ( )

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

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

522  : void
523  {
524  $current_error_data = $this->getErrorData();
525  $this->errordata = [];
526 
527  $has_too_long_errors = false;
528  foreach ($this->getParsedErrorText() as $paragraph) {
529  foreach ($paragraph as $position => $word) {
530  if ($word['error_type'] === 'in_passage'
531  || $word['error_type'] === 'passage_end'
532  || $word['error_type'] === 'none') {
533  continue;
534  }
535 
536  $text_wrong = $word['text_wrong'];
537  if (mb_strlen($text_wrong) > self::ERROR_MAX_LENGTH) {
538  $has_too_long_errors = true;
539  continue;
540  }
541 
542  list($text_correct, $points) =
543  $this->getAdditionalInformationFromExistingErrorDataByErrorText($current_error_data, $text_wrong);
544  $this->errordata[] = new assAnswerErrorText($text_wrong, $text_correct, $points, $position);
545  }
546  }
547 
548  if ($has_too_long_errors) {
549  $this->tpl->setOnScreenMessage(
550  'failure',
551  $this->lng->txt('qst_error_text_too_long')
552  );
553  }
554  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
float $points
The maximum available points for the question.
getAdditionalInformationFromExistingErrorDataByErrorText(array $current_error_data, string $text_wrong)
+ Here is the call graph for this function:

◆ setErrorText()

assErrorText::setErrorText ( ?string  $text)

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

Referenced by loadFromDb().

867  : void
868  {
869  $this->errortext = $text ?? '';
870  }
+ Here is the caller graph for this function:

◆ setExportDetailsXLSX()

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

{}

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

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

490  : int
491  {
492  parent::setExportDetailsXLSX($worksheet, $startrow, $col, $active_id, $pass);
493 
494  $i = 0;
495  $selections = [];
496  $solutions = $this->getSolutionValues($active_id, $pass);
497  if (is_array($solutions)) {
498  foreach ($solutions as $solution) {
499  $selections[] = $solution['value1'];
500  }
501  }
502  $errortext = $this->createErrorTextExport($selections);
503  $i++;
504  $worksheet->setCell($startrow + $i, $col + 2, $errortext);
505  $i++;
506 
507  return $startrow + $i + 1;
508  }
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)
createErrorTextExport(array $selections)
const string $errortext
+ Here is the call graph for this function:

◆ setParsedErrorText()

assErrorText::setParsedErrorText ( array  $parsed_errortext)

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

References $parsed_errortext.

Referenced by loadFromDb(), and parseErrorText().

896  : void
897  {
898  $this->parsed_errortext = $parsed_errortext;
899  }
+ Here is the caller graph for this function:

◆ setPointsWrong()

assErrorText::setPointsWrong (   $a_value)

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

Referenced by loadFromDb().

920  : void
921  {
922  $this->points_wrong = $a_value;
923  }
+ Here is the caller graph for this function:

◆ setTextSize()

assErrorText::setTextSize (   $a_value)

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

Referenced by loadFromDb().

906  : void
907  {
908  // in self-assesment-mode value should always be set (and must not be null)
909  if ($a_value === null) {
910  $a_value = 100;
911  }
912  $this->textsize = $a_value;
913  }
+ Here is the caller graph for this function:

◆ toJSON()

assErrorText::toJSON ( )

Implements ilAssQuestionLMExportable.

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

References ilObjMediaObject\_getMobsOfObject(), ilRTE\_replaceMediaObjectImageSrc(), assQuestion\formatSAQuestion(), getErrorDataAsArrayForJS(), getErrorText(), assQuestion\getId(), assQuestion\getNrOfTries(), getParsedErrorTextForJS(), assQuestion\getQuestion(), getQuestionType(), assQuestion\getShuffle(), and assQuestion\getTitleForHTMLOutput().

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

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

Field Documentation

◆ $errordata

array assErrorText::$errordata = []
protected

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

Referenced by getErrorData().

◆ $errortext

const string assErrorText::$errortext = ''
protected

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

◆ $parsed_errortext

array assErrorText::$parsed_errortext = []
protected

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

Referenced by getParsedErrorText(), and setParsedErrorText().

◆ $points_wrong

float assErrorText::$points_wrong
protected

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

Referenced by getPointsWrong().

◆ $textsize

float assErrorText::$textsize
protected

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

Referenced by getTextSize().

◆ DEFAULT_TEXT_SIZE

const assErrorText::DEFAULT_TEXT_SIZE = 100.0
protected

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

◆ 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' => '(('

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: