ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
assQuestion Class Reference
+ Inheritance diagram for assQuestion:
+ Collaboration diagram for assQuestion:

Public Member Functions

 getQuestionType ()
 
 isComplete ()
 
 saveWorkingData (int $active_id, ?int $pass=null, bool $authorized=true)
 
 calculateReachedPoints (int $active_id, ?int $pass=null, bool $authorized_solution=true)
 
 getAdditionalTableName ()
 
 getAnswerTableName ()
 
 toLog (AdditionalInformationGenerator $additional_info)
 MUST return an array of the question settings that can be stored in the log. More...
 
 getCurrentUser ()
 
 getShuffler ()
 
 setShuffler (Transformation $shuffler)
 
 setProcessLocker (ilAssQuestionProcessLocker $processLocker)
 
 getProcessLocker ()
 
 fromXML (string $importdirectory, int $user_id, ilQTIItem $item, int $questionpool_id, ?int $tst_id, ?ilObject &$tst_object, int &$question_counter, array $import_mapping, array $solutionhints=[])
 
 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...
 
 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 $authorized_solution=true)
 
 calculateResultsFromSolution (int $active_id, int $pass)
 Calculates the question results from a previously saved question solution. More...
 
 persistWorkingState (int $active_id, $pass, bool $authorized=true)
 persists the working state for current testactive and testpass More...
 
 persistPreviewState (ilAssQuestionPreviewSession $preview_session)
 persists the preview state for current user and question More...
 
 validateSolutionSubmit ()
 
 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, ?int $pass=null)
 
 getSolutionValues (int $active_id, ?int $pass=null, bool $authorized=true)
 Loads solutions of a given user from the database an returns it. More...
 
 deleteAnswers (int $question_id)
 
 deleteAdditionalTableData (int $question_id)
 
 delete (int $question_id)
 
 getTotalAnswers ()
 
 cloneXHTMLMediaObjectsOfQuestion (int $source_question_id)
 
 createPageObject ()
 
 clonePageOfQuestion (int $a_q_id)
 
 getPageOfQuestion ()
 
 setOriginalId (?int $original_id)
 
 getOriginalId ()
 
static 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=null)
 
 duplicate (bool $for_test=true, string $title='', string $author='', int $owner=-1, $test_obj_id=null)
 
 copyObject (int $target_parent_id, string $title='')
 
 createNewOriginalFromThisDuplicate (int $target_parent_id, string $target_question_title='')
 
 saveToDb (?int $original_id=null)
 
 deleteSuggestedSolutions ()
 
 getSuggestedSolution (int $subquestion_index=0)
 
 resolveInternalLink (string $internal_link)
 
 resolveSuggestedSolutionLinks ()
 
 getInternalLinkHref (string $target)
 
 syncWithOriginal ()
 
 getPoints ()
 
 setPoints (float $points)
 
 getSolutionMaxPass (int $active_id)
 
 isWriteable ()
 
 deductHintPointsFromReachedPoints (ilAssQuestionPreviewSession $preview_session, $reached_points)
 
 calculateReachedPointsFromPreviewSession (ilAssQuestionPreviewSession $preview_session)
 
 isPreviewSolutionCorrect (ilAssQuestionPreviewSession $preview_session)
 
 adjustReachedPointsByScoringOptions (float $points, int $active_id)
 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="")
 
 getQuestionTypeID ()
 
 cloneHints (int $source_question_id, int $target_question_id)
 
 cleanupMediaObjectUsage ()
 
 getInstances ()
 
 getActiveUserData (int $active_id)
 Returns the user id and the test id for a given active id. More...
 
 hasSpecificFeedback ()
 
 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 (int $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 ()
 
 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 $value_pairs)
 
 updateTimestamp ()
 
 getTestPresentationConfig ()
 
 hasWritableOriginalInQuestionPool ()
 
 answerToParticipantInteraction (AdditionalInformationGenerator $additional_info, int $test_ref_id, int $active_id, int $pass, string $source_ip, TestParticipantInteractionTypes $interaction_type)
 
 toQuestionAdministrationInteraction (AdditionalInformationGenerator $additional_info, int $test_ref_id, TestQuestionAdministrationInteractionTypes $interaction_type)
 
 getSolutionForTextOutput (int $active_id, int $pass)
 
 getCorrectSolutionForTextOutput (int $active_id, int $pass)
 
 getVariablesAsTextArray (int $active_id, int $pass)
 

Static Public Member Functions

static setForcePassResultUpdateEnabled (bool $force_pass_results_update_enabled)
 
static isForcePassResultUpdateEnabled ()
 
static _getSuggestedSolutionOutput (int $question_id)
 
static _getReachedPoints (int $active_id, int $question_id, int $pass)
 
static isFileAvailable (string $file)
 
static saveOriginalId (int $questionId, int $originalId)
 
static resetOriginalId (int $questionId)
 
static instantiateQuestion (int $question_id)
 
static _getSolutionMaxPass (int $question_id, int $active_id)
 Returns the maximum pass a users question solution. More...
 
static getFeedbackClassNameByQuestionType (string $questionType)
 
static _questionExistsInTest (int $question_id, int $test_id)
 
static lookupParentObjId (int $question_id)
 
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

const ADDITIONAL_CONTENT_EDITING_MODE_RTE = 'default'
 
const ADDITIONAL_CONTENT_EDITING_MODE_IPE = 'pageobject'
 
const TRIM_PATTERN = '/^[\p{C}\p{Z}]+|[\p{C}\p{Z}]+$/u'
 
ilAssQuestionFeedback $feedbackOBJ
 
bool $prevent_rte_usage = false
 
bool $selfassessmenteditingmode = false
 
int $defaultnroftries = 0
 
string $questionActionCmd = 'handleQuestionAction'
 
const KEY_VALUES_IMPLOSION_SEPARATOR = ':'
 

Protected Member Functions

 solutionValuesToLog (AdditionalInformationGenerator $additional_info, array $solution_values)
 MUST convert the given solution values into an array or a string that can be stored in the log. More...
 
 solutionValuesToText (array $solution_values)
 MUST convert the given solution values into text. More...
 
 getQuestionAction ()
 
 isNonEmptyItemListPostSubmission (string $post_submission_field_name)
 
 savePreviewData (ilAssQuestionPreviewSession $preview_session)
 
 deletePageOfQuestion (int $question_id)
 
 cloneQuestionTypeSpecificProperties (self $target)
 
 removeAllImageFiles (string $image_target_path)
 
 onDuplicate (int $original_parent_id, int $original_question_id, int $duplicate_parent_id, int $duplicate_question_id)
 
 afterSyncWithOriginal (int $original_question_id, int $clone_question_id, int $original_parent_id, int $clone_parent_id)
 
 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 ()
 
 cloneSuggestedSolutions (int $source_question_id, int $target_question_id)
 
 duplicateSuggestedSolutionFiles (int $parent_id, int $question_id)
 Duplicates the files of a suggested solution if the question is duplicated. More...
 
 cloneSuggestedSolutionFiles (int $source_question_id, int $target_question_id)
 
 copySuggestedSolutions (int $target_question_id)
 
 ensureNonNegativePoints (float $points)
 
 purifyAndPrepareTextAreaOutput (string $content)
 
 getRTETextWithMediaObjects ()
 
 getSelfAssessmentFormatter ()
 
 lmMigrateQuestionTypeGenericContent (ilAssSelfAssessmentMigrator $migrator)
 
 lmMigrateQuestionTypeSpecificContent (ilAssSelfAssessmentMigrator $migrator)
 
 duplicateQuestionHints (int $original_question_id, int $duplicate_question_id)
 
 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 ()
 
 getSuggestedSolutionsRepo ()
 
 loadSuggestedSolutions ()
 
 answerToLog (AdditionalInformationGenerator $additional_info, int $active_id, int $pass)
 

Static Protected Member Functions

static getNumExistingSolutionRecords (int $activeId, int $pass, int $questionId)
 

Protected Attributes

const HAS_SPECIFIC_FEEDBACK = true
 
GeneralQuestionPropertiesRepository $questionrepository
 
RequestDataCollector $questionpool_request
 
QuestionFiles $question_files
 
ilAssQuestionProcessLocker $processLocker
 
ilTestQuestionConfig $testQuestionConfig
 
SuggestedSolutionsDatabaseRepository $suggestedsolution_repo
 
ILIAS $ilias
 
ilGlobalPageTemplate $tpl
 
ilLanguage $lng
 
ilDBInterface $db
 
ilObjUser $current_user
 
SkillUsageService $skillUsageService
 
HTTPServices $http
 
Refinery $refinery
 
Transformation $shuffler
 
LoggingServices $log
 
Container $dic
 
ilAssQuestionLifecycle $lifecycle
 
ilAssQuestionPage $page
 
int $id
 
string $title
 
string $comment
 
int $owner
 
string $author
 
int $thumb_size
 
string $question
 
float $points = 0.0
 
bool $shuffle = true
 
int $test_id
 
int $obj_id = 0
 
int $original_id = null
 
int $lastChange = null
 
string $external_id = null
 
int $step = null
 
array $suggested_solutions
 

Static Protected Attributes

static $force_pass_results_update_enabled = false
 
static $imageSourceFixReplaceMap
 

Private Member Functions

 importHint (int $question_id, array $hint_array)
 
 deleteTaxonomyAssignments ()
 

Private Attributes

const DEFAULT_THUMB_SIZE = 150
 
const MINIMUM_THUMB_SIZE = 20
 
const MAXIMUM_THUMB_SIZE = 8192
 
ilTestQuestionConfig $test_question_config = null
 
int $nr_of_tries
 
string $export_image_path
 
string $additionalContentEditingMode = ''
 

Detailed Description

Member Function Documentation

◆ _getReachedPoints()

static assQuestion::_getReachedPoints ( int  $active_id,
int  $question_id,
int  $pass 
)
static

Definition at line 535 of file class.assQuestion.php.

References $DIC, $ilDB, and $points.

Referenced by ILIAS\Test\Scoring\Manual\TestScoringByParticipantGUI\buildManScoringParticipantForm(), and ILIAS\Test\Scoring\Manual\TestScoringByParticipantGUI\saveManScoringParticipantScreen().

535  : float
536  {
537  global $DIC;
538  $ilDB = $DIC['ilDB'];
539 
540  $points = 0.0;
541 
542  $result = $ilDB->queryF(
543  "SELECT * FROM tst_test_result WHERE active_fi = %s AND question_fi = %s AND pass = %s",
544  ['integer','integer','integer'],
545  [$active_id, $question_id, $pass]
546  );
547  if ($result->numRows() == 1) {
548  $row = $ilDB->fetchAssoc($result);
549  $points = (float) $row["points"];
550  }
551  return $points;
552  }
global $DIC
Definition: shib_login.php:25
+ Here is the caller graph for this function:

◆ _getSolutionMaxPass()

static assQuestion::_getSolutionMaxPass ( int  $question_id,
int  $active_id 
)
static

Returns the maximum pass a users question solution.

Definition at line 1814 of file class.assQuestion.php.

References $DIC, and $ilDB.

Referenced by buildHashedImageFilename(), and ilObjTest\getTextAnswer().

1814  : ?int
1815  {
1816  // the following code was the old solution which added the non answered
1817  // questions of a pass from the answered questions of the previous pass
1818  // with the above solution, only the answered questions of the last pass are counted
1819  global $DIC;
1820  $ilDB = $DIC['ilDB'];
1821 
1822  $result = $ilDB->queryF(
1823  "SELECT MAX(pass) maxpass FROM tst_test_result WHERE active_fi = %s AND question_fi = %s",
1824  ['integer','integer'],
1825  [$active_id, $question_id]
1826  );
1827  if ($result->numRows() === 1) {
1828  $row = $ilDB->fetchAssoc($result);
1829  return $row["maxpass"];
1830  }
1831 
1832  return null;
1833  }
global $DIC
Definition: shib_login.php:25
+ Here is the caller graph for this function:

◆ _getSuggestedSolutionOutput()

static assQuestion::_getSuggestedSolutionOutput ( int  $question_id)
static

Definition at line 478 of file class.assQuestion.php.

Referenced by ILIAS\Test\Scoring\Manual\TestScoringByQuestionGUI\buildFeedbackModal(), and ilObjTest\getTestResult().

478  : string
479  {
480  $question = self::instantiateQuestion($question_id);
481  if (!is_object($question)) {
482  return "";
483  }
484  return $question->getSuggestedSolutionOutput();
485  }
+ Here is the caller graph for this function:

◆ _questionExistsInTest()

static assQuestion::_questionExistsInTest ( int  $question_id,
int  $test_id 
)
static

Definition at line 2216 of file class.assQuestion.php.

References $DIC, and $ilDB.

2216  : bool
2217  {
2218  global $DIC;
2219  $ilDB = $DIC['ilDB'];
2220 
2221  if ($question_id < 1) {
2222  return false;
2223  }
2224 
2225  $result = $ilDB->queryF(
2226  "SELECT question_fi FROM tst_test_question WHERE question_fi = %s AND test_fi = %s",
2227  ['integer', 'integer'],
2228  [$question_id, $test_id]
2229  );
2230  return $ilDB->numRows($result) == 1;
2231  }
global $DIC
Definition: shib_login.php:25

◆ addAnswerOptionValue()

assQuestion::addAnswerOptionValue ( int  $qIndex,
string  $answerOptionValue,
float  $points 
)

Definition at line 2871 of file class.assQuestion.php.

2871  : void
2872  {
2873  }

◆ adjustReachedPointsByScoringOptions()

assQuestion::adjustReachedPointsByScoringOptions ( float  $points,
int  $active_id 
)
final

Adjust the given reached points by checks for all special scoring options in the test container.

public

Parameters
integer$points
integer$active_id
integer$pass

Definition at line 1880 of file class.assQuestion.php.

References $points, ilObjTest\_getCountSystem(), ilObjTest\_getScoreCutting(), and getMaximumPoints().

Referenced by calculateResultsFromSolution(), and getAdjustedReachedPoints().

1880  : float
1881  {
1882  $count_system = ilObjTest::_getCountSystem($active_id);
1883  if ($count_system == 1) {
1884  if (abs($this->getMaximumPoints() - $points) > 0.0000000001) {
1885  $points = 0;
1886  }
1887  }
1888  $score_cutting = ilObjTest::_getScoreCutting($active_id);
1889  if ($score_cutting == 0) {
1890  if ($points < 0) {
1891  $points = 0;
1892  }
1893  }
1894  return $points;
1895  }
static _getCountSystem($active_id)
static _getScoreCutting(int $active_id)
Determines if the score of a question should be cut at 0 points or the score of the whole test...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ afterSyncWithOriginal()

assQuestion::afterSyncWithOriginal ( int  $original_question_id,
int  $clone_question_id,
int  $original_parent_id,
int  $clone_parent_id 
)
protected

Definition at line 1456 of file class.assQuestion.php.

Referenced by syncWithOriginal().

1461  : void {
1462  $this->feedbackOBJ->cloneFeedback($original_question_id, $clone_question_id);
1463  }
+ Here is the caller graph for this function:

◆ answerToLog()

assQuestion::answerToLog ( AdditionalInformationGenerator  $additional_info,
int  $active_id,
int  $pass 
)
protected

Definition at line 3054 of file class.assQuestion.php.

References getReachedPoints(), getSolutionValues(), and solutionValuesToLog().

Referenced by answerToParticipantInteraction().

3058  : array {
3059  return [
3060  AdditionalInformationGenerator::KEY_PASS => $pass,
3061  AdditionalInformationGenerator::KEY_REACHED_POINTS => $this->getReachedPoints($active_id, $pass),
3062  AdditionalInformationGenerator::KEY_PAX_ANSWER => $this->solutionValuesToLog(
3063  $additional_info,
3064  $this->getSolutionValues($active_id, $pass)
3065  )
3066  ];
3067  }
getSolutionValues(int $active_id, ?int $pass=null, bool $authorized=true)
Loads solutions of a given user from the database an returns it.
solutionValuesToLog(AdditionalInformationGenerator $additional_info, array $solution_values)
MUST convert the given solution values into an array or a string that can be stored in the log...
getReachedPoints(int $active_id, int $pass)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ answerToParticipantInteraction()

assQuestion::answerToParticipantInteraction ( AdditionalInformationGenerator  $additional_info,
int  $test_ref_id,
int  $active_id,
int  $pass,
string  $source_ip,
TestParticipantInteractionTypes  $interaction_type 
)

Implements ILIAS\TestQuestionPool\Questions\Question.

Definition at line 3020 of file class.assQuestion.php.

References answerToLog().

Referenced by ilTestPlayerAbstractGUI\save().

3028  return new TestParticipantInteraction(
3029  $test_ref_id,
3030  $this->id,
3031  $this->current_user->getId(),
3032  $source_ip,
3033  $interaction_type,
3034  time(),
3035  $this->answerToLog($additional_info, $active_id, $pass)
3036  );
3037  }
answerToLog(AdditionalInformationGenerator $additional_info, int $active_id, int $pass)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ authorizedOrIntermediateSolutionExists()

assQuestion::authorizedOrIntermediateSolutionExists ( int  $active_id,
int  $pass 
)

Definition at line 2805 of file class.assQuestion.php.

References lookupForExistingSolutions().

2805  : bool
2806  {
2807  $solutionAvailability = $this->lookupForExistingSolutions($active_id, $pass);
2808  return $solutionAvailability['authorized'] || $solutionAvailability['intermediate'];
2809  }
lookupForExistingSolutions(int $activeId, int $pass)
Lookup if an authorized or intermediate solution exists.
+ Here is the call graph for this function:

◆ authorizedSolutionExists()

assQuestion::authorizedSolutionExists ( int  $active_id,
?int  $pass 
)

Definition at line 2796 of file class.assQuestion.php.

References lookupForExistingSolutions().

2796  : bool
2797  {
2798  if ($pass === null) {
2799  return false;
2800  }
2801  $solutionAvailability = $this->lookupForExistingSolutions($active_id, $pass);
2802  return (bool) $solutionAvailability['authorized'];
2803  }
lookupForExistingSolutions(int $activeId, int $pass)
Lookup if an authorized or intermediate solution exists.
+ Here is the call graph for this function:

◆ buildHashedImageFilename()

assQuestion::buildHashedImageFilename ( string  $plain_image_filename,
bool  $unique = false 
)

Definition at line 1896 of file class.assQuestion.php.

References $DIC, $ilDB, _getSolutionMaxPass(), ilObjTest\_getUserIdFromActiveId(), and ilCourseObjectiveResult\_updateObjectiveResult().

Referenced by assKprimChoice\handleFileUpload(), assMatchingQuestion\rebuildThumbnails(), assOrderingQuestion\storeImageFile(), and assOrderingQuestion\updateImageFile().

1896  : string
1897  {
1898  $extension = "";
1899 
1900  if (preg_match("/.*\.(png|jpg|gif|jpeg)$/i", $plain_image_filename, $matches)) {
1901  $extension = "." . $matches[1];
1902  }
1903 
1904  if ($unique) {
1905  $plain_image_filename = uniqid($plain_image_filename . microtime(true), true);
1906  }
1907 
1908  return md5($plain_image_filename) . $extension;
1909  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildQuestionDataQuery()

assQuestion::buildQuestionDataQuery ( )
protected

Definition at line 2466 of file class.assQuestion.php.

Referenced by assKprimChoice\loadFromDb().

2466  : string
2467  {
2468  return "
2469  SELECT qpl_questions.*,
2470  {$this->getAdditionalTableName()}.*
2471  FROM qpl_questions
2472  LEFT JOIN {$this->getAdditionalTableName()}
2473  ON {$this->getAdditionalTableName()}.question_fi = qpl_questions.question_id
2474  WHERE qpl_questions.question_id = %s
2475  ";
2476  }
+ Here is the caller graph for this function:

◆ buildTestPresentationConfig()

assQuestion::buildTestPresentationConfig ( )
protected

Definition at line 2978 of file class.assQuestion.php.

Referenced by getTestPresentationConfig().

2979  {
2980  return new ilTestQuestionConfig();
2981  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the caller graph for this function:

◆ calculateReachedPoints()

assQuestion::calculateReachedPoints ( int  $active_id,
?int  $pass = null,
bool  $authorized_solution = true 
)
abstract

Referenced by calculateResultsFromSolution(), and getAdjustedReachedPoints().

+ Here is the caller graph for this function:

◆ calculateReachedPointsFromPreviewSession()

assQuestion::calculateReachedPointsFromPreviewSession ( ilAssQuestionPreviewSession  $preview_session)

Definition at line 1847 of file class.assQuestion.php.

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

Referenced by isPreviewSolutionCorrect().

1848  {
1849  $reached_points = $this->deductHintPointsFromReachedPoints(
1850  $preview_session,
1851  $this->calculateReachedPointsForSolution($preview_session->getParticipantsSolution())
1852  );
1853 
1854  return $this->ensureNonNegativePoints($reached_points);
1855  }
ensureNonNegativePoints(float $points)
deductHintPointsFromReachedPoints(ilAssQuestionPreviewSession $preview_session, $reached_points)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calculateResultsFromSolution()

assQuestion::calculateResultsFromSolution ( int  $active_id,
int  $pass 
)
final

Calculates the question results from a previously saved question solution.

Definition at line 581 of file class.assQuestion.php.

References ilCourseObjectiveResult\_updateObjectiveResult(), adjustReachedPointsByScoringOptions(), calculateReachedPoints(), getId(), getObjId(), getProcessLocker(), getStep(), and lookupForExistingSolutions().

Referenced by persistWorkingState().

581  : void
582  {
583  // determine reached points for submitted solution
584  $reached_points = $this->calculateReachedPoints($active_id, $pass);
585  $questionHintTracking = new ilAssQuestionHintTracking($this->getId(), $active_id, $pass);
586  $requests_statistic_data = $questionHintTracking->getRequestStatisticDataByQuestionAndTestpass();
587  $reached_points = $reached_points - $requests_statistic_data->getRequestsPoints();
588 
589  // adjust reached points regarding to tests scoring options
590  $reached_points = $this->adjustReachedPointsByScoringOptions($reached_points, $active_id);
591 
592  if (is_null($reached_points)) {
593  $reached_points = 0.0;
594  }
595 
596  // fau: testNav - check for existing authorized solution to know if a result record should be written
597  $existing_solutions = $this->lookupForExistingSolutions($active_id, $pass);
598 
599  $this->getProcessLocker()->executeUserQuestionResultUpdateOperation(
600  function () use ($active_id, $pass, $reached_points, $requests_statistic_data, $existing_solutions) {
601  $query = "
602  DELETE FROM tst_test_result
603 
604  WHERE active_fi = %s
605  AND question_fi = %s
606  AND pass = %s
607  ";
608 
609  $types = ['integer', 'integer', 'integer'];
610  $values = [$active_id, $this->getId(), $pass];
611 
612  if ($this->getStep() !== null) {
613  $query .= "
614  AND step = %s
615  ";
616 
617  $types[] = 'integer';
618  $values[] = $this->getStep();
619  }
620  $this->db->manipulateF($query, $types, $values);
621 
622  if ($existing_solutions['authorized']) {
623  $next_id = $this->db->nextId("tst_test_result");
624  $fieldData = [
625  'test_result_id' => ['integer', $next_id],
626  'active_fi' => ['integer', $active_id],
627  'question_fi' => ['integer', $this->getId()],
628  'pass' => ['integer', $pass],
629  'points' => ['float', $reached_points],
630  'tstamp' => ['integer', time()],
631  'hint_count' => ['integer', $requests_statistic_data->getRequestsCount()],
632  'hint_points' => ['float', $requests_statistic_data->getRequestsPoints()],
633  'answered' => ['integer', true]
634  ];
635 
636  if ($this->getStep() !== null) {
637  $fieldData['step'] = ['integer', $this->getStep()];
638  }
639 
640  $this->db->insert('tst_test_result', $fieldData);
641  }
642  }
643  );
644 
645  // update test pass results
646  $test = new ilObjTest(
647  $this->getObjId(),
648  false
649  );
650  $test->updateTestPassResults($active_id, $pass, $this->getProcessLocker());
651  ilCourseObjectiveResult::_updateObjectiveResult($this->current_user->getId(), $active_id, $this->getId());
652  }
adjustReachedPointsByScoringOptions(float $points, int $active_id)
Adjust the given reached points by checks for all special scoring options in the test container...
calculateReachedPoints(int $active_id, ?int $pass=null, bool $authorized_solution=true)
lookupForExistingSolutions(int $activeId, int $pass)
Lookup if an authorized or intermediate solution exists.
static _updateObjectiveResult(int $a_user_id, int $a_active_id, int $a_question_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cleanupMediaObjectUsage()

assQuestion::cleanupMediaObjectUsage ( )

Definition at line 2085 of file class.assQuestion.php.

References ilRTE\_cleanupMediaObjectUsage(), getId(), and getRTETextWithMediaObjects().

Referenced by saveToDb().

2085  : void
2086  {
2087  $combinedtext = $this->getRTETextWithMediaObjects();
2088  ilRTE::_cleanupMediaObjectUsage($combinedtext, "qpl:html", $this->getId());
2089  }
static _cleanupMediaObjectUsage(string $a_text, string $a_usage_type, int $a_usage_id)
Synchronises appearances of media objects in $a_text with media object usage table.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cloneHints()

assQuestion::cloneHints ( int  $source_question_id,
int  $target_question_id 
)

Definition at line 2029 of file class.assQuestion.php.

Referenced by syncWithOriginal().

2032  : void {
2033  // delete hints of the original
2034  $this->db->manipulateF(
2035  "DELETE FROM qpl_hints WHERE qht_question_fi = %s",
2036  ['integer'],
2037  [$target_question_id]
2038  );
2039 
2040  // get hints of the actual question
2041  $result = $this->db->queryF(
2042  "SELECT * FROM qpl_hints WHERE qht_question_fi = %s",
2043  ['integer'],
2044  [$source_question_id]
2045  );
2046 
2047  // save hints to the original
2048  if ($this->db->numRows($result) < 1) {
2049  return;
2050  }
2051 
2052  while ($row = $this->db->fetchAssoc($result)) {
2053  $next_id = $this->db->nextId('qpl_hints');
2054  $this->db->insert(
2055  'qpl_hints',
2056  [
2057  'qht_hint_id' => ['integer', $next_id],
2058  'qht_question_fi' => ['integer', $target_question_id],
2059  'qht_hint_index' => ['integer', $row["qht_hint_index"]],
2060  'qht_hint_points' => ['float', $row["qht_hint_points"]],
2061  'qht_hint_text' => ['text', $row["qht_hint_text"]],
2062  ]
2063  );
2064  }
2065  }
+ Here is the caller graph for this function:

◆ clonePageOfQuestion()

assQuestion::clonePageOfQuestion ( int  $a_q_id)

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

1065  : void
1066  {
1067  if ($a_q_id > 0) {
1068  $page = new ilAssQuestionPage($a_q_id);
1069  $page->buildDom();
1070  ilPCPlugged::handleCopiedPluggedContent($page, $page->getDomDoc());
1071  $xml = str_replace("il__qst_" . $a_q_id, "il__qst_" . $this->id, $page->getXMLFromDom());
1072  $this->page->setXMLContent($xml);
1073  $this->page->updateFromXML();
1074  }
1075  }
buildDom(bool $a_force=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getDomDoc()
Get dom doc (DOMDocument)
ilAssQuestionPage $page
getXMLFromDom(bool $a_incl_head=false, bool $a_append_mobs=false, bool $a_append_bib=false, string $a_append_str="", bool $a_omit_pageobject_tag=false, int $style_id=0, bool $offline=false)
get xml content of page from dom (use this, if any changes are made to the document) ...

◆ cloneQuestionTypeSpecificProperties()

assQuestion::cloneQuestionTypeSpecificProperties ( self  $target)
protected

Definition at line 1369 of file class.assQuestion.php.

Referenced by copyObject(), createNewOriginalFromThisDuplicate(), duplicate(), and syncWithOriginal().

1371  : self {
1372  return $target;
1373  }
+ Here is the caller graph for this function:

◆ cloneSuggestedSolutionFiles()

assQuestion::cloneSuggestedSolutionFiles ( int  $source_question_id,
int  $target_question_id 
)
protected

Definition at line 1595 of file class.assQuestion.php.

References ilFileUtils\delDir(), getSuggestedSolutionPath(), and ilFileUtils\makeDirParents().

Referenced by cloneSuggestedSolutions(), and onDuplicate().

1598  : void {
1599  $filepath_target = $this->getSuggestedSolutionPath();
1600  $filepath_original = str_replace("/$target_question_id/solution", "/$source_question_id/solution", $filepath_target);
1601  ilFileUtils::delDir($filepath_original);
1602  foreach ($this->suggested_solutions as $solution) {
1603  if (!$solution->isOfTypeFile()
1604  || $solution->getFilename() === '') {
1605  continue;
1606  }
1607 
1608  if (!file_exists($filepath_original)) {
1609  ilFileUtils::makeDirParents($filepath_original);
1610  }
1611 
1612  if (!is_file($filepath_original . $solution->getFilename())
1613  || copy($filepath_target . $solution->getFilename(), $filepath_target . $solution->getFilename())) {
1614  $this->log->root()->error('File for suggested solutions could not be cloned:');
1615  $this->log->root()->error("Question-Id: {$this->id}; Question-Title: {$this->title}; File: {$filepath_original}{$solution->getFilename()}");
1616  }
1617  }
1618  }
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cloneSuggestedSolutions()

assQuestion::cloneSuggestedSolutions ( int  $source_question_id,
int  $target_question_id 
)
protected

Definition at line 1559 of file class.assQuestion.php.

References cloneSuggestedSolutionFiles(), and getSuggestedSolutionsRepo().

Referenced by syncWithOriginal().

1562  : void {
1563  $this->getSuggestedSolutionsRepo()->clone($source_question_id, $target_question_id);
1564  $this->cloneSuggestedSolutionFiles($source_question_id, $target_question_id);
1565  }
cloneSuggestedSolutionFiles(int $source_question_id, int $target_question_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cloneXHTMLMediaObjectsOfQuestion()

assQuestion::cloneXHTMLMediaObjectsOfQuestion ( int  $source_question_id)

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

References ilObjMediaObject\_getMobsOfObject(), ilObjMediaObject\_saveUsage(), and getId().

Referenced by syncWithOriginal().

1045  : void
1046  {
1047  $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $source_question_id);
1048  foreach ($mobs as $mob) {
1049  ilObjMediaObject::_saveUsage($mob, "qpl:html", $this->getId());
1050  }
1051  }
static _saveUsage(int $a_mob_id, string $a_type, int $a_id, int $a_usage_hist_nr=0, string $a_lang="-")
Save usage of mob within another container (e.g.
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:
+ Here is the caller graph for this function:

◆ convertISO8601FormatH_i_s_ExtendedToSeconds()

static assQuestion::convertISO8601FormatH_i_s_ExtendedToSeconds ( string  $time)
static

Definition at line 2772 of file class.assQuestion.php.

References ILIAS\Repository\int().

2772  : int
2773  {
2774  $sec = 0;
2775  $time_array = explode(':', $time);
2776  if (count($time_array) == 3) {
2777  $sec += (int) $time_array[0] * 3600;
2778  $sec += (int) $time_array[1] * 60;
2779  $sec += (int) $time_array[2];
2780  }
2781  return $sec;
2782  }
+ Here is the call graph for this function:

◆ copyObject()

assQuestion::copyObject ( int  $target_parent_id,
string  $title = '' 
)
final

Definition at line 1312 of file class.assQuestion.php.

References cloneQuestionTypeSpecificProperties(), getId(), and getObjId().

1315  : int {
1316  if ($this->getId() <= 0) {
1317  throw new RuntimeException('The question has not been saved. It cannot be duplicated');
1318  }
1319  // duplicate the question in database
1320  $clone = clone $this;
1321  $clone->id = -1;
1322  $source_parent_id = $this->getObjId();
1323  $clone->setObjId($target_parent_id);
1324  if ($title) {
1325  $clone->setTitle($title);
1326  }
1327  $clone->saveToDb();
1328  $clone->clonePageOfQuestion($this->id);
1329  $clone->cloneXHTMLMediaObjectsOfQuestion($this->id);
1330  $clone = $this->cloneQuestionTypeSpecificProperties($clone);
1331 
1332  $clone->onCopy($source_parent_id, $this->id, $clone->getObjId(), $clone->getId());
1333 
1334  return $clone->id;
1335  }
cloneQuestionTypeSpecificProperties(self $target)
+ Here is the call graph for this function:

◆ copySuggestedSolutions()

assQuestion::copySuggestedSolutions ( int  $target_question_id)
protected

Definition at line 1620 of file class.assQuestion.php.

References getSuggestedSolutions(), and getSuggestedSolutionsRepo().

Referenced by onCopy(), and onDuplicate().

1620  : void
1621  {
1622  $update = [];
1623  foreach ($this->getSuggestedSolutions() as $index => $solution) {
1624  $solution = $solution->withQuestionId($target_question_id);
1625  $update[] = $solution;
1626  }
1627  $this->getSuggestedSolutionsRepo()->update($update);
1628  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createNewOriginalFromThisDuplicate()

assQuestion::createNewOriginalFromThisDuplicate ( int  $target_parent_id,
string  $target_question_title = '' 
)
final

Definition at line 1337 of file class.assQuestion.php.

References $id, cloneQuestionTypeSpecificProperties(), getId(), and getObjId().

1340  : int {
1341  if ($this->getId() <= 0) {
1342  throw new RuntimeException('The question has not been saved. It cannot be duplicated');
1343  }
1344 
1345  $source_question_id = $this->id;
1346  $source_parent_id = $this->getObjId();
1347 
1348  // duplicate the question in database
1349  $clone = clone $this;
1350  $clone->id = -1;
1351 
1352  $clone->setObjId($target_parent_id);
1353 
1354  if ($target_question_title) {
1355  $clone->setTitle($target_question_title);
1356  }
1357 
1358  $clone->saveToDb();
1359  $clone->clonePageOfQuestion($source_question_id);
1360  $clone->cloneXHTMLMediaObjectsOfQuestion($source_question_id);
1361 
1362  $clone = $this->cloneQuestionTypeSpecificProperties($clone);
1363 
1364  $clone->onCopy($source_parent_id, $source_question_id, $clone->getObjId(), $clone->getId());
1365 
1366  return $clone->id;
1367  }
cloneQuestionTypeSpecificProperties(self $target)
+ Here is the call graph for this function:

◆ createNewQuestion()

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

Returns
integer ID of the new question

Definition at line 1173 of file class.assQuestion.php.

References createPageObject(), getAdditionalContentEditingMode(), getAuthor(), getDefaultNrOfTries(), getExternalId(), getId(), getObjId(), getQuestionTypeID(), and setId().

1173  : int
1174  {
1175  $complete = '0';
1176  $obj_id = $this->getObjId();
1177  if ($obj_id <= 0
1178  && $this->questionpool_request->hasRefId()) {
1179  $obj_id = $this->questionpool_request->getRefId();
1180  }
1181 
1182  if ($obj_id <= 0) {
1183  $obj_id = $this->questionpool_request->int('sel_qpl');
1184  }
1185 
1186  if ($obj_id <= 0) {
1187  return $this->getId();
1188  }
1189 
1190  $tstamp = time();
1191  if ($a_create_page) {
1192  $tstamp = 0;
1193  }
1194 
1195  $next_id = $this->db->nextId('qpl_questions');
1196  $this->db->insert("qpl_questions", [
1197  "question_id" => ["integer", $next_id],
1198  "question_type_fi" => ["integer", $this->getQuestionTypeID()],
1199  "obj_fi" => ["integer", $obj_id],
1200  "title" => ["text", ''],
1201  "description" => ["text", ''],
1202  "author" => ["text", $this->getAuthor()],
1203  "owner" => ["integer", $this->current_user->getId()],
1204  "question_text" => ["clob", ''],
1205  "points" => ["float", "0.0"],
1206  "nr_of_tries" => ["integer", $this->getDefaultNrOfTries()], // #10771
1207  "complete" => ["text", $complete],
1208  "created" => ["integer", time()],
1209  "original_id" => ["integer", null],
1210  "tstamp" => ["integer", $tstamp],
1211  "external_id" => ["text", $this->getExternalId()],
1212  'add_cont_edit_mode' => ['text', $this->getAdditionalContentEditingMode()]
1213  ]);
1214  $this->setId($next_id);
1215 
1216  if ($a_create_page) {
1217  // create page object of question
1218  $this->createPageObject();
1219  }
1220 
1221  return $this->getId();
1222  }
setId(int $id=-1)
+ Here is the call graph for this function:

◆ createPageObject()

assQuestion::createPageObject ( )

Definition at line 1053 of file class.assQuestion.php.

References getId(), and getObjId().

Referenced by createNewQuestion(), and saveQuestionDataToDb().

1053  : void
1054  {
1055  $qpl_id = $this->getObjId();
1056  $this->page = new ilAssQuestionPage(0);
1057  $this->page->setId($this->getId());
1058  $this->page->setParentId($qpl_id);
1059  $this->page->setXMLContent("<PageObject><PageContent>" .
1060  "<Question QRef=\"il__qst_" . $this->getId() . "\"/>" .
1061  "</PageContent></PageObject>");
1062  $this->page->create(false);
1063  }
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:

◆ deductHintPointsFromReachedPoints()

assQuestion::deductHintPointsFromReachedPoints ( ilAssQuestionPreviewSession  $preview_session,
  $reached_points 
)

Definition at line 1840 of file class.assQuestion.php.

Referenced by assNumeric\calculateReachedPointsFromPreviewSession(), assErrorText\calculateReachedPointsFromPreviewSession(), assSingleChoice\calculateReachedPointsFromPreviewSession(), assOrderingQuestion\calculateReachedPointsFromPreviewSession(), assFormulaQuestion\calculateReachedPointsFromPreviewSession(), assClozeTest\calculateReachedPointsFromPreviewSession(), and calculateReachedPointsFromPreviewSession().

1840  : ?float
1841  {
1842  $hint_tracking = new ilAssQuestionPreviewHintTracking($this->db, $preview_session);
1843  $requests_statistic_data = $hint_tracking->getRequestStatisticData();
1844  return $reached_points - $requests_statistic_data->getRequestsPoints();
1845  }
+ Here is the caller graph for this function:

◆ delete()

assQuestion::delete ( int  $question_id)

Definition at line 879 of file class.assQuestion.php.

References Vendor\Package\$e, ilObjMediaObject\_exists(), ilObjMediaObject\_getMobsOfObject(), ilObjMediaObject\_removeUsage(), ilObjQuestionPool\_updateQuestionCount(), CLIENT_WEB_DIR, ilFileUtils\delDir(), deleteAdditionalTableData(), deleteAnswers(), deleteComments(), ilAssQuestionHintList\deleteHintsByQuestionIds(), deletePageOfQuestion(), deleteTaxonomyAssignments(), getObjId(), getSuggestedSolutionsRepo(), and isAdditionalContentEditingModePageObject().

879  : void
880  {
881  if ($question_id < 1) {
882  return;
883  }
884 
885  $result = $this->db->queryF(
886  "SELECT obj_fi FROM qpl_questions WHERE question_id = %s",
887  ['integer'],
888  [$question_id]
889  );
890  if ($this->db->numRows($result) !== 1) {
891  return;
892  }
893 
894  $row = $this->db->fetchAssoc($result);
895  $obj_id = $row["obj_fi"];
896 
897  try {
898  $this->deletePageOfQuestion($question_id);
899  } catch (Exception $e) {
900  $this->log->root()->error("EXCEPTION: Could not delete page of question $question_id: $e");
901  return;
902  }
903 
904  $affectedRows = $this->db->manipulateF(
905  "DELETE FROM qpl_questions WHERE question_id = %s",
906  ['integer'],
907  [$question_id]
908  );
909  if ($affectedRows == 0) {
910  return;
911  }
912 
913  try {
914  $this->deleteAdditionalTableData($question_id);
915  $this->deleteAnswers($question_id);
916  $this->feedbackOBJ->deleteGenericFeedbacks($question_id, $this->isAdditionalContentEditingModePageObject());
917  $this->feedbackOBJ->deleteSpecificAnswerFeedbacks($question_id, $this->isAdditionalContentEditingModePageObject());
918  } catch (Exception $e) {
919  $this->log->root()->error("EXCEPTION: Could not delete additional table data of question {$question_id}: {$e}");
920  }
921 
922  try {
923  // delete the question in the tst_test_question table (list of test questions)
924  $affectedRows = $this->db->manipulateF(
925  "DELETE FROM tst_test_question WHERE question_fi = %s",
926  ['integer'],
927  [$question_id]
928  );
929  } catch (Exception $e) {
930  $this->log->root()->error("EXCEPTION: Could not delete delete question {$question_id} from a test: {$e}");
931  }
932 
933  try {
934  $this->getSuggestedSolutionsRepo()->deleteForQuestion($question_id);
935  } catch (Exception $e) {
936  $this->log->root()->error("EXCEPTION: Could not delete suggested solutions of question {$question_id}: {$e}");
937  }
938 
939  $directory = CLIENT_WEB_DIR . "/assessment/" . $obj_id . "/$question_id";
940  try {
941  if (is_dir($directory)) {
942  ilFileUtils::delDir($directory);
943  }
944  } catch (Exception $e) {
945  $this->log->root()->error("EXCEPTION: Could not delete question file directory {$directory} of question {$question_id}: {$e}");
946  }
947 
948  try {
949  $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $question_id);
950  // remaining usages are not in text anymore -> delete them
951  // and media objects (note: delete method of ilObjMediaObject
952  // checks whether object is used in another context; if yes,
953  // the object is not deleted!)
954  foreach ($mobs as $mob) {
955  ilObjMediaObject::_removeUsage($mob, "qpl:html", $question_id);
956  if (ilObjMediaObject::_exists($mob)) {
957  $mob_obj = new ilObjMediaObject($mob);
958  $mob_obj->delete();
959  }
960  }
961  } catch (Exception $e) {
962  $this->log->root()->error("EXCEPTION: Error deleting the media objects of question {$question_id}: {$e}");
963  }
964  ilAssQuestionHintTracking::deleteRequestsByQuestionIds([$question_id]);
966  $assignmentList = new ilAssQuestionSkillAssignmentList($this->db);
967  $assignmentList->setParentObjId($obj_id);
968  $assignmentList->setQuestionIdFilter($question_id);
969  $assignmentList->loadFromDb();
970  foreach ($assignmentList->getAssignmentsByQuestionId($question_id) as $assignment) {
971  /* @var ilAssQuestionSkillAssignment $assignment */
972  $assignment->deleteFromDb();
973 
974  // remove skill usage
975  if (!$assignment->isSkillUsed()) {
976  $this->skillUsageService->removeUsage(
977  $assignment->getParentObjId(),
978  $assignment->getSkillBaseId(),
979  $assignment->getSkillTrefId()
980  );
981  }
982  }
983 
984  $this->deleteTaxonomyAssignments();
985  $this->deleteComments();
986 
987  try {
989  } catch (Exception $e) {
990  $this->log->root()->error(
991  "EXCEPTION: Error updating the question pool question count of"
992  . " question pool {$this->getObjId()} when deleting question {$question_id}: {$e}"
993  );
994  }
995  }
deletePageOfQuestion(int $question_id)
deleteAdditionalTableData(int $question_id)
deleteAnswers(int $question_id)
static deleteHintsByQuestionIds(array $questionIds)
Deletes all question hints relating to questions included in given question ids.
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
const CLIENT_WEB_DIR
Definition: constants.php:47
static _exists(int $id, bool $reference=false, ?string $type=null)
static _getMobsOfObject(string $a_type, int $a_id, int $a_usage_hist_nr=0, string $a_lang="-")
static _removeUsage(int $a_mob_id, string $a_type, int $a_id, int $a_usage_hist_nr=0, string $a_lang="-")
Remove usage of mob in another container.
static _updateQuestionCount(int $object_id)
isAdditionalContentEditingModePageObject()
+ Here is the call graph for this function:

◆ deleteAdditionalTableData()

assQuestion::deleteAdditionalTableData ( int  $question_id)

Definition at line 852 of file class.assQuestion.php.

References getAdditionalTableName().

Referenced by delete().

852  : void
853  {
854  $additional_table_name = $this->getAdditionalTableName();
855 
856  if (!is_array($additional_table_name)) {
857  $additional_table_name = [$additional_table_name];
858  }
859 
860  foreach ($additional_table_name as $table) {
861  if (strlen($table)) {
862  $this->db->manipulateF(
863  "DELETE FROM $table WHERE question_fi = %s",
864  ['integer'],
865  [$question_id]
866  );
867  }
868  }
869  }
getAdditionalTableName()
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteAnswers()

assQuestion::deleteAnswers ( int  $question_id)

Definition at line 833 of file class.assQuestion.php.

References getAnswerTableName().

Referenced by delete().

833  : void
834  {
835  $answer_table_name = $this->getAnswerTableName();
836 
837  if (!is_array($answer_table_name)) {
838  $answer_table_name = [$answer_table_name];
839  }
840 
841  foreach ($answer_table_name as $table) {
842  if (strlen($table)) {
843  $this->db->manipulateF(
844  "DELETE FROM $table WHERE question_fi = %s",
845  ['integer'],
846  [$question_id]
847  );
848  }
849  }
850  }
getAnswerTableName()
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteComments()

assQuestion::deleteComments ( )
protected

Definition at line 1509 of file class.assQuestion.php.

References getId(), getNotesManager(), getNotesRepo(), and getObjId().

Referenced by delete().

1509  : void
1510  {
1511  $repo = $this->getNotesRepo();
1512  $manager = $this->getNotesManager();
1513  $source_id = $this->getId();
1514  $notes = $manager->getNotesForRepositoryObjIds([$this->getObjId()], Note::PUBLIC);
1515  $notes = array_filter(
1516  $notes,
1517  fn($n) => $n->getContext()->getSubObjId() === $source_id
1518  );
1519  foreach ($notes as $note) {
1520  $repo->deleteNote($note->getId());
1521  }
1522  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteDummySolutionRecord()

assQuestion::deleteDummySolutionRecord ( int  $activeId,
int  $passIndex 
)
protected

Definition at line 2676 of file class.assQuestion.php.

References getSolutionValues(), and removeSolutionRecordById().

Referenced by assFileUpload\saveWorkingData().

2676  : void
2677  {
2678  foreach ($this->getSolutionValues($activeId, $passIndex, false) as $solutionRec) {
2679  if ($solutionRec['value1'] == '' && $solutionRec['value2'] == '') {
2680  $this->removeSolutionRecordById($solutionRec['solution_id']);
2681  }
2682  }
2683  }
getSolutionValues(int $active_id, ?int $pass=null, bool $authorized=true)
Loads solutions of a given user from the database an returns it.
removeSolutionRecordById(int $solutionId)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deletePageOfQuestion()

assQuestion::deletePageOfQuestion ( int  $question_id)
protected

Definition at line 871 of file class.assQuestion.php.

References ilPageObject\_exists().

Referenced by delete().

871  : void
872  {
873  if (ilAssQuestionPage::_exists('qpl', $question_id, "", true)) {
874  $page = new ilAssQuestionPage($question_id);
875  $page->delete();
876  }
877  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilAssQuestionPage $page
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteSolutionRecordByValues()

assQuestion::deleteSolutionRecordByValues ( int  $activeId,
int  $passIndex,
bool  $authorized,
array  $matchValues 
)
protected

Definition at line 2690 of file class.assQuestion.php.

References getId(), getStep(), and ILIAS\Repository\int().

2690  : void
2691  {
2692  $types = ["integer", "integer", "integer", "integer"];
2693  $values = [$activeId, $this->getId(), $passIndex, (int) $authorized];
2694  $valuesCondition = [];
2695 
2696  foreach ($matchValues as $valueField => $value) {
2697  switch ($valueField) {
2698  case 'value1':
2699  case 'value2':
2700  $valuesCondition[] = "{$valueField} = %s";
2701  $types[] = 'text';
2702  $values[] = $value;
2703  break;
2704 
2705  default:
2706  throw new ilTestQuestionPoolException('invalid value field given: ' . $valueField);
2707  }
2708  }
2709 
2710  $valuesCondition = implode(' AND ', $valuesCondition);
2711 
2712  $query = "
2713  DELETE FROM tst_solutions
2714  WHERE active_fi = %s
2715  AND question_fi = %s
2716  AND pass = %s
2717  AND authorized = %s
2718  AND $valuesCondition
2719  ";
2720 
2721  if ($this->getStep() !== null) {
2722  $query .= " AND step = %s ";
2723  $types[] = 'integer';
2724  $values[] = $this->getStep();
2725  }
2726 
2727  $this->db->manipulateF($query, $types, $values);
2728  }
+ Here is the call graph for this function:

◆ deleteSuggestedSolutions()

assQuestion::deleteSuggestedSolutions ( )

Definition at line 1542 of file class.assQuestion.php.

References ilInternalLink\_deleteAllLinksOfSource(), ilFileUtils\delDir(), getId(), getSuggestedSolutionPath(), and getSuggestedSolutionsRepo().

1542  : void
1543  {
1544  $this->getSuggestedSolutionsRepo()->deleteForQuestion($this->getId());
1547  $this->suggested_solutions = [];
1548  }
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
+ Here is the call graph for this function:

◆ deleteTaxonomyAssignments()

assQuestion::deleteTaxonomyAssignments ( )
private

Definition at line 997 of file class.assQuestion.php.

References getId(), getObjId(), and ilObjTaxonomy\getUsageOfObject().

Referenced by delete().

997  : void
998  {
999  $taxIds = ilObjTaxonomy::getUsageOfObject($this->getObjId());
1000 
1001  foreach ($taxIds as $taxId) {
1002  $taxNodeAssignment = new ilTaxNodeAssignment('qpl', $this->getObjId(), 'quest', $taxId);
1003  $taxNodeAssignment->deleteAssignmentsOfItem($this->getId());
1004  }
1005  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getUsageOfObject(int $a_obj_id, bool $a_include_titles=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ duplicate()

assQuestion::duplicate ( bool  $for_test = true,
string  $title = '',
string  $author = '',
int  $owner = -1,
  $test_obj_id = null 
)

Definition at line 1268 of file class.assQuestion.php.

References cloneQuestionTypeSpecificProperties(), getId(), and getObjId().

1274  : int {
1275  if ($this->id <= 0) {
1276  // The question has not been saved. It cannot be duplicated
1277  return -1;
1278  }
1279 
1280  $clone = clone $this;
1281  $clone->id = -1;
1282 
1283  if ((int) $test_obj_id > 0) {
1284  $clone->setObjId($test_obj_id);
1285  }
1286 
1287  if ($title) {
1288  $clone->setTitle($title);
1289  }
1290  if ($author) {
1291  $clone->setAuthor($author);
1292  }
1293  if ($owner) {
1294  $clone->setOwner($owner);
1295  }
1296  if ($for_test) {
1297  $clone->saveToDb($this->id);
1298  } else {
1299  $clone->saveToDb();
1300  }
1301 
1302  $clone->clonePageOfQuestion($this->getId());
1303  $clone->cloneXHTMLMediaObjectsOfQuestion($this->getId());
1304 
1305  $clone = $this->cloneQuestionTypeSpecificProperties($clone);
1306 
1307  $clone->onDuplicate($this->getObjId(), $this->getId(), $clone->getObjId(), $clone->getId());
1308 
1309  return $clone->id;
1310  }
cloneQuestionTypeSpecificProperties(self $target)
+ Here is the call graph for this function:

◆ duplicateComments()

assQuestion::duplicateComments ( int  $parent_source_id,
int  $source_id,
int  $parent_target_id,
int  $target_id 
)
protected

Definition at line 1475 of file class.assQuestion.php.

References getNotesDataService(), and getNotesManager().

Referenced by onCopy(), and onDuplicate().

1480  : void {
1481  $manager = $this->getNotesManager();
1482  $data_service = $this->getNotesDataService();
1483  $notes = $manager->getNotesForRepositoryObjIds([$parent_source_id], Note::PUBLIC);
1484  $notes = array_filter(
1485  $notes,
1486  fn($n) => $n->getContext()->getSubObjId() === $source_id
1487  );
1488 
1489  foreach ($notes as $note) {
1490  $new_context = $data_service->context(
1491  $parent_target_id,
1492  $target_id,
1493  $note->getContext()->getType()
1494  );
1495  $new_note = $data_service->note(
1496  -1,
1497  $new_context,
1498  $note->getText(),
1499  $note->getAuthor(),
1500  $note->getType(),
1501  $note->getCreationDate(),
1502  $note->getUpdateDate(),
1503  $note->getRecipient()
1504  );
1505  $manager->createNote($new_note, [], true);
1506  }
1507  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ duplicateIntermediateSolutionAuthorized()

assQuestion::duplicateIntermediateSolutionAuthorized ( int  $activeId,
int  $passIndex 
)
protected

Definition at line 2730 of file class.assQuestion.php.

References getSolutionValues(), and saveCurrentSolution().

Referenced by forceExistingIntermediateSolution().

2730  : void
2731  {
2732  foreach ($this->getSolutionValues($activeId, $passIndex, false) as $rec) {
2733  $this->saveCurrentSolution($activeId, $passIndex, $rec['value1'], $rec['value2'], true, $rec['tstamp']);
2734  }
2735  }
getSolutionValues(int $active_id, ?int $pass=null, bool $authorized=true)
Loads solutions of a given user from the database an returns it.
saveCurrentSolution(int $active_id, int $pass, $value1, $value2, bool $authorized=true, $tstamp=0)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ duplicateQuestionHints()

assQuestion::duplicateQuestionHints ( int  $original_question_id,
int  $duplicate_question_id 
)
protected

Definition at line 2309 of file class.assQuestion.php.

References ilAssQuestionHintList\duplicateListForQuestion(), ensureHintPageObjectExists(), getId(), and isAdditionalContentEditingModePageObject().

Referenced by onCopy(), and onDuplicate().

2309  : void
2310  {
2311  $hintIds = ilAssQuestionHintList::duplicateListForQuestion($original_question_id, $duplicate_question_id);
2312 
2314  foreach ($hintIds as $originalHintId => $duplicateHintId) {
2315  $this->ensureHintPageObjectExists($originalHintId);
2316  $originalPageObject = new ilAssHintPage($originalHintId);
2317  $originalXML = $originalPageObject->getXMLContent();
2318 
2319  $duplicatePageObject = new ilAssHintPage();
2320  $duplicatePageObject->setId($duplicateHintId);
2321  $duplicatePageObject->setParentId($this->getId());
2322  $duplicatePageObject->setXMLContent($originalXML);
2323  $duplicatePageObject->createFromXML();
2324  }
2325  }
2326  }
ensureHintPageObjectExists($pageObjectId)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static duplicateListForQuestion($originalQuestionId, $duplicateQuestionId)
duplicates a hint list from given original question id to given duplicate question id and returns an ...
isAdditionalContentEditingModePageObject()
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ duplicateSkillAssignments()

assQuestion::duplicateSkillAssignments ( int  $srcParentId,
int  $srcQuestionId,
int  $trgParentId,
int  $trgQuestionId 
)
protected

Definition at line 2328 of file class.assQuestion.php.

Referenced by onCopy(), onDuplicate(), and syncSkillAssignments().

2328  : void
2329  {
2330  $assignmentList = new ilAssQuestionSkillAssignmentList($this->db);
2331  $assignmentList->setParentObjId($srcParentId);
2332  $assignmentList->setQuestionIdFilter($srcQuestionId);
2333  $assignmentList->loadFromDb();
2334 
2335  foreach ($assignmentList->getAssignmentsByQuestionId($srcQuestionId) as $assignment) {
2336  $assignment->setParentObjId($trgParentId);
2337  $assignment->setQuestionId($trgQuestionId);
2338  $assignment->saveToDb();
2339 
2340  // add skill usage
2341  $this->skillUsageService->addUsage(
2342  $trgParentId,
2343  $assignment->getSkillBaseId(),
2344  $assignment->getSkillTrefId()
2345  );
2346  }
2347  }
+ Here is the caller graph for this function:

◆ duplicateSuggestedSolutionFiles()

assQuestion::duplicateSuggestedSolutionFiles ( int  $parent_id,
int  $question_id 
)
protected

Duplicates the files of a suggested solution if the question is duplicated.

Definition at line 1570 of file class.assQuestion.php.

References getSuggestedSolutionPath(), and ilFileUtils\makeDirParents().

Referenced by onCopy().

1570  : void
1571  {
1572  foreach ($this->suggested_solutions as $solution) {
1573  if (!$solution->isOfTypeFile()
1574  || $solution->getFilename() === '') {
1575  continue;
1576  }
1577 
1578  $filepath = $this->getSuggestedSolutionPath();
1579  $filepath_original = str_replace(
1580  "/{$this->obj_id}/{$this->id}/solution",
1581  "/{$parent_id}/{$question_id}/solution",
1582  $filepath
1583  );
1584  if (!file_exists($filepath)) {
1585  ilFileUtils::makeDirParents($filepath);
1586  }
1587  if (!is_file($filepath_original . $solution->getFilename())
1588  || !copy($filepath_original . $solution->getFilename(), $filepath . $solution->getFilename())) {
1589  $this->log->root()->error('File for suggested solutions could not be duplicated:');
1590  $this->log->root()->error("Question-Id: {$this->id}; Question-Title: {$this->title}; File: {$filepath_original}{$solution->getFilename()}");
1591  }
1592  }
1593  }
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ensureHintPageObjectExists()

assQuestion::ensureHintPageObjectExists (   $pageObjectId)

Definition at line 2372 of file class.assQuestion.php.

References ilPageObject\_exists(), and getId().

Referenced by duplicateQuestionHints().

2372  : void
2373  {
2374  if (!ilAssHintPage::_exists('qht', $pageObjectId)) {
2375  $pageObject = new ilAssHintPage();
2376  $pageObject->setParentId($this->getId());
2377  $pageObject->setId($pageObjectId);
2378  $pageObject->createFromXML();
2379  }
2380  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ensureNonNegativePoints()

◆ explodeKeyValues()

static assQuestion::explodeKeyValues ( string  $keyValues)
static

Definition at line 2671 of file class.assQuestion.php.

References KEY_VALUES_IMPLOSION_SEPARATOR.

2671  : array
2672  {
2673  return explode(assQuestion::KEY_VALUES_IMPLOSION_SEPARATOR, $keyValues);
2674  }
const KEY_VALUES_IMPLOSION_SEPARATOR

◆ extendedTrim()

static assQuestion::extendedTrim ( string  $value)
static

Trim non-printable characters from the beginning and end of a string.

Note: The PHP trim() function is not fully Unicode-compatible and may not handle non-printable characters effectively. As a result, it may not trim certain Unicode characters, such as control characters, zero width characters or ideographic space as expected.

This method provides a workaround for trimming non-printable characters until PHP 8.4, where the mb_trim() function is introduced. Users are encouraged to migrate to mb_trim() for proper Unicode and non-printable character handling.

Parameters
string$valueThe string to trim.
Returns
string The trimmed string.

Definition at line 3008 of file class.assQuestion.php.

Referenced by assTextSubset\getSolutionSubmit(), and assTextSubsetGUI\writeAnswerSpecificPostData().

3008  : string
3009  {
3010  return preg_replace(self::TRIM_PATTERN, '', $value);
3011  }
+ Here is the caller graph for this function:

◆ fetchIndexedValuesFromValuePairs()

assQuestion::fetchIndexedValuesFromValuePairs ( array  $value_pairs)

Definition at line 2949 of file class.assQuestion.php.

Referenced by assOrderingQuestion\calculateReachedPoints(), assOrderingQuestion\getOrderingElementListForSolutionOutput(), assOrderingQuestion\getSolutionOrderingElementListForTestOutput(), assOrderingQuestion\solutionValuesToLog(), and assOrderingQuestion\solutionValuesToText().

2949  : array
2950  {
2951  $indexed_values = [];
2952 
2953  foreach ($value_pairs as $valuePair) {
2954  $indexed_values[$valuePair['value1']] = $valuePair['value2'];
2955  }
2956 
2957  return $indexed_values;
2958  }
+ Here is the caller graph for this function:

◆ fetchValuePairsFromIndexedValues()

assQuestion::fetchValuePairsFromIndexedValues ( array  $indexedValues)

Definition at line 2938 of file class.assQuestion.php.

2938  : array
2939  {
2940  $valuePairs = [];
2941 
2942  foreach ($indexedValues as $value1 => $value2) {
2943  $valuePairs[] = ['value1' => $value1, 'value2' => $value2];
2944  }
2945 
2946  return $valuePairs;
2947  }

◆ fixSvgToPng()

static assQuestion::fixSvgToPng ( string  $imageFilenameContainingString)

Definition at line 1102 of file class.assQuestion.php.

1102  : string
1103  {
1104  $needles = array_keys(self::$imageSourceFixReplaceMap);
1105  $replacements = array_values(self::$imageSourceFixReplaceMap);
1106  return str_replace($needles, $replacements, $imageFilenameContainingString);
1107  }

◆ fixUnavailableSkinImageSources()

assQuestion::fixUnavailableSkinImageSources ( string  $html)

Definition at line 1109 of file class.assQuestion.php.

References ilUtil\getImagePath(), and ilFileUtils\removeTrailingPathSeparators().

1109  : string
1110  {
1111  $matches = null;
1112  if (preg_match_all('/src="(.*?)"/m', $html, $matches)) {
1113  $sources = $matches[1];
1114 
1115  $needleReplacementMap = [];
1116 
1117  foreach ($sources as $src) {
1118  $file = ilFileUtils::removeTrailingPathSeparators(ILIAS_ABSOLUTE_PATH) . DIRECTORY_SEPARATOR . $src;
1119 
1120  if (file_exists($file)) {
1121  continue;
1122  }
1123 
1124  $levels = explode(DIRECTORY_SEPARATOR, $src);
1125  if (count($levels) < 5 || $levels[0] !== 'Customizing' || $levels[2] !== 'skin') {
1126  continue;
1127  }
1128 
1129  $component = '';
1130 
1131  if ($levels[4] === 'components/ILIAS' || $levels[4] === 'components/ILIAS') {
1132  $component = $levels[4] . DIRECTORY_SEPARATOR . $levels[5];
1133  }
1134 
1135  $needleReplacementMap[$src] = ilUtil::getImagePath(basename($src), $component);
1136  }
1137 
1138  if (count($needleReplacementMap)) {
1139  $html = str_replace(array_keys($needleReplacementMap), array_values($needleReplacementMap), $html);
1140  }
1141  }
1142 
1143  return $html;
1144  }
static removeTrailingPathSeparators(string $path)
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
+ Here is the call graph for this function:

◆ forceExistingIntermediateSolution()

assQuestion::forceExistingIntermediateSolution ( int  $activeId,
int  $passIndex,
bool  $considerDummyRecordCreation 
)
protected

Definition at line 2737 of file class.assQuestion.php.

References duplicateIntermediateSolutionAuthorized(), getSolutionValues(), saveCurrentSolution(), and updateCurrentSolutionsAuthorization().

Referenced by assFileUpload\saveWorkingData().

2737  : void
2738  {
2739  $intermediateSolution = $this->getSolutionValues($activeId, $passIndex, false);
2740 
2741  if (!count($intermediateSolution)) {
2742  $this->updateCurrentSolutionsAuthorization($activeId, $passIndex, false, true);
2743 
2744  // create a backup as authorized solution again (keeping timestamps)
2745  $this->duplicateIntermediateSolutionAuthorized($activeId, $passIndex);
2746 
2747  if ($considerDummyRecordCreation) {
2748  // create an additional dummy record to indicate the existence of an intermediate solution
2749  // even if all entries are deleted from the intermediate solution later
2750  $this->saveCurrentSolution($activeId, $passIndex, null, null, false);
2751  }
2752  }
2753  }
getSolutionValues(int $active_id, ?int $pass=null, bool $authorized=true)
Loads solutions of a given user from the database an returns it.
updateCurrentSolutionsAuthorization(int $activeId, int $pass, bool $authorized, bool $keepTime=false)
saveCurrentSolution(int $active_id, int $pass, $value1, $value2, bool $authorized=true, $tstamp=0)
duplicateIntermediateSolutionAuthorized(int $activeId, int $passIndex)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ formatSAQuestion()

◆ fromXML()

assQuestion::fromXML ( string  $importdirectory,
int  $user_id,
ilQTIItem  $item,
int  $questionpool_id,
?int  $tst_id,
?ilObject $tst_object,
int &  $question_counter,
array  $import_mapping,
array  $solutionhints = [] 
)
final

Definition at line 257 of file class.assQuestion.php.

References getQuestionType(), and importHint().

267  : array {
268  $classname = $this->getQuestionType() . "Import";
269  $import = new $classname($this);
270  $new_import_mapping = $import->fromXML(
271  $importdirectory,
272  $user_id,
273  $item,
274  $questionpool_id,
275  $tst_id,
276  $tst_object,
277  $question_counter,
278  $import_mapping
279  );
280 
281  foreach ($solutionhints as $hint) {
282  $this->importHint($import->getQuestionId(), $hint);
283  }
284 
285  return $new_import_mapping;
286  }
importHint(int $question_id, array $hint_array)
+ Here is the call graph for this function:

◆ getActiveUserData()

assQuestion::getActiveUserData ( int  $active_id)

Returns the user id and the test id for a given active id.

Parameters
integer$active_idActive id for a test/user
Returns
array Result array containing the user_id and test_id

Definition at line 2135 of file class.assQuestion.php.

2135  : array
2136  {
2137  $result = $this->db->queryF(
2138  "SELECT * FROM tst_active WHERE active_id = %s",
2139  ['integer'],
2140  [$active_id]
2141  );
2142  if ($this->db->numRows($result)) {
2143  $row = $this->db->fetchAssoc($result);
2144  return ["user_id" => $row["user_fi"], "test_id" => $row["test_fi"]];
2145  }
2146 
2147  return [];
2148  }

◆ getAdditionalContentEditingMode()

assQuestion::getAdditionalContentEditingMode ( )

◆ getAdditionalTableName()

assQuestion::getAdditionalTableName ( )
abstract

Referenced by deleteAdditionalTableData().

+ Here is the caller graph for this function:

◆ getAdjustedReachedPoints()

assQuestion::getAdjustedReachedPoints ( int  $active_id,
int  $pass,
bool  $authorized_solution = true 
)
final

Definition at line 564 of file class.assQuestion.php.

References adjustReachedPointsByScoringOptions(), calculateReachedPoints(), and getId().

564  : float
565  {
566  // determine reached points for submitted solution
567  $reached_points = $this->calculateReachedPoints($active_id, $pass, $authorized_solution);
568  $hint_tracking = new ilAssQuestionHintTracking($this->getId(), $active_id, $pass);
569  $requests_statistic_data = $hint_tracking->getRequestStatisticDataByQuestionAndTestpass();
570  $reached_points = $reached_points - $requests_statistic_data->getRequestsPoints();
571 
572  // adjust reached points regarding to tests scoring options
573  $reached_points = $this->adjustReachedPointsByScoringOptions($reached_points, $active_id);
574 
575  return $reached_points;
576  }
adjustReachedPointsByScoringOptions(float $points, int $active_id)
Adjust the given reached points by checks for all special scoring options in the test container...
calculateReachedPoints(int $active_id, ?int $pass=null, bool $authorized_solution=true)
+ Here is the call graph for this function:

◆ getAnswerTableName()

assQuestion::getAnswerTableName ( )
abstract

Referenced by deleteAnswers().

+ Here is the caller graph for this function:

◆ getAuthor()

assQuestion::getAuthor ( )

Definition at line 427 of file class.assQuestion.php.

References $author.

Referenced by createNewQuestion(), assOrderingQuestion\isComplete(), assClozeTest\isComplete(), and saveQuestionDataToDb().

427  : string
428  {
429  return $this->author;
430  }
+ Here is the caller graph for this function:

◆ getAuthorForHTMLOutput()

assQuestion::getAuthorForHTMLOutput ( )

Definition at line 432 of file class.assQuestion.php.

References ILIAS\Repository\refinery().

432  : string
433  {
434  return $this->refinery->string()->stripTags()->transform($this->author);
435  }
+ Here is the call graph for this function:

◆ getComment()

assQuestion::getComment ( )

Definition at line 393 of file class.assQuestion.php.

References $comment.

Referenced by saveQuestionDataToDb().

393  : string
394  {
395  return $this->comment;
396  }
+ Here is the caller graph for this function:

◆ getCorrectSolutionForTextOutput()

assQuestion::getCorrectSolutionForTextOutput ( int  $active_id,
int  $pass 
)

Definition at line 3078 of file class.assQuestion.php.

References getSolutionValues(), and solutionValuesToText().

3081  : array|string {
3082  return $this->solutionValuesToText(
3083  $this->getSolutionValues($active_id, $pass)
3084  );
3085  }
getSolutionValues(int $active_id, ?int $pass=null, bool $authorized=true)
Loads solutions of a given user from the database an returns it.
solutionValuesToText(array $solution_values)
MUST convert the given solution values into text.
+ Here is the call graph for this function:

◆ getCurrentSolutionResultSet()

assQuestion::getCurrentSolutionResultSet ( int  $active_id,
int  $pass,
bool  $authorized = true 
)
protected

Definition at line 2488 of file class.assQuestion.php.

References getId(), and getStep().

Referenced by assOrderingHorizontal\calculateReachedPoints(), assNumeric\calculateReachedPoints(), assFileUpload\calculateReachedPoints(), assErrorText\calculateReachedPoints(), assSingleChoice\calculateReachedPoints(), assTextSubset\calculateReachedPoints(), assMultipleChoice\calculateReachedPoints(), assTextQuestion\calculateReachedPoints(), assKprimChoice\calculateReachedPoints(), assLongMenu\calculateReachedPoints(), assMatchingQuestion\calculateReachedPoints(), assClozeTest\fetchUserResult(), assNumeric\saveWorkingData(), and assSingleChoice\saveWorkingData().

2488  : \ilDBStatement
2489  {
2490  if ($this->getStep() !== null) {
2491  $query = "
2492  SELECT *
2493  FROM tst_solutions
2494  WHERE active_fi = %s
2495  AND question_fi = %s
2496  AND pass = %s
2497  AND step = %s
2498  AND authorized = %s
2499  ";
2500 
2501  return $this->db->queryF(
2502  $query,
2503  ['integer', 'integer', 'integer', 'integer', 'integer'],
2504  [$active_id, $this->getId(), $pass, $this->getStep(), (int) $authorized]
2505  );
2506  }
2507 
2508  $query = "
2509  SELECT *
2510  FROM tst_solutions
2511  WHERE active_fi = %s
2512  AND question_fi = %s
2513  AND pass = %s
2514  AND authorized = %s
2515  ";
2516 
2517  return $this->db->queryF(
2518  $query,
2519  ['integer', 'integer', 'integer', 'integer'],
2520  [$active_id, $this->getId(), $pass, (int) $authorized]
2521  );
2522  }
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:

◆ getCurrentUser()

assQuestion::getCurrentUser ( )

Definition at line 232 of file class.assQuestion.php.

References $current_user.

Referenced by isWriteable().

232  : ilObjUser
233  {
234  return $this->current_user;
235  }
ilObjUser $current_user
+ Here is the caller graph for this function:

◆ getDefaultNrOfTries()

assQuestion::getDefaultNrOfTries ( )

Definition at line 2289 of file class.assQuestion.php.

References $defaultnroftries.

Referenced by createNewQuestion().

2289  : int
2290  {
2291  return $this->defaultnroftries;
2292  }
+ Here is the caller graph for this function:

◆ getDescriptionForHTMLOutput()

assQuestion::getDescriptionForHTMLOutput ( )

Definition at line 398 of file class.assQuestion.php.

References ILIAS\UI\examples\Symbol\Glyph\Comment\comment(), and ILIAS\Repository\refinery().

398  : string
399  {
400  return $this->refinery->encode()->htmlSpecialCharsAsEntities()->transform($this->comment);
401  }
comment()
description: > Example for rendring a comment glyph.
Definition: comment.php:25
+ Here is the call graph for this function:

◆ getExternalId()

assQuestion::getExternalId ( )

Definition at line 467 of file class.assQuestion.php.

References $external_id, getId(), and IL_INST_ID.

Referenced by createNewQuestion(), and saveQuestionDataToDb().

467  : string
468  {
469  if ($this->external_id === null || $this->external_id === '') {
470  if ($this->getId() > 0) {
471  return 'il_' . IL_INST_ID . '_qst_' . $this->getId();
472  }
473  return uniqid('', true);
474  }
475  return $this->external_id;
476  }
const IL_INST_ID
Definition: constants.php:40
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFeedbackClassNameByQuestionType()

static assQuestion::getFeedbackClassNameByQuestionType ( string  $questionType)
static

Definition at line 2155 of file class.assQuestion.php.

References $DIC, $ilDB, and ILIAS\TestQuestionPool\Questions\GeneralQuestionPropertiesRepository\getForQuestionId().

Referenced by assQuestionGUI\_getQuestionGUI().

2155  : string
2156  {
2157  return str_replace('ass', 'ilAss', $questionType) . 'Feedback';
2158  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHtmlQuestionContentPurifier()

assQuestion::getHtmlQuestionContentPurifier ( )
Returns
ilHtmlPurifierInterface|ilAssHtmlUserSolutionPurifier

Definition at line 2461 of file class.assQuestion.php.

References ilHtmlPurifierFactory\getInstanceByType().

Referenced by assSingleChoice\addAnswer(), assKprimChoice\addAnswer(), assMultipleChoice\addAnswer(), assClozeTest\getClozeTextForHTMLOutput(), purifyAndPrepareTextAreaOutput(), assKprimChoice\setAnswers(), and assLongMenu\setLongMenuTextValue().

2462  {
2463  return ilHtmlPurifierFactory::getInstanceByType('qpl_usersolution');
2464  }
Interface for html sanitizing functionality.
static getInstanceByType(string $type)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHtmlUserSolutionPurifier()

assQuestion::getHtmlUserSolutionPurifier ( )
Returns
ilHtmlPurifierInterface|ilAssHtmlUserSolutionPurifier

Definition at line 2453 of file class.assQuestion.php.

References ilHtmlPurifierFactory\getInstanceByType().

Referenced by assTextQuestion\getSolutionSubmit(), and assTextSubset\getSolutionSubmit().

2454  {
2455  return ilHtmlPurifierFactory::getInstanceByType('qpl_usersolution');
2456  }
Interface for html sanitizing functionality.
static getInstanceByType(string $type)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getId()

assQuestion::getId ( )

Definition at line 378 of file class.assQuestion.php.

References $id.

Referenced by ilQuestionUsagesTableGUI\__construct(), ilQuestionCumulatedStatisticsTableGUI\__construct(), ilAssQuestionHintsOrderingClipboard\__construct(), assLongMenu\buildFolderName(), assOrderingQuestion\buildNestedOrderingElementInputGui(), assClozeTest\calculateCombinationResult(), calculateResultsFromSolution(), cleanupMediaObjectUsage(), assOrderingQuestion\cloneQuestionTypeSpecificProperties(), assSingleChoice\cloneQuestionTypeSpecificProperties(), assMultipleChoice\cloneQuestionTypeSpecificProperties(), assImagemapQuestion\cloneQuestionTypeSpecificProperties(), assMatchingQuestion\cloneQuestionTypeSpecificProperties(), assKprimChoice\cloneQuestionTypeSpecificProperties(), assFormulaQuestion\cloneQuestionTypeSpecificProperties(), assClozeTest\cloneQuestionTypeSpecificProperties(), cloneXHTMLMediaObjectsOfQuestion(), copyObject(), createNewOriginalFromThisDuplicate(), createNewQuestion(), createPageObject(), deleteComments(), deleteSolutionRecordByValues(), deleteSuggestedSolutions(), deleteTaxonomyAssignments(), duplicate(), assTextQuestion\duplicateAnswers(), duplicateQuestionHints(), ensureHintPageObjectExists(), assOrderingQuestion\fetchSolutionListFromFormSubmissionData(), getAdjustedReachedPoints(), assFormulaQuestion\getBestSolution(), assLongMenu\getCorrectAnswersAsJson(), getCurrentSolutionResultSet(), assErrorText\getErrorDataAsArrayForJS(), getExternalId(), assFileUpload\getFileUploadPath(), assFileUpload\getFileUploadPathWeb(), getInstances(), assTextQuestion\getLatestAutosaveContent(), assClozeTest\getMaximumPoints(), assOrderingQuestion\getOrderingElementList(), assErrorText\getParsedErrorTextForJS(), getReachedPoints(), assMultipleChoice\getRTETextWithMediaObjects(), assSingleChoice\getRTETextWithMediaObjects(), getRTETextWithMediaObjects(), getSolutionMaxPass(), assOrderingQuestion\getSolutionOrderingElementList(), getSolutionValues(), assFileUpload\getUploadedFiles(), assNumeric\getUserQuestionResult(), assOrderingHorizontal\getUserQuestionResult(), assTextSubset\getUserQuestionResult(), assErrorText\getUserQuestionResult(), assSingleChoice\getUserQuestionResult(), assMultipleChoice\getUserQuestionResult(), assOrderingQuestion\getUserQuestionResult(), assFormulaQuestion\getUserQuestionResult(), assMatchingQuestion\getUserQuestionResult(), assClozeTest\getUserQuestionResult(), assFormulaQuestion\getVariableSolutionValuesForPass(), assFileUpload\hasFileUploads(), isAnswered(), isWriteable(), assTextQuestion\loadFromDb(), loadSuggestedSolutions(), assLongMenu\lookupForExistingSolutions(), assFormulaQuestion\lookupForExistingSolutions(), lookupForExistingSolutions(), lookupMaxStep(), migrateContentForLearningModule(), ilAssNestedOrderingElementsInputGUI\prepareReprintable(), removeAllExistingSolutions(), removeCurrentSolution(), assFormulaQuestion\removeExistingSolutions(), removeExistingSolutions(), removeResultRecord(), ilAssOrderingQuestionAuthoringFormGUI\renewOrderingElementInput(), resolveSuggestedSolutionLinks(), assFileUpload\saveAdditionalQuestionDataToDb(), assErrorText\saveAdditionalQuestionDataToDb(), assImagemapQuestion\saveAdditionalQuestionDataToDb(), assMatchingQuestion\saveAdditionalQuestionDataToDb(), assOrderingHorizontal\saveAdditionalQuestionDataToDb(), assLongMenu\saveAdditionalQuestionDataToDb(), assClozeTest\saveAdditionalQuestionDataToDb(), assNumeric\saveAdditionalQuestionDataToDb(), assKprimChoice\saveAdditionalQuestionDataToDb(), assTextSubset\saveAdditionalQuestionDataToDb(), assSingleChoice\saveAdditionalQuestionDataToDb(), assMultipleChoice\saveAdditionalQuestionDataToDb(), assTextQuestion\saveAdditionalQuestionDataToDb(), assOrderingQuestion\saveAdditionalQuestionDataToDb(), assErrorText\saveAnswerSpecificDataToDb(), assMatchingQuestion\saveAnswerSpecificDataToDb(), assImagemapQuestion\saveAnswerSpecificDataToDb(), assClozeTest\saveAnswerSpecificDataToDb(), assLongMenu\saveAnswerSpecificDataToDb(), assNumeric\saveAnswerSpecificDataToDb(), assKprimChoice\saveAnswerSpecificDataToDb(), assTextSubset\saveAnswerSpecificDataToDb(), assMultipleChoice\saveAnswerSpecificDataToDb(), assClozeTest\saveClozeNumericGapRecordToDb(), assClozeTest\saveClozeSelectGapRecordToDb(), assClozeTest\saveClozeTextGapRecordToDb(), assFormulaQuestion\saveCurrentSolution(), saveCurrentSolution(), assSingleChoice\savePreviewData(), saveQuestionDataToDb(), assFormulaQuestion\saveToDb(), saveToDb(), assFormulaQuestion\saveWorkingData(), assFormulaQuestion\setId(), assOrderingQuestion\setOrderingElementList(), syncWithOriginal(), assOrderingHorizontal\toJSON(), assTextQuestion\toJSON(), assTextSubset\toJSON(), assMultipleChoice\toJSON(), assSingleChoice\toJSON(), assLongMenu\toJSON(), assKprimChoice\toJSON(), assErrorText\toJSON(), assOrderingQuestion\toJSON(), assMatchingQuestion\toJSON(), assClozeTest\toJSON(), updateCurrentSolutionsAuthorization(), ilLOTestQuestionAdapter\updateQuestionResult(), and updateTimestamp().

378  : int
379  {
380  return $this->id;
381  }
+ Here is the caller graph for this function:

◆ getImagePath()

assQuestion::getImagePath (   $question_id = null,
  $object_id = null 
)

Returns the image path for web accessable images of a question.

The image path is under the CLIENT_WEB_DIR in assessment/REFERENCE_ID_OF_QUESTION_POOL/ID_OF_QUESTION/images

Definition at line 713 of file class.assQuestion.php.

References $id, and $obj_id.

Referenced by assOrderingQuestion\buildOrderingImagesFormDataConverter(), assOrderingQuestion\cleanImagefiles(), assOrderingQuestion\cloneImages(), assMatchingQuestion\cloneImages(), assImagemapQuestion\copyImagemapFiles(), assMatchingQuestion\deleteImagefile(), assOrderingQuestion\dropImageFile(), assOrderingQuestion\ensureImagePathExists(), assKprimChoice\handleFileUpload(), assOrderingQuestion\isImageFileStored(), assKprimChoice\loadAnswerData(), assSingleChoice\loadFromDb(), assMultipleChoice\loadFromDb(), assOrderingQuestion\rebuildThumbnails(), assMatchingQuestion\rebuildThumbnails(), assSingleChoice\saveAdditionalQuestionDataToDb(), assMultipleChoice\saveAdditionalQuestionDataToDb(), assMultipleChoice\setImageFile(), assSingleChoice\setImageFile(), assMatchingQuestion\setImageFile(), assImagemapQuestion\setImageFilename(), assOrderingQuestion\storeImageFile(), and assOrderingQuestion\updateImageFile().

713  : string
714  {
715  if ($question_id === null) {
716  $question_id = $this->id;
717  }
718 
719  if ($object_id === null) {
720  $object_id = $this->obj_id;
721  }
722 
723  return $this->question_files->buildImagePath($question_id, $object_id);
724  }
+ Here is the caller graph for this function:

◆ getImagePathWeb()

assQuestion::getImagePathWeb ( )

Returns the web image path for web accessable images of a question.

The image path is under the web accessable data dir in assessment/REFERENCE_ID_OF_QUESTION_POOL/ID_OF_QUESTION/images TODO: in use? refactor and ask for a supported path in all cases, not for THE dynamic highlander path ^^

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

References $export_image_path, CLIENT_WEB_DIR, and ilFileUtils\removeTrailingPathSeparators().

Referenced by assOrderingQuestion\buildNestedOrderingElementInputGui(), assOrderingQuestion\buildNestedOrderingFormDataConverter(), assOrderingQuestion\buildOrderingImagesFormDataConverter(), assKprimChoice\loadAnswerData(), assMultipleChoice\toJSON(), assSingleChoice\toJSON(), assKprimChoice\toJSON(), and assOrderingQuestion\toJSON().

742  : string
743  {
744  if (!$this->export_image_path) {
746  . "/assessment/{$this->obj_id}/{$this->id}/images/";
747  return str_replace(
748  ilFileUtils::removeTrailingPathSeparators(ILIAS_ABSOLUTE_PATH . '/public'),
750  $webdir
751  );
752  }
754  }
static removeTrailingPathSeparators(string $path)
const CLIENT_WEB_DIR
Definition: constants.php:47
string $export_image_path
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getInstances()

assQuestion::getInstances ( )

Definition at line 2091 of file class.assQuestion.php.

References ilObject\_getAllReferences(), ilObjTest\_lookupAuthor(), ilObject\_lookupTitle(), and getId().

2091  : array
2092  {
2093  $result = $this->db->queryF(
2094  "SELECT question_id FROM qpl_questions WHERE original_id = %s",
2095  ["integer"],
2096  [$this->getId()]
2097  );
2098  $instances = [];
2099  $ids = [];
2100  while ($row = $this->db->fetchAssoc($result)) {
2101  $ids[] = $row["question_id"];
2102  }
2103  foreach ($ids as $question_id) {
2104  // check non random tests
2105  $result = $this->db->queryF(
2106  "SELECT tst_tests.obj_fi FROM tst_tests, tst_test_question WHERE tst_test_question.question_fi = %s AND tst_test_question.test_fi = tst_tests.test_id",
2107  ["integer"],
2108  [$question_id]
2109  );
2110  while ($row = $this->db->fetchAssoc($result)) {
2111  $instances[$row['obj_fi']] = ilObject::_lookupTitle($row['obj_fi']);
2112  }
2113  // check random tests
2114  $result = $this->db->queryF(
2115  "SELECT tst_tests.obj_fi FROM tst_tests, tst_test_rnd_qst, tst_active WHERE tst_test_rnd_qst.active_fi = tst_active.active_id AND tst_test_rnd_qst.question_fi = %s AND tst_tests.test_id = tst_active.test_fi",
2116  ["integer"],
2117  [$question_id]
2118  );
2119  while ($row = $this->db->fetchAssoc($result)) {
2120  $instances[$row['obj_fi']] = ilObject::_lookupTitle($row['obj_fi']);
2121  }
2122  }
2123  foreach ($instances as $key => $value) {
2124  $instances[$key] = ["obj_id" => $key, "title" => $value, "author" => ilObjTest::_lookupAuthor($key), "refs" => ilObject::_getAllReferences($key)];
2125  }
2126  return $instances;
2127  }
static _getAllReferences(int $id)
get all reference ids for object ID
static _lookupTitle(int $obj_id)
static _lookupAuthor($obj_id)
Gets the authors name of the ilObjTest object.
+ Here is the call graph for this function:

◆ getInternalLinkHref()

assQuestion::getInternalLinkHref ( string  $target)

Definition at line 1709 of file class.assQuestion.php.

Referenced by getSuggestedSolutionOutput().

1709  : string
1710  {
1711  $linktypes = [
1712  "lm" => "LearningModule",
1713  "pg" => "PageObject",
1714  "st" => "StructureObject",
1715  "git" => "GlossaryItem",
1716  "mob" => "MediaObject"
1717  ];
1718  $href = "";
1719  if (preg_match("/il__(\w+)_(\d+)/", $target, $matches)) {
1720  $type = $matches[1];
1721  $target_id = $matches[2];
1722  switch ($linktypes[$matches[1]]) {
1723  case "MediaObject":
1724  $href = "./ilias.php?baseClass=ilLMPresentationGUI&obj_type=" . $linktypes[$type]
1725  . "&cmd=media&ref_id=" . $this->questionpool_request->getRefId()
1726  . "&mob_id=" . $target_id;
1727  break;
1728  case "StructureObject":
1729  case "GlossaryItem":
1730  case "PageObject":
1731  case "LearningModule":
1732  default:
1733  $href = "./goto.php?target=" . $type . "_" . $target_id;
1734  break;
1735  }
1736  }
1737  return $href;
1738  }
+ Here is the caller graph for this function:

◆ getLastChange()

assQuestion::getLastChange ( )

Definition at line 2483 of file class.assQuestion.php.

References $lastChange.

2483  : ?int
2484  {
2485  return $this->lastChange;
2486  }

◆ getLifecycle()

assQuestion::getLifecycle ( )

Definition at line 452 of file class.assQuestion.php.

References $lifecycle.

Referenced by saveToDb().

453  {
454  return $this->lifecycle;
455  }
ilAssQuestionLifecycle $lifecycle
+ Here is the caller graph for this function:

◆ getMaximumPoints()

assQuestion::getMaximumPoints ( )

Definition at line 559 of file class.assQuestion.php.

References $points.

Referenced by adjustReachedPointsByScoringOptions(), isPreviewSolutionCorrect(), and saveQuestionDataToDb().

559  : float
560  {
561  return $this->points;
562  }
+ Here is the caller graph for this function:

◆ getMaximumThumbSize()

assQuestion::getMaximumThumbSize ( )

Definition at line 422 of file class.assQuestion.php.

422  : int
423  {
424  return self::MAXIMUM_THUMB_SIZE;
425  }

◆ getMinimumThumbSize()

assQuestion::getMinimumThumbSize ( )

Definition at line 417 of file class.assQuestion.php.

Referenced by assSingleChoice\loadFromDb(), assMultipleChoice\loadFromDb(), and assOrderingQuestion\loadFromDb().

417  : int
418  {
419  return self::MINIMUM_THUMB_SIZE;
420  }
+ Here is the caller graph for this function:

◆ getNotesDataService()

assQuestion::getNotesDataService ( )
protected

Definition at line 1530 of file class.assQuestion.php.

References $service.

Referenced by duplicateComments().

1530  : NotesInternalDataService
1531  {
1532  $service = new NotesService($this->dic);
1533  return $service->internal()->data();
1534  }
$service
Definition: ltiresult.php:36
+ Here is the caller graph for this function:

◆ getNotesManager()

assQuestion::getNotesManager ( )
protected

Definition at line 1524 of file class.assQuestion.php.

References $service.

Referenced by deleteComments(), and duplicateComments().

1524  : NotesManager
1525  {
1526  $service = new NotesService($this->dic);
1527  return $service->internal()->domain()->notes();
1528  }
$service
Definition: ltiresult.php:36
+ Here is the caller graph for this function:

◆ getNotesRepo()

assQuestion::getNotesRepo ( )
protected

Definition at line 1536 of file class.assQuestion.php.

References $service.

Referenced by deleteComments().

1536  : NotesRepo
1537  {
1538  $service = new NotesService($this->dic);
1539  return $service->internal()->repo()->note();
1540  }
$service
Definition: ltiresult.php:36
+ Here is the caller graph for this function:

◆ getNrOfTries()

◆ getNumExistingSolutionRecords()

static assQuestion::getNumExistingSolutionRecords ( int  $activeId,
int  $pass,
int  $questionId 
)
staticprotected

Definition at line 2388 of file class.assQuestion.php.

References $DIC, $ilDB, and $res.

Referenced by isAnswered().

2388  : int
2389  {
2390  global $DIC;
2391  $ilDB = $DIC['ilDB'];
2392 
2393  $query = "
2394  SELECT count(active_fi) cnt
2395 
2396  FROM tst_solutions
2397 
2398  WHERE active_fi = %s
2399  AND question_fi = %s
2400  AND pass = %s
2401  ";
2402 
2403  $res = $ilDB->queryF(
2404  $query,
2405  ['integer','integer','integer'],
2406  [$activeId, $questionId, $pass]
2407  );
2408 
2409  $row = $ilDB->fetchAssoc($res);
2410 
2411  return (int) $row['cnt'];
2412  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: shib_login.php:25
+ Here is the caller graph for this function:

◆ getObjId()

◆ getOriginalId()

assQuestion::getOriginalId ( )

Definition at line 1088 of file class.assQuestion.php.

References $original_id.

Referenced by syncWithOriginal().

1088  : ?int
1089  {
1090  return $this->original_id;
1091  }
+ Here is the caller graph for this function:

◆ getOwner()

assQuestion::getOwner ( )

Definition at line 437 of file class.assQuestion.php.

References $owner.

Referenced by saveQuestionDataToDb(), and saveToDb().

437  : int
438  {
439  return $this->owner;
440  }
+ Here is the caller graph for this function:

◆ getPageOfQuestion()

assQuestion::getPageOfQuestion ( )

Definition at line 1077 of file class.assQuestion.php.

1077  : string
1078  {
1079  $page = new ilAssQuestionPage($this->id);
1080  return $page->getXMLContent();
1081  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilAssQuestionPage $page
getXMLContent(bool $a_incl_head=false)
get xml content of page

◆ getPoints()

◆ getPreventRteUsage()

assQuestion::getPreventRteUsage ( )

Definition at line 2250 of file class.assQuestion.php.

References $prevent_rte_usage.

2250  : bool
2251  {
2252  return $this->prevent_rte_usage;
2253  }

◆ getProcessLocker()

◆ getQuestion()

◆ getQuestionAction()

assQuestion::getQuestionAction ( )
protected

Definition at line 222 of file class.assQuestion.php.

Referenced by assFileUpload\isFileDeletionAction().

222  : string
223  {
224  return $this->questionpool_request->getCmdIndex($this->questionActionCmd) ?? '';
225  }
+ Here is the caller graph for this function:

◆ getQuestionForHTMLOutput()

assQuestion::getQuestionForHTMLOutput ( )

Definition at line 1991 of file class.assQuestion.php.

References purifyAndPrepareTextAreaOutput().

1991  : string
1992  {
1993  return $this->purifyAndPrepareTextAreaOutput($this->question);
1994  }
purifyAndPrepareTextAreaOutput(string $content)
+ Here is the call graph for this function:

◆ getQuestionType()

assQuestion::getQuestionType ( )
abstract

Referenced by fromXML(), getQuestionTypeID(), and toXML().

+ Here is the caller graph for this function:

◆ getQuestionTypeID()

assQuestion::getQuestionTypeID ( )

Definition at line 2015 of file class.assQuestion.php.

References getQuestionType().

Referenced by createNewQuestion(), and saveQuestionDataToDb().

2015  : int
2016  {
2017  $result = $this->db->queryF(
2018  "SELECT question_type_id FROM qpl_qst_type WHERE type_tag = %s",
2019  ['text'],
2020  [$this->getQuestionType()]
2021  );
2022  if ($this->db->numRows($result) == 1) {
2023  $row = $this->db->fetchAssoc($result);
2024  return (int) $row["question_type_id"];
2025  }
2026  return 0;
2027  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getReachedPoints()

assQuestion::getReachedPoints ( int  $active_id,
int  $pass 
)

Definition at line 554 of file class.assQuestion.php.

References getId().

Referenced by answerToLog(), and ilLOTestQuestionAdapter\updateQuestionResult().

554  : float
555  {
556  return round(self::_getReachedPoints($active_id, $this->getId(), $pass), 2);
557  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRTETextWithMediaObjects()

assQuestion::getRTETextWithMediaObjects ( )
protected

Definition at line 2067 of file class.assQuestion.php.

References getId(), ilAssQuestionHintList\getListByQuestionId(), and getQuestion().

Referenced by cleanupMediaObjectUsage().

2067  : string
2068  {
2069  // must be called in parent classes. add additional RTE text in the parent
2070  // classes and call this method to add the standard RTE text
2071  $collected = $this->getQuestion();
2072  $collected .= $this->feedbackOBJ->getGenericFeedbackContent($this->getId(), false);
2073  $collected .= $this->feedbackOBJ->getGenericFeedbackContent($this->getId(), true);
2074  $collected .= $this->feedbackOBJ->getAllSpecificAnswerFeedbackContents($this->getId());
2075 
2076  $questionHintList = ilAssQuestionHintList::getListByQuestionId($this->getId());
2077  foreach ($questionHintList as $questionHint) {
2078  /* @var $questionHint ilAssQuestionHint */
2079  $collected .= $questionHint->getText();
2080  }
2081 
2082  return $collected;
2083  }
static getListByQuestionId($questionId)
instantiates a question hint list for the passed question id
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSelfAssessmentEditingMode()

assQuestion::getSelfAssessmentEditingMode ( )

Definition at line 2279 of file class.assQuestion.php.

References $selfassessmenteditingmode.

Referenced by ilAssQuestionAuthoringFormGUI\addGenericAssessmentQuestionCommandButtons().

2279  : bool
2280  {
2282  }
bool $selfassessmenteditingmode
+ Here is the caller graph for this function:

◆ getSelfAssessmentFormatter()

assQuestion::getSelfAssessmentFormatter ( )
protected

Definition at line 2238 of file class.assQuestion.php.

Referenced by formatSAQuestion().

2239  {
2240  return new \ilAssSelfAssessmentQuestionFormatter();
2241  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the caller graph for this function:

◆ getShuffle()

◆ getShuffler()

assQuestion::getShuffler ( )

Definition at line 237 of file class.assQuestion.php.

References $shuffler.

Referenced by assOrderingHorizontal\getRandomOrderingElements(), assOrderingQuestion\getShuffledOrderingElementList(), assOrderingQuestion\toJSON(), and assMatchingQuestion\toJSON().

238  {
239  return $this->shuffler;
240  }
Transformation $shuffler
A transformation is a function from one datatype to another.
+ Here is the caller graph for this function:

◆ getSolutionForTextOutput()

assQuestion::getSolutionForTextOutput ( int  $active_id,
int  $pass 
)

Definition at line 3069 of file class.assQuestion.php.

References getSolutionValues(), and solutionValuesToText().

3072  : array|string {
3073  return $this->solutionValuesToText(
3074  $this->getSolutionValues($active_id, $pass)
3075  );
3076  }
getSolutionValues(int $active_id, ?int $pass=null, bool $authorized=true)
Loads solutions of a given user from the database an returns it.
solutionValuesToText(array $solution_values)
MUST convert the given solution values into text.
+ Here is the call graph for this function:

◆ getSolutionMaxPass()

◆ getSolutionRecordById()

assQuestion::getSolutionRecordById ( int  $solutionId)
protected
Returns
array tst_solutions.*

Definition at line 2537 of file class.assQuestion.php.

Referenced by assFileUpload\saveWorkingData().

2537  : array
2538  {
2539  $result = $this->db->queryF(
2540  "SELECT * FROM tst_solutions WHERE solution_id = %s",
2541  ['integer'],
2542  [$solutionId]
2543  );
2544 
2545  if ($this->db->numRows($result) > 0) {
2546  return $this->db->fetchAssoc($result);
2547  }
2548  return [];
2549  }
+ Here is the caller graph for this function:

◆ getSolutionValues()

assQuestion::getSolutionValues ( int  $active_id,
?int  $pass = null,
bool  $authorized = true 
)

Loads solutions of a given user from the database an returns it.

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

References getId(), getSolutionMaxPass(), and getStep().

Referenced by answerToLog(), assOrderingQuestion\calculateReachedPoints(), assFormulaQuestion\calculateReachedPoints(), deleteDummySolutionRecord(), duplicateIntermediateSolutionAuthorized(), forceExistingIntermediateSolution(), assFormulaQuestion\getCorrectSolutionForTextOutput(), getCorrectSolutionForTextOutput(), assOrderingQuestion\getOrderingElementListForSolutionOutput(), getSolutionForTextOutput(), ilTestCorrectionsGUI\getSolutions(), ilTestCorrectionsGUI\getSolutionsByParticipantResults(), getTestOutputSolutions(), assFileUpload\getUploadedFilesForWeb(), assFileUpload\getUserSolutionPreferingIntermediate(), and getUserSolutionPreferingIntermediate().

785  : array {
786  if ($pass === null && is_numeric($active_id)) {
787  $pass = $this->getSolutionMaxPass((int) $active_id);
788  }
789 
790  if ($this->getStep() !== null) {
791  $query = "
792  SELECT *
793  FROM tst_solutions
794  WHERE active_fi = %s
795  AND question_fi = %s
796  AND pass = %s
797  AND step = %s
798  AND authorized = %s
799  ORDER BY solution_id";
800 
801  $result = $this->db->queryF(
802  $query,
803  ['integer', 'integer', 'integer', 'integer', 'integer'],
804  [(int) $active_id, $this->getId(), $pass, $this->getStep(), (int) $authorized]
805  );
806  } else {
807  $query = "
808  SELECT *
809  FROM tst_solutions
810  WHERE active_fi = %s
811  AND question_fi = %s
812  AND pass = %s
813  AND authorized = %s
814  ORDER BY solution_id
815  ";
816 
817  $result = $this->db->queryF(
818  $query,
819  ['integer', 'integer', 'integer', 'integer'],
820  [(int) $active_id, $this->getId(), $pass, (int) $authorized]
821  );
822  }
823 
824  $values = [];
825 
826  while ($row = $this->db->fetchAssoc($result)) {
827  $values[] = $row;
828  }
829 
830  return $values;
831  }
getSolutionMaxPass(int $active_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getStep()

◆ getSuggestedSolution()

assQuestion::getSuggestedSolution ( int  $subquestion_index = 0)

Definition at line 1551 of file class.assQuestion.php.

1552  {
1553  if (array_key_exists($subquestion_index, $this->suggested_solutions)) {
1554  return $this->suggested_solutions[$subquestion_index];
1555  }
1556  return null;
1557  }

◆ getSuggestedSolutionOutput()

assQuestion::getSuggestedSolutionOutput ( )

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

References getInternalLinkHref(), getSuggestedSolutionPathWeb(), ILIAS\Repository\lng(), ilLegacyFormElementsUtil\prepareFormOutput(), ilWACSignedPath\setTokenMaxLifetimeInSeconds(), and ilWACSignedPath\signFile().

487  : string
488  {
489  $output = [];
490  foreach ($this->suggested_solutions as $solution) {
491  switch ($solution->getType()) {
492  case SuggestedSolution::TYPE_LM:
493  case SuggestedSolution::TYPE_LM_CHAPTER:
494  case SuggestedSolution::TYPE_LM_PAGE:
495  case SuggestedSolution::TYPE_GLOSARY_TERM:
496  $output[] = '<a href="'
497  . $this->getInternalLinkHref($solution->getInternalLink())
498  . '">'
499  . $this->lng->txt("solution_hint")
500  . '</a>';
501  break;
502 
503  case SuggestedSolution::TYPE_FILE:
504  $possible_texts = array_values(
505  array_filter(
506  [
507  ilLegacyFormElementsUtil::prepareFormOutput($solution->getTitle()),
508  ilLegacyFormElementsUtil::prepareFormOutput($solution->getFilename()),
509  $this->lng->txt('tst_show_solution_suggested')
510  ]
511  )
512  );
513 
515  $path_to_solution = $this->getSuggestedSolutionPathWeb() . $solution->getFilename();
516  if (!file_exists($path_to_solution)) {
517  break;
518  }
519  $output[] = '<a href="'
520  . ilWACSignedPath::signFile($path_to_solution)
521  . '">'
522  . $possible_texts[0]
523  . '</a>';
524  break;
525  }
526  }
527  return implode("<br />", $output);
528  }
static prepareFormOutput($a_str, bool $a_strip=false)
static setTokenMaxLifetimeInSeconds(int $token_max_lifetime_in_seconds)
static signFile(string $path_to_file)
getInternalLinkHref(string $target)
+ Here is the call graph for this function:

◆ getSuggestedSolutionPath()

assQuestion::getSuggestedSolutionPath ( )

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

References CLIENT_WEB_DIR.

Referenced by cloneSuggestedSolutionFiles(), deleteSuggestedSolutions(), and duplicateSuggestedSolutionFiles().

704  : string
705  {
706  return CLIENT_WEB_DIR . "/assessment/$this->obj_id/$this->id/solution/";
707  }
const CLIENT_WEB_DIR
Definition: constants.php:47
+ Here is the caller graph for this function:

◆ getSuggestedSolutionPathWeb()

assQuestion::getSuggestedSolutionPathWeb ( )

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

References CLIENT_WEB_DIR, and ilFileUtils\removeTrailingPathSeparators().

Referenced by getSuggestedSolutionOutput().

726  : string
727  {
729  . "/assessment/{$this->obj_id}/{$this->id}/solution/";
730  return str_replace(
731  ilFileUtils::removeTrailingPathSeparators(ILIAS_ABSOLUTE_PATH . '/public'),
733  $webdir
734  );
735  }
static removeTrailingPathSeparators(string $path)
const CLIENT_WEB_DIR
Definition: constants.php:47
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSuggestedSolutions()

assQuestion::getSuggestedSolutions ( )

Definition at line 530 of file class.assQuestion.php.

References $suggested_solutions.

Referenced by copySuggestedSolutions().

530  : array
531  {
533  }
array $suggested_solutions
+ Here is the caller graph for this function:

◆ getSuggestedSolutionsRepo()

assQuestion::getSuggestedSolutionsRepo ( )
protected

Definition at line 2983 of file class.assQuestion.php.

References $suggestedsolution_repo.

Referenced by cloneSuggestedSolutions(), copySuggestedSolutions(), delete(), deleteSuggestedSolutions(), and loadSuggestedSolutions().

+ Here is the caller graph for this function:

◆ getTestId()

assQuestion::getTestId ( )

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

References $test_id.

Referenced by resetUsersAnswer().

388  : int
389  {
390  return $this->test_id;
391  }
+ Here is the caller graph for this function:

◆ getTestOutputSolutions()

assQuestion::getTestOutputSolutions ( int  $activeId,
int  $pass 
)

Definition at line 756 of file class.assQuestion.php.

References getSolutionValues(), getTestPresentationConfig(), and getUserSolutionPreferingIntermediate().

Referenced by assOrderingQuestion\getSolutionOrderingElementListForTestOutput().

756  : array
757  {
758  if ($this->getTestPresentationConfig()->isSolutionInitiallyPrefilled()) {
759  return $this->getSolutionValues($activeId, $pass, true);
760  }
761  return $this->getUserSolutionPreferingIntermediate($activeId, $pass);
762  }
getSolutionValues(int $active_id, ?int $pass=null, bool $authorized=true)
Loads solutions of a given user from the database an returns it.
getUserSolutionPreferingIntermediate(int $active_id, ?int $pass=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTestPresentationConfig()

assQuestion::getTestPresentationConfig ( )

Definition at line 2969 of file class.assQuestion.php.

References $test_question_config, and buildTestPresentationConfig().

Referenced by getTestOutputSolutions(), ilTestPlayerAbstractGUI\initTestQuestionConfig(), and assFileUpload\isFileReuseHandlingRequired().

2970  {
2971  if ($this->test_question_config === null) {
2972  $this->test_question_config = $this->buildTestPresentationConfig();
2973  }
2974 
2976  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilTestQuestionConfig $test_question_config
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getThumbSize()

◆ getTitle()

assQuestion::getTitle ( )

Definition at line 363 of file class.assQuestion.php.

References $title.

Referenced by getTitleFilenameCompliant(), assOrderingQuestion\isComplete(), assClozeTest\isComplete(), and saveQuestionDataToDb().

363  : string
364  {
365  return $this->title;
366  }
+ Here is the caller graph for this function:

◆ getTitleFilenameCompliant()

assQuestion::getTitleFilenameCompliant ( )

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

References ilFileUtils\getASCIIFilename(), and getTitle().

373  : string
374  {
375  return ilFileUtils::getASCIIFilename($this->getTitle());
376  }
static getASCIIFilename(string $a_filename)
+ Here is the call graph for this function:

◆ getTitleForHTMLOutput()

◆ getTotalAnswers()

assQuestion::getTotalAnswers ( )

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

1007  : int
1008  {
1009  // get all question references to the question id
1010  $result = $this->db->queryF(
1011  "SELECT question_id FROM qpl_questions WHERE original_id = %s OR question_id = %s",
1012  ['integer','integer'],
1013  [$this->id, $this->id]
1014  );
1015  if ($this->db->numRows($result) == 0) {
1016  return 0;
1017  }
1018  $found_id = [];
1019  while ($row = $this->db->fetchAssoc($result)) {
1020  $found_id[] = $row["question_id"];
1021  }
1022 
1023  $result = $this->db->query("SELECT * FROM tst_test_result WHERE " . $this->db->in('question_fi', $found_id, false, 'integer'));
1024 
1025  return $this->db->numRows($result);
1026  }

◆ getUserSolutionPreferingIntermediate()

assQuestion::getUserSolutionPreferingIntermediate ( int  $active_id,
?int  $pass = null 
)

Definition at line 765 of file class.assQuestion.php.

References getSolutionValues().

Referenced by getTestOutputSolutions().

768  : array {
769  $solution = $this->getSolutionValues($active_id, $pass, false);
770 
771  if (!count($solution)) {
772  $solution = $this->getSolutionValues($active_id, $pass, true);
773  }
774 
775  return $solution;
776  }
getSolutionValues(int $active_id, ?int $pass=null, bool $authorized=true)
Loads solutions of a given user from the database an returns it.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getValidAdditionalContentEditingModes()

assQuestion::getValidAdditionalContentEditingModes ( )

Definition at line 2442 of file class.assQuestion.php.

Referenced by isValidAdditionalContentEditingMode(), and setAdditionalContentEditingMode().

2442  : array
2443  {
2444  return [
2445  self::ADDITIONAL_CONTENT_EDITING_MODE_RTE,
2446  self::ADDITIONAL_CONTENT_EDITING_MODE_IPE
2447  ];
2448  }
+ Here is the caller graph for this function:

◆ getVariablesAsTextArray()

assQuestion::getVariablesAsTextArray ( int  $active_id,
int  $pass 
)

Definition at line 3087 of file class.assQuestion.php.

3090  : array {
3091  return [];
3092  }

◆ hasSpecificFeedback()

assQuestion::hasSpecificFeedback ( )

Definition at line 2150 of file class.assQuestion.php.

2150  : bool
2151  {
2152  return static::HAS_SPECIFIC_FEEDBACK;
2153  }

◆ hasWritableOriginalInQuestionPool()

assQuestion::hasWritableOriginalInQuestionPool ( )

Definition at line 3013 of file class.assQuestion.php.

References instantiateQuestion().

3013  : bool
3014  {
3015  return !is_null($this->original_id)
3016  && $this->questionrepository->questionExistsInPool($this->original_id)
3017  && assQuestion::instantiateQuestion($this->original_id)->isWriteable();
3018  }
static instantiateQuestion(int $question_id)
+ Here is the call graph for this function:

◆ implodeKeyValues()

static assQuestion::implodeKeyValues ( array  $keyValues)
static

Definition at line 2666 of file class.assQuestion.php.

References KEY_VALUES_IMPLOSION_SEPARATOR.

Referenced by assImagemapQuestionGUI\buildSelectionParameter().

2666  : string
2667  {
2668  return implode(assQuestion::KEY_VALUES_IMPLOSION_SEPARATOR, $keyValues);
2669  }
const KEY_VALUES_IMPLOSION_SEPARATOR
+ Here is the caller graph for this function:

◆ importHint()

assQuestion::importHint ( int  $question_id,
array  $hint_array 
)
private

Definition at line 288 of file class.assQuestion.php.

References getAdditionalContentEditingMode().

Referenced by fromXML().

288  : void
289  {
290  $hint = new ilAssQuestionHint();
291  $hint->setQuestionId($question_id);
292  $hint->setIndex($hint_array['index'] ?? '');
293  $hint->setPoints($hint_array['points'] ?? '');
294  if ($this->getAdditionalContentEditingMode() === self::ADDITIONAL_CONTENT_EDITING_MODE_IPE) {
295  $hint->save();
296  $hint_page = (new ilAssHintPage());
297  $hint_page->setParentId($question_id);
298  $hint_page->setId($hint->getId());
299  $hint_page->setXMLContent($hint_array['txt']);
300  $hint_page->createFromXML();
301  return;
302  }
303 
304  $hint->setText($hint_array['txt'] ?? '');
305  $hint->save();
306  }
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:

◆ instantiateQuestion()

static assQuestion::instantiateQuestion ( int  $question_id)
static
Parameters
int$question_id
Returns
assQuestion
Exceptions
InvalidArgumentException

Definition at line 1775 of file class.assQuestion.php.

References $DIC, $ilDB, $question, and ILIAS\TestQuestionPool\Questions\GeneralQuestionPropertiesRepository\getForQuestionId().

Referenced by ilObjTest\_instanciateQuestion(), ILIAS\Test\ExportImport\ResultsExportExcel\addUserContent(), ilTestFixedQuestionSetConfig\cloneQuestionSetRelatedData(), ilObjTestGUI\copyAndLinkQuestionsToPoolObject(), ilPCQuestion\copyPoolQuestionIntoPage(), ilObjQuestionPool\deleteQuestion(), ilTestResultsToXML\exportTestResults(), ilAssLacQuestionProvider\getQuestion(), ilTestPlayerAbstractGUI\getQuestionInstance(), ILIAS\Test\ExportImport\Export\getQuestionQtiXml(), ilBulkEditQuestionsGUI\getQuestions(), ilTestRandomQuestionSetPoolDeriver\getQuestionsForPool(), ilTestSequence\getSequenceSummary(), ILIAS\Test\Questions\Presentation\QuestionsTableActions\handleCommand(), ilPCQuestion\handleCopiedContent(), hasWritableOriginalInQuestionPool(), ilObjTest\insertQuestion(), ilQuestionPageParser\processPagesToParse(), ilAssIncompleteQuestionPurger\purgeQuestionIds(), ilObjTest\removeQuestionWithResults(), ilTestRandomQuestionSetStagingPoolBuilder\removeStagedQuestions(), ilSoapTestAdministration\saveQuestion(), ilSoapTestAdministration\saveQuestionSolution(), ilTestRandomQuestionSetStagingPoolBuilder\stageQuestionsFromSourcePool(), and ilAssQuestionSkillAssignmentsGUI\syncOriginalCmd().

1775  : assQuestion
1776  {
1777  global $DIC;
1778  $ilCtrl = $DIC['ilCtrl'];
1779  $ilDB = $DIC['ilDB'];
1780  $lng = $DIC['lng'];
1781  $questionrepository = QuestionPoolDIC::dic()['question.general_properties.repository'];
1782  $question_type = $questionrepository->getForQuestionId($question_id)?->getClassName() ?? '';
1783  if ($question_type === '') {
1784  throw new InvalidArgumentException('No question with ID ' . $question_id . ' exists');
1785  }
1786 
1787  $question = new $question_type();
1788  $question->loadFromDb($question_id);
1789 
1790  $feedbackObjectClassname = self::getFeedbackClassNameByQuestionType($question_type);
1791  $question->feedbackOBJ = new $feedbackObjectClassname($question, $ilCtrl, $ilDB, $lng);
1792 
1793  return $question;
1794  }
ilLanguage $lng
global $DIC
Definition: shib_login.php:25
GeneralQuestionPropertiesRepository $questionrepository
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ intermediateSolutionExists()

assQuestion::intermediateSolutionExists ( int  $active_id,
int  $pass 
)

Definition at line 2790 of file class.assQuestion.php.

References lookupForExistingSolutions().

Referenced by assFileUpload\saveWorkingData().

2790  : bool
2791  {
2792  $solutionAvailability = $this->lookupForExistingSolutions($active_id, $pass);
2793  return (bool) $solutionAvailability['intermediate'];
2794  }
lookupForExistingSolutions(int $activeId, int $pass)
Lookup if an authorized or intermediate solution exists.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isAddableAnswerOptionValue()

assQuestion::isAddableAnswerOptionValue ( int  $qIndex,
string  $answerOptionValue 
)

Definition at line 2866 of file class.assQuestion.php.

2866  : bool
2867  {
2868  return false;
2869  }

◆ isAdditionalContentEditingModePageObject()

assQuestion::isAdditionalContentEditingModePageObject ( )

Definition at line 2428 of file class.assQuestion.php.

References ADDITIONAL_CONTENT_EDITING_MODE_IPE, and getAdditionalContentEditingMode().

Referenced by delete(), duplicateQuestionHints(), assClozeTest\getClozeTextForHTMLOutput(), and purifyAndPrepareTextAreaOutput().

2428  : bool
2429  {
2431  }
const ADDITIONAL_CONTENT_EDITING_MODE_IPE
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isAnswered()

assQuestion::isAnswered ( int  $active_id,
int  $pass 
)

Definition at line 2382 of file class.assQuestion.php.

References getId(), and getNumExistingSolutionRecords().

2382  : bool
2383  {
2384  $numExistingSolutionRecords = assQuestion::getNumExistingSolutionRecords($active_id, $pass, $this->getId());
2385  return $numExistingSolutionRecords > 0;
2386  }
static getNumExistingSolutionRecords(int $activeId, int $pass, int $questionId)
+ Here is the call graph for this function:

◆ isComplete()

assQuestion::isComplete ( )
abstract

Referenced by saveQuestionDataToDb(), and saveToDb().

+ Here is the caller graph for this function:

◆ isDummySolutionRecord()

assQuestion::isDummySolutionRecord ( array  $solutionRecord)
protected

Definition at line 2685 of file class.assQuestion.php.

Referenced by assFileUpload\calculateReachedPoints().

2685  : bool
2686  {
2687  return !strlen($solutionRecord['value1']) && !strlen($solutionRecord['value2']);
2688  }
+ Here is the caller graph for this function:

◆ isFileAvailable()

static assQuestion::isFileAvailable ( string  $file)
static

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

1028  : bool
1029  {
1030  if (!file_exists($file)) {
1031  return false;
1032  }
1033 
1034  if (!is_file($file)) {
1035  return false;
1036  }
1037 
1038  if (!is_readable($file)) {
1039  return false;
1040  }
1041 
1042  return true;
1043  }

◆ isForcePassResultUpdateEnabled()

static assQuestion::isForcePassResultUpdateEnabled ( )
static

Definition at line 217 of file class.assQuestion.php.

217  : bool
218  {
219  return self::$force_pass_results_update_enabled;
220  }

◆ isNonEmptyItemListPostSubmission()

assQuestion::isNonEmptyItemListPostSubmission ( string  $post_submission_field_name)
protected

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

Referenced by assFileUpload\isFileDeletionSubmitAvailable(), and assFileUpload\isFileReuseSubmitAvailable().

227  : bool
228  {
229  return !empty($this->questionpool_request->strArray($post_submission_field_name));
230  }
+ Here is the caller graph for this function:

◆ isPreviewSolutionCorrect()

assQuestion::isPreviewSolutionCorrect ( ilAssQuestionPreviewSession  $preview_session)

Definition at line 1862 of file class.assQuestion.php.

References calculateReachedPointsFromPreviewSession(), and getMaximumPoints().

1862  : bool
1863  {
1864  $reached_points = $this->calculateReachedPointsFromPreviewSession($preview_session);
1865 
1866  return !($reached_points < $this->getMaximumPoints());
1867  }
calculateReachedPointsFromPreviewSession(ilAssQuestionPreviewSession $preview_session)
+ Here is the call graph for this function:

◆ isValidAdditionalContentEditingMode()

assQuestion::isValidAdditionalContentEditingMode ( string  $additionalContentEditingMode)

Definition at line 2433 of file class.assQuestion.php.

References getValidAdditionalContentEditingModes().

2433  : bool
2434  {
2436  return true;
2437  }
2438 
2439  return false;
2440  }
getValidAdditionalContentEditingModes()
string $additionalContentEditingMode
+ Here is the call graph for this function:

◆ isWriteable()

assQuestion::isWriteable ( )

Definition at line 1835 of file class.assQuestion.php.

References ilObjQuestionPool\_isWriteable(), getCurrentUser(), getId(), and getObjId().

1835  : bool
1836  {
1837  return ilObjQuestionPool::_isWriteable($this->getObjId(), $this->getCurrentUser()->getId());
1838  }
static _isWriteable($object_id, $user_id)
Returns true, if the question pool is writeable by a given user.
+ Here is the call graph for this function:

◆ lmMigrateQuestionTypeGenericContent()

assQuestion::lmMigrateQuestionTypeGenericContent ( ilAssSelfAssessmentMigrator  $migrator)
protected

Definition at line 2264 of file class.assQuestion.php.

References ilAssSelfAssessmentMigrator\migrateToLmContent(), and setQuestion().

Referenced by migrateContentForLearningModule().

2264  : void
2265  {
2266  $this->setQuestion($migrator->migrateToLmContent($this->getQuestion()));
2267  }
setQuestion(string $question="")
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lmMigrateQuestionTypeSpecificContent()

assQuestion::lmMigrateQuestionTypeSpecificContent ( ilAssSelfAssessmentMigrator  $migrator)
protected

Definition at line 2269 of file class.assQuestion.php.

Referenced by migrateContentForLearningModule().

2269  : void
2270  {
2271  // overwrite if any question type specific content except feedback needs to be migrated
2272  }
+ Here is the caller graph for this function:

◆ loadFromDb()

assQuestion::loadFromDb ( int  $question_id)

Definition at line 1146 of file class.assQuestion.php.

References $data, and loadSuggestedSolutions().

1146  : void
1147  {
1148  $result = $this->db->queryF(
1149  'SELECT external_id FROM qpl_questions WHERE question_id = %s',
1150  ['integer'],
1151  [$question_id]
1152  );
1153  if ($this->db->numRows($result) === 1) {
1154  $data = $this->db->fetchAssoc($result);
1155  $this->external_id = $data['external_id'];
1156  }
1157 
1159  $this->suggested_solutions = [];
1160  if ($suggested_solutions) {
1161  foreach ($suggested_solutions as $solution) {
1162  $this->suggested_solutions[$solution->getSubquestionIndex()] = $solution;
1163  }
1164  }
1165  }
array $suggested_solutions
+ Here is the call graph for this function:

◆ loadSuggestedSolutions()

assQuestion::loadSuggestedSolutions ( )
protected

Definition at line 2988 of file class.assQuestion.php.

References getId(), and getSuggestedSolutionsRepo().

Referenced by loadFromDb().

2988  : array
2989  {
2990  $question_id = $this->getId();
2991  return $this->getSuggestedSolutionsRepo()->selectFor($question_id);
2992  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lookupForExistingSolutions()

assQuestion::lookupForExistingSolutions ( int  $activeId,
int  $pass 
)

Lookup if an authorized or intermediate solution exists.

Returns
array ['authorized' => bool, 'intermediate' => bool]

Definition at line 2830 of file class.assQuestion.php.

References getId(), and getStep().

Referenced by authorizedOrIntermediateSolutionExists(), authorizedSolutionExists(), calculateResultsFromSolution(), and intermediateSolutionExists().

2830  : array
2831  {
2832  $return = [
2833  'authorized' => false,
2834  'intermediate' => false
2835  ];
2836 
2837  $query = "
2838  SELECT authorized, COUNT(*) cnt
2839  FROM tst_solutions
2840  WHERE active_fi = %s
2841  AND question_fi = %s
2842  AND pass = %s
2843  ";
2844 
2845  if ($this->getStep() !== null) {
2846  $query .= " AND step = " . $this->db->quote((int) $this->getStep(), 'integer') . " ";
2847  }
2848 
2849  $query .= "
2850  GROUP BY authorized
2851  ";
2852 
2853  $result = $this->db->queryF($query, ['integer', 'integer', 'integer'], [$activeId, $this->getId(), $pass]);
2854 
2855  while ($row = $this->db->fetchAssoc($result)) {
2856  if ($row['authorized']) {
2857  $return['authorized'] = $row['cnt'] > 0;
2858  } else {
2859  $return['intermediate'] = $row['cnt'] > 0;
2860  }
2861  }
2862  return $return;
2863  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lookupMaxStep()

assQuestion::lookupMaxStep ( int  $active_id,
int  $pass 
)
protected

Definition at line 2812 of file class.assQuestion.php.

References getId().

Referenced by assNumeric\getUserQuestionResult(), assOrderingHorizontal\getUserQuestionResult(), assTextSubset\getUserQuestionResult(), assSingleChoice\getUserQuestionResult(), assMultipleChoice\getUserQuestionResult(), assOrderingQuestion\getUserQuestionResult(), assFormulaQuestion\getUserQuestionResult(), assMatchingQuestion\getUserQuestionResult(), and assClozeTest\getUserQuestionResult().

2812  : int
2813  {
2814  $result = $this->db->queryF(
2815  "SELECT MAX(step) max_step FROM tst_solutions WHERE active_fi = %s AND pass = %s AND question_fi = %s",
2816  ["integer", "integer", "integer"],
2817  [$active_id, $pass, $this->getId()]
2818  );
2819 
2820  $row = $this->db->fetchAssoc($result);
2821 
2822  return (int) $row['max_step'];
2823  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lookupParentObjId()

static assQuestion::lookupParentObjId ( int  $question_id)
static

Definition at line 2296 of file class.assQuestion.php.

References $DIC, $ilDB, and $res.

Referenced by ILIAS\Test\Questions\Presentation\QuestionsTableActions\checkQuestionParametersForCopyToPool(), and ilAssQuestionSkillAssignmentsGUI\isSyncOriginalPossibleAndAllowed().

2296  : ?int
2297  {
2298  global $DIC;
2299  $ilDB = $DIC['ilDB'];
2300 
2301  $query = "SELECT obj_fi FROM qpl_questions WHERE question_id = %s";
2302 
2303  $res = $ilDB->queryF($query, ['integer'], [$question_id]);
2304  $row = $ilDB->fetchAssoc($res);
2305 
2306  return $row['obj_fi'] ?? null;
2307  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: shib_login.php:25
+ Here is the caller graph for this function:

◆ migrateContentForLearningModule()

assQuestion::migrateContentForLearningModule ( ilAssSelfAssessmentMigrator  $migrator)

Definition at line 2255 of file class.assQuestion.php.

References getId(), lmMigrateQuestionTypeGenericContent(), lmMigrateQuestionTypeSpecificContent(), and saveToDb().

Referenced by ilAssSelfAssessmentQuestionFormatter\prepareQuestionForLearningModule().

2255  : void
2256  {
2257  $this->lmMigrateQuestionTypeGenericContent($migrator);
2258  $this->lmMigrateQuestionTypeSpecificContent($migrator);
2259  $this->saveToDb();
2260 
2261  $this->feedbackOBJ->migrateContentForLearningModule($migrator, $this->getId());
2262  }
lmMigrateQuestionTypeSpecificContent(ilAssSelfAssessmentMigrator $migrator)
saveToDb(?int $original_id=null)
lmMigrateQuestionTypeGenericContent(ilAssSelfAssessmentMigrator $migrator)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ onCopy()

assQuestion::onCopy ( int  $sourceParentId,
int  $sourceQuestionId,
int  $targetParentId,
int  $targetQuestionId 
)
protected

Definition at line 1465 of file class.assQuestion.php.

References copySuggestedSolutions(), duplicateComments(), duplicateQuestionHints(), duplicateSkillAssignments(), and duplicateSuggestedSolutionFiles().

1465  : void
1466  {
1467  $this->copySuggestedSolutions($targetQuestionId);
1468  $this->duplicateSuggestedSolutionFiles($sourceParentId, $sourceQuestionId);
1469  $this->feedbackOBJ->duplicateFeedback($sourceQuestionId, $targetQuestionId);
1470  $this->duplicateQuestionHints($sourceQuestionId, $targetQuestionId);
1471  $this->duplicateSkillAssignments($sourceParentId, $sourceQuestionId, $targetParentId, $targetQuestionId);
1472  $this->duplicateComments($sourceParentId, $sourceQuestionId, $targetParentId, $targetQuestionId);
1473  }
duplicateSkillAssignments(int $srcParentId, int $srcQuestionId, int $trgParentId, int $trgQuestionId)
duplicateQuestionHints(int $original_question_id, int $duplicate_question_id)
duplicateComments(int $parent_source_id, int $source_id, int $parent_target_id, int $target_id)
duplicateSuggestedSolutionFiles(int $parent_id, int $question_id)
Duplicates the files of a suggested solution if the question is duplicated.
copySuggestedSolutions(int $target_question_id)
+ Here is the call graph for this function:

◆ onDuplicate()

assQuestion::onDuplicate ( int  $original_parent_id,
int  $original_question_id,
int  $duplicate_parent_id,
int  $duplicate_question_id 
)
protected

Definition at line 1442 of file class.assQuestion.php.

References cloneSuggestedSolutionFiles(), copySuggestedSolutions(), duplicateComments(), duplicateQuestionHints(), and duplicateSkillAssignments().

1447  : void {
1448  $this->copySuggestedSolutions($duplicate_question_id);
1449  $this->cloneSuggestedSolutionFiles($original_parent_id, $original_question_id);
1450  $this->feedbackOBJ->duplicateFeedback($original_question_id, $duplicate_question_id);
1451  $this->duplicateQuestionHints($original_question_id, $duplicate_question_id);
1452  $this->duplicateSkillAssignments($original_parent_id, $original_question_id, $duplicate_parent_id, $duplicate_question_id);
1453  $this->duplicateComments($original_parent_id, $original_question_id, $duplicate_parent_id, $duplicate_question_id);
1454  }
cloneSuggestedSolutionFiles(int $source_question_id, int $target_question_id)
duplicateSkillAssignments(int $srcParentId, int $srcQuestionId, int $trgParentId, int $trgQuestionId)
duplicateQuestionHints(int $original_question_id, int $duplicate_question_id)
duplicateComments(int $parent_source_id, int $source_id, int $parent_target_id, int $target_id)
copySuggestedSolutions(int $target_question_id)
+ Here is the call graph for this function:

◆ persistPreviewState()

assQuestion::persistPreviewState ( ilAssQuestionPreviewSession  $preview_session)
final

persists the preview state for current user and question

Definition at line 688 of file class.assQuestion.php.

References savePreviewData(), and validateSolutionSubmit().

688  : bool
689  {
690  $this->savePreviewData($preview_session);
691  return $this->validateSolutionSubmit();
692  }
savePreviewData(ilAssQuestionPreviewSession $preview_session)
+ Here is the call graph for this function:

◆ persistWorkingState()

assQuestion::persistWorkingState ( int  $active_id,
  $pass,
bool  $authorized = true 
)
final

persists the working state for current testactive and testpass

Returns
bool if saving happened

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

References ilObjTest\_getPass(), calculateResultsFromSolution(), getProcessLocker(), removeIntermediateSolution(), saveWorkingData(), and validateSolutionSubmit().

Referenced by ilTestPlayerAbstractGUI\save().

658  : bool
659  {
660  if (!$this instanceof QuestionPartiallySaveable && !$this->validateSolutionSubmit()) {
661  return false;
662  }
663 
664  $saveStatus = false;
665 
666  $this->getProcessLocker()->executePersistWorkingStateLockOperation(function () use ($active_id, $pass, $authorized, &$saveStatus) {
667  if ($pass === null) {
668  $pass = ilObjTest::_getPass($active_id);
669  }
670 
671  $saveStatus = $this->saveWorkingData($active_id, $pass, $authorized);
672 
673  if ($authorized) {
674  // fau: testNav - remove an intermediate solution if the authorized solution is saved
675  // the intermediate solution would set the displayed question status as "editing ..."
676  $this->removeIntermediateSolution($active_id, $pass);
677  // fau.
678  $this->calculateResultsFromSolution($active_id, $pass);
679  }
680  });
681 
682  return $saveStatus;
683  }
calculateResultsFromSolution(int $active_id, int $pass)
Calculates the question results from a previously saved question solution.
static _getPass($active_id)
Retrieves the actual pass of a given user for a given test.
removeIntermediateSolution(int $active_id, int $pass)
saveWorkingData(int $active_id, ?int $pass=null, bool $authorized=true)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ purifyAndPrepareTextAreaOutput()

assQuestion::purifyAndPrepareTextAreaOutput ( string  $content)
protected

Definition at line 1996 of file class.assQuestion.php.

References getHtmlQuestionContentPurifier(), isAdditionalContentEditingModePageObject(), and ilLegacyFormElementsUtil\prepareTextareaOutput().

Referenced by getQuestionForHTMLOutput(), and assFormulaQuestion\substituteVariables().

1996  : string
1997  {
1998  $purified_content = $this->getHtmlQuestionContentPurifier()->purify($content);
2000  || !(new ilSetting('advanced_editing'))->get('advanced_editing_javascript_editor') === 'tinymce') {
2001  $purified_content = nl2br($purified_content);
2002  }
2004  $purified_content,
2005  true,
2006  true
2007  );
2008  }
isAdditionalContentEditingModePageObject()
static prepareTextareaOutput(string $txt_output, bool $prepare_for_latex_output=false, bool $omitNl2BrWhenTextArea=false)
Prepares a string for a text area output where latex code may be in it If the text is HTML-free...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeAllExistingSolutions()

assQuestion::removeAllExistingSolutions ( )

Definition at line 2875 of file class.assQuestion.php.

References getId().

2875  : void
2876  {
2877  $query = "DELETE FROM tst_solutions WHERE question_fi = %s";
2878  $this->db->manipulateF($query, ['integer'], [$this->getId()]);
2879  }
+ Here is the call graph for this function:

◆ removeAllImageFiles()

assQuestion::removeAllImageFiles ( string  $image_target_path)
protected

Definition at line 1401 of file class.assQuestion.php.

Referenced by assOrderingQuestion\cloneImages(), assMatchingQuestion\cloneImages(), and assImagemapQuestion\copyImagemapFiles().

1401  : void
1402  {
1403  $target = opendir($image_target_path);
1404  while ($target_file = readdir($target)) {
1405  if ($target_file === '.' || $target_file === '..') {
1406  continue;
1407  }
1408  copy(
1409  $image_target_path . DIRECTORY_SEPARATOR . $target_file,
1410  $image_target_path . DIRECTORY_SEPARATOR . $target_file
1411  );
1412  }
1413  }
+ Here is the caller graph for this function:

◆ removeCurrentSolution()

assQuestion::removeCurrentSolution ( int  $active_id,
int  $pass,
bool  $authorized = true 
)
Returns
int Affected rows

Definition at line 2562 of file class.assQuestion.php.

References getId(), and getStep().

Referenced by removeIntermediateSolution(), assOrderingHorizontal\saveWorkingData(), assErrorText\saveWorkingData(), assTextSubset\saveWorkingData(), assKprimChoice\saveWorkingData(), assTextQuestion\saveWorkingData(), assMultipleChoice\saveWorkingData(), assLongMenu\saveWorkingData(), assFileUpload\saveWorkingData(), assOrderingQuestion\saveWorkingData(), assMatchingQuestion\saveWorkingData(), and assClozeTest\saveWorkingData().

2562  : int
2563  {
2564  if ($this->getStep() !== null) {
2565  $query = '
2566  DELETE FROM tst_solutions
2567  WHERE active_fi = %s
2568  AND question_fi = %s
2569  AND pass = %s
2570  AND step = %s
2571  AND authorized = %s
2572  ';
2573 
2574  return $this->db->manipulateF(
2575  $query,
2576  ['integer', 'integer', 'integer', 'integer', 'integer'],
2577  [$active_id, $this->getId(), $pass, $this->getStep(), (int) $authorized]
2578  );
2579  }
2580 
2581  $query = "
2582  DELETE FROM tst_solutions
2583  WHERE active_fi = %s
2584  AND question_fi = %s
2585  AND pass = %s
2586  AND authorized = %s
2587  ";
2588 
2589  return $this->db->manipulateF(
2590  $query,
2591  ['integer', 'integer', 'integer', 'integer'],
2592  [$active_id, $this->getId(), $pass, (int) $authorized]
2593  );
2594  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeExistingSolutions()

assQuestion::removeExistingSolutions ( int  $activeId,
int  $pass 
)

Definition at line 2881 of file class.assQuestion.php.

References getId(), and getStep().

Referenced by resetUsersAnswer().

2881  : int
2882  {
2883  $query = "
2884  DELETE FROM tst_solutions
2885  WHERE active_fi = %s
2886  AND question_fi = %s
2887  AND pass = %s
2888  ";
2889 
2890  if ($this->getStep() !== null) {
2891  $query .= " AND step = " . $this->db->quote((int) $this->getStep(), 'integer') . " ";
2892  }
2893 
2894  return $this->db->manipulateF(
2895  $query,
2896  ['integer', 'integer', 'integer'],
2897  [$activeId, $this->getId(), $pass]
2898  );
2899  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeIntermediateSolution()

assQuestion::removeIntermediateSolution ( int  $active_id,
int  $pass 
)

Definition at line 2552 of file class.assQuestion.php.

References getProcessLocker(), and removeCurrentSolution().

Referenced by persistWorkingState().

2552  : void
2553  {
2554  $this->getProcessLocker()->executeUserSolutionUpdateLockOperation(function () use ($active_id, $pass) {
2555  $this->removeCurrentSolution($active_id, $pass, false);
2556  });
2557  }
removeCurrentSolution(int $active_id, int $pass, bool $authorized=true)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeResultRecord()

assQuestion::removeResultRecord ( int  $activeId,
int  $pass 
)

Definition at line 2918 of file class.assQuestion.php.

References getId(), and getStep().

Referenced by resetUsersAnswer().

2918  : int
2919  {
2920  $query = "
2921  DELETE FROM tst_test_result
2922  WHERE active_fi = %s
2923  AND question_fi = %s
2924  AND pass = %s
2925  ";
2926 
2927  if ($this->getStep() !== null) {
2928  $query .= " AND step = " . $this->db->quote((int) $this->getStep(), 'integer') . " ";
2929  }
2930 
2931  return $this->db->manipulateF(
2932  $query,
2933  ['integer', 'integer', 'integer'],
2934  [$activeId, $this->getId(), $pass]
2935  );
2936  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeSolutionRecordById()

assQuestion::removeSolutionRecordById ( int  $solutionId)
protected

Definition at line 2524 of file class.assQuestion.php.

Referenced by deleteDummySolutionRecord(), assNumeric\saveWorkingData(), and assSingleChoice\saveWorkingData().

2524  : int
2525  {
2526  return $this->db->manipulateF(
2527  "DELETE FROM tst_solutions WHERE solution_id = %s",
2528  ['integer'],
2529  [$solutionId]
2530  );
2531  }
+ Here is the caller graph for this function:

◆ resetOriginalId()

static assQuestion::resetOriginalId ( int  $questionId)
static

Definition at line 1428 of file class.assQuestion.php.

References $DIC, and $ilDB.

Referenced by ilTestRandomQuestionSetPoolDeriver\updateTestQuestionStage().

1428  : void
1429  {
1430  global $DIC;
1431  $ilDB = $DIC->database();
1432 
1433  $query = "UPDATE qpl_questions SET tstamp = %s, original_id = NULL WHERE question_id = %s";
1434 
1435  $ilDB->manipulateF(
1436  $query,
1437  ['integer', 'text'],
1438  [time(), $questionId]
1439  );
1440  }
global $DIC
Definition: shib_login.php:25
+ Here is the caller graph for this function:

◆ resetUsersAnswer()

assQuestion::resetUsersAnswer ( int  $activeId,
int  $pass 
)

Definition at line 2901 of file class.assQuestion.php.

References getProcessLocker(), getTestId(), removeExistingSolutions(), and removeResultRecord().

2901  : void
2902  {
2903  $this->removeExistingSolutions($activeId, $pass);
2904  $this->removeResultRecord($activeId, $pass);
2905 
2906  $test = new ilObjTest(
2907  $this->test_id,
2908  false
2909  );
2910  $test->updateTestPassResults(
2911  $activeId,
2912  $pass,
2913  $this->getProcessLocker(),
2914  $this->getTestId()
2915  );
2916  }
removeResultRecord(int $activeId, int $pass)
removeExistingSolutions(int $activeId, int $pass)
+ Here is the call graph for this function:

◆ resolveInternalLink()

assQuestion::resolveInternalLink ( string  $internal_link)

Definition at line 1630 of file class.assQuestion.php.

References ilInternalLink\_getIdForImportId(), and ilLMObject\_getIdForImportId().

Referenced by resolveSuggestedSolutionLinks().

1630  : string
1631  {
1632  if (preg_match("/il_(\d+)_(\w+)_(\d+)/", $internal_link, $matches) === false) {
1633  return $internal_link;
1634  }
1635  switch ($matches[2]) {
1636  case "lm":
1637  $resolved_link = ilLMObject::_getIdForImportId($internal_link);
1638  break;
1639  case "pg":
1640  $resolved_link = ilInternalLink::_getIdForImportId("PageObject", $internal_link);
1641  break;
1642  case "st":
1643  $resolved_link = ilInternalLink::_getIdForImportId("StructureObject", $internal_link);
1644  break;
1645  case "git":
1646  $resolved_link = ilInternalLink::_getIdForImportId("GlossaryItem", $internal_link);
1647  break;
1648  case "mob":
1649  $resolved_link = ilInternalLink::_getIdForImportId("MediaObject", $internal_link);
1650  break;
1651  }
1652  if ($resolved_link === null) {
1653  return "il__{$matches[2]}_{$matches[3]}";
1654  }
1655  return $internal_link;
1656  }
static _getIdForImportId(string $a_import_id)
get current object id for import id (static)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resolveSuggestedSolutionLinks()

assQuestion::resolveSuggestedSolutionLinks ( )

Definition at line 1661 of file class.assQuestion.php.

References ilInternalLink\_deleteAllLinksOfSource(), ilInternalLink\_saveLink(), getId(), and resolveInternalLink().

1661  : void
1662  {
1663  $resolvedlinks = 0;
1664  $result_pre = $this->db->queryF(
1665  "SELECT internal_link, suggested_solution_id FROM qpl_sol_sug WHERE question_fi = %s",
1666  ['integer'],
1667  [$this->getId()]
1668  );
1669  if ($this->db->numRows($result_pre) < 1) {
1670  return;
1671  }
1672 
1673  while ($row = $this->db->fetchAssoc($result_pre)) {
1674  $internal_link = $row["internal_link"];
1675  $resolved_link = $this->resolveInternalLink($internal_link);
1676  if ($internal_link === $resolved_link) {
1677  continue;
1678  }
1679  // internal link was resolved successfully
1680  $this->db->manipulateF(
1681  "UPDATE qpl_sol_sug SET internal_link = %s WHERE suggested_solution_id = %s",
1682  ['text','integer'],
1683  [$resolved_link, $row["suggested_solution_id"]]
1684  );
1685  $resolvedlinks++;
1686  }
1687  if ($resolvedlinks === 0) {
1688  return;
1689  }
1690 
1692 
1693  $result_post = $this->db->queryF(
1694  "SELECT internal_link FROM qpl_sol_sug WHERE question_fi = %s",
1695  ['integer'],
1696  [$this->getId()]
1697  );
1698  if ($this->db->numRows($result_post) < 1) {
1699  return;
1700  }
1701 
1702  while ($row = $this->db->fetchAssoc($result_post)) {
1703  if (preg_match("/il_(\d*?)_(\w+)_(\d+)/", $row["internal_link"], $matches)) {
1704  ilInternalLink::_saveLink("qst", $this->getId(), $matches[2], $matches[3], $matches[1]);
1705  }
1706  }
1707  }
resolveInternalLink(string $internal_link)
+ Here is the call graph for this function:

◆ saveCurrentSolution()

assQuestion::saveCurrentSolution ( int  $active_id,
int  $pass,
  $value1,
  $value2,
bool  $authorized = true,
  $tstamp = 0 
)

Definition at line 2597 of file class.assQuestion.php.

References getId(), getStep(), and ILIAS\Repository\int().

Referenced by duplicateIntermediateSolutionAuthorized(), forceExistingIntermediateSolution(), assOrderingHorizontal\saveWorkingData(), assNumeric\saveWorkingData(), assErrorText\saveWorkingData(), assSingleChoice\saveWorkingData(), assTextSubset\saveWorkingData(), assKprimChoice\saveWorkingData(), assTextQuestion\saveWorkingData(), assMultipleChoice\saveWorkingData(), assFileUpload\saveWorkingData(), assLongMenu\saveWorkingData(), assOrderingQuestion\saveWorkingData(), assMatchingQuestion\saveWorkingData(), and assClozeTest\saveWorkingData().

2597  : int
2598  {
2599  $next_id = $this->db->nextId("tst_solutions");
2600 
2601  $fieldData = [
2602  "solution_id" => ["integer", $next_id],
2603  "active_fi" => ["integer", $active_id],
2604  "question_fi" => ["integer", $this->getId()],
2605  "value1" => ["clob", $value1],
2606  "value2" => ["clob", $value2],
2607  "pass" => ["integer", $pass],
2608  "tstamp" => ["integer", ((int) $tstamp > 0) ? (int) $tstamp : time()],
2609  'authorized' => ['integer', (int) $authorized]
2610  ];
2611 
2612  if ($this->getStep() !== null) {
2613  $fieldData['step'] = ["integer", $this->getStep()];
2614  }
2615 
2616  return $this->db->insert("tst_solutions", $fieldData);
2617  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveOriginalId()

static assQuestion::saveOriginalId ( int  $questionId,
int  $originalId 
)
static

Definition at line 1415 of file class.assQuestion.php.

References $DIC, and $ilDB.

Referenced by ilObjTestGUI\copyAndLinkQuestionsToPoolObject(), ilObjTestGUI\executeAfterQuestionCreationTasks(), and ilTestRandomQuestionSetPoolDeriver\updateTestQuestionStage().

1415  : void
1416  {
1417  global $DIC;
1418  $ilDB = $DIC->database();
1419  $query = "UPDATE qpl_questions SET tstamp = %s, original_id = %s WHERE question_id = %s";
1420 
1421  $ilDB->manipulateF(
1422  $query,
1423  ['integer','integer', 'text'],
1424  [time(), $originalId, $questionId]
1425  );
1426  }
global $DIC
Definition: shib_login.php:25
+ Here is the caller graph for this function:

◆ savePreviewData()

assQuestion::savePreviewData ( ilAssQuestionPreviewSession  $preview_session)
protected

Definition at line 699 of file class.assQuestion.php.

References ilAssQuestionPreviewSession\setParticipantsSolution().

Referenced by persistPreviewState().

699  : void
700  {
701  $preview_session->setParticipantsSolution($this->getSolutionSubmit());
702  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveQuestionDataToDb()

assQuestion::saveQuestionDataToDb ( ?int  $original_id = null)

Definition at line 1224 of file class.assQuestion.php.

References ilRTE\_replaceMediaObjectImageSrc(), createPageObject(), getAdditionalContentEditingMode(), getAuthor(), getComment(), getExternalId(), getId(), getMaximumPoints(), getNrOfTries(), getObjId(), getOwner(), getQuestion(), getQuestionTypeID(), getTitle(), isComplete(), and setId().

Referenced by assNumeric\saveToDb(), assTextSubset\saveToDb(), assErrorText\saveToDb(), assOrderingHorizontal\saveToDb(), assSingleChoice\saveToDb(), assMultipleChoice\saveToDb(), assOrderingQuestion\saveToDb(), assTextQuestion\saveToDb(), assFileUpload\saveToDb(), assMatchingQuestion\saveToDb(), assImagemapQuestion\saveToDb(), assLongMenu\saveToDb(), assClozeTest\saveToDb(), assKprimChoice\saveToDb(), and assFormulaQuestion\saveToDb().

1224  : void
1225  {
1226  if ($this->getId() === -1) {
1227  $next_id = $this->db->nextId('qpl_questions');
1228  $this->db->insert("qpl_questions", [
1229  "question_id" => ["integer", $next_id],
1230  "question_type_fi" => ["integer", $this->getQuestionTypeID()],
1231  "obj_fi" => ["integer", $this->getObjId()],
1232  "title" => ["text", mb_substr($this->getTitle(), 0, 124)],
1233  "description" => ["text", mb_substr($this->getComment(), 0, 1000)],
1234  "author" => ["text", mb_substr($this->getAuthor(), 0, 512)],
1235  "owner" => ["integer", $this->getOwner()],
1236  "question_text" => ["clob", ilRTE::_replaceMediaObjectImageSrc($this->getQuestion(), 0)],
1237  "points" => ["float", $this->getMaximumPoints()],
1238  "nr_of_tries" => ["integer", $this->getNrOfTries()],
1239  "created" => ["integer", time()],
1240  "original_id" => ["integer", $original_id],
1241  "tstamp" => ["integer", time()],
1242  "external_id" => ["text", $this->getExternalId()],
1243  'add_cont_edit_mode' => ['text', $this->getAdditionalContentEditingMode()]
1244  ]);
1245  $this->setId($next_id);
1246  // create page object of question
1247  $this->createPageObject();
1248  return;
1249  }
1250 
1251  // Vorhandenen Datensatz aktualisieren
1252  $this->db->update("qpl_questions", [
1253  "obj_fi" => ["integer", $this->getObjId()],
1254  "title" => ["text", mb_substr($this->getTitle(), 0, 124)],
1255  "description" => ["text", mb_substr($this->getComment(), 0, 1000)],
1256  "author" => ["text", mb_substr($this->getAuthor(), 0, 512)],
1257  "question_text" => ["clob", ilRTE::_replaceMediaObjectImageSrc($this->getQuestion(), 0)],
1258  "points" => ["float", $this->getMaximumPoints()],
1259  "nr_of_tries" => ["integer", $this->getNrOfTries()],
1260  "tstamp" => ["integer", time()],
1261  'complete' => ['integer', $this->isComplete()],
1262  "external_id" => ["text", $this->getExternalId()]
1263  ], [
1264  "question_id" => ["integer", $this->getId()]
1265  ]);
1266  }
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...
setId(int $id=-1)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveToDb()

assQuestion::saveToDb ( ?int  $original_id = null)

Definition at line 1375 of file class.assQuestion.php.

References ilObjQuestionPool\_updateQuestionCount(), cleanupMediaObjectUsage(), getId(), getLifecycle(), getObjId(), getOwner(), and isComplete().

Referenced by assOrderingQuestion\cloneQuestionTypeSpecificProperties(), and migrateContentForLearningModule().

1375  : void
1376  {
1377  // remove unused media objects from ILIAS
1378  $this->cleanupMediaObjectUsage();
1379 
1380  $complete = "0";
1381  if ($this->isComplete()) {
1382  $complete = "1";
1383  }
1384 
1385  $this->db->update(
1386  'qpl_questions',
1387  [
1388  'tstamp' => ['integer', time()],
1389  'owner' => ['integer', $this->getOwner()],
1390  'complete' => ['integer', $complete],
1391  'lifecycle' => ['text', $this->getLifecycle()->getIdentifier()],
1392  ],
1393  [
1394  'question_id' => ['integer', $this->getId()]
1395  ]
1396  );
1397 
1399  }
static _updateQuestionCount(int $object_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveWorkingData()

assQuestion::saveWorkingData ( int  $active_id,
?int  $pass = null,
bool  $authorized = true 
)
abstract

Referenced by persistWorkingState().

+ Here is the caller graph for this function:

◆ setAdditionalContentEditingMode()

assQuestion::setAdditionalContentEditingMode ( ?string  $additionalContentEditingMode)

◆ setAuthor()

◆ setComment()

◆ setDefaultNrOfTries()

assQuestion::setDefaultNrOfTries ( int  $defaultnroftries)

Definition at line 2284 of file class.assQuestion.php.

References $defaultnroftries.

2284  : void
2285  {
2286  $this->defaultnroftries = $defaultnroftries;
2287  }

◆ setExportImagePath()

assQuestion::setExportImagePath ( string  $path)

Definition at line 2211 of file class.assQuestion.php.

References $path.

2211  : void
2212  {
2213  $this->export_image_path = $path;
2214  }
$path
Definition: ltiservices.php:30

◆ setExternalId()

assQuestion::setExternalId ( ?string  $external_id)

Definition at line 462 of file class.assQuestion.php.

References $external_id.

462  : void
463  {
464  $this->external_id = $external_id;
465  }

◆ setForcePassResultUpdateEnabled()

static assQuestion::setForcePassResultUpdateEnabled ( bool  $force_pass_results_update_enabled)
static

Definition at line 212 of file class.assQuestion.php.

References $force_pass_results_update_enabled.

212  : void
213  {
214  self::$force_pass_results_update_enabled = $force_pass_results_update_enabled;
215  }
static $force_pass_results_update_enabled

◆ setId()

◆ setLastChange()

assQuestion::setLastChange ( int  $lastChange)

Definition at line 2478 of file class.assQuestion.php.

References $lastChange.

Referenced by assKprimChoice\loadFromDb().

2478  : void
2479  {
2480  $this->lastChange = $lastChange;
2481  }
+ Here is the caller graph for this function:

◆ setLifecycle()

◆ setNrOfTries()

◆ setObjId()

◆ setOriginalId()

◆ setOwner()

◆ setPoints()

◆ setPreventRteUsage()

assQuestion::setPreventRteUsage ( bool  $prevent_rte_usage)

Definition at line 2245 of file class.assQuestion.php.

References $prevent_rte_usage.

2245  : void
2246  {
2247  $this->prevent_rte_usage = $prevent_rte_usage;
2248  }

◆ setProcessLocker()

assQuestion::setProcessLocker ( ilAssQuestionProcessLocker  $processLocker)

Definition at line 247 of file class.assQuestion.php.

References $processLocker.

247  : void
248  {
249  $this->processLocker = $processLocker;
250  }
ilAssQuestionProcessLocker $processLocker

◆ setQuestion()

◆ setSelfAssessmentEditingMode()

assQuestion::setSelfAssessmentEditingMode ( bool  $selfassessmenteditingmode)

Definition at line 2274 of file class.assQuestion.php.

References $selfassessmenteditingmode.

2274  : void
2275  {
2276  $this->selfassessmenteditingmode = $selfassessmenteditingmode;
2277  }
bool $selfassessmenteditingmode

◆ setShuffle()

assQuestion::setShuffle ( ?bool  $shuffle = true)

Definition at line 345 of file class.assQuestion.php.

Referenced by assSingleChoice\loadFromDb(), assMultipleChoice\loadFromDb(), and assTextQuestion\loadFromDb().

345  : void
346  {
347  $this->shuffle = $shuffle ?? false;
348  }
+ Here is the caller graph for this function:

◆ setShuffler()

assQuestion::setShuffler ( Transformation  $shuffler)

Definition at line 242 of file class.assQuestion.php.

References $shuffler.

Referenced by assMatchingQuestion\toJSON().

242  : void
243  {
244  $this->shuffler = $shuffler;
245  }
Transformation $shuffler
+ Here is the caller graph for this function:

◆ setStep()

assQuestion::setStep (   $step)
Parameters
int | null$step

Definition at line 2759 of file class.assQuestion.php.

References $step.

Referenced by assFileUpload\getUploadedFilesForWeb().

2759  : void
2760  {
2761  $this->step = $step;
2762  }
+ Here is the caller graph for this function:

◆ setTestId()

assQuestion::setTestId ( int  $id = -1)

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

References $id.

335  : void
336  {
337  $this->test_id = $id;
338  }

◆ setThumbSize()

assQuestion::setThumbSize ( int  $a_size)

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

Referenced by assSingleChoice\loadFromDb(), assMultipleChoice\loadFromDb(), assOrderingQuestion\loadFromDb(), and assOrderingQuestion\setContentType().

408  : void
409  {
410  if ($a_size >= self::MINIMUM_THUMB_SIZE) {
411  $this->thumb_size = $a_size;
412  } else {
413  throw new ilException("Thumb size must be at least " . self::MINIMUM_THUMB_SIZE . "px");
414  }
415  }
+ Here is the caller graph for this function:

◆ setTitle()

◆ solutionValuesToLog()

assQuestion::solutionValuesToLog ( AdditionalInformationGenerator  $additional_info,
array  $solution_values 
)
abstractprotected

MUST convert the given solution values into an array or a string that can be stored in the log.

Language variables must be generated through the corresponding functions in the AdditionalInformationGenerator. If an array is returned it will be rendered into a line per array entry in the format "key: value". If the key exists as a language variable, it will be translated.

Referenced by answerToLog().

+ Here is the caller graph for this function:

◆ solutionValuesToText()

assQuestion::solutionValuesToText ( array  $solution_values)
abstractprotected

MUST convert the given solution values into text.

If the text has multiple lines each line MUST be placed as an entry in an array.

Referenced by getCorrectSolutionForTextOutput(), and getSolutionForTextOutput().

+ Here is the caller graph for this function:

◆ syncSkillAssignments()

assQuestion::syncSkillAssignments ( int  $srcParentId,
int  $srcQuestionId,
int  $trgParentId,
int  $trgQuestionId 
)

Definition at line 2349 of file class.assQuestion.php.

References duplicateSkillAssignments().

2349  : void
2350  {
2351  $assignmentList = new ilAssQuestionSkillAssignmentList($this->db);
2352  $assignmentList->setParentObjId($trgParentId);
2353  $assignmentList->setQuestionIdFilter($trgQuestionId);
2354  $assignmentList->loadFromDb();
2355 
2356  foreach ($assignmentList->getAssignmentsByQuestionId($trgQuestionId) as $assignment) {
2357  $assignment->deleteFromDb();
2358 
2359  // remove skill usage
2360  if (!$assignment->isSkillUsed()) {
2361  $this->skillUsageService->removeUsage(
2362  $assignment->getParentObjId(),
2363  $assignment->getSkillBaseId(),
2364  $assignment->getSkillTrefId()
2365  );
2366  }
2367  }
2368 
2369  $this->duplicateSkillAssignments($srcParentId, $srcQuestionId, $trgParentId, $trgQuestionId);
2370  }
duplicateSkillAssignments(int $srcParentId, int $srcQuestionId, int $trgParentId, int $trgQuestionId)
+ Here is the call graph for this function:

◆ syncWithOriginal()

assQuestion::syncWithOriginal ( )

Definition at line 1740 of file class.assQuestion.php.

References afterSyncWithOriginal(), cloneHints(), cloneQuestionTypeSpecificProperties(), cloneSuggestedSolutions(), cloneXHTMLMediaObjectsOfQuestion(), getId(), getObjId(), and getOriginalId().

1740  : void
1741  {
1742  if ($this->getOriginalId() === null) {
1743  return;
1744  }
1745 
1746  $original_parent_id = self::lookupParentObjId($this->getOriginalId());
1747 
1748  if ($original_parent_id === null) {
1749  return;
1750  }
1751 
1752  $this->cloneSuggestedSolutions($this->getId(), $this->getOriginalId());
1753  $original = clone $this;
1754  // Now we become the original
1755  $original->setId($this->getOriginalId());
1756  $original->setOriginalId(null);
1757  $original->setObjId($original_parent_id);
1758 
1759  $original->saveToDb();
1760 
1761  $original->deletePageOfQuestion($this->getOriginalId());
1762  $original->createPageObject();
1763  $original->clonePageOfQuestion($this->getId());
1764  $original = $this->cloneQuestionTypeSpecificProperties($original);
1765  $this->cloneXHTMLMediaObjectsOfQuestion($original->getId());
1766  $this->afterSyncWithOriginal($this->getOriginalId(), $this->getId(), $original_parent_id, $this->getObjId());
1767  $this->cloneHints($this->id, $this->original_id);
1768  }
cloneXHTMLMediaObjectsOfQuestion(int $source_question_id)
cloneHints(int $source_question_id, int $target_question_id)
cloneQuestionTypeSpecificProperties(self $target)
cloneSuggestedSolutions(int $source_question_id, int $target_question_id)
afterSyncWithOriginal(int $original_question_id, int $clone_question_id, int $original_parent_id, int $clone_parent_id)
+ Here is the call graph for this function:

◆ toJSON()

assQuestion::toJSON ( )

Definition at line 2784 of file class.assQuestion.php.

2784  : string
2785  {
2786  return json_encode([]);
2787  }

◆ toLog()

assQuestion::toLog ( AdditionalInformationGenerator  $additional_info)
abstract

MUST return an array of the question settings that can be stored in the log.

Language variables must be generated through the corresponding functions in the AdditionalInformationGenerator. If an array is returned it will be rendered into a line per array entry in the format "key: value". If the key exists as a language variable, it will be translated.

Implements ILIAS\TestQuestionPool\Questions\Question.

Referenced by toQuestionAdministrationInteraction().

+ Here is the caller graph for this function:

◆ toQuestionAdministrationInteraction()

assQuestion::toQuestionAdministrationInteraction ( AdditionalInformationGenerator  $additional_info,
int  $test_ref_id,
TestQuestionAdministrationInteractionTypes  $interaction_type 
)

Implements ILIAS\TestQuestionPool\Questions\Question.

Definition at line 3039 of file class.assQuestion.php.

References toLog().

3045  $test_ref_id,
3046  $this->id,
3047  $this->current_user->getId(),
3048  $interaction_type,
3049  time(),
3050  $this->toLog($additional_info)
3051  );
3052  }
toLog(AdditionalInformationGenerator $additional_info)
MUST return an array of the question settings that can be stored in the log.
+ Here is the call graph for this function:

◆ toXML()

assQuestion::toXML ( bool  $a_include_header = true,
bool  $a_include_binary = true,
bool  $a_shuffle = false,
bool  $test_output = false,
bool  $force_image_references = false 
)
final

Returns a QTI xml representation of the question.

Returns
string The QTI xml representation of the question

Definition at line 313 of file class.assQuestion.php.

References getQuestionType().

319  : string {
320  $classname = $this->getQuestionType() . "Export";
321  $export = new $classname($this);
322  return $export->toXML($a_include_header, $a_include_binary, $a_shuffle, $test_output, $force_image_references);
323  }
+ Here is the call graph for this function:

◆ updateCurrentSolution()

assQuestion::updateCurrentSolution ( int  $solutionId,
  $value1,
  $value2,
bool  $authorized = true 
)

Definition at line 2620 of file class.assQuestion.php.

References getStep(), and ILIAS\Repository\int().

Referenced by assNumeric\saveWorkingData(), and assSingleChoice\saveWorkingData().

2620  : int
2621  {
2622  $fieldData = [
2623  "value1" => ["clob", $value1],
2624  "value2" => ["clob", $value2],
2625  "tstamp" => ["integer", time()],
2626  'authorized' => ['integer', (int) $authorized]
2627  ];
2628 
2629  if ($this->getStep() !== null) {
2630  $fieldData['step'] = ["integer", $this->getStep()];
2631  }
2632 
2633  return $this->db->update("tst_solutions", $fieldData, [
2634  'solution_id' => ['integer', $solutionId]
2635  ]);
2636  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateCurrentSolutionsAuthorization()

assQuestion::updateCurrentSolutionsAuthorization ( int  $activeId,
int  $pass,
bool  $authorized,
bool  $keepTime = false 
)

Definition at line 2639 of file class.assQuestion.php.

References getId(), getStep(), and ILIAS\Repository\int().

Referenced by forceExistingIntermediateSolution(), and assFileUpload\saveWorkingData().

2639  : int
2640  {
2641  $fieldData = [
2642  'authorized' => ['integer', (int) $authorized]
2643  ];
2644 
2645  if (!$keepTime) {
2646  $fieldData['tstamp'] = ['integer', time()];
2647  }
2648 
2649  $whereData = [
2650  'question_fi' => ['integer', $this->getId()],
2651  'active_fi' => ['integer', $activeId],
2652  'pass' => ['integer', $pass]
2653  ];
2654 
2655  if ($this->getStep() !== null) {
2656  $whereData['step'] = ["integer", $this->getStep()];
2657  }
2658 
2659  return $this->db->update('tst_solutions', $fieldData, $whereData);
2660  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateTimestamp()

assQuestion::updateTimestamp ( )

Definition at line 2960 of file class.assQuestion.php.

References getId().

2960  : void
2961  {
2962  $this->db->manipulateF(
2963  "UPDATE qpl_questions SET tstamp = %s WHERE question_id = %s",
2964  ['integer', 'integer'],
2965  [time(), $this->getId()]
2966  );
2967  }
+ Here is the call graph for this function:

◆ validateSolutionSubmit()

assQuestion::validateSolutionSubmit ( )

Implements ILIAS\TestQuestionPool\Questions\Question.

Definition at line 694 of file class.assQuestion.php.

Referenced by persistPreviewState(), and persistWorkingState().

694  : bool
695  {
696  return true;
697  }
+ Here is the caller graph for this function:

Field Documentation

◆ $additionalContentEditingMode

string assQuestion::$additionalContentEditingMode = ''
private

◆ $author

◆ $comment

◆ $current_user

ilObjUser assQuestion::$current_user
protected

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

Referenced by getCurrentUser().

◆ $db

ilDBInterface assQuestion::$db
protected

Definition at line 74 of file class.assQuestion.php.

◆ $defaultnroftries

int assQuestion::$defaultnroftries = 0

Definition at line 107 of file class.assQuestion.php.

Referenced by getDefaultNrOfTries(), and setDefaultNrOfTries().

◆ $dic

Container assQuestion::$dic
protected

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

◆ $export_image_path

string assQuestion::$export_image_path
private

Definition at line 102 of file class.assQuestion.php.

Referenced by getImagePathWeb().

◆ $external_id

string assQuestion::$external_id = null
protected

Definition at line 103 of file class.assQuestion.php.

Referenced by getExternalId(), and setExternalId().

◆ $feedbackOBJ

ilAssQuestionFeedback assQuestion::$feedbackOBJ

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

◆ $force_pass_results_update_enabled

assQuestion::$force_pass_results_update_enabled = false
staticprotected

Definition at line 62 of file class.assQuestion.php.

Referenced by setForcePassResultUpdateEnabled().

◆ $http

HTTPServices assQuestion::$http
protected

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

◆ $id

◆ $ilias

ILIAS assQuestion::$ilias
protected

Definition at line 71 of file class.assQuestion.php.

◆ $imageSourceFixReplaceMap

assQuestion::$imageSourceFixReplaceMap
staticprotected
Initial value:
= [
'ok.svg' => 'ok.png'

Definition at line 1093 of file class.assQuestion.php.

◆ $lastChange

int assQuestion::$lastChange = null
protected

Definition at line 101 of file class.assQuestion.php.

Referenced by getLastChange(), and setLastChange().

◆ $lifecycle

ilAssQuestionLifecycle assQuestion::$lifecycle
protected

Definition at line 84 of file class.assQuestion.php.

Referenced by getLifecycle(), and setLifecycle().

◆ $lng

ilLanguage assQuestion::$lng
protected

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

◆ $log

LoggingServices assQuestion::$log
protected

Definition at line 80 of file class.assQuestion.php.

◆ $nr_of_tries

int assQuestion::$nr_of_tries
private

Definition at line 100 of file class.assQuestion.php.

Referenced by getNrOfTries().

◆ $obj_id

int assQuestion::$obj_id = 0
protected

Definition at line 98 of file class.assQuestion.php.

Referenced by getImagePath(), getObjId(), and setObjId().

◆ $original_id

◆ $owner

◆ $page

ilAssQuestionPage assQuestion::$page
protected

Definition at line 86 of file class.assQuestion.php.

◆ $points

float assQuestion::$points = 0.0
protected

Definition at line 95 of file class.assQuestion.php.

Referenced by _getReachedPoints(), assTextSubset\addAnswer(), assSingleChoice\addAnswer(), assMultipleChoice\addAnswer(), assTextQuestion\addAnswer(), assMatchingQuestion\addMatchingPair(), adjustReachedPointsByScoringOptions(), assClozeTest\calculateCombinationResult(), assOrderingHorizontal\calculateReachedPoints(), assNumeric\calculateReachedPoints(), assErrorText\calculateReachedPoints(), assSingleChoice\calculateReachedPoints(), assKprimChoice\calculateReachedPoints(), assMatchingQuestion\calculateReachedPoints(), assFormulaQuestion\calculateReachedPoints(), assTextQuestion\calculateReachedPointsForSolution(), assLongMenu\calculateReachedPointsForSolution(), assOrderingHorizontal\calculateReachedPointsForSolution(), assTextSubset\calculateReachedPointsForSolution(), assKprimChoice\calculateReachedPointsForSolution(), assMultipleChoice\calculateReachedPointsForSolution(), assMatchingQuestion\calculateReachedPointsForSolution(), assClozeTest\calculateReachedPointsForSolution(), assNumeric\calculateReachedPointsFromPreviewSession(), assSingleChoice\calculateReachedPointsFromPreviewSession(), assFormulaQuestion\calculateReachedPointsFromPreviewSession(), assLongMenu\checkQuestionCustomPart(), assMatchingQuestion\createMatchingPair(), ensureNonNegativePoints(), assClozeTest\getMaximumGapPoints(), assTextQuestion\getMaximumPoints(), assTextSubset\getMaximumPoints(), assLongMenu\getMaximumPoints(), assSingleChoice\getMaximumPoints(), getMaximumPoints(), assMatchingQuestion\getMaximumPoints(), assClozeTest\getMaximumPoints(), assFormulaQuestion\getMaximumPoints(), assTextQuestion\getMinimumPoints(), getPoints(), assLongMenu\getPointsForGap(), assErrorText\getPointsForSelectedPositions(), assNumeric\getUserQuestionResult(), assOrderingHorizontal\getUserQuestionResult(), assTextSubset\getUserQuestionResult(), assLongMenu\getUserQuestionResult(), assErrorText\getUserQuestionResult(), assSingleChoice\getUserQuestionResult(), assMultipleChoice\getUserQuestionResult(), assOrderingQuestion\getUserQuestionResult(), assFormulaQuestion\getUserQuestionResult(), assMatchingQuestion\getUserQuestionResult(), assClozeTest\getUserQuestionResult(), assMatchingQuestion\insertMatchingPair(), assLongMenu\saveAnswerSpecificDataToDb(), assTextQuestion\setAnswers(), assErrorText\setErrorsFromParsedErrorText(), assClozeTest\setGapAnswerPoints(), and setPoints().

◆ $prevent_rte_usage

bool assQuestion::$prevent_rte_usage = false

Definition at line 105 of file class.assQuestion.php.

Referenced by getPreventRteUsage(), and setPreventRteUsage().

◆ $processLocker

ilAssQuestionProcessLocker assQuestion::$processLocker
protected

Definition at line 67 of file class.assQuestion.php.

Referenced by getProcessLocker(), and setProcessLocker().

◆ $question

◆ $question_files

QuestionFiles assQuestion::$question_files
protected

Definition at line 66 of file class.assQuestion.php.

◆ $questionActionCmd

string assQuestion::$questionActionCmd = 'handleQuestionAction'

Definition at line 108 of file class.assQuestion.php.

◆ $questionpool_request

RequestDataCollector assQuestion::$questionpool_request
protected

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

◆ $questionrepository

GeneralQuestionPropertiesRepository assQuestion::$questionrepository
protected

Definition at line 64 of file class.assQuestion.php.

◆ $refinery

Refinery assQuestion::$refinery
protected

◆ $selfassessmenteditingmode

bool assQuestion::$selfassessmenteditingmode = false

◆ $shuffle

◆ $shuffler

Transformation assQuestion::$shuffler
protected

Definition at line 79 of file class.assQuestion.php.

Referenced by getShuffler(), and setShuffler().

◆ $skillUsageService

SkillUsageService assQuestion::$skillUsageService
protected

Definition at line 76 of file class.assQuestion.php.

◆ $step

int assQuestion::$step = null
protected

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

Referenced by getStep(), assFileUpload\getUploadedFilesForWeb(), and setStep().

◆ $suggested_solutions

array assQuestion::$suggested_solutions
protected

Definition at line 114 of file class.assQuestion.php.

Referenced by getSuggestedSolutions().

◆ $suggestedsolution_repo

SuggestedSolutionsDatabaseRepository assQuestion::$suggestedsolution_repo
protected

Definition at line 69 of file class.assQuestion.php.

Referenced by getSuggestedSolutionsRepo().

◆ $test_id

◆ $test_question_config

ilTestQuestionConfig assQuestion::$test_question_config = null
private

Definition at line 83 of file class.assQuestion.php.

Referenced by getTestPresentationConfig().

◆ $testQuestionConfig

ilTestQuestionConfig assQuestion::$testQuestionConfig
protected

Definition at line 68 of file class.assQuestion.php.

◆ $thumb_size

int assQuestion::$thumb_size
protected

Definition at line 93 of file class.assQuestion.php.

Referenced by getThumbSize().

◆ $title

◆ $tpl

ilGlobalPageTemplate assQuestion::$tpl
protected

Definition at line 72 of file class.assQuestion.php.

◆ ADDITIONAL_CONTENT_EDITING_MODE_IPE

◆ ADDITIONAL_CONTENT_EDITING_MODE_RTE

◆ DEFAULT_THUMB_SIZE

const assQuestion::DEFAULT_THUMB_SIZE = 150
private

Definition at line 57 of file class.assQuestion.php.

◆ HAS_SPECIFIC_FEEDBACK

const assQuestion::HAS_SPECIFIC_FEEDBACK = true
protected

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

◆ KEY_VALUES_IMPLOSION_SEPARATOR

const assQuestion::KEY_VALUES_IMPLOSION_SEPARATOR = ':'

Definition at line 2664 of file class.assQuestion.php.

Referenced by explodeKeyValues(), and implodeKeyValues().

◆ MAXIMUM_THUMB_SIZE

const assQuestion::MAXIMUM_THUMB_SIZE = 8192
private

Definition at line 59 of file class.assQuestion.php.

◆ MINIMUM_THUMB_SIZE

const assQuestion::MINIMUM_THUMB_SIZE = 20
private

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

◆ TRIM_PATTERN

const assQuestion::TRIM_PATTERN = '/^[\p{C}\p{Z}]+|[\p{C}\p{Z}]+$/u'

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


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