ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
assErrorText Class Reference

Class for error text questions. 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 ()
 
 saveAdditionalQuestionDataToDb ()
 Saves the data for the additional data table. More...
 
 loadFromDb ($question_id)
 Loads the object from the database. More...
 
 duplicate ($for_test=true, $title="", $author="", $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, $returndetails=FALSE)
 Returns the points, a learner has reached answering the question. More...
 
 toggleSelection ($position, $active_id, $pass=null)
 Change the selection during a test when a user selects/deselects a word without using javascript. More...
 
 saveWorkingData ($active_id, $pass=NULL)
 Saves the learners input of the question to the database. More...
 
 getQuestionType ()
 Returns the question type of the question. More...
 
 getAdditionalTableName ()
 Returns the name of the additional question data table in the database. More...
 
 getAnswerTableName ()
 Returns the name of the answer table in the database. More...
 
 getRTETextWithMediaObjects ()
 Collects all text in the question which could contain media objects which were created with the Rich Text Editor. More...
 
 setExportDetailsXLS (&$worksheet, $startrow, $active_id, $pass, &$format_title, &$format_bold)
 Creates an Excel worksheet for the detailed cumulated results of this question. More...
 
 fromXML (&$item, &$questionpool_id, &$tst_id, &$tst_object, &$question_counter, &$import_mapping)
 Creates a question from a QTI file. More...
 
 toXML ($a_include_header=true, $a_include_binary=true, $a_shuffle=false, $test_output=false, $force_image_references=false)
 Returns a QTI xml representation of the question and sets the internal domxml variable with the DOM XML representation of the QTI xml representation. More...
 
 getBestSolution ($active_id, $pass)
 Returns the best solution for a given pass of a participant. More...
 
 getErrorsFromText ($a_text="")
 
 setErrorData ($a_data)
 
 createErrorTextOutput ($selections=null, $graphicalOutput=false, $correct_solution=false)
 
 createErrorTextExport ($selections=null)
 
 getBestSelection ($withPositivePointsOnly=true)
 
 flushErrorData ()
 Flush error data. More...
 
 addErrorData ($text_wrong, $text_correct, $points)
 
 getErrorData ()
 Get error data. More...
 
 getErrorText ()
 Get error text. More...
 
 setErrorText ($a_value)
 Set error text. More...
 
 getTextSize ()
 Set text size in percent. More...
 
 setTextSize ($a_value)
 Set text size in percent. More...
 
 getPointsWrong ()
 Get wrong points. More...
 
 setPointsWrong ($a_value)
 Set wrong points. More...
 
 __get ($value)
 Object getter. More...
 
 __set ($key, $value)
 Object setter. More...
 
 toJSON ()
 Returns a JSON representation of the question. More...
 
- Public Member Functions inherited from assQuestion
 __construct ( $title="", $comment="", $author="", $owner=-1, $question="")
 assQuestion constructor More...
 
 setProcessLocker ($processLocker)
 
 getProcessLocker ()
 
 fromXML (&$item, &$questionpool_id, &$tst_id, &$tst_object, &$question_counter, &$import_mapping)
 Receives parameters from a QTI parser and creates a valid ILIAS question object. More...
 
 toXML ($a_include_header=true, $a_include_binary=true, $a_shuffle=false, $test_output=false, $force_image_references=false)
 Returns a QTI xml representation of the question. More...
 
 isComplete ()
 Returns true, if a question is complete for use. More...
 
 questionTitleExists ($questionpool_id, $title)
 Returns TRUE if the question title exists in the database. More...
 
 setTitle ($title="")
 Sets the title string of the assQuestion object. More...
 
 setId ($id=-1)
 Sets the id of the assQuestion object. More...
 
 setTestId ($id=-1)
 Sets the test id of the assQuestion object. More...
 
 setComment ($comment="")
 Sets the comment string of the assQuestion object. More...
 
 setOutputType ($outputType=OUTPUT_HTML)
 Sets the output type. More...
 
 setShuffle ($shuffle=true)
 Sets the shuffle flag. More...
 
 setEstimatedWorkingTime ($hour=0, $min=0, $sec=0)
 Sets the estimated working time of a question. More...
 
 keyInArray ($searchkey, $array)
 returns TRUE if the key occurs in an array More...
 
 setAuthor ($author="")
 Sets the authors name of the assQuestion object. More...
 
 setOwner ($owner="")
 Sets the creator/owner ID of the assQuestion object. More...
 
 getTitle ()
 Gets the title string of the assQuestion object. More...
 
 getId ()
 Gets the id of the assQuestion object. More...
 
 getShuffle ()
 Gets the shuffle flag. More...
 
 getTestId ()
 Gets the test id of the assQuestion object. More...
 
 getComment ()
 Gets the comment string of the assQuestion object. More...
 
 getOutputType ()
 Gets the output type. More...
 
 supportsJavascriptOutput ()
 Returns true if the question type supports JavaScript output. More...
 
 supportsNonJsOutput ()
 
 requiresJsSwitch ()
 
 getEstimatedWorkingTime ()
 Gets the estimated working time of a question. More...
 
 getAuthor ()
 Gets the authors name of the assQuestion object. More...
 
 getOwner ()
 Gets the creator/owner ID of the assQuestion object. More...
 
 getObjId ()
 Get the object id of the container object. More...
 
 setObjId ($obj_id=0)
 Set the object id of the container object. More...
 
 setExternalId ($external_id)
 
 getExternalId ()
 
 _getMaximumPoints ($question_id)
 Returns the maximum points, a learner can reach answering the question. More...
 
_getQuestionInfo ($question_id)
 Returns question information from the database. More...
 
 getSuggestedSolutionOutput ()
 
_getSuggestedSolution ($question_id, $subquestion_index=0)
 Returns a suggested solution for a given subquestion index. More...
 
 getSuggestedSolutions ()
 Return the suggested solutions. More...
 
 _getReachedPoints ($active_id, $question_id, $pass=NULL)
 Returns the points, a learner has reached answering the question. More...
 
 getReachedPoints ($active_id, $pass=NULL)
 Returns the points, a learner has reached answering the question This is the fast way to get the points directly from the database. More...
 
 getMaximumPoints ()
 Returns the maximum points, a learner can reach answering the question. More...
 
 getAdjustedReachedPoints ($active_id, $pass=NULL)
 returns the reached points ... More...
 
 calculateResultsFromSolution ($active_id, $pass=NULL, $obligationsEnabled=false)
 Calculates the question results from a previously saved question solution. More...
 
 persistWorkingState ($active_id, $pass=NULL, $obligationsEnabled=false)
 persists the working state for current testactive and testpass More...
 
 saveWorkingData ($active_id, $pass=NULL)
 Saves the learners input of the question to the database. More...
 
 _updateTestResultCache ($active_id, ilAssQuestionProcessLocker $processLocker=null)
 Move this to a proper place. More...
 
 logAction ($logtext="", $active_id="", $question_id="")
 Logs an action into the Test&Assessment log. More...
 
 _logAction ($logtext="", $active_id="", $question_id="")
 Logs an action into the Test&Assessment log. More...
 
 moveUploadedMediaFile ($file, $name)
 Move an uploaded media file to an public accessible temp dir to present it. More...
 
 getSuggestedSolutionPath ()
 Returns the path for a suggested solution. More...
 
 getJavaPath ()
 Returns the image path for web accessable images of a question. More...
 
 getImagePath ($question_id=null, $object_id=null)
 Returns the image path for web accessable images of a question. More...
 
 getFlashPath ()
 Returns the image path for web accessable flash files of a question. More...
 
 getJavaPathWeb ()
 Returns the web image path for web accessable java applets of a question. More...
 
 getSuggestedSolutionPathWeb ()
 Returns the web path for a suggested solution. More...
 
 getImagePathWeb ()
 Returns the web image path for web accessable images of a question. More...
 
 getFlashPathWeb ()
 Returns the web image path for web accessable flash applications of a question. More...
 
getSolutionValues ($active_id, $pass=NULL)
 Loads solutions of a given user from the database an returns it. More...
 
 isInUse ($question_id="")
 Checks whether the question is in use or not. More...
 
 isClone ($question_id="")
 Checks whether the question is a clone of another question or not. More...
 
 pcArrayShuffle ($array)
 Shuffles the values of a given array. More...
 
 getQuestionTypeFromDb ($question_id)
 get question type for question id More...
 
 getAdditionalTableName ()
 Returns the name of the additional question data table in the database. More...
 
 getAnswerTableName ()
 Returns the name of the answer table in the database. More...
 
 deleteAnswers ($question_id)
 Deletes datasets from answers tables. More...
 
 deleteAdditionalTableData ($question_id)
 Deletes datasets from the additional question table in the database. More...
 
 delete ($question_id)
 Deletes a question and all materials from the database. More...
 
 getTotalAnswers ()
 get total number of answers More...
 
 _getTotalAnswers ($a_q_id)
 get number of answers for question id (static) note: do not use $this inside this method More...
 
 _getTotalRightAnswers ($a_q_id)
 get number of answers for question id (static) note: do not use $this inside this method More...
 
 _getTitle ($a_q_id)
 Returns the title of a question. More...
 
 _getQuestionText ($a_q_id)
 Returns question text. More...
 
 copyXHTMLMediaObjectsOfQuestion ($a_q_id)
 
 syncXHTMLMediaObjectsOfQuestion ()
 
 createPageObject ()
 create page object of question More...
 
 copyPageOfQuestion ($a_q_id)
 
 getPageOfQuestion ()
 
 _getQuestionType ($question_id)
 Returns the question type of a question with a given id. More...
 
 _getQuestionTitle ($question_id)
 Returns the question title of a question with a given id. More...
 
 setOriginalId ($original_id)
 
 getOriginalId ()
 
 loadFromDb ($question_id)
 Loads the question from the database. More...
 
 createNewQuestion ($a_create_page=true)
 Creates a new question without an owner when a new question is created This assures that an ID is given to the question if a file upload or something else occurs. More...
 
 saveQuestionDataToDb ($original_id="")
 
 saveToDb ($original_id="")
 Saves the question to the database. More...
 
 setNewOriginalId ($newId)
 
 deleteSuggestedSolutions ()
 Deletes all suggestes solutions in the database. More...
 
 getSuggestedSolution ($subquestion_index=0)
 Returns a suggested solution for a given subquestion index. More...
 
 getSuggestedSolutionTitle ($subquestion_index=0)
 Returns the title of a suggested solution at a given subquestion_index. More...
 
 setSuggestedSolution ($solution_id="", $subquestion_index=0, $is_import=false)
 Sets a suggested solution for the question. More...
 
 _resolveInternalLink ($internal_link)
 
 _resolveIntLinks ($question_id)
 
 _getInternalLinkHref ($target="")
 
 syncWithOriginal ()
 
 createRandomSolution ($test_id, $user_id)
 
 _questionExists ($question_id)
 Returns true if the question already exists in the database. More...
 
 _questionExistsInPool ($question_id)
 Returns true if the question already exists in the database and is assigned to a question pool. More...
 
 getPoints ()
 Returns the maximum available points for the question. More...
 
 setPoints ($a_points)
 Sets the maximum available points for the question. More...
 
 getSolutionMaxPass ($active_id)
 Returns the maximum pass a users question solution. More...
 
 _getSolutionMaxPass ($question_id, $active_id)
 Returns the maximum pass a users question solution. More...
 
 _isWriteable ($question_id, $user_id)
 Returns true if the question is writeable by a certain user. More...
 
 _isUsedInRandomTest ($question_id="")
 Checks whether the question is used in a random test or not. More...
 
 calculateReachedPoints ($active_id, $pass=NULL, $returndetails=FALSE)
 Returns the points, a learner has reached answering the question. More...
 
 adjustReachedPointsByScoringOptions ($points, $active_id, $pass=NULL)
 Adjust the given reached points by checks for all special scoring options in the test container. More...
 
 isHTML ($a_text)
 Checks if a given string contains HTML or not. More...
 
 prepareTextareaOutput ($txt_output, $prepare_for_latex_output=FALSE)
 Prepares a string for a text area output in tests. More...
 
 QTIMaterialToString ($a_material)
 Reads an QTI material tag an creates a text string. More...
 
 addQTIMaterial (&$a_xml_writer, $a_material, $close_material_tag=TRUE, $add_mobs=TRUE)
 Creates a QTI material tag from a plain text or xhtml text. More...
 
 createNewImageFileName ($image_filename)
 
 _setReachedPoints ($active_id, $question_id, $points, $maxpoints, $pass, $manualscoring, $obligationsEnabled)
 Sets the points, a learner has reached answering the question Additionally objective results are updated. More...
 
 getQuestion ()
 Gets the question string of the question object. More...
 
 setQuestion ($question="")
 Sets the question string of the question object. More...
 
 getQuestionType ()
 Returns the question type of the question. More...
 
 getQuestionTypeID ()
 Returns the question type of the question. More...
 
 getRTETextWithMediaObjects ()
 Collects all text in the question which could contain media objects which were created with the Rich Text Editor. More...
 
 cleanupMediaObjectUsage ()
 synchronises appearances of media objects in the question with media object usage table More...
 
getInstances ()
 Gets all instances of the question. More...
 
 _needsManualScoring ($question_id)
 
 getActiveUserData ($active_id)
 Returns the user id and the test id for a given active id. More...
 
 setExportDetailsXLS (&$worksheet, $startrow, $active_id, $pass, &$format_title, &$format_bold)
 Creates an Excel worksheet for the detailed cumulated results of this question. More...
 
 __get ($value)
 Object getter. More...
 
 __set ($key, $value)
 Object setter. More...
 
 getNrOfTries ()
 
 setNrOfTries ($a_nr_of_tries)
 
 setExportImagePath ($a_path)
 
 _questionExistsInTest ($question_id, $test_id)
 
 formatSAQuestion ($a_q)
 Format self assessment question. More...
 
 setPreventRteUsage ($a_val)
 Set prevent rte usage. More...
 
 getPreventRteUsage ()
 Get prevent rte usage. More...
 
 setSelfAssessmentEditingMode ($a_selfassessmenteditingmode)
 Set Self-Assessment Editing Mode. More...
 
 getSelfAssessmentEditingMode ()
 Get Self-Assessment Editing Mode. More...
 
 setDefaultNrOfTries ($a_defaultnroftries)
 Set Default Nr of Tries. More...
 
 getDefaultNrOfTries ()
 Get Default Nr of Tries. More...
 
 isAnswered ($active_id, $pass=null)
 returns boolean wether the question is answered during test pass or not More...
 
 setObligationsToBeConsidered ($obligationsToBeConsidered=true)
 sets the flag wether obligations are to be considered or not More...
 
 areObligationsToBeConsidered ()
 gets the flag wether obligations are to be considered or not More...
 
 isAutosaveable ()
 
 getAdditionalContentEditingMode ()
 getter for additional content editing mode for this question More...
 
 setAdditionalContentEditingMode ($additinalContentEditingMode)
 setter for additional content editing mode for this question More...
 
 isAdditionalContentEditingModePageObject ()
 isser for additional "pageobject" content editing mode More...
 
 isValidAdditionalContentEditingMode ($additionalContentEditingMode)
 returns the fact wether the passed additional content mode is valid or not More...
 
 getValidAdditionalContentEditingModes ()
 getter for valid additional content editing modes More...
 
 addQuestionChangeListener (ilQuestionChangeListener $listener)
 
 getQuestionChangeListeners ()
 
 getHtmlUserSolutionPurifier ()
 
 duplicate ($for_test=true, $title="", $author="", $owner="", $testObjId=null)
 

Protected Member Functions

 reworkWorkingData ($active_id, $pass, $obligationsAnswered)
 Reworks the allready saved working data if neccessary. More...
 
 isTokenSelected ($counter, array $selection)
 
 getPointsForSelectedPositions ($positions)
 
- Protected Member Functions inherited from assQuestion
 reworkWorkingData ($active_id, $pass, $obligationsAnswered)
 Reworks the allready saved working data if neccessary. More...
 
 deletePageOfQuestion ($question_id)
 Deletes the page object of a question with a given ID. More...
 
 onDuplicate ($originalParentId, $originalQuestionId, $duplicateParentId, $duplicateQuestionId)
 Will be called when a question is duplicated (inside a question pool or for insertion in a test) More...
 
 onSyncWithOriginal ($originalQuestionId, $duplicateQuestionId)
 
 onCopy ($sourceParentId, $sourceQuestionId, $targetParentId, $targetQuestionId)
 Will be called when a question is copied (into another question pool) More...
 
 duplicateSuggestedSolutionFiles ($parent_id, $question_id)
 Duplicates the files of a suggested solution if the question is duplicated. More...
 
 syncSuggestedSolutionFiles ($original_id)
 Syncs the files of a suggested solution if the question is synced. More...
 
 copySuggestedSolutionFiles ($source_questionpool_id, $source_question_id)
 
 duplicateQuestionHints ($originalQuestionId, $duplicateQuestionId)
 

Protected Attributes

 $errortext
 
 $textsize
 
 $errordata
 
 $points_wrong
 
- Protected Attributes inherited from assQuestion
 $id
 
 $title
 
 $comment
 
 $owner
 
 $author
 
 $question
 
 $points
 
 $est_working_time
 
 $shuffle
 
 $test_id
 
 $obj_id
 
 $ilias
 
 $tpl
 
 $lng
 
 $outputType
 
 $suggested_solutions
 
 $original_id
 
 $page
 
 $external_id = ''
 
 $questionChangeListeners = array()
 
 $processLocker
 

Additional Inherited Members

- Static Public Member Functions inherited from assQuestion
static _getSuggestedSolutionCount ($question_id)
 Returns the number of suggested solutions associated with a question. More...
 
static _getSuggestedSolutionOutput ($question_id)
 Returns the output of the suggested solution. More...
 
static _getOriginalId ($question_id)
 Returns the original id of a question. More...
 
static originalQuestionExists ($questionId)
 
static _instanciateQuestion ($question_id)
 Creates an instance of a question with a given question id. More...
 
static _instantiateQuestion ($question_id)
 
static _isWorkedThrough ($active_id, $question_id, $pass=NULL)
 Returns true if the question was worked through in the given pass Worked through means that the user entered at least one value. More...
 
static _areAnswered ($a_user_id, $a_question_ids)
 Checks if an array of question ids is answered by an user or not. More...
 
static _includeClass ($question_type, $gui=0)
 Include the php class file for a given question type. More...
 
static getGuiClassNameByQuestionType ($questionType)
 
static getObjectClassNameByQuestionType ($questionType)
 
static getFeedbackClassNameByQuestionType ($questionType)
 
static isCoreQuestionType ($questionType)
 
static includeCoreClass ($questionType, $withGuiClass)
 
static includePluginClass ($questionType, $withGuiClass)
 
static _getQuestionTypeName ($type_tag)
 Return the translation for a given question type tag. More...
 
static & _instanciateQuestionGUI ($question_id)
 Creates an instance of a question gui with a given question id. More...
 
static instantiateQuestionGUI ($a_question_id)
 Creates an instance of a question gui with a given question id. More...
 
static lookupParentObjId ($questionId)
 ilDB $ilDB More...
 
static lookupOriginalParentObjId ($originalQuestionId)
 returns the parent object id for given original question id (should be a qpl id, but theoretically it can be a tst id, too) More...
 
static isObligationPossible ($questionId)
 returns boolean wether it is possible to set this question type as obligatory or not considering the current question configuration More...
 
- Data Fields inherited from assQuestion
const ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT = 'default'
 constant for additional content editing mode "default" More...
 
const ADDITIONAL_CONTENT_EDITING_MODE_PAGE_OBJECT = 'pageobject'
 constant for additional content editing mode "pageobject" More...
 
 $feedbackOBJ = null
 
 $prevent_rte_usage = false
 
 $selfassessmenteditingmode = false
 
 $defaultnroftries = false
 
- Static Protected Member Functions inherited from assQuestion
static doesSolutionRecordsExist ($activeId, $pass, $questionId)
 checks wether there are existing solution records for the given test active / pass and given question id More...
 

Detailed Description

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 21 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.
Returns

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

References assQuestion\$author, assQuestion\$comment, assQuestion\$owner, assQuestion\$question, and assQuestion\$title.

46  {
47  parent::__construct($title, $comment, $author, $owner, $question);
48  $this->errortext = '';
49  $this->textsize = 100.0;
50  $this->errordata = array();
51  }

Member Function Documentation

◆ __get()

assErrorText::__get (   $value)

Object getter.

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

References getErrorText(), getPointsWrong(), and getTextSize().

1204  {
1205  switch ($value)
1206  {
1207  case "errortext":
1208  return $this->getErrorText();
1209  break;
1210  case "textsize":
1211  return $this->getTextSize();
1212  break;
1213  case "points_wrong":
1214  return $this->getPointsWrong();
1215  break;
1216  default:
1217  return parent::__get($value);
1218  break;
1219  }
1220  }
getErrorText()
Get error text.
getTextSize()
Set text size in percent.
getPointsWrong()
Get wrong points.
+ Here is the call graph for this function:

◆ __set()

assErrorText::__set (   $key,
  $value 
)

Object setter.

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

References setErrorText(), setPointsWrong(), and setTextSize().

1226  {
1227  switch ($key)
1228  {
1229  case "errortext":
1230  $this->setErrorText($value);
1231  break;
1232  case "textsize":
1233  $this->setTextSize($value);
1234  break;
1235  case "points_wrong":
1236  $this->setPointsWrong($value);
1237  break;
1238  default:
1239  parent::__set($key, $value);
1240  break;
1241  }
1242  }
setTextSize($a_value)
Set text size in percent.
setErrorText($a_value)
Set error text.
setPointsWrong($a_value)
Set wrong points.
+ Here is the call graph for this function:

◆ addErrorData()

assErrorText::addErrorData (   $text_wrong,
  $text_correct,
  $points 
)

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

References assQuestion\$points.

1120  {
1121  include_once "./Modules/TestQuestionPool/classes/class.assAnswerErrorText.php";
1122  array_push($this->errordata, new assAnswerErrorText($text_wrong, $text_correct, $points));
1123  }
Class for error text answers.

◆ calculateReachedPoints()

assErrorText::calculateReachedPoints (   $active_id,
  $pass = NULL,
  $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 345 of file class.assErrorText.php.

References $pass, assQuestion\$points, $result, $row, assQuestion\getId(), getPointsForSelectedPositions(), and assQuestion\getSolutionMaxPass().

Referenced by toggleSelection().

346  {
347  if( $returndetails )
348  {
349  throw new ilTestException('return details not implemented for '.__METHOD__);
350  }
351 
352  global $ilDB;
353 
354  /* First get the positions which were selected by the user. */
355  $positions = array();
356  if (is_null($pass)) {
357  $pass = $this->getSolutionMaxPass($active_id);
358  }
359  $result = $ilDB->queryF( "SELECT value1 FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
360  array('integer','integer','integer'),
361  array($active_id, $this->getId(), $pass) );
362 
363  while ($row = $ilDB->fetchAssoc($result)) {
364  array_push($positions, $row['value1']);
365  }
366  $points = $this->getPointsForSelectedPositions($positions);
367  return $points;
368  }
getId()
Gets the id of the assQuestion object.
$result
getSolutionMaxPass($active_id)
Returns the maximum pass a users question solution.
Base Exception for all Exceptions relating to Modules/Test.
getPointsForSelectedPositions($positions)
+ 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 252 of file class.assErrorText.php.

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

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

◆ createErrorTextExport()

assErrorText::createErrorTextExport (   $selections = null)

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

References getErrorText(), and ilUtil\prepareFormOutput().

Referenced by setExportDetailsXLS().

881  {
882  $counter = 0;
883  $errorcounter = 0;
884  include_once "./Services/Utilities/classes/class.ilStr.php";
885  if (!is_array($selections)) $selections = array();
886  $textarray = preg_split("/[\n\r]+/", $this->getErrorText());
887  foreach ($textarray as $textidx => $text)
888  {
889  $items = preg_split("/\s+/", $text);
890  foreach ($items as $idx => $item)
891  {
892  if (($posHash = strpos($item, '#')) === 0
893  || ($posOpeningBrackets = strpos($item, '((')) === 0
894  || ($posClosingBrackets = strpos($item, '))')) !== false) {
895  /* (Word|Passage)-Marking delimiter found. */
896 
897  if ($posHash !== false)
898  $item = ilStr::substr($item, 1, ilStr::strlen($item) - 1);
899  elseif ($posOpeningBrackets !== false) {
900  $item = ilStr::substr($item, 2, ilStr::strlen($item) - 2);
901 
902  /* Sometimes a closing bracket group needs
903  to be removed as well. */
904  if (strpos($item, '))') !== false)
905  $item = ilStr::substr($item, 0, ilStr::strlen($item) - 2);
906  }
907  else{
908  $appendComma = "";
909  if ($item{$posClosingBrackets+2} == ',')
910  $appendComma = ",";
911 
912  $item = ilStr::substr($item, 0, $posClosingBrackets) . $appendComma;
913  }
914  }
915 
916  $word = "";
917  if (in_array($counter, $selections))
918  {
919  $word .= '#';
920  }
921  $word .= ilUtil::prepareFormOutput($item);
922  if (in_array($counter, $selections))
923  {
924  $word .= '#';
925  }
926  $items[$idx] = $word;
927  $counter++;
928  }
929  $textarray[$textidx] = join($items, " ");
930  }
931  return join($textarray, "\n");
932  }
getErrorText()
Get error text.
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createErrorTextOutput()

assErrorText::createErrorTextOutput (   $selections = null,
  $graphicalOutput = false,
  $correct_solution = false 
)

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

References $img, getErrorText(), ilUtil\getImagePath(), getPointsForSelectedPositions(), isTokenSelected(), and ilUtil\prepareFormOutput().

670  {
671  $counter = 0;
672  $errorcounter = 0;
673  include_once "./Services/Utilities/classes/class.ilStr.php";
674  if (!is_array($selections)) $selections = array();
675  $textarray = preg_split("/[\n\r]+/", $this->getErrorText());
676 
677  foreach ($textarray as $textidx => $text)
678  {
679  $in_passage = false;
680  $passage_end = false;
681  $items = preg_split("/\s+/", $text);
682  foreach ($items as $idx => $item)
683  {
684  $img = '';
685 
686  if(
687  ($posHash = strpos($item, '#')) === 0 ||
688  ($posOpeningBrackets = strpos($item, '((')) === 0 ||
689  ($posClosingBrackets = strpos($item, '))')) !== false
690  )
691  {
692  /* (Word|Passage)-Marking delimiter found. */
693 
694  if($posHash !== false)
695  {
696  $item = ilStr::substr($item, 1, ilStr::strlen($item) - 1);
697  $passage_end = false;
698  }
699  else if($posOpeningBrackets !== false)
700  {
701  $in_passage = true;
702  $passage_start_idx = $counter;
703  $items_in_passage = array();
704  $passage_end = false;
705  $item = ilStr::substr($item, 2, ilStr::strlen($item) - 2);
706 
707  /* Sometimes a closing bracket group needs
708  to be removed as well. */
709  if(strpos($item, '))') !== false)
710  {
711  $item = str_replace("))", "", $item);
712  $passage_end = true;
713  }
714  }
715  else
716  {
717  $passage_end = true;
718  $item = str_replace("))", "", $item);
719  }
720 
721  if($correct_solution && !$in_passage)
722  {
723  $errorobject = $this->errordata[$errorcounter];
724  if (is_object($errorobject) )
725  {
726  $item = strlen($errorobject->text_correct) ? $errorobject->text_correct : '&nbsp;';
727  }
728  $errorcounter++;
729  }
730  }
731 
732  if($in_passage && !$passage_end)
733  {
734  $items_in_passage[$idx] = $item;
735  $items[$idx] = '';
736  $counter++;
737  continue;
738  }
739 
740  if($in_passage && $passage_end)
741  {
742  $in_passage = false;
743  $passage_end = false;
744  if($correct_solution)
745  {
746  $class = '';
747  if($this->isTokenSelected($counter, $selections))
748  {
749  $class = "sel";
750  }
751 
752  $errorobject = $this->errordata[$errorcounter];
753  if (is_object($errorobject) )
754  {
755  $item = strlen($errorobject->text_correct) ? $errorobject->text_correct : '&nbsp;';
756  }
757  $errorcounter++;
758  $items[$idx] = '<a class="' . $class . '" href="#HREF' . $idx . '" onclick="javascript: return false;">' . ($item == '&nbsp;' ? $item : ilUtil::prepareFormOutput($item)) . '</a>' . $img;
759  $counter++;
760  continue;
761  }
762 
763  $group_selected = true;
764  if($graphicalOutput)
765  {
766  $start_idx = $passage_start_idx;
767  foreach($items_in_passage as $tmp_idx => $tmp_item)
768  {
769  if(!$this->isTokenSelected($start_idx, $selections))
770  {
771  $group_selected = false;
772  break;
773  }
774 
775  ++$start_idx;
776  }
777  if($group_selected)
778  {
779  if(!$this->isTokenSelected($counter, $selections))
780  {
781  $group_selected = false;
782  }
783  }
784  }
785 
786  $item_stack = array();
787  $start_idx = $passage_start_idx;
788  foreach($items_in_passage as $tmp_idx => $tmp_item)
789  {
790  $class = '';
791  if($this->isTokenSelected($start_idx, $selections))
792  {
793  $class = "sel";
794  }
795  $item_stack[] = '<a class="' . $class . '" href="#HREF' . $tmp_idx . '" onclick="javascript: return false;">' . ilUtil::prepareFormOutput($tmp_item) . '</a>' . $img;
796  $start_idx++;
797  }
798  $class = '';
799  if($this->isTokenSelected($counter, $selections))
800  {
801  $class = "sel";
802  }
803  if($graphicalOutput)
804  {
805  if ($group_selected)
806  {
807  $img = ' <img src="' . ilUtil::getImagePath("icon_ok.png") . '" alt="' . $this->lng->txt("answer_is_right") . '" title="' . $this->lng->txt("answer_is_right") . '" /> ';
808  }
809  else
810  {
811  $img = ' <img src="' . ilUtil::getImagePath("icon_not_ok.png") . '" alt="' . $this->lng->txt("answer_is_wrong") . '" title="' . $this->lng->txt("answer_is_wrong") . '" /> ';
812  }
813  }
814 
815  $item_stack[] = '<a class="' . $class . '" href="#HREF' . $idx . '" onclick="javascript: return false;">' . ($item == '&nbsp;' ? $item : ilUtil::prepareFormOutput($item)) . '</a>' . $img;
816  $item_stack = trim(implode(" ", $item_stack));
817  $item_stack = strlen($item_stack) ? $item_stack : '&nbsp;';
818 
819  if($graphicalOutput)
820  {
821  $items[$idx] = '<span class="selGroup">'.$item_stack.'</span>';
822  }
823  else
824  {
825  $items[$idx] = $item_stack;
826  }
827 
828  $counter++;
829  continue;
830  }
831 
832  // Errors markes with #, group errors (()) are handled above
833  $class = '';
834  $img = '';
835  if($this->isTokenSelected($counter, $selections))
836  {
837  $class = "sel";
838  if($graphicalOutput)
839  {
840  if ($this->getPointsForSelectedPositions(array($counter)) >= 0)
841  {
842  $img = ' <img src="' . ilUtil::getImagePath("icon_ok.png") . '" alt="' . $this->lng->txt("answer_is_right") . '" title="' . $this->lng->txt("answer_is_right") . '" /> ';
843  }
844  else
845  {
846  $img = ' <img src="' . ilUtil::getImagePath("icon_not_ok.png") . '" alt="' . $this->lng->txt("answer_is_wrong") . '" title="' . $this->lng->txt("answer_is_wrong") . '" /> ';
847  }
848  }
849  }
850 
851  $items[$idx] = '<a class="' . $class . '" href="#HREF' . $idx . '" onclick="javascript: return false;">' . ($item == '&nbsp;' ? $item : ilUtil::prepareFormOutput($item)) . '</a>' . $img;
852  $counter++;
853  }
854  $textarray[$textidx] = '<p>' . implode(" ", $items) . '</p>';
855  }
856 
857  return implode("\n", $textarray);
858  }
getErrorText()
Get error text.
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
isTokenSelected($counter, array $selection)
getPointsForSelectedPositions($positions)
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
+ Here is the call graph for this function:

◆ createNewOriginalFromThisDuplicate()

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

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

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

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

◆ duplicate()

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

Duplicates the object.

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

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

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

◆ flushErrorData()

assErrorText::flushErrorData ( )

Flush error data.

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

1115  {
1116  $this->errordata = array();
1117  }

◆ fromXML()

assErrorText::fromXML ( $item,
$questionpool_id,
$tst_id,
$tst_object,
$question_counter,
$import_mapping 
)

Creates a question from a QTI file.

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

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

579  {
580  include_once "./Modules/TestQuestionPool/classes/import/qti12/class.assErrorTextImport.php";
581  $import = new assErrorTextImport($this);
582  $import->fromXML($item, $questionpool_id, $tst_id, $tst_object, $question_counter, $import_mapping);
583  }
Class for error text question imports.

◆ getAdditionalTableName()

assErrorText::getAdditionalTableName ( )

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

Returns
string The additional table name

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

Referenced by loadFromDb(), and saveAdditionalQuestionDataToDb().

506  {
507  return "qpl_qst_errortext";
508  }
+ Here is the caller graph for this function:

◆ getAnswerTableName()

assErrorText::getAnswerTableName ( )

Returns the name of the answer table in the database.

Returns
string The answer table name

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

516  {
517  return "qpl_a_errortext";
518  }

◆ getBestSelection()

assErrorText::getBestSelection (   $withPositivePointsOnly = true)

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

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

935  {
936  $passages = array();
937  $words = array();
938  $counter = 0;
939  $errorcounter = 0;
940  $textarray = preg_split("/[\n\r]+/", $this->getErrorText());
941  foreach ($textarray as $textidx => $text)
942  {
943  $items = preg_split("/\s+/", $text);
944  $inPassage = false;
945  foreach ($items as $word)
946  {
947  $points = $this->getPointsWrong();
948  $isErrorItem = false;
949  if (strpos($word, '#') === 0)
950  {
951  /* Word selection detected */
952  $errorobject = $this->errordata[$errorcounter];
953  if (is_object($errorobject))
954  {
955  $points = $errorobject->points;
956  $isErrorItem = true;
957  }
958  $errorcounter++;
959  }
960  elseif (($posOpeningBracket = strpos($word, '((')) === 0
961  || ($posClosingBracket = strpos($word, '))')) !== false
962  || $inPassage)
963  {
964  /* Passage selection detected */
965 
966  if ($posOpeningBracket !== false)
967  {
968  $passages[] = array('begin_pos' => $counter, 'cnt_words' => 0);
969  $inPassage = true;
970  }
971  elseif ($posClosingBracket !== false)
972  {
973  $inPassage = false;
974  $cur_pidx = count($passages) - 1;
975  $passages[$cur_pidx]['end_pos'] = $counter;
976 
977  $errorobject = $this->errordata[$errorcounter];
978  if (is_object($errorobject))
979  {
980  $passages[$cur_pidx]['score'] = $errorobject->points;
981  $passages[$cur_pidx]['isError'] = true;
982  }
983 
984  $errorcounter++;
985  }
986 
987  $cur_pidx = count($passages) - 1;
988  $passages[$cur_pidx]['cnt_words']++;
989  $points = 0;
990  }
991 
992  $words[$counter] = array("word" => $word, "points" => $points, "isError" => $isErrorItem);
993  $counter++;
994  }
995  }
996 
997  $selections = array();
998  foreach ($passages as $cnt => $pdata)
999  {
1000  if (!$withPositivePointsOnly && $pdata['isError'] || $withPositivePointsOnly && $pdata['score'] > 0)
1001  {
1002  $indexes = range($pdata['begin_pos'], $pdata['end_pos']);
1003  $selections[$pdata['begin_pos']] = $indexes;
1004  }
1005  }
1006 
1007  foreach ($words as $idx => $word)
1008  {
1009  if (!$withPositivePointsOnly && $word['isError'] || $withPositivePointsOnly && $word['points'] > 0)
1010  {
1011  $selections[$idx] = array($idx);
1012  }
1013  }
1014 
1015  ksort($selections);
1016 
1017  $selections = array_values($selections);
1018 
1019  return $selections;
1020  }
getErrorText()
Get error text.
getPointsWrong()
Get wrong points.
+ Here is the call graph for this function:

◆ getBestSolution()

assErrorText::getBestSolution (   $active_id,
  $pass 
)

Returns the best solution for a given pass of a participant.

Returns
array An associated array containing the best solution

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

604  {
605  $user_solution = array();
606  return $user_solution;
607  }

◆ getErrorData()

assErrorText::getErrorData ( )

Get error data.

Returns
array Error data

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

References $errordata.

Referenced by toJSON().

1131  {
1132  return $this->errordata;
1133  }
+ Here is the caller graph for this function:

◆ getErrorsFromText()

assErrorText::getErrorsFromText (   $a_text = "")

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

References getErrorText().

610  {
611  if (strlen($a_text) == 0)
612  $a_text = $this->getErrorText();
613 
614  /* Workaround to allow '(' and ')' in passages.
615  The beginning- and ending- Passage delimiters are
616  replaced by a ~ (Tilde) symbol. */
617  $a_text = str_replace(array("((", "))"), array("~", "~"), $a_text);
618 
619  /* Match either Passage delimited by double brackets
620  or single words marked with a hash (#). */
621  $r_passage = "/(~([^~]+)~|#([^\s]+))/";
622 
623  preg_match_all($r_passage, $a_text, $matches);
624 
625  if (is_array($matches[0]) && !empty($matches[0])) {
626  /* At least one match. */
627 
628  /* We need only groups 2 and 3, respectively representing
629  passage matches and single word matches. */
630  $matches = array_intersect_key($matches, array(2 => '', 3 => ''));
631 
632  /* Remove empty values. */
633  $matches[2] = array_diff($matches[2], array(''));
634  $matches[3] = array_diff($matches[3], array(''));
635 
636  return array(
637  "passages" => $matches[2],
638  "words" => $matches[3],);
639  }
640 
641  return array();
642  }
getErrorText()
Get error text.
+ Here is the call graph for this function:

◆ getErrorText()

assErrorText::getErrorText ( )

Get error text.

Returns
string Error text

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

References $errortext.

Referenced by __get(), createErrorTextExport(), createErrorTextOutput(), getBestSelection(), getErrorsFromText(), getPointsForSelectedPositions(), saveAdditionalQuestionDataToDb(), and toJSON().

1141  {
1142  return $this->errortext;
1143  }
+ Here is the caller graph for this function:

◆ getMaximumPoints()

assErrorText::getMaximumPoints ( )

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

See also
$points

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

Referenced by isComplete().

326  {
327  $maxpoints = 0.0;
328  foreach ($this->errordata as $object)
329  {
330  if ($object->points > 0) $maxpoints += $object->points;
331  }
332  return $maxpoints;
333  }
+ Here is the caller graph for this function:

◆ getPointsForSelectedPositions()

assErrorText::getPointsForSelectedPositions (   $positions)
protected

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

References assQuestion\$points, $total, getErrorText(), and getPointsWrong().

Referenced by calculateReachedPoints(), and createErrorTextOutput().

1023  {
1024  $passages = array();
1025  $words = array();
1026  $counter = 0;
1027  $errorcounter = 0;
1028  $textarray = preg_split("/[\n\r]+/", $this->getErrorText());
1029  foreach ($textarray as $textidx => $text)
1030  {
1031  $items = preg_split("/\s+/", $text);
1032  $inPassage = false;
1033  foreach ($items as $word)
1034  {
1035  $points = $this->getPointsWrong();
1036  if (strpos($word, '#') === 0)
1037  {
1038  /* Word selection detected */
1039  $errorobject = $this->errordata[$errorcounter];
1040  if (is_object($errorobject))
1041  {
1042  $points = $errorobject->points;
1043  }
1044  $errorcounter++;
1045  }
1046  elseif (($posOpeningBracket = strpos($word, '((')) === 0
1047  || ($posClosingBracket = strpos($word, '))')) !== false
1048  || $inPassage)
1049  {
1050  /* Passage selection detected */
1051 
1052  if ($posOpeningBracket !== false)
1053  {
1054  $passages[] = array('begin_pos' => $counter, 'cnt_words' => 0);
1055  $inPassage = true;
1056  }
1057  elseif ($posClosingBracket !== false)
1058  {
1059  $inPassage = false;
1060  $cur_pidx = count($passages) - 1;
1061  $passages[$cur_pidx]['end_pos'] = $counter;
1062 
1063  $errorobject = $this->errordata[$errorcounter];
1064  if (is_object($errorobject))
1065  {
1066  $passages[$cur_pidx]['score'] = $errorobject->points;
1067  }
1068  $errorcounter++;
1069  }
1070 
1071  $cur_pidx = count($passages) - 1;
1072  $passages[$cur_pidx]['cnt_words']++;
1073  $points = 0;
1074  }
1075 
1076  $words[$counter] = array("word" => $word, "points" => $points);
1077  $counter++;
1078  }
1079  }
1080 
1081  /* Calculate reached points */
1082  $total = 0;
1083  foreach ($positions as $position)
1084  {
1085  /* First iterate through positions
1086  to identify single-word-selections. */
1087 
1088  $total += $words[$position]['points'];
1089  }
1090 
1091  foreach ($passages as $cnt => $p_data)
1092  {
1093  /* Iterate through configured passages to check
1094  wether the entire passage is selected or not.
1095  The total points is incremented by the passage's
1096  score only if the entire passage is selected. */
1097  $isSelected = in_array($p_data['begin_pos'], $positions);
1098 
1099  for ($i = 0; $i < $p_data['cnt_words']; $i++)
1100  {
1101  $current_pos = $p_data['begin_pos'] + $i;
1102  $isSelected = $isSelected && in_array($current_pos, $positions);
1103  }
1104 
1105  $total += $isSelected ? $p_data['score'] : 0;
1106  }
1107 
1108  return $total;
1109  }
getErrorText()
Get error text.
getPointsWrong()
Get wrong points.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPointsWrong()

assErrorText::getPointsWrong ( )

Get wrong points.

Returns
double Points for wrong selection

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

References $points_wrong.

Referenced by __get(), getBestSelection(), getPointsForSelectedPositions(), and saveAdditionalQuestionDataToDb().

1186  {
1187  return $this->points_wrong;
1188  }
+ Here is the caller graph for this function:

◆ getQuestionType()

assErrorText::getQuestionType ( )

Returns the question type of the question.

Returns
integer The question type of the question

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

Referenced by toJSON().

496  {
497  return "assErrorText";
498  }
+ Here is the caller graph for this function:

◆ getRTETextWithMediaObjects()

assErrorText::getRTETextWithMediaObjects ( )

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

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

525  {
526  $text = parent::getRTETextWithMediaObjects();
527  return $text;
528  }

◆ getTextSize()

assErrorText::getTextSize ( )

Set text size in percent.

Returns
double Text size in percent

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

References $textsize.

Referenced by __get(), and saveAdditionalQuestionDataToDb().

1161  {
1162  return $this->textsize;
1163  }
+ Here is the caller 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 58 of file class.assErrorText.php.

References getMaximumPoints().

59  {
60  if (strlen($this->title)
61  && ($this->author)
62  && ($this->question)
63  && ($this->getMaximumPoints() > 0))
64  {
65  return true;
66  }
67  else
68  {
69  return false;
70  }
71  }
getMaximumPoints()
Returns the maximum points, a learner can reach answering the question.
+ Here is the call graph for this function:

◆ isTokenSelected()

assErrorText::isTokenSelected (   $counter,
array  $selection 
)
protected

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

References $data.

Referenced by createErrorTextOutput().

861  {
862  foreach($selection as $data)
863  {
864  if( !is_array($data) )
865  {
866  if($counter == $data)
867  {
868  return true;
869  }
870  }
871  elseif( in_array($counter, $data) )
872  {
873  return true;
874  }
875  }
876 
877  return false;
878  }
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data
+ Here is the caller 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 142 of file class.assErrorText.php.

References $data, $result, ilRTE\_replaceMediaObjectImageSrc(), ilDB\fetchAssoc(), getAdditionalTableName(), assQuestion\setAdditionalContentEditingMode(), assQuestion\setAuthor(), assQuestion\setComment(), setErrorText(), assQuestion\setEstimatedWorkingTime(), assQuestion\setId(), assQuestion\setNrOfTries(), assQuestion\setObjId(), assQuestion\setOriginalId(), assQuestion\setOwner(), assQuestion\setPoints(), setPointsWrong(), assQuestion\setQuestion(), setTextSize(), and assQuestion\setTitle().

143  {
144  global $ilDB;
145 
146  $result = $ilDB->queryF("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",
147  array("integer"),
148  array($question_id)
149  );
150  if ($result->numRows() == 1)
151  {
152  $data = $ilDB->fetchAssoc($result);
153  $this->setId($question_id);
154  $this->setObjId($data["obj_fi"]);
155  $this->setTitle($data["title"]);
156  $this->setComment($data["description"]);
157  $this->setOriginalId($data["original_id"]);
158  $this->setNrOfTries($data['nr_of_tries']);
159  $this->setAuthor($data["author"]);
160  $this->setPoints($data["points"]);
161  $this->setOwner($data["owner"]);
162  include_once("./Services/RTE/classes/class.ilRTE.php");
163  $this->setQuestion(ilRTE::_replaceMediaObjectImageSrc($data["question_text"], 1));
164  $this->setErrorText($data["errortext"]);
165  $this->setTextSize($data["textsize"]);
166  $this->setPointsWrong($data["points_wrong"]);
167  $this->setEstimatedWorkingTime(substr($data["working_time"], 0, 2), substr($data["working_time"], 3, 2), substr($data["working_time"], 6, 2));
168 
169  try
170  {
171  $this->setAdditionalContentEditingMode($data['add_cont_edit_mode']);
172  }
174  {
175  }
176  }
177 
178  $result = $ilDB->queryF("SELECT * FROM qpl_a_errortext WHERE question_fi = %s ORDER BY sequence ASC",
179  array('integer'),
180  array($question_id)
181  );
182  include_once "./Modules/TestQuestionPool/classes/class.assAnswerErrorText.php";
183  if ($result->numRows() > 0)
184  {
185  while ($data = $ilDB->fetchAssoc($result))
186  {
187  array_push($this->errordata, new assAnswerErrorText($data["text_wrong"], $data["text_correct"], $data["points"]));
188  }
189  }
190 
191  parent::loadFromDb($question_id);
192  }
setTextSize($a_value)
Set text size in percent.
$result
setId($id=-1)
Sets the id of the assQuestion object.
setErrorText($a_value)
Set error text.
setEstimatedWorkingTime($hour=0, $min=0, $sec=0)
Sets the estimated working time of a question.
Class for error text answers.
setNrOfTries($a_nr_of_tries)
setAdditionalContentEditingMode($additinalContentEditingMode)
setter for additional content editing mode for this question
fetchAssoc($a_set)
Fetch row as associative array from result set.
setAuthor($author="")
Sets the authors name of the assQuestion object.
setPointsWrong($a_value)
Set wrong points.
getAdditionalTableName()
Returns the name of the additional question data table in the database.
setPoints($a_points)
Sets the maximum available points for the question.
static _replaceMediaObjectImageSrc($a_text, $a_direction=0)
replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data
setQuestion($question="")
Sets the question string of the question object.
setOriginalId($original_id)
setTitle($title="")
Sets the title string of the assQuestion object.
setObjId($obj_id=0)
Set the object id of the container object.
setComment($comment="")
Sets the comment string of the assQuestion object.
setOwner($owner="")
Sets the creator/owner ID of the assQuestion object.
+ Here is the call graph for this function:

◆ reworkWorkingData()

assErrorText::reworkWorkingData (   $active_id,
  $pass,
  $obligationsAnswered 
)
protected

Reworks the allready saved working data if neccessary.

protected

Parameters
integer$active_id
integer$pass
boolean$obligationsAnswered

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

486  {
487  // nothing to rework!
488  }

◆ saveAdditionalQuestionDataToDb()

assErrorText::saveAdditionalQuestionDataToDb ( )

Saves the data for the additional data table.

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

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

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

Referenced by saveToDb().

117  {
118  global $ilDB;
119  // save additional data
120  $ilDB->manipulateF( "DELETE FROM " . $this->getAdditionalTableName() . " WHERE question_fi = %s",
121  array( "integer" ),
122  array( $this->getId() )
123  );
124 
125  $ilDB->manipulateF("INSERT INTO " . $this->getAdditionalTableName() . " (question_fi, errortext, textsize, points_wrong) VALUES (%s, %s, %s, %s)",
126  array("integer", "text", "float", "float"),
127  array(
128  $this->getId(),
129  $this->getErrorText(),
130  $this->getTextSize(),
131  $this->getPointsWrong()
132  )
133  );
134  }
getErrorText()
Get error text.
getId()
Gets the id of the assQuestion object.
getTextSize()
Set text size in percent.
getPointsWrong()
Get wrong points.
getAdditionalTableName()
Returns the name of the additional question data table in the database.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveAnswerSpecificDataToDb()

assErrorText::saveAnswerSpecificDataToDb ( )

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

References assQuestion\getId().

Referenced by saveToDb().

86  {
87  global $ilDB;
88  $ilDB->manipulateF( "DELETE FROM qpl_a_errortext WHERE question_fi = %s",
89  array( 'integer' ),
90  array( $this->getId() )
91  );
92 
93  $sequence = 0;
94  foreach ($this->errordata as $object)
95  {
96  $next_id = $ilDB->nextId( 'qpl_a_errortext' );
97  $ilDB->manipulateF( "INSERT INTO qpl_a_errortext (answer_id, question_fi, text_wrong, text_correct, points, sequence) VALUES (%s, %s, %s, %s, %s, %s)",
98  array( 'integer', 'integer', 'text', 'text', 'float', 'integer' ),
99  array(
100  $next_id,
101  $this->getId(),
102  $object->text_wrong,
103  $object->text_correct,
104  $object->points,
105  $sequence++
106  )
107  );
108  }
109  }
getId()
Gets the id of the assQuestion object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveToDb()

assErrorText::saveToDb (   $original_id = "")

Saves a the object to the database.

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

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

78  {
82  parent::saveToDb();
83  }
saveQuestionDataToDb($original_id="")
saveAdditionalQuestionDataToDb()
Saves the data for the additional data table.
+ Here is the call graph for this function:

◆ saveWorkingData()

assErrorText::saveWorkingData (   $active_id,
  $pass = NULL 
)

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

References $_POST, $ilUser, $pass, ilObjAssessmentFolder\_enabledAssessmentLogging(), ilObjAssessmentFolder\_getLogLanguage(), ilObjTest\_getPass(), assQuestion\getId(), assQuestion\getProcessLocker(), and assQuestion\logAction().

418  {
419  global $ilDB;
420  global $ilUser;
421 
422  if (is_null($pass))
423  {
424  include_once "./Modules/Test/classes/class.ilObjTest.php";
425  $pass = ilObjTest::_getPass($active_id);
426  }
427 
428  $this->getProcessLocker()->requestUserSolutionUpdateLock();
429 
430  $affectedRows = $ilDB->manipulateF("DELETE FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
431  array('integer','integer','integer'),
432  array($active_id, $this->getId(), $pass)
433  );
434 
435  $entered_values = false;
436  if (strlen($_POST["qst_" . $this->getId()]))
437  {
438  $selected = split(",", $_POST["qst_" . $this->getId()]);
439  foreach ($selected as $position)
440  {
441  $next_id = $ilDB->nextId('tst_solutions');
442  $affectedRows = $ilDB->insert("tst_solutions", array(
443  "solution_id" => array("integer", $next_id),
444  "active_fi" => array("integer", $active_id),
445  "question_fi" => array("integer", $this->getId()),
446  "value1" => array("clob", $position),
447  "value2" => array("clob", null),
448  "pass" => array("integer", $pass),
449  "tstamp" => array("integer", time())
450  ));
451  }
452  $entered_values = true;
453  }
454 
455  $this->getProcessLocker()->releaseUserSolutionUpdateLock();
456 
457  if ($entered_values)
458  {
459  include_once ("./Modules/Test/classes/class.ilObjAssessmentFolder.php");
461  {
462  $this->logAction($this->lng->txtlng("assessment", "log_user_entered_values", ilObjAssessmentFolder::_getLogLanguage()), $active_id, $this->getId());
463  }
464  }
465  else
466  {
467  include_once ("./Modules/Test/classes/class.ilObjAssessmentFolder.php");
469  {
470  $this->logAction($this->lng->txtlng("assessment", "log_user_not_entered_values", ilObjAssessmentFolder::_getLogLanguage()), $active_id, $this->getId());
471  }
472  }
473 
474  return true;
475  }
getId()
Gets the id of the assQuestion object.
$_POST['username']
Definition: cron.php:12
_getPass($active_id)
Retrieves the actual pass of a given user for a given test.
_enabledAssessmentLogging()
check wether assessment logging is enabled or not
_getLogLanguage()
retrieve the log language for assessment logging
global $ilUser
Definition: imgupload.php:15
logAction($logtext="", $active_id="", $question_id="")
Logs an action into the Test&Assessment log.
+ Here is the call graph for this function:

◆ setErrorData()

assErrorText::setErrorData (   $a_data)

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

References $errordata, $errors, and assQuestion\$points.

645  {
646  include_once "./Modules/TestQuestionPool/classes/class.assAnswerErrorText.php";
647  $temp = $this->errordata;
648  $this->errordata = array();
649  foreach ($a_data as $err_type => $errors) {
650  /* Iterate through error types (Passages|single words) */
651 
652  foreach ($errors as $idx => $error) {
653  /* Iterate through errors of this type. */
654  $text_correct = "";
655  $points = 0.0;
656  foreach ($temp as $object) {
657  if (strcmp($object->text_wrong, $error) == 0) {
658  $text_correct = $object->text_correct;
659  $points = $object->points;
660  continue;
661  }
662  }
663  $this->errordata[$idx] = new assAnswerErrorText($error, $text_correct, $points);
664  }
665  }
666  ksort($this->errordata);
667  }
$errors
Class for error text answers.

◆ setErrorText()

assErrorText::setErrorText (   $a_value)

Set error text.

Parameters
string$a_valueError text

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

Referenced by __set(), and loadFromDb().

1151  {
1152  $this->errortext = $a_value;
1153  }
+ Here is the caller graph for this function:

◆ setExportDetailsXLS()

assErrorText::setExportDetailsXLS ( $worksheet,
  $startrow,
  $active_id,
  $pass,
$format_title,
$format_bold 
)

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

Parameters
object$worksheetReference to the parent excel worksheet
object$startrowStartrow of the output in the excel worksheet
object$active_idActive id of the participant
object$passTest pass
object$format_titleExcel title format
object$format_boldExcel bold format
array$eval_dataCumulated evaluation data

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

References $errortext, $pass, ilExcelUtils\_convert_text(), createErrorTextExport(), assQuestion\getSolutionValues(), and assQuestion\getTitle().

542  {
543  include_once ("./Services/Excel/classes/class.ilExcelUtils.php");
544  $worksheet->writeString($startrow, 0, ilExcelUtils::_convert_text($this->lng->txt($this->getQuestionType())), $format_title);
545  $worksheet->writeString($startrow, 1, ilExcelUtils::_convert_text($this->getTitle()), $format_title);
546 
547  $i= 0;
548  $selections = array();
549  $solutions =& $this->getSolutionValues($active_id, $pass);
550  if (is_array($solutions))
551  {
552  foreach ($solutions as $solution)
553  {
554  array_push($selections, $solution['value1']);
555  }
556  $errortext_value = join(",", $selections);
557  }
558  $errortext = $this->createErrorTextExport($selections);
559  $errortext = preg_replace("/#HREF\d+/is", "javascript:void(0);", $errortext);
560  $i++;
561  $worksheet->writeString($startrow+$i, 0, ilExcelUtils::_convert_text($errortext));
562  $i++;
563  return $startrow + $i + 1;
564  }
& getSolutionValues($active_id, $pass=NULL)
Loads solutions of a given user from the database an returns it.
createErrorTextExport($selections=null)
_convert_text($a_text, $a_target="has been removed")
getTitle()
Gets the title string of the assQuestion object.
+ Here is the call graph for this function:

◆ setPointsWrong()

assErrorText::setPointsWrong (   $a_value)

Set wrong points.

Parameters
double$a_valuePoints for wrong selection

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

Referenced by __set(), and loadFromDb().

1196  {
1197  $this->points_wrong = $a_value;
1198  }
+ Here is the caller graph for this function:

◆ setTextSize()

assErrorText::setTextSize (   $a_value)

Set text size in percent.

Parameters
double$a_valuetext size in percent

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

Referenced by __set(), and loadFromDb().

1171  {
1172  // in self-assesment-mode value should always be set (and must not be null)
1173  if($a_value === null)
1174  {
1175  $a_value = 100;
1176  }
1177  $this->textsize = $a_value;
1178  }
+ Here is the caller graph for this function:

◆ toggleSelection()

assErrorText::toggleSelection (   $position,
  $active_id,
  $pass = null 
)

Change the selection during a test when a user selects/deselects a word without using javascript.

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

References $ilUser, $pass, ilObjAssessmentFolder\_enabledAssessmentLogging(), ilObjAssessmentFolder\_getLogLanguage(), ilObjTest\_getPass(), calculateReachedPoints(), assQuestion\getId(), and assQuestion\logAction().

374  {
375  global $ilDB;
376  global $ilUser;
377 
378  if (is_null($pass))
379  {
380  include_once "./Modules/Test/classes/class.ilObjTest.php";
381  $pass = ilObjTest::_getPass($active_id);
382  }
383 
384  $affectedRows = $ilDB->manipulateF("DELETE FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s AND value1 = %s",
385  array('integer','integer','integer', 'text'),
386  array($active_id, $this->getId(), $pass, $position)
387  );
388  if ($affectedRows == 0)
389  {
390  $next_id = $ilDB->nextId('tst_solutions');
391  $affectedRows = $ilDB->insert("tst_solutions", array(
392  "solution_id" => array("integer", $next_id),
393  "active_fi" => array("integer", $active_id),
394  "question_fi" => array("integer", $this->getId()),
395  "value1" => array("clob", $position),
396  "value2" => array("clob", null),
397  "pass" => array("integer", $pass),
398  "tstamp" => array("integer", time())
399  ));
400  }
401  include_once ("./Modules/Test/classes/class.ilObjAssessmentFolder.php");
403  {
404  $this->logAction($this->lng->txtlng("assessment", "log_user_entered_values", ilObjAssessmentFolder::_getLogLanguage()), $active_id, $this->getId());
405  }
406  $this->calculateReachedPoints($active_id, $pass);
407  }
getId()
Gets the id of the assQuestion object.
_getPass($active_id)
Retrieves the actual pass of a given user for a given test.
calculateReachedPoints($active_id, $pass=NULL, $returndetails=FALSE)
Returns the points, a learner has reached answering the question.
_enabledAssessmentLogging()
check wether assessment logging is enabled or not
_getLogLanguage()
retrieve the log language for assessment logging
global $ilUser
Definition: imgupload.php:15
logAction($logtext="", $active_id="", $question_id="")
Logs an action into the Test&Assessment log.
+ Here is the call graph for this function:

◆ toJSON()

assErrorText::toJSON ( )

Returns a JSON representation of the question.

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

References $mobs, $result, ilObjMediaObject\_getMobsOfObject(), ilRTE\_replaceMediaObjectImageSrc(), assQuestion\formatSAQuestion(), getErrorData(), getErrorText(), assQuestion\getId(), assQuestion\getNrOfTries(), assQuestion\getQuestion(), getQuestionType(), assQuestion\getShuffle(), assQuestion\getTitle(), and ilUtil\prepareFormOutput().

1249  {
1250  include_once("./Services/RTE/classes/class.ilRTE.php");
1251  $result = array();
1252  $result['id'] = (int) $this->getId();
1253  $result['type'] = (string) $this->getQuestionType();
1254  $result['title'] = (string) $this->getTitle();
1255  $result['question'] = $this->formatSAQuestion($this->getQuestion());
1256  $result['text'] = (string) ilRTE::_replaceMediaObjectImageSrc($this->getErrorText(), 0);
1257  $result['nr_of_tries'] = (int) $this->getNrOfTries();
1258  $result['shuffle'] = (bool) $this->getShuffle();
1259  $result['feedback'] = array(
1260  "onenotcorrect" => $this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), false),
1261  "allcorrect" => $this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), true)
1262  );
1263 
1264  $answers = array();
1265  foreach ($this->getErrorData() as $idx => $answer_obj)
1266  {
1267  array_push($answers, array(
1268  "answertext_wrong" => (string) $answer_obj->text_wrong,
1269  "answertext_correct" => (string) $answer_obj->text_correct,
1270  "points" => (float)$answer_obj->points,
1271  "order" => (int)$idx+1
1272  ));
1273  }
1274  $result['correct_answers'] = $answers;
1275 
1276  $answers = array();
1277  $textarray = preg_split("/[\n\r]+/", $this->getErrorText());
1278  foreach ($textarray as $textidx => $text)
1279  {
1280  $items = preg_split("/\s+/", trim($text));
1281  foreach ($items as $idx => $item)
1282  {
1283  if(substr($item, 0, 1) == "#")
1284  {
1285  $item = substr($item, 1);
1286 
1287  // #14115 - add position to correct answer
1288  foreach($result["correct_answers"] as $aidx => $answer)
1289  {
1290  if($answer["answertext_wrong"] == $item && !$answer["pos"])
1291  {
1292  $result["correct_answers"][$aidx]["pos"] = $this->getId()."_".$textidx."_".($idx+1);
1293  break;
1294  }
1295  }
1296  }
1297  array_push($answers, array(
1298  "answertext" => (string) ilUtil::prepareFormOutput($item),
1299  "order" => $this->getId()."_".$textidx."_".($idx+1)
1300  ));
1301  }
1302  if($textidx != sizeof($textarray)-1)
1303  {
1304  array_push($answers, array(
1305  "answertext" => "###",
1306  "order" => $this->getId()."_".$textidx."_".($idx+2)
1307  ));
1308  }
1309  }
1310  $result['answers'] = $answers;
1311 
1312  $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $this->getId());
1313  $result['mobs'] = $mobs;
1314 
1315  return json_encode($result);
1316  }
getErrorText()
Get error text.
getId()
Gets the id of the assQuestion object.
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
getErrorData()
Get error data.
formatSAQuestion($a_q)
Format self assessment question.
$result
getQuestionType()
Returns the question type of the question.
getShuffle()
Gets the shuffle flag.
$mobs
getQuestion()
Gets the question string of the question object.
_getMobsOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
get mobs of object
static _replaceMediaObjectImageSrc($a_text, $a_direction=0)
replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
getTitle()
Gets the title string of the assQuestion object.
+ 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 
)

Returns a QTI xml representation of the question and sets the internal domxml variable with the DOM XML representation of the QTI xml representation.

Returns
string The QTI xml representation of the question

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

592  {
593  include_once "./Modules/TestQuestionPool/classes/export/qti12/class.assErrorTextExport.php";
594  $export = new assErrorTextExport($this);
595  return $export->toXML($a_include_header, $a_include_binary, $a_shuffle, $test_output, $force_image_references);
596  }
Class for error text question exports.

Field Documentation

◆ $errordata

assErrorText::$errordata
protected

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

Referenced by getErrorData(), and setErrorData().

◆ $errortext

assErrorText::$errortext
protected

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

Referenced by getErrorText(), and setExportDetailsXLS().

◆ $points_wrong

assErrorText::$points_wrong
protected

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

Referenced by getPointsWrong().

◆ $textsize

assErrorText::$textsize
protected

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

Referenced by getTextSize().


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