ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
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)
 
 toXML (bool $a_include_header=true, bool $a_include_binary=true, bool $a_shuffle=false, bool $test_output=false, bool $force_image_references=false)
 
 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 ()
 
 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)
 
 updateOriginalId (?int $original_id=null)
 
 duplicate (bool $set_original_id=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 ()
 
 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 ()
 
 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)
 
 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)
 
 toNormalized (Transformations $transformations, array $context=[])
 
 fromNormalized (array $normalized, Transformations $transformations)
 
 validateSolutionSubmit ()
 
 toLog (AdditionalInformationGenerator $additional_info)
 
 answerToParticipantInteraction (AdditionalInformationGenerator $additional_info, int $test_id, int $active_id, int $pass, string $source_ip, TestParticipantInteractionTypes $interaction_type)
 
 toQuestionAdministrationInteraction (AdditionalInformationGenerator $additional_info, int $test_id, TestQuestionAdministrationInteractionTypes $interaction_type)
 

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

 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 517 of file class.assQuestion.php.

517 : float
518 {
519 global $DIC;
520 $ilDB = $DIC['ilDB'];
521
522 $points = 0.0;
523
524 $result = $ilDB->queryF(
525 "SELECT * FROM tst_test_result WHERE active_fi = %s AND question_fi = %s AND pass = %s",
526 ['integer','integer','integer'],
527 [$active_id, $question_id, $pass]
528 );
529 if ($result->numRows() == 1) {
530 $row = $ilDB->fetchAssoc($result);
531 $points = (float) $row["points"];
532 }
533 return $points;
534 }
global $DIC
Definition: shib_login.php:26

References $DIC, and $ilDB.

◆ _getSolutionMaxPass()

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

Returns the maximum pass a users question solution.

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

1791 : ?int
1792 {
1793 // the following code was the old solution which added the non answered
1794 // questions of a pass from the answered questions of the previous pass
1795 // with the above solution, only the answered questions of the last pass are counted
1796 global $DIC;
1797 $ilDB = $DIC['ilDB'];
1798
1799 $result = $ilDB->queryF(
1800 "SELECT MAX(pass) maxpass FROM tst_test_result WHERE active_fi = %s AND question_fi = %s",
1801 ['integer','integer'],
1802 [$active_id, $question_id]
1803 );
1804 if ($result->numRows() === 1) {
1805 $row = $ilDB->fetchAssoc($result);
1806 return $row["maxpass"];
1807 }
1808
1809 return null;
1810 }

References $DIC, and $ilDB.

Referenced by ilObjTest\getTextAnswer().

+ Here is the caller graph for this function:

◆ _getSuggestedSolutionOutput()

static assQuestion::_getSuggestedSolutionOutput ( int  $question_id)
static

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

460 : string
461 {
462 $question = self::instantiateQuestion($question_id);
463 if (!is_object($question)) {
464 return "";
465 }
466 return $question->getSuggestedSolutionOutput();
467 }
static instantiateQuestion(int $question_id)

◆ _questionExistsInTest()

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

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

2129 : bool
2130 {
2131 global $DIC;
2132 $ilDB = $DIC['ilDB'];
2133
2134 if ($question_id < 1) {
2135 return false;
2136 }
2137
2138 $result = $ilDB->queryF(
2139 "SELECT question_fi FROM tst_test_question WHERE question_fi = %s AND test_fi = %s",
2140 ['integer', 'integer'],
2141 [$question_id, $test_id]
2142 );
2143 return $ilDB->numRows($result) == 1;
2144 }

References $DIC, and $ilDB.

◆ addAnswerOptionValue()

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

Reimplemented in assClozeTest, and assTextSubset.

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

2755 : void
2756 {
2757 }

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

@final @access public

Parameters
integer$points
integer$active_id
integer$pass

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

1846 : float
1847 {
1848 $count_system = ilObjTest::_getCountSystem($active_id);
1849 if ($count_system == 1) {
1850 if (abs($this->getMaximumPoints() - $points) > 0.0000000001) {
1851 $points = 0;
1852 }
1853 }
1854 $score_cutting = ilObjTest::_getScoreCutting($active_id);
1855 if ($score_cutting == 0) {
1856 if ($points < 0) {
1857 $points = 0;
1858 }
1859 }
1860 return $points;
1861 }
static _getScoreCutting(int $active_id)
static _getCountSystem(int $active_id)

References ilObjTest\_getCountSystem(), and ilObjTest\_getScoreCutting().

+ Here is the call graph for this function:

◆ afterSyncWithOriginal()

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

Reimplemented in assMatchingQuestion, and assSingleChoice.

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

1439 : void {
1440 $this->feedbackOBJ->cloneFeedback($original_question_id, $clone_question_id);
1441 }

◆ answerToLog()

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

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

2931 : array {
2932 return [
2933 AdditionalInformationGenerator::KEY_PASS => $pass,
2934 AdditionalInformationGenerator::KEY_REACHED_POINTS => $this->getReachedPoints($active_id, $pass),
2935 AdditionalInformationGenerator::KEY_PAX_ANSWER => $this->solutionValuesToLog(
2936 $additional_info,
2937 $this->getSolutionValues($active_id, $pass)
2938 )
2939 ];
2940 }
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)

◆ 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 2893 of file class.assQuestion.php.

2901 return new TestParticipantInteraction(
2902 $test_ref_id,
2903 $this->id,
2904 $this->current_user->getId(),
2905 $source_ip,
2906 $interaction_type,
2907 time(),
2908 $this->answerToLog($additional_info, $active_id, $pass)
2909 );
2910 }
answerToLog(AdditionalInformationGenerator $additional_info, int $active_id, int $pass)

Referenced by ilTestPlayerAbstractGUI\save().

+ Here is the caller graph for this function:

◆ authorizedOrIntermediateSolutionExists()

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

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

2689 : bool
2690 {
2691 $solutionAvailability = $this->lookupForExistingSolutions($active_id, $pass);
2692 return $solutionAvailability['authorized'] || $solutionAvailability['intermediate'];
2693 }
lookupForExistingSolutions(int $activeId, int $pass)
Lookup if an authorized or intermediate solution exists.

◆ authorizedSolutionExists()

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

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

2680 : bool
2681 {
2682 if ($pass === null) {
2683 return false;
2684 }
2685 $solutionAvailability = $this->lookupForExistingSolutions($active_id, $pass);
2686 return (bool) $solutionAvailability['authorized'];
2687 }

◆ buildHashedImageFilename()

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

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

1862 : string
1863 {
1864 $extension = "";
1865
1866 if (preg_match("/.*\.(png|jpg|gif|jpeg)$/i", $plain_image_filename, $matches)) {
1867 $extension = "." . $matches[1];
1868 }
1869
1870 if ($unique) {
1871 $plain_image_filename = uniqid($plain_image_filename . microtime(true), true);
1872 }
1873
1874 return md5($plain_image_filename) . $extension;
1875 }

◆ buildQuestionDataQuery()

assQuestion::buildQuestionDataQuery ( )
protected

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

2350 : string
2351 {
2352 return "
2353 SELECT qpl_questions.*,
2354 {$this->getAdditionalTableName()}.*
2355 FROM qpl_questions
2356 LEFT JOIN {$this->getAdditionalTableName()}
2357 ON {$this->getAdditionalTableName()}.question_fi = qpl_questions.question_id
2358 WHERE qpl_questions.question_id = %s
2359 ";
2360 }

Referenced by assKprimChoice\loadFromDb().

+ Here is the caller graph for this function:

◆ buildTestPresentationConfig()

assQuestion::buildTestPresentationConfig ( )
protected

Reimplemented in assFileUpload, assMultipleChoice, assOrderingHorizontal, and assOrderingQuestion.

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

2853 {
2854 return new ilTestQuestionConfig();
2855 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ calculateReachedPoints()

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

◆ calculateReachedPointsFromPreviewSession()

assQuestion::calculateReachedPointsFromPreviewSession ( ilAssQuestionPreviewSession  $preview_session)

Reimplemented in assClozeTest, assErrorText, assImagemapQuestion, assOrderingQuestion, assSingleChoice, assFormulaQuestion, and assNumeric.

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

1818 {
1819 $reached_points = $this->calculateReachedPointsForSolution($preview_session->getParticipantsSolution());
1820 return $this->ensureNonNegativePoints($reached_points);
1821 }
ensureNonNegativePoints(float $points)

References ilAssQuestionPreviewSession\getParticipantsSolution().

+ Here is the call 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 559 of file class.assQuestion.php.

559 : void
560 {
561 // determine reached points for submitted solution
562 $reached_points = $this->calculateReachedPoints($active_id, $pass);
563
564 // adjust reached points regarding to tests scoring options
565 $reached_points = $this->adjustReachedPointsByScoringOptions($reached_points, $active_id);
566
567 if (is_null($reached_points)) {
568 $reached_points = 0.0;
569 }
570
571 // fau: testNav - check for existing authorized solution to know if a result record should be written
572 $existing_solutions = $this->lookupForExistingSolutions($active_id, $pass);
573
574 $this->getProcessLocker()->executeUserQuestionResultUpdateOperation(
575 function () use ($active_id, $pass, $reached_points, $existing_solutions) {
576 $query = "
577 DELETE FROM tst_test_result
578
579 WHERE active_fi = %s
580 AND question_fi = %s
581 AND pass = %s
582 ";
583
584 $types = ['integer', 'integer', 'integer'];
585 $values = [$active_id, $this->getId(), $pass];
586
587 if ($this->getStep() !== null) {
588 $query .= "
589 AND step = %s
590 ";
591
592 $types[] = 'integer';
593 $values[] = $this->getStep();
594 }
595 $this->db->manipulateF($query, $types, $values);
596
597 if ($existing_solutions['authorized']) {
598 $next_id = $this->db->nextId("tst_test_result");
599 $fieldData = [
600 'test_result_id' => ['integer', $next_id],
601 'active_fi' => ['integer', $active_id],
602 'question_fi' => ['integer', $this->getId()],
603 'pass' => ['integer', $pass],
604 'points' => ['float', $reached_points],
605 'tstamp' => ['integer', time()],
606 'answered' => ['integer', true]
607 ];
608
609 if ($this->getStep() !== null) {
610 $fieldData['step'] = ['integer', $this->getStep()];
611 }
612
613 $this->db->insert('tst_test_result', $fieldData);
614 }
615 }
616 );
617
618 $this->test_result_repository->updateTestAttemptResult($active_id, $pass, $this->getProcessLocker());
619 ilCourseObjectiveResult::_updateObjectiveResult($this->current_user->getId(), $active_id, $this->getId());
620 }
calculateReachedPoints(int $active_id, ?int $pass=null, bool $authorized_solution=true)
adjustReachedPointsByScoringOptions(float $points, int $active_id)
Adjust the given reached points by checks for all special scoring options in the test container.
static _updateObjectiveResult(int $a_user_id, int $a_active_id, int $a_question_id)

References ilCourseObjectiveResult\_updateObjectiveResult(), and ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ cleanupMediaObjectUsage()

assQuestion::cleanupMediaObjectUsage ( )

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

1999 : void
2000 {
2001 $combinedtext = $this->getRTETextWithMediaObjects();
2002 ilRTE::_cleanupMediaObjectUsage($combinedtext, "qpl:html", $this->getId());
2003 }
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.

References ilRTE\_cleanupMediaObjectUsage(), and ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ clonePageOfQuestion()

assQuestion::clonePageOfQuestion ( int  $a_q_id)

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

1025 : void
1026 {
1027 if ($a_q_id > 0) {
1028 $page = new ilAssQuestionPage($a_q_id);
1029 $page->buildDom();
1030 ilPCPlugged::handleCopiedPluggedContent($page, $page->getDomDoc());
1031 $xml = str_replace("il__qst_" . $a_q_id, "il__qst_" . $this->id, $page->getXMLFromDom());
1032 $this->page->setXMLContent($xml);
1033 $this->page->updateFromXML();
1034 }
1035 }
ilAssQuestionPage $page
getDomDoc()
Get dom doc (DOMDocument)
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)
buildDom(bool $a_force=false)

References $page.

◆ cloneQuestionTypeSpecificProperties()

assQuestion::cloneQuestionTypeSpecificProperties ( self  $target)
protected

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

1350 : self {
1351 return $target;
1352 }

◆ cloneSuggestedSolutionFiles()

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

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

1575 : void {
1576 $filepath_target = $this->getSuggestedSolutionPath();
1577 $filepath_original = str_replace("/$target_question_id/solution", "/$source_question_id/solution", $filepath_target);
1578 ilFileUtils::delDir($filepath_original);
1579 foreach ($this->suggested_solutions as $solution) {
1580 if (!$solution->isOfTypeFile()
1581 || $solution->getFilename() === '') {
1582 continue;
1583 }
1584
1585 if (!file_exists($filepath_original)) {
1586 ilFileUtils::makeDirParents($filepath_original);
1587 }
1588
1589 if (!is_file($filepath_original . $solution->getFilename())
1590 || copy($filepath_target . $solution->getFilename(), $filepath_target . $solution->getFilename())) {
1591 $this->log->forComponent('qpl')->error('File for suggested solutions could not be cloned:');
1592 $this->log->forComponent('qpl')->error("Question-Id: {$this->id}; Question-Title: {$this->title}; File: {$filepath_original}{$solution->getFilename()}");
1593 }
1594 }
1595 }
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

◆ cloneSuggestedSolutions()

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

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

1539 : void {
1540 $this->getSuggestedSolutionsRepo()->clone($source_question_id, $target_question_id);
1541 $this->cloneSuggestedSolutionFiles($source_question_id, $target_question_id);
1542 }
cloneSuggestedSolutionFiles(int $source_question_id, int $target_question_id)

◆ cloneXHTMLMediaObjectsOfQuestion()

assQuestion::cloneXHTMLMediaObjectsOfQuestion ( int  $source_question_id)

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

1005 : void
1006 {
1007 $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $source_question_id);
1008 foreach ($mobs as $mob) {
1009 ilObjMediaObject::_saveUsage($mob, "qpl:html", $this->getId());
1010 }
1011 }
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|false $a_usage_hist_nr=0, string $a_lang="-")

References ilObjMediaObject\_getMobsOfObject(), ilObjMediaObject\_saveUsage(), and ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ convertISO8601FormatH_i_s_ExtendedToSeconds()

static assQuestion::convertISO8601FormatH_i_s_ExtendedToSeconds ( string  $time)
static

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

2656 : int
2657 {
2658 $sec = 0;
2659 $time_array = explode(':', $time);
2660 if (count($time_array) == 3) {
2661 $sec += (int) $time_array[0] * 3600;
2662 $sec += (int) $time_array[1] * 60;
2663 $sec += (int) $time_array[2];
2664 }
2665 return $sec;
2666 }

References ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ copyObject()

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

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

1294 : int {
1295 if ($this->getId() <= 0) {
1296 throw new RuntimeException('The question has not been saved. It cannot be duplicated');
1297 }
1298 // duplicate the question in database
1299 $clone = clone $this;
1300 $clone->id = -1;
1301 $source_parent_id = $this->getObjId();
1302 $clone->setObjId($target_parent_id);
1303 if ($title) {
1304 $clone->setTitle($title);
1305 }
1306 $clone->saveToDb();
1307 $clone->clonePageOfQuestion($this->id);
1308 $clone->cloneXHTMLMediaObjectsOfQuestion($this->id);
1309 $clone = $this->cloneQuestionTypeSpecificProperties($clone);
1310
1311 $clone->onCopy($source_parent_id, $this->id, $clone->getObjId(), $clone->getId());
1312
1313 return $clone->id;
1314 }
cloneQuestionTypeSpecificProperties(self $target)

◆ copySuggestedSolutions()

assQuestion::copySuggestedSolutions ( int  $target_question_id)
protected

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

1597 : void
1598 {
1599 $update = [];
1600 foreach ($this->getSuggestedSolutions() as $index => $solution) {
1601 $solution = $solution->withQuestionId($target_question_id);
1602 $update[] = $solution;
1603 }
1604 $this->getSuggestedSolutionsRepo()->update($update);
1605 }

◆ createNewOriginalFromThisDuplicate()

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

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

1319 : int {
1320 if ($this->getId() <= 0) {
1321 throw new RuntimeException('The question has not been saved. It cannot be duplicated');
1322 }
1323
1324 $source_question_id = $this->id;
1325 $source_parent_id = $this->getObjId();
1326
1327 // duplicate the question in database
1328 $clone = clone $this;
1329 $clone->id = -1;
1330
1331 $clone->setObjId($target_parent_id);
1332
1333 if ($target_question_title) {
1334 $clone->setTitle($target_question_title);
1335 }
1336
1337 $clone->saveToDb();
1338 $clone->clonePageOfQuestion($source_question_id);
1339 $clone->cloneXHTMLMediaObjectsOfQuestion($source_question_id);
1340
1341 $clone = $this->cloneQuestionTypeSpecificProperties($clone);
1342
1343 $clone->onCopy($source_parent_id, $source_question_id, $clone->getObjId(), $clone->getId());
1344
1345 return $clone->id;
1346 }

◆ 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 1133 of file class.assQuestion.php.

1133 : int
1134 {
1135 $complete = '0';
1136 $obj_id = $this->getObjId();
1137 if ($obj_id <= 0
1138 && $this->questionpool_request->hasRefId()) {
1139 $obj_id = $this->questionpool_request->getRefId();
1140 }
1141
1142 if ($obj_id <= 0) {
1143 $obj_id = $this->questionpool_request->int('sel_qpl');
1144 }
1145
1146 if ($obj_id <= 0) {
1147 return $this->getId();
1148 }
1149
1150 $tstamp = time();
1151 if ($a_create_page) {
1152 $tstamp = 0;
1153 }
1154
1155 $next_id = $this->db->nextId('qpl_questions');
1156 $this->db->insert("qpl_questions", [
1157 "question_id" => ["integer", $next_id],
1158 "question_type_fi" => ["integer", $this->getQuestionTypeID()],
1159 "obj_fi" => ["integer", $obj_id],
1160 "title" => ["text", ''],
1161 "description" => ["text", ''],
1162 "author" => ["text", $this->getAuthor()],
1163 "owner" => ["integer", $this->current_user->getId()],
1164 "question_text" => ["clob", ''],
1165 "points" => ["float", "0.0"],
1166 "nr_of_tries" => ["integer", $this->getDefaultNrOfTries()], // #10771
1167 "complete" => ["text", $complete],
1168 "created" => ["integer", time()],
1169 "original_id" => ["integer", null],
1170 "tstamp" => ["integer", $tstamp],
1171 "external_id" => ["text", $this->getExternalId()],
1172 'add_cont_edit_mode' => ['text', $this->getAdditionalContentEditingMode()]
1173 ]);
1174 $this->setId($next_id);
1175
1176 if ($a_create_page) {
1177 // create page object of question
1178 $this->createPageObject();
1179 }
1180
1181 return $this->getId();
1182 }
setId(int $id=-1)

References ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ createPageObject()

assQuestion::createPageObject ( )

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

1013 : void
1014 {
1015 $qpl_id = $this->getObjId();
1016 $this->page = new ilAssQuestionPage(0);
1017 $this->page->setId($this->getId());
1018 $this->page->setParentId($qpl_id);
1019 $this->page->setXMLContent("<PageObject><PageContent>" .
1020 "<Question QRef=\"il__qst_" . $this->getId() . "\"/>" .
1021 "</PageContent></PageObject>");
1022 $this->page->create(false);
1023 }

References ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ delete()

assQuestion::delete ( int  $question_id)

Reimplemented in assLongMenu.

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

841 : void
842 {
843 if ($question_id < 1) {
844 return;
845 }
846
847 $result = $this->db->queryF(
848 "SELECT obj_fi FROM qpl_questions WHERE question_id = %s",
849 ['integer'],
850 [$question_id]
851 );
852 if ($this->db->numRows($result) !== 1) {
853 return;
854 }
855
856 $row = $this->db->fetchAssoc($result);
857 $obj_id = $row["obj_fi"];
858
859 try {
860 $this->deletePageOfQuestion($question_id);
861 } catch (Exception $e) {
862 $this->log->forComponent('qpl')->error("EXCEPTION: Could not delete page of question $question_id: $e");
863 return;
864 }
865
866 $affectedRows = $this->db->manipulateF(
867 "DELETE FROM qpl_questions WHERE question_id = %s",
868 ['integer'],
869 [$question_id]
870 );
871 if ($affectedRows == 0) {
872 return;
873 }
874
875 try {
876 $this->deleteAdditionalTableData($question_id);
877 $this->deleteAnswers($question_id);
878 $this->feedbackOBJ->deleteGenericFeedbacks($question_id, $this->isAdditionalContentEditingModePageObject());
879 $this->feedbackOBJ->deleteSpecificAnswerFeedbacks($question_id, $this->isAdditionalContentEditingModePageObject());
880 } catch (Exception $e) {
881 $this->log->forComponent('qpl')->error("EXCEPTION: Could not delete additional table data of question {$question_id}: {$e}");
882 }
883
884 try {
885 // delete the question in the tst_test_question table (list of test questions)
886 $affectedRows = $this->db->manipulateF(
887 "DELETE FROM tst_test_question WHERE question_fi = %s",
888 ['integer'],
889 [$question_id]
890 );
891 } catch (Exception $e) {
892 $this->log->forComponent('qpl')->error("EXCEPTION: Could not delete delete question {$question_id} from a test: {$e}");
893 }
894
895 try {
896 $this->getSuggestedSolutionsRepo()->deleteForQuestion($question_id);
897 } catch (Exception $e) {
898 $this->log->forComponent('qpl')->error("EXCEPTION: Could not delete suggested solutions of question {$question_id}: {$e}");
899 }
900
901 $directory = CLIENT_WEB_DIR . "/assessment/" . $obj_id . "/$question_id";
902 try {
903 if (is_dir($directory)) {
904 ilFileUtils::delDir($directory);
905 }
906 } catch (Exception $e) {
907 $this->log->forComponent('qpl')->error("EXCEPTION: Could not delete question file directory {$directory} of question {$question_id}: {$e}");
908 }
909
910 try {
911 $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $question_id);
912 // remaining usages are not in text anymore -> delete them
913 // and media objects (note: delete method of ilObjMediaObject
914 // checks whether object is used in another context; if yes,
915 // the object is not deleted!)
916 foreach ($mobs as $mob) {
917 ilObjMediaObject::_removeUsage($mob, "qpl:html", $question_id);
918 if (ilObjMediaObject::_exists($mob)) {
919 $mob_obj = new ilObjMediaObject($mob);
920 $mob_obj->delete();
921 }
922 }
923 } catch (Exception $e) {
924 $this->log->forComponent('qpl')->error("EXCEPTION: Error deleting the media objects of question {$question_id}: {$e}");
925 }
926 $assignmentList = new ilAssQuestionSkillAssignmentList($this->db);
927 $assignmentList->setParentObjId($obj_id);
928 $assignmentList->setQuestionIdFilter($question_id);
929 $assignmentList->loadFromDb();
930 foreach ($assignmentList->getAssignmentsByQuestionId($question_id) as $assignment) {
931 /* @var ilAssQuestionSkillAssignment $assignment */
932 $assignment->deleteFromDb();
933
934 // remove skill usage
935 if (!$assignment->isSkillUsed()) {
936 $this->skillUsageService->removeUsage(
937 $assignment->getParentObjId(),
938 $assignment->getSkillBaseId(),
939 $assignment->getSkillTrefId()
940 );
941 }
942 }
943
945 $this->deleteComments();
946
947 try {
949 } catch (Exception $e) {
950 $this->log->forComponent('qpl')->error(
951 "EXCEPTION: Error updating the question pool question count of"
952 . " question pool {$this->getObjId()} when deleting question {$question_id}: {$e}"
953 );
954 }
955 }
deletePageOfQuestion(int $question_id)
deleteAdditionalTableData(int $question_id)
deleteAnswers(int $question_id)
isAdditionalContentEditingModePageObject()
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
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)
const CLIENT_WEB_DIR
Definition: constants.php:47

References Vendor\Package\$e, ilObjMediaObject\_exists(), ilObjMediaObject\_getMobsOfObject(), ilObjMediaObject\_removeUsage(), ilObjQuestionPool\_updateQuestionCount(), CLIENT_WEB_DIR, and ilFileUtils\delDir().

+ Here is the call graph for this function:

◆ deleteAdditionalTableData()

assQuestion::deleteAdditionalTableData ( int  $question_id)

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

820 : void
821 {
822 $table_name = $this->getAdditionalTableName();
823
824 if (strlen($table_name)) {
825 $this->db->manipulateF(
826 "DELETE FROM $table_name WHERE question_fi = %s",
828 [$question_id]
829 );
830 }
831 }
getAdditionalTableName()

References ilDBConstants\T_INTEGER.

◆ deleteAnswers()

assQuestion::deleteAnswers ( int  $question_id)

Reimplemented in assFormulaQuestion.

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

801 : void
802 {
803 $answer_table_name = $this->getAnswerTableName();
804
805 if (!is_array($answer_table_name)) {
806 $answer_table_name = [$answer_table_name];
807 }
808
809 foreach ($answer_table_name as $table) {
810 if (strlen($table)) {
811 $this->db->manipulateF(
812 "DELETE FROM $table WHERE question_fi = %s",
813 ['integer'],
814 [$question_id]
815 );
816 }
817 }
818 }
getAnswerTableName()

◆ deleteComments()

assQuestion::deleteComments ( )
protected

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

1486 : void
1487 {
1488 $repo = $this->getNotesRepo();
1489 $manager = $this->getNotesManager();
1490 $source_id = $this->getId();
1491 $notes = $manager->getNotesForRepositoryObjIds([$this->getObjId()], Note::PUBLIC);
1492 $notes = array_filter(
1493 $notes,
1494 fn($n) => $n->getContext()->getSubObjId() === $source_id
1495 );
1496 foreach ($notes as $note) {
1497 $repo->deleteNote($note->getId());
1498 }
1499 }

References ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ deleteDummySolutionRecord()

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

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

2560 : void
2561 {
2562 foreach ($this->getSolutionValues($activeId, $passIndex, false) as $solutionRec) {
2563 if ($solutionRec['value1'] == '' && $solutionRec['value2'] == '') {
2564 $this->removeSolutionRecordById($solutionRec['solution_id']);
2565 }
2566 }
2567 }
removeSolutionRecordById(int $solutionId)

◆ deletePageOfQuestion()

assQuestion::deletePageOfQuestion ( int  $question_id)
protected

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

833 : void
834 {
835 if (ilAssQuestionPage::_exists('qpl', $question_id, "", true)) {
836 $page = new ilAssQuestionPage($question_id);
837 $page->delete();
838 }
839 }
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists.

References $page, and ilPageObject\_exists().

+ Here is the call graph for this function:

◆ deleteSolutionRecordByValues()

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

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

2574 : void
2575 {
2576 $types = ["integer", "integer", "integer", "integer"];
2577 $values = [$activeId, $this->getId(), $passIndex, (int) $authorized];
2578 $valuesCondition = [];
2579
2580 foreach ($matchValues as $valueField => $value) {
2581 switch ($valueField) {
2582 case 'value1':
2583 case 'value2':
2584 $valuesCondition[] = "{$valueField} = %s";
2585 $types[] = 'text';
2586 $values[] = $value;
2587 break;
2588
2589 default:
2590 throw new ilTestQuestionPoolException('invalid value field given: ' . $valueField);
2591 }
2592 }
2593
2594 $valuesCondition = implode(' AND ', $valuesCondition);
2595
2596 $query = "
2597 DELETE FROM tst_solutions
2598 WHERE active_fi = %s
2599 AND question_fi = %s
2600 AND pass = %s
2601 AND authorized = %s
2602 AND $valuesCondition
2603 ";
2604
2605 if ($this->getStep() !== null) {
2606 $query .= " AND step = %s ";
2607 $types[] = 'integer';
2608 $values[] = $this->getStep();
2609 }
2610
2611 $this->db->manipulateF($query, $types, $values);
2612 }

References ILIAS\Survey\Mode\getId(), and ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ deleteSuggestedSolutions()

assQuestion::deleteSuggestedSolutions ( )

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

1519 : void
1520 {
1521 $this->getSuggestedSolutionsRepo()->deleteForQuestion($this->getId());
1524 $this->suggested_solutions = [];
1525 }

References ilInternalLink\_deleteAllLinksOfSource(), ilFileUtils\delDir(), and ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ deleteTaxonomyAssignments()

assQuestion::deleteTaxonomyAssignments ( )
private

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

957 : void
958 {
959 $taxIds = ilObjTaxonomy::getUsageOfObject($this->getObjId());
960
961 foreach ($taxIds as $taxId) {
962 $taxNodeAssignment = new ilTaxNodeAssignment('qpl', $this->getObjId(), 'quest', $taxId);
963 $taxNodeAssignment->deleteAssignmentsOfItem($this->getId());
964 }
965 }
static getUsageOfObject(int $a_obj_id, bool $a_include_titles=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ILIAS\Survey\Mode\getId(), and ilObjTaxonomy\getUsageOfObject().

+ Here is the call graph for this function:

◆ duplicate()

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

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

1253 : int {
1254 if ($this->id <= 0) {
1255 // The question has not been saved. It cannot be duplicated
1256 return -1;
1257 }
1258
1259 $clone = clone $this;
1260 $clone->id = -1;
1261
1262 if ((int) $test_obj_id > 0) {
1263 $clone->setObjId($test_obj_id);
1264 }
1265
1266 if ($title) {
1267 $clone->setTitle($title);
1268 }
1269 if ($author) {
1270 $clone->setAuthor($author);
1271 }
1272 if ($owner) {
1273 $clone->setOwner($owner);
1274 }
1275 if ($set_original_id) {
1276 $clone->saveToDb($this->id);
1277 } else {
1278 $clone->saveToDb();
1279 }
1280
1281 $clone->clonePageOfQuestion($this->getId());
1282 $clone->cloneXHTMLMediaObjectsOfQuestion($this->getId());
1283
1284 $clone = $this->cloneQuestionTypeSpecificProperties($clone);
1285
1286 $clone->onDuplicate($this->getObjId(), $this->getId(), $clone->getObjId(), $clone->getId());
1287
1288 return $clone->id;
1289 }

◆ duplicateComments()

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

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

1457 : void {
1458 $manager = $this->getNotesManager();
1459 $data_service = $this->getNotesDataService();
1460 $notes = $manager->getNotesForRepositoryObjIds([$parent_source_id], Note::PUBLIC);
1461 $notes = array_filter(
1462 $notes,
1463 fn($n) => $n->getContext()->getSubObjId() === $source_id
1464 );
1465
1466 foreach ($notes as $note) {
1467 $new_context = $data_service->context(
1468 $parent_target_id,
1469 $target_id,
1470 $note->getContext()->getType()
1471 );
1472 $new_note = $data_service->note(
1473 -1,
1474 $new_context,
1475 $note->getText(),
1476 $note->getAuthor(),
1477 $note->getType(),
1478 $note->getCreationDate(),
1479 $note->getUpdateDate(),
1480 $note->getRecipient()
1481 );
1482 $manager->createNote($new_note, [], true);
1483 }
1484 }

◆ duplicateIntermediateSolutionAuthorized()

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

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

2614 : void
2615 {
2616 foreach ($this->getSolutionValues($activeId, $passIndex, false) as $rec) {
2617 $this->saveCurrentSolution($activeId, $passIndex, $rec['value1'], $rec['value2'], true, $rec['tstamp']);
2618 }
2619 }
saveCurrentSolution(int $active_id, int $pass, $value1, $value2, bool $authorized=true, $tstamp=0)

◆ duplicateSkillAssignments()

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

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

2222 : void
2223 {
2224 $assignmentList = new ilAssQuestionSkillAssignmentList($this->db);
2225 $assignmentList->setParentObjId($srcParentId);
2226 $assignmentList->setQuestionIdFilter($srcQuestionId);
2227 $assignmentList->loadFromDb();
2228
2229 foreach ($assignmentList->getAssignmentsByQuestionId($srcQuestionId) as $assignment) {
2230 $assignment->setParentObjId($trgParentId);
2231 $assignment->setQuestionId($trgQuestionId);
2232 $assignment->saveToDb();
2233
2234 // add skill usage
2235 $this->skillUsageService->addUsage(
2236 $trgParentId,
2237 $assignment->getSkillBaseId(),
2238 $assignment->getSkillTrefId()
2239 );
2240 }
2241 }

◆ 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 1547 of file class.assQuestion.php.

1547 : void
1548 {
1549 foreach ($this->suggested_solutions as $solution) {
1550 if (!$solution->isOfTypeFile()
1551 || $solution->getFilename() === '') {
1552 continue;
1553 }
1554
1555 $filepath = $this->getSuggestedSolutionPath();
1556 $filepath_original = str_replace(
1557 "/{$this->obj_id}/{$this->id}/solution",
1558 "/{$parent_id}/{$question_id}/solution",
1559 $filepath
1560 );
1561 if (!file_exists($filepath)) {
1562 ilFileUtils::makeDirParents($filepath);
1563 }
1564 if (!is_file($filepath_original . $solution->getFilename())
1565 || !copy($filepath_original . $solution->getFilename(), $filepath . $solution->getFilename())) {
1566 $this->log->forComponent('qpl')->error('File for suggested solutions could not be duplicated:');
1567 $this->log->forComponent('qpl')->error("Question-Id: {$this->id}; Question-Title: {$this->title}; File: {$filepath_original}{$solution->getFilename()}");
1568 }
1569 }
1570 }

References ILIAS\UI\examples\Symbol\Glyph\Copy\copy(), and ilFileUtils\makeDirParents().

+ Here is the call graph for this function:

◆ ensureNonNegativePoints()

assQuestion::ensureNonNegativePoints ( float  $points)
protected

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

1823 : float
1824 {
1825 return $points > 0.0 ? $points : 0.0;
1826 }

Referenced by assNumeric\calculateReachedPointsFromPreviewSession().

+ Here is the caller graph for this function:

◆ explodeKeyValues()

static assQuestion::explodeKeyValues ( string  $keyValues)
static

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

2555 : array
2556 {
2557 return explode(assQuestion::KEY_VALUES_IMPLOSION_SEPARATOR, $keyValues);
2558 }
const KEY_VALUES_IMPLOSION_SEPARATOR

References 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 2881 of file class.assQuestion.php.

2881 : string
2882 {
2883 return preg_replace(self::TRIM_PATTERN, '', $value);
2884 }

Referenced by assTextSubsetGUI\writeAnswerSpecificPostData().

+ Here is the caller graph for this function:

◆ fetchIndexedValuesFromValuePairs()

assQuestion::fetchIndexedValuesFromValuePairs ( array  $value_pairs)

Reimplemented in assMatchingQuestion.

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

2823 : array
2824 {
2825 $indexed_values = [];
2826
2827 foreach ($value_pairs as $valuePair) {
2828 $indexed_values[$valuePair['value1']] = $valuePair['value2'];
2829 }
2830
2831 return $indexed_values;
2832 }

◆ fetchValuePairsFromIndexedValues()

assQuestion::fetchValuePairsFromIndexedValues ( array  $indexedValues)

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

2812 : array
2813 {
2814 $valuePairs = [];
2815
2816 foreach ($indexedValues as $value1 => $value2) {
2817 $valuePairs[] = ['value1' => $value1, 'value2' => $value2];
2818 }
2819
2820 return $valuePairs;
2821 }

◆ fixSvgToPng()

assQuestion::fixSvgToPng ( string  $imageFilenameContainingString)

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

1062 : string
1063 {
1064 $needles = array_keys(self::$imageSourceFixReplaceMap);
1065 $replacements = array_values(self::$imageSourceFixReplaceMap);
1066 return str_replace($needles, $replacements, $imageFilenameContainingString);
1067 }

◆ fixUnavailableSkinImageSources()

assQuestion::fixUnavailableSkinImageSources ( string  $html)

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

1069 : string
1070 {
1071 $matches = null;
1072 if (preg_match_all('/src="(.*?)"/m', $html, $matches)) {
1073 $sources = $matches[1];
1074
1075 $needleReplacementMap = [];
1076
1077 foreach ($sources as $src) {
1078 $file = ilFileUtils::removeTrailingPathSeparators(ILIAS_ABSOLUTE_PATH) . DIRECTORY_SEPARATOR . $src;
1079
1080 if (file_exists($file)) {
1081 continue;
1082 }
1083
1084 $levels = explode(DIRECTORY_SEPARATOR, $src);
1085 if (count($levels) < 5 || $levels[0] !== 'Customizing' || $levels[2] !== 'skin') {
1086 continue;
1087 }
1088
1089 $component = '';
1090
1091 if ($levels[4] === 'components/ILIAS' || $levels[4] === 'components/ILIAS') {
1092 $component = $levels[4] . DIRECTORY_SEPARATOR . $levels[5];
1093 }
1094
1095 $needleReplacementMap[$src] = ilUtil::getImagePath(basename($src), $component);
1096 }
1097
1098 if (count($needleReplacementMap)) {
1099 $html = str_replace(array_keys($needleReplacementMap), array_values($needleReplacementMap), $html);
1100 }
1101 }
1102
1103 return $html;
1104 }
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)

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

+ Here is the call graph for this function:

◆ forceExistingIntermediateSolution()

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

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

2621 : void
2622 {
2623 $intermediateSolution = $this->getSolutionValues($activeId, $passIndex, false);
2624
2625 if (!count($intermediateSolution)) {
2626 $this->updateCurrentSolutionsAuthorization($activeId, $passIndex, false, true);
2627
2628 // create a backup as authorized solution again (keeping timestamps)
2629 $this->duplicateIntermediateSolutionAuthorized($activeId, $passIndex);
2630
2631 if ($considerDummyRecordCreation) {
2632 // create an additional dummy record to indicate the existence of an intermediate solution
2633 // even if all entries are deleted from the intermediate solution later
2634 $this->saveCurrentSolution($activeId, $passIndex, null, null, false);
2635 }
2636 }
2637 }
updateCurrentSolutionsAuthorization(int $activeId, int $pass, bool $authorized, bool $keepTime=false)
duplicateIntermediateSolutionAuthorized(int $activeId, int $passIndex)

◆ formatSAQuestion()

assQuestion::formatSAQuestion (   $a_q)

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

2146 : string
2147 {
2148 return $this->getSelfAssessmentFormatter()->format($a_q);
2149 }

◆ fromNormalized()

assQuestion::fromNormalized ( array  $normalized,
Transformations  $transformations 
)
Parameters
array<array-key,mixed>$normalized

Reimplemented in assClozeTest, assErrorText, assFileUpload, assFormulaQuestion, assImagemapQuestion, assKprimChoice, assLongMenu, assMatchingQuestion, assMultipleChoice, assNumeric, assOrderingHorizontal, assOrderingQuestion, assSingleChoice, assTextQuestion, and assTextSubset.

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

3002 : static
3003 {
3004 $clone = clone $this;
3005 $clone->id = $transformations->denormalize($normalized['id'], Id::class)->getId();
3006 $clone->obj_id = $transformations->denormalize($normalized['parent_id'], Id::class)->getId();
3007 $clone->original_id = $transformations->nullableInt($normalized['original_id']);
3008 $clone->external_id = $transformations->nullableString($normalized['external_id']);
3009 $clone->owner = $transformations->int($normalized['owner']);
3010 $clone->title = $transformations->string($normalized['title']);
3011 $clone->comment = $transformations->string($normalized['description']);
3012 $clone->question = $transformations->string($normalized['question_text']);
3013 $clone->points = $transformations->float($normalized['available_points']);
3014 $clone->nr_of_tries = $transformations->int($normalized['nr_of_tries']);
3015 $clone->lifecycle = $transformations->denormalize($normalized['lifecycle'], $clone->lifecycle);
3016 $clone->author = $transformations->string($normalized['author']);
3017 $clone->lastChange = $transformations->nullableInt($normalized['updated_timestamp']);
3018 $clone->additionalContentEditingMode = $transformations->string($normalized['additional_content_editing_mode']);
3019 $clone->thumb_size = $transformations->int($normalized['thumb_size']);
3020 $clone->shuffle = $transformations->bool($normalized['shuffle']);
3021
3022 $clone->suggested_solutions = array_map(
3023 static fn(array $suggested_solution): SuggestedSolution => $transformations->denormalize(
3024 $suggested_solution,
3025 SuggestedSolution::class
3026 ),
3027 $normalized['suggested_solutions']
3028 );
3029
3030 return $clone;
3031 }
denormalize(array|float|bool|int|string|null $normalized, string|object $expected)

References ILIAS\TestQuestionPool\ExportImport\Foundation\Normalize\Transformations\bool(), ILIAS\TestQuestionPool\ExportImport\Foundation\Normalize\Transformations\denormalize(), ILIAS\TestQuestionPool\ExportImport\Foundation\Normalize\Transformations\float(), ILIAS\TestQuestionPool\ExportImport\Foundation\Normalize\Transformations\int(), ILIAS\TestQuestionPool\ExportImport\Foundation\Normalize\Transformations\nullableInt(), ILIAS\TestQuestionPool\ExportImport\Foundation\Normalize\Transformations\nullableString(), and ILIAS\TestQuestionPool\ExportImport\Foundation\Normalize\Transformations\string().

+ Here is the call graph for this function:

◆ 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 
)
final
Deprecated:
12: Use ILIAS\TestQuestionPool\ExportImport\Import\QuestionsImporter instead

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

276 : array {
277 $classname = $this->getQuestionType() . "Import";
278 $import = new $classname($this);
279 $new_import_mapping = $import->fromXML(
280 $importdirectory,
281 $user_id,
282 $item,
283 $questionpool_id,
284 $tst_id,
285 $tst_object,
286 $question_counter,
287 $import_mapping
288 );
289 return $new_import_mapping;
290 }

◆ 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 2049 of file class.assQuestion.php.

2049 : array
2050 {
2051 $result = $this->db->queryF(
2052 "SELECT * FROM tst_active WHERE active_id = %s",
2053 ['integer'],
2054 [$active_id]
2055 );
2056 if ($this->db->numRows($result)) {
2057 $row = $this->db->fetchAssoc($result);
2058 return ["user_id" => $row["user_fi"], "test_id" => $row["test_fi"]];
2059 }
2060
2061 return [];
2062 }

◆ getAdditionalContentEditingMode()

assQuestion::getAdditionalContentEditingMode ( )

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

2298 : string
2299 {
2301 }
string $additionalContentEditingMode

◆ getAdditionalTableName()

◆ getAdjustedReachedPoints()

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

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

546 : float
547 {
548 // determine reached points for submitted solution
549 $reached_points = $this->calculateReachedPoints($active_id, $pass, $authorized_solution);
550 // adjust reached points regarding to tests scoring options
551 $reached_points = $this->adjustReachedPointsByScoringOptions($reached_points, $active_id);
552
553 return $reached_points;
554 }

◆ getAnswerTableName()

◆ getAuthor()

assQuestion::getAuthor ( )

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

409 : string
410 {
411 return $this->author;
412 }

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

+ Here is the caller graph for this function:

◆ getAuthorForHTMLOutput()

assQuestion::getAuthorForHTMLOutput ( )

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

414 : string
415 {
416 return $this->refinery->string()->stripTags()->transform($this->author);
417 }

References ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ getComment()

assQuestion::getComment ( )

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

375 : string
376 {
377 return $this->comment;
378 }

References $comment.

◆ getCorrectSolutionForTextOutput()

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

Reimplemented in assClozeTest, assErrorText, assFileUpload, assFormulaQuestion, assImagemapQuestion, assKprimChoice, assLongMenu, assMatchingQuestion, assMultipleChoice, assNumeric, assOrderingHorizontal, assOrderingQuestion, assSingleChoice, assTextQuestion, and assTextSubset.

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

2954 : array|string {
2955 return $this->solutionValuesToText(
2956 $this->getSolutionValues($active_id, $pass)
2957 );
2958 }
solutionValuesToText(array $solution_values)
MUST convert the given solution values into text.

◆ getCurrentSolutionResultSet()

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

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

2373 {
2374 if ($this->getStep() !== null) {
2375 $query = "
2376 SELECT *
2377 FROM tst_solutions
2378 WHERE active_fi = %s
2379 AND question_fi = %s
2380 AND pass = %s
2381 AND step = %s
2382 AND authorized = %s
2383 ";
2384
2385 return $this->db->queryF(
2386 $query,
2387 ['integer', 'integer', 'integer', 'integer', 'integer'],
2388 [$active_id, $this->getId(), $pass, $this->getStep(), (int) $authorized]
2389 );
2390 }
2391
2392 $query = "
2393 SELECT *
2394 FROM tst_solutions
2395 WHERE active_fi = %s
2396 AND question_fi = %s
2397 AND pass = %s
2398 AND authorized = %s
2399 ";
2400
2401 return $this->db->queryF(
2402 $query,
2403 ['integer', 'integer', 'integer', 'integer'],
2404 [$active_id, $this->getId(), $pass, (int) $authorized]
2405 );
2406 }
Interface ilDBStatement.

References ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ getCurrentUser()

assQuestion::getCurrentUser ( )

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

239 : ilObjUser
240 {
241 return $this->current_user;
242 }
ilObjUser $current_user
User class.

References $current_user.

◆ getDefaultNrOfTries()

assQuestion::getDefaultNrOfTries ( )

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

2202 : int
2203 {
2205 }

◆ getDescriptionForHTMLOutput()

assQuestion::getDescriptionForHTMLOutput ( )

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

380 : string
381 {
382 return $this->refinery->encode()->htmlSpecialCharsAsEntities()->transform($this->comment);
383 }

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

+ Here is the call graph for this function:

◆ getExternalId()

assQuestion::getExternalId ( )

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

449 : string
450 {
451 if ($this->external_id === null || $this->external_id === '') {
452 if ($this->getId() > 0) {
453 return 'il_' . IL_INST_ID . '_qst_' . $this->getId();
454 }
455 return uniqid('', true);
456 }
457 return $this->external_id;
458 }
const IL_INST_ID
Definition: constants.php:40

References ILIAS\Survey\Mode\getId(), and IL_INST_ID.

+ Here is the call graph for this function:

◆ getFeedbackClassNameByQuestionType()

static assQuestion::getFeedbackClassNameByQuestionType ( string  $questionType)
static

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

2069 : string
2070 {
2071 return str_replace('ass', 'ilAss', $questionType) . 'Feedback';
2072 }

Referenced by assQuestionGUI\_getQuestionGUI().

+ Here is the caller graph for this function:

◆ getHtmlQuestionContentPurifier()

assQuestion::getHtmlQuestionContentPurifier ( )
Returns
ilHtmlPurifierInterface|ilAssHtmlUserSolutionPurifier

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

2346 {
2347 return ilHtmlPurifierFactory::getInstanceByType('qpl_usersolution');
2348 }
static getInstanceByType(string $type)
Interface for html sanitizing functionality.

References ilHtmlPurifierFactory\getInstanceByType().

Referenced by assKprimChoice\addAnswer(), assKprimChoice\setAnswers(), and assLongMenu\setLongMenuTextValue().

+ 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 2337 of file class.assQuestion.php.

2338 {
2339 return ilHtmlPurifierFactory::getInstanceByType('qpl_usersolution');
2340 }

References ilHtmlPurifierFactory\getInstanceByType().

+ Here is the call graph for this function:

◆ getId()

◆ 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 681 of file class.assQuestion.php.

681 : string
682 {
683 if ($question_id === null) {
684 $question_id = $this->id;
685 }
686
687 if ($object_id === null) {
688 $object_id = $this->obj_id;
689 }
690
691 return $this->question_files->buildImagePath($question_id, $object_id);
692 }

References $id.

Referenced by assKprimChoice\loadAnswerData(), assMultipleChoice\loadFromDb(), and assSingleChoice\loadFromDb().

+ 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 710 of file class.assQuestion.php.

710 : string
711 {
712 if (!$this->export_image_path) {
714 . "/assessment/{$this->obj_id}/{$this->id}/images/";
715 return str_replace(
716 ilFileUtils::removeTrailingPathSeparators(ILIAS_ABSOLUTE_PATH . '/public'),
718 $webdir
719 );
720 }
722 }
string $export_image_path

References CLIENT_WEB_DIR, and ilFileUtils\removeTrailingPathSeparators().

Referenced by assKprimChoice\loadAnswerData().

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

◆ getInstances()

assQuestion::getInstances ( )

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

2005 : array
2006 {
2007 $result = $this->db->queryF(
2008 "SELECT question_id FROM qpl_questions WHERE original_id = %s",
2009 ["integer"],
2010 [$this->getId()]
2011 );
2012 $instances = [];
2013 $ids = [];
2014 while ($row = $this->db->fetchAssoc($result)) {
2015 $ids[] = $row["question_id"];
2016 }
2017 foreach ($ids as $question_id) {
2018 // check non random tests
2019 $result = $this->db->queryF(
2020 "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",
2021 ["integer"],
2022 [$question_id]
2023 );
2024 while ($row = $this->db->fetchAssoc($result)) {
2025 $instances[$row['obj_fi']] = ilObject::_lookupTitle($row['obj_fi']);
2026 }
2027 // check random tests
2028 $result = $this->db->queryF(
2029 "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",
2030 ["integer"],
2031 [$question_id]
2032 );
2033 while ($row = $this->db->fetchAssoc($result)) {
2034 $instances[$row['obj_fi']] = ilObject::_lookupTitle($row['obj_fi']);
2035 }
2036 }
2037 foreach ($instances as $key => $value) {
2038 $instances[$key] = ["obj_id" => $key, "title" => $value, "author" => ilObjTest::_lookupAuthor($key), "refs" => ilObject::_getAllReferences($key)];
2039 }
2040 return $instances;
2041 }
static _lookupAuthor($obj_id)
Gets the authors name of the ilObjTest object.
static _getAllReferences(int $id)
get all reference ids for object ID
static _lookupTitle(int $obj_id)

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

+ Here is the call graph for this function:

◆ getInternalLinkHref()

assQuestion::getInternalLinkHref ( string  $target)

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

1686 : string
1687 {
1688 $linktypes = [
1689 "lm" => "LearningModule",
1690 "pg" => "PageObject",
1691 "st" => "StructureObject",
1692 "git" => "GlossaryItem",
1693 "mob" => "MediaObject"
1694 ];
1695 $href = "";
1696 if (preg_match("/il__(\w+)_(\d+)/", $target, $matches)) {
1697 $type = $matches[1];
1698 $target_id = $matches[2];
1699 switch ($linktypes[$matches[1]]) {
1700 case "MediaObject":
1701 $href = "./ilias.php?baseClass=ilLMPresentationGUI&obj_type=" . $linktypes[$type]
1702 . "&cmd=media&ref_id=" . $this->questionpool_request->getRefId()
1703 . "&mob_id=" . $target_id;
1704 break;
1705 case "StructureObject":
1706 case "GlossaryItem":
1707 case "PageObject":
1708 case "LearningModule":
1709 default:
1710 $href = "./goto.php?target=" . $type . "_" . $target_id;
1711 break;
1712 }
1713 }
1714 return $href;
1715 }

References ILIAS\Scripts\PHPStan\$target.

◆ getLastChange()

assQuestion::getLastChange ( )

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

2367 : ?int
2368 {
2369 return $this->lastChange;
2370 }

◆ getLifecycle()

assQuestion::getLifecycle ( )

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

References $lifecycle.

◆ getMaximumPoints()

◆ getMaximumThumbSize()

assQuestion::getMaximumThumbSize ( )

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

404 : int
405 {
407 }
const MAXIMUM_THUMB_SIZE

◆ getMinimumThumbSize()

assQuestion::getMinimumThumbSize ( )

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

399 : int
400 {
402 }
const MINIMUM_THUMB_SIZE

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

+ Here is the caller graph for this function:

◆ getNotesDataService()

assQuestion::getNotesDataService ( )
protected

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

1507 : NotesInternalDataService
1508 {
1509 $service = new NotesService($this->dic);
1510 return $service->internal()->data();
1511 }
$service
Definition: ltiresult.php:44

References $service.

◆ getNotesManager()

assQuestion::getNotesManager ( )
protected

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

1501 : NotesManager
1502 {
1503 $service = new NotesService($this->dic);
1504 return $service->internal()->domain()->notes();
1505 }

References $service.

◆ getNotesRepo()

assQuestion::getNotesRepo ( )
protected

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

1513 : NotesRepo
1514 {
1515 $service = new NotesService($this->dic);
1516 return $service->internal()->repo()->note();
1517 }

References $service.

◆ getNrOfTries()

assQuestion::getNrOfTries ( )

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

2114 : int
2115 {
2116 return $this->nr_of_tries;
2117 }

◆ getNumExistingSolutionRecords()

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

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

2272 : int
2273 {
2274 global $DIC;
2275 $ilDB = $DIC['ilDB'];
2276
2277 $query = "
2278 SELECT count(active_fi) cnt
2279
2280 FROM tst_solutions
2281
2282 WHERE active_fi = %s
2283 AND question_fi = %s
2284 AND pass = %s
2285 ";
2286
2287 $res = $ilDB->queryF(
2288 $query,
2289 ['integer','integer','integer'],
2290 [$activeId, $questionId, $pass]
2291 );
2292
2293 $row = $ilDB->fetchAssoc($res);
2294
2295 return (int) $row['cnt'];
2296 }
foreach($_POST as $key=> $value) $res

References $DIC, $ilDB, and $res.

Referenced by isAnswered().

+ Here is the caller graph for this function:

◆ getObjId()

assQuestion::getObjId ( )

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

424 : int
425 {
426 return $this->obj_id;
427 }

Referenced by ilAssQuestionSkillAssignmentsGUI\syncOriginalCmd().

+ Here is the caller graph for this function:

◆ getOriginalId()

assQuestion::getOriginalId ( )

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

1048 : ?int
1049 {
1050 return $this->original_id;
1051 }

Referenced by ilAssQuestionSkillAssignmentsGUI\syncOriginalCmd().

+ Here is the caller graph for this function:

◆ getOwner()

assQuestion::getOwner ( )

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

419 : int
420 {
421 return $this->owner;
422 }

◆ getPageOfQuestion()

assQuestion::getPageOfQuestion ( )

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

1037 : string
1038 {
1039 $page = new ilAssQuestionPage($this->id);
1040 return $page->getXMLContent();
1041 }
getXMLContent(bool $a_incl_head=false)
get xml content of page

References $page.

◆ getPoints()

assQuestion::getPoints ( )

◆ getPreventRteUsage()

assQuestion::getPreventRteUsage ( )

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

2163 : bool
2164 {
2166 }

◆ getProcessLocker()

assQuestion::getProcessLocker ( )

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

References $processLocker.

◆ getQuestion()

assQuestion::getQuestion ( )

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

1945 : string
1946 {
1947 return $this->question;
1948 }

Referenced by assOrderingQuestion\isComplete().

+ Here is the caller graph for this function:

◆ getQuestionAction()

assQuestion::getQuestionAction ( )
protected

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

229 : string
230 {
231 return $this->questionpool_request->getCmdIndex($this->questionActionCmd) ?? '';
232 }

◆ getQuestionForHTMLOutput()

assQuestion::getQuestionForHTMLOutput ( )

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

1950 : string
1951 {
1952 return $this->purifyAndPrepareTextAreaOutput($this->question);
1953 }
purifyAndPrepareTextAreaOutput(string $content)

◆ getQuestionType()

◆ getQuestionTypeID()

assQuestion::getQuestionTypeID ( )

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

1974 : int
1975 {
1976 $result = $this->db->queryF(
1977 "SELECT question_type_id FROM qpl_qst_type WHERE type_tag = %s",
1978 ['text'],
1979 [$this->getQuestionType()]
1980 );
1981 if ($this->db->numRows($result) == 1) {
1982 $row = $this->db->fetchAssoc($result);
1983 return (int) $row["question_type_id"];
1984 }
1985 return 0;
1986 }

◆ getReachedPoints()

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

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

536 : float
537 {
538 return round(self::_getReachedPoints($active_id, $this->getId(), $pass), 2);
539 }

References ILIAS\Survey\Mode\getId().

Referenced by ilLOTestQuestionAdapter\updateQuestionResult().

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

◆ getRTETextWithMediaObjects()

assQuestion::getRTETextWithMediaObjects ( )
protected

Reimplemented in assClozeTest, assFileUpload, assFormulaQuestion, assImagemapQuestion, assKprimChoice, assLongMenu, assMatchingQuestion, assMultipleChoice, assNumeric, assOrderingHorizontal, assOrderingQuestion, assSingleChoice, assTextQuestion, and assTextSubset.

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

1988 : string
1989 {
1990 // must be called in parent classes. add additional RTE text in the parent
1991 // classes and call this method to add the standard RTE text
1992 $collected = $this->getQuestion();
1993 $collected .= $this->feedbackOBJ->getGenericFeedbackContent($this->getId(), false);
1994 $collected .= $this->feedbackOBJ->getGenericFeedbackContent($this->getId(), true);
1995 $collected .= $this->feedbackOBJ->getAllSpecificAnswerFeedbackContents($this->getId());
1996 return $collected;
1997 }

References ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ getSelfAssessmentEditingMode()

assQuestion::getSelfAssessmentEditingMode ( )

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

2192 : bool
2193 {
2195 }
bool $selfassessmenteditingmode

Referenced by ilAssQuestionAuthoringFormGUI\addGenericAssessmentQuestionCommandButtons().

+ Here is the caller graph for this function:

◆ getSelfAssessmentFormatter()

assQuestion::getSelfAssessmentFormatter ( )
protected

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

2152 {
2153 return new \ilAssSelfAssessmentQuestionFormatter();
2154 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ getShuffle()

assQuestion::getShuffle ( )

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

365 : bool
366 {
367 return $this->shuffle;
368 }

◆ getShuffler()

assQuestion::getShuffler ( )

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

245 {
246 return $this->shuffler;
247 }
Transformation $shuffler
A transformation is a function from one datatype to another.

References $shuffler.

◆ getSolutionForTextOutput()

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

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

2945 : array|string {
2946 return $this->solutionValuesToText(
2947 $this->getSolutionValues($active_id, $pass)
2948 );
2949 }

◆ getSolutionMaxPass()

assQuestion::getSolutionMaxPass ( int  $active_id)

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

1783 : ?int
1784 {
1785 return self::_getSolutionMaxPass($this->getId(), $active_id);
1786 }
static _getSolutionMaxPass(int $question_id, int $active_id)
Returns the maximum pass a users question solution.

References ILIAS\Survey\Mode\getId().

Referenced by assErrorText\calculateReachedPoints(), assLongMenu\calculateReachedPoints(), assNumeric\calculateReachedPoints(), assOrderingHorizontal\calculateReachedPoints(), assTextQuestion\calculateReachedPoints(), and assTextSubset\calculateReachedPoints().

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

◆ getSolutionRecordById()

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

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

2421 : array
2422 {
2423 $result = $this->db->queryF(
2424 "SELECT * FROM tst_solutions WHERE solution_id = %s",
2425 ['integer'],
2426 [$solutionId]
2427 );
2428
2429 if ($this->db->numRows($result) > 0) {
2430 return $this->db->fetchAssoc($result);
2431 }
2432 return [];
2433 }

◆ 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 749 of file class.assQuestion.php.

753 : array {
754 if ($pass === null && is_numeric($active_id)) {
755 $pass = $this->getSolutionMaxPass((int) $active_id);
756 }
757
758 if ($this->getStep() !== null) {
759 $query = "
760 SELECT *
761 FROM tst_solutions
762 WHERE active_fi = %s
763 AND question_fi = %s
764 AND pass = %s
765 AND step = %s
766 AND authorized = %s
767 ORDER BY solution_id";
768
769 $result = $this->db->queryF(
770 $query,
771 ['integer', 'integer', 'integer', 'integer', 'integer'],
772 [(int) $active_id, $this->getId(), $pass, $this->getStep(), (int) $authorized]
773 );
774 } else {
775 $query = "
776 SELECT *
777 FROM tst_solutions
778 WHERE active_fi = %s
779 AND question_fi = %s
780 AND pass = %s
781 AND authorized = %s
782 ORDER BY solution_id
783 ";
784
785 $result = $this->db->queryF(
786 $query,
787 ['integer', 'integer', 'integer', 'integer'],
788 [(int) $active_id, $this->getId(), $pass, (int) $authorized]
789 );
790 }
791
792 $values = [];
793
794 while ($row = $this->db->fetchAssoc($result)) {
795 $values[] = $row;
796 }
797
798 return $values;
799 }
getSolutionMaxPass(int $active_id)

Referenced by ilTestCorrectionsGUI\getSolutions(), and ilTestCorrectionsGUI\getSolutionsByParticipantResults().

+ Here is the caller graph for this function:

◆ getStep()

assQuestion::getStep ( )
Returns
int|null

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

2651 : ?int
2652 {
2653 return $this->step;
2654 }

◆ getSuggestedSolution()

assQuestion::getSuggestedSolution ( int  $subquestion_index = 0)

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

1529 {
1530 if (array_key_exists($subquestion_index, $this->suggested_solutions)) {
1531 return $this->suggested_solutions[$subquestion_index];
1532 }
1533 return null;
1534 }

◆ getSuggestedSolutionOutput()

assQuestion::getSuggestedSolutionOutput ( )

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

469 : string
470 {
471 $output = [];
472 foreach ($this->suggested_solutions as $solution) {
473 switch ($solution->getType()) {
474 case SuggestedSolution::TYPE_LM:
475 case SuggestedSolution::TYPE_LM_CHAPTER:
476 case SuggestedSolution::TYPE_LM_PAGE:
477 case SuggestedSolution::TYPE_GLOSARY_TERM:
478 $output[] = '<a href="'
479 . $this->getInternalLinkHref($solution->getInternalLink())
480 . '">'
481 . $this->lng->txt("solution_hint")
482 . '</a>';
483 break;
484
485 case SuggestedSolution::TYPE_FILE:
486 $possible_texts = array_values(
487 array_filter(
488 [
489 ilLegacyFormElementsUtil::prepareFormOutput($solution->getTitle()),
490 ilLegacyFormElementsUtil::prepareFormOutput($solution->getFilename()),
491 $this->lng->txt('tst_show_solution_suggested')
492 ]
493 )
494 );
495
497 $path_to_solution = "{$this->getSuggestedSolutionPath()}{$solution->getFilename()}";
498 if (!file_exists($path_to_solution)) {
499 break;
500 }
501 $output[] = '<a href="'
502 . ilWACSignedPath::signFile($path_to_solution)
503 . '">'
504 . $possible_texts[0]
505 . '</a>';
506 break;
507 }
508 }
509 return implode("<br />", $output);
510 }
getInternalLinkHref(string $target)
static prepareFormOutput($a_str, bool $a_strip=false)
static setTokenMaxLifetimeInSeconds(int $token_max_lifetime_in_seconds)
static signFile(string $path_to_file)

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

+ Here is the call graph for this function:

◆ getSuggestedSolutionPath()

assQuestion::getSuggestedSolutionPath ( )

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

672 : string
673 {
674 return CLIENT_WEB_DIR . "/assessment/$this->obj_id/$this->id/solution/";
675 }

References CLIENT_WEB_DIR.

◆ getSuggestedSolutionPathWeb()

assQuestion::getSuggestedSolutionPathWeb ( )

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

694 : string
695 {
697 . "/assessment/{$this->obj_id}/{$this->id}/solution/";
698 return str_replace(
699 ilFileUtils::removeTrailingPathSeparators(ILIAS_ABSOLUTE_PATH . '/public'),
701 $webdir
702 );
703 }

References CLIENT_WEB_DIR, and ilFileUtils\removeTrailingPathSeparators().

+ Here is the call graph for this function:

◆ getSuggestedSolutions()

assQuestion::getSuggestedSolutions ( )

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

512 : array
513 {
515 }
array $suggested_solutions

◆ getSuggestedSolutionsRepo()

assQuestion::getSuggestedSolutionsRepo ( )
protected

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

◆ getTestId()

assQuestion::getTestId ( )

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

370 : int
371 {
372 return $this->test_id;
373 }

◆ getTestOutputSolutions()

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

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

724 : array
725 {
726 if ($this->getTestPresentationConfig()->isSolutionInitiallyPrefilled()) {
727 return $this->getSolutionValues($activeId, $pass, true);
728 }
729 return $this->getUserSolutionPreferingIntermediate($activeId, $pass);
730 }
getUserSolutionPreferingIntermediate(int $active_id, ?int $pass=null)

◆ getTestPresentationConfig()

assQuestion::getTestPresentationConfig ( )

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

2844 {
2845 if ($this->test_question_config === null) {
2846 $this->test_question_config = $this->buildTestPresentationConfig();
2847 }
2848
2850 }
ilTestQuestionConfig $test_question_config

Referenced by ilTestPlayerAbstractGUI\initTestQuestionConfig().

+ Here is the caller graph for this function:

◆ getThumbSize()

assQuestion::getThumbSize ( )

Reimplemented in assKprimChoice, and assMatchingQuestion.

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

385 : int
386 {
387 return $this->thumb_size;
388 }

◆ getTitle()

assQuestion::getTitle ( )

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

345 : string
346 {
347 return $this->title;
348 }

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

+ Here is the caller graph for this function:

◆ getTitleFilenameCompliant()

assQuestion::getTitleFilenameCompliant ( )

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

355 : string
356 {
358 }
static getASCIIFilename(string $a_filename)

References ilFileUtils\getASCIIFilename(), and ILIAS\GlobalScreen\Scope\Footer\Factory\getTitle().

+ Here is the call graph for this function:

◆ getTitleForHTMLOutput()

assQuestion::getTitleForHTMLOutput ( )

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

350 : string
351 {
352 return $this->refinery->encode()->htmlSpecialCharsAsEntities()->transform($this->title);
353 }

References ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ getTotalAnswers()

assQuestion::getTotalAnswers ( )

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

967 : int
968 {
969 // get all question references to the question id
970 $result = $this->db->queryF(
971 "SELECT question_id FROM qpl_questions WHERE original_id = %s OR question_id = %s",
972 ['integer','integer'],
973 [$this->id, $this->id]
974 );
975 if ($this->db->numRows($result) == 0) {
976 return 0;
977 }
978 $found_id = [];
979 while ($row = $this->db->fetchAssoc($result)) {
980 $found_id[] = $row["question_id"];
981 }
982
983 $result = $this->db->query("SELECT * FROM tst_test_result WHERE " . $this->db->in('question_fi', $found_id, false, 'integer'));
984
985 return $this->db->numRows($result);
986 }

◆ getUserSolutionPreferingIntermediate()

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

Reimplemented in assFileUpload.

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

736 : array {
737 $solution = $this->getSolutionValues($active_id, $pass, false);
738
739 if (!count($solution)) {
740 $solution = $this->getSolutionValues($active_id, $pass, true);
741 }
742
743 return $solution;
744 }

◆ getValidAdditionalContentEditingModes()

assQuestion::getValidAdditionalContentEditingModes ( )

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

2326 : array
2327 {
2328 return [
2331 ];
2332 }
const ADDITIONAL_CONTENT_EDITING_MODE_RTE
const ADDITIONAL_CONTENT_EDITING_MODE_IPE

◆ getVariablesAsTextArray()

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

Reimplemented in assFormulaQuestion.

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

2963 : array {
2964 return [];
2965 }

◆ hasSpecificFeedback()

assQuestion::hasSpecificFeedback ( )

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

2064 : bool
2065 {
2066 return static::HAS_SPECIFIC_FEEDBACK;
2067 }

◆ hasWritableOriginalInQuestionPool()

assQuestion::hasWritableOriginalInQuestionPool ( )

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

2886 : bool
2887 {
2888 return !is_null($this->original_id)
2889 && $this->questionrepository->questionExistsInPool($this->original_id)
2890 && assQuestion::instantiateQuestion($this->original_id)->isWriteable();
2891 }

References instantiateQuestion().

+ Here is the call graph for this function:

◆ implodeKeyValues()

static assQuestion::implodeKeyValues ( array  $keyValues)
static

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

2550 : string
2551 {
2552 return implode(assQuestion::KEY_VALUES_IMPLOSION_SEPARATOR, $keyValues);
2553 }

References KEY_VALUES_IMPLOSION_SEPARATOR.

Referenced by assImagemapQuestionGUI\buildSelectionParameter().

+ 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 1752 of file class.assQuestion.php.

1752 : assQuestion
1753 {
1754 global $DIC;
1755 $ilCtrl = $DIC['ilCtrl'];
1756 $ilDB = $DIC['ilDB'];
1757 $lng = $DIC['lng'];
1758 $questionrepository = QuestionPoolDIC::dic()['question.general_properties.repository'];
1759 $question_type = $questionrepository->getForQuestionId($question_id)?->getClassName() ?? '';
1760 if ($question_type === '') {
1761 throw new InvalidArgumentException('No question with ID ' . $question_id . ' exists');
1762 }
1763
1764 $question = new $question_type();
1765 $question->loadFromDb($question_id);
1766
1767 $feedbackObjectClassname = self::getFeedbackClassNameByQuestionType($question_type);
1768 $question->feedbackOBJ = new $feedbackObjectClassname($question, $ilCtrl, $ilDB, $lng);
1769
1770 return $question;
1771 }
GeneralQuestionPropertiesRepository $questionrepository
ilLanguage $lng
static getFeedbackClassNameByQuestionType(string $questionType)

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

Referenced by ilObjTest\_instanciateQuestion(), ilTestFixedQuestionSetConfig\cloneQuestionSetRelatedData(), ilObjTestGUI\copyAndLinkQuestionsToPoolObject(), ilObjQuestionPool\deleteQuestion(), ilTestResultsToXML\exportTestResults(), ILIAS\TestQuestionPool\Skills\EditSkillsOfQuestionTable\getComponents(), 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(), ilTestRandomQuestionSetStagingPoolBuilder\stageQuestionsFromSourcePoolCheap(), and ilAssQuestionSkillAssignmentsGUI\syncOriginalCmd().

+ 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 2674 of file class.assQuestion.php.

2674 : bool
2675 {
2676 $solutionAvailability = $this->lookupForExistingSolutions($active_id, $pass);
2677 return (bool) $solutionAvailability['intermediate'];
2678 }

◆ isAddableAnswerOptionValue()

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

Reimplemented in assClozeTest, and assTextSubset.

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

2750 : bool
2751 {
2752 return false;
2753 }

◆ isAdditionalContentEditingModePageObject()

assQuestion::isAdditionalContentEditingModePageObject ( )

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

2312 : bool
2313 {
2315 }

References ADDITIONAL_CONTENT_EDITING_MODE_IPE.

◆ isAnswered()

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

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

2266 : bool
2267 {
2268 $numExistingSolutionRecords = assQuestion::getNumExistingSolutionRecords($active_id, $pass, $this->getId());
2269 return $numExistingSolutionRecords > 0;
2270 }
static getNumExistingSolutionRecords(int $activeId, int $pass, int $questionId)

References ILIAS\Survey\Mode\getId(), and getNumExistingSolutionRecords().

+ Here is the call graph for this function:

◆ isComplete()

◆ isDummySolutionRecord()

assQuestion::isDummySolutionRecord ( array  $solutionRecord)
protected

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

2569 : bool
2570 {
2571 return !strlen($solutionRecord['value1']) && !strlen($solutionRecord['value2']);
2572 }

◆ isFileAvailable()

static assQuestion::isFileAvailable ( string  $file)
static

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

988 : bool
989 {
990 if (!file_exists($file)) {
991 return false;
992 }
993
994 if (!is_file($file)) {
995 return false;
996 }
997
998 if (!is_readable($file)) {
999 return false;
1000 }
1001
1002 return true;
1003 }

◆ isForcePassResultUpdateEnabled()

static assQuestion::isForcePassResultUpdateEnabled ( )
static

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

224 : bool
225 {
227 }
static $force_pass_results_update_enabled

References $force_pass_results_update_enabled.

◆ isNonEmptyItemListPostSubmission()

assQuestion::isNonEmptyItemListPostSubmission ( string  $post_submission_field_name)
protected

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

234 : bool
235 {
236 return !empty($this->questionpool_request->strArray($post_submission_field_name));
237 }

◆ isPreviewSolutionCorrect()

assQuestion::isPreviewSolutionCorrect ( ilAssQuestionPreviewSession  $preview_session)

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

1828 : bool
1829 {
1830 $reached_points = $this->calculateReachedPointsFromPreviewSession($preview_session);
1831
1832 return !($reached_points < $this->getMaximumPoints());
1833 }
calculateReachedPointsFromPreviewSession(ilAssQuestionPreviewSession $preview_session)

◆ isValidAdditionalContentEditingMode()

assQuestion::isValidAdditionalContentEditingMode ( string  $additionalContentEditingMode)

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

2317 : bool
2318 {
2320 return true;
2321 }
2322
2323 return false;
2324 }
getValidAdditionalContentEditingModes()

◆ isWriteable()

assQuestion::isWriteable ( )

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

1812 : bool
1813 {
1814 return ilObjQuestionPool::_isWriteable($this->getObjId(), $this->getCurrentUser()->getId());
1815 }
static _isWriteable($object_id, $user_id)
Returns true, if the question pool is writeable by a given user.

References ilObjQuestionPool\_isWriteable(), and ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ lmMigrateQuestionTypeGenericContent()

assQuestion::lmMigrateQuestionTypeGenericContent ( ilAssSelfAssessmentMigrator  $migrator)
protected

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

2177 : void
2178 {
2179 $this->setQuestion($migrator->migrateToLmContent($this->getQuestion()));
2180 }
setQuestion(string $question="")

References ilAssSelfAssessmentMigrator\migrateToLmContent().

+ Here is the call graph for this function:

◆ lmMigrateQuestionTypeSpecificContent()

assQuestion::lmMigrateQuestionTypeSpecificContent ( ilAssSelfAssessmentMigrator  $migrator)
protected

Reimplemented in assClozeTest, assKprimChoice, assLongMenu, assMultipleChoice, and assSingleChoice.

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

2182 : void
2183 {
2184 // overwrite if any question type specific content except feedback needs to be migrated
2185 }

◆ loadFromDb()

assQuestion::loadFromDb ( int  $question_id)

Reimplemented in assClozeTest, assFileUpload, assFormulaQuestion, assImagemapQuestion, assMultipleChoice, assNumeric, assSingleChoice, assTextQuestion, and assTextSubset.

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

1106 : void
1107 {
1108 $result = $this->db->queryF(
1109 'SELECT external_id FROM qpl_questions WHERE question_id = %s',
1110 ['integer'],
1111 [$question_id]
1112 );
1113 if ($this->db->numRows($result) === 1) {
1114 $data = $this->db->fetchAssoc($result);
1115 $this->external_id = $data['external_id'];
1116 }
1117
1119 $this->suggested_solutions = [];
1121 foreach ($suggested_solutions as $solution) {
1122 $this->suggested_solutions[$solution->getSubquestionIndex()] = $solution;
1123 }
1124 }
1125 }
$data
Definition: storeScorm.php:45

References $data.

◆ loadSuggestedSolutions()

assQuestion::loadSuggestedSolutions ( )
protected

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

2862 : array
2863 {
2864 return $this->getSuggestedSolutionsRepo()->selectFor($this->getId());
2865 }

References ILIAS\Survey\Mode\getId().

+ Here is the call 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]

Reimplemented in assFormulaQuestion, and assLongMenu.

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

2714 : array
2715 {
2716 $return = [
2717 'authorized' => false,
2718 'intermediate' => false
2719 ];
2720
2721 $query = "
2722 SELECT authorized, COUNT(*) cnt
2723 FROM tst_solutions
2724 WHERE active_fi = %s
2725 AND question_fi = %s
2726 AND pass = %s
2727 ";
2728
2729 if ($this->getStep() !== null) {
2730 $query .= " AND step = " . $this->db->quote((int) $this->getStep(), 'integer') . " ";
2731 }
2732
2733 $query .= "
2734 GROUP BY authorized
2735 ";
2736
2737 $result = $this->db->queryF($query, ['integer', 'integer', 'integer'], [$activeId, $this->getId(), $pass]);
2738
2739 while ($row = $this->db->fetchAssoc($result)) {
2740 if ($row['authorized']) {
2741 $return['authorized'] = $row['cnt'] > 0;
2742 } else {
2743 $return['intermediate'] = $row['cnt'] > 0;
2744 }
2745 }
2746 return $return;
2747 }

References ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ lookupMaxStep()

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

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

2696 : int
2697 {
2698 $result = $this->db->queryF(
2699 "SELECT MAX(step) max_step FROM tst_solutions WHERE active_fi = %s AND pass = %s AND question_fi = %s",
2700 ["integer", "integer", "integer"],
2701 [$active_id, $pass, $this->getId()]
2702 );
2703
2704 $row = $this->db->fetchAssoc($result);
2705
2706 return (int) $row['max_step'];
2707 }

References ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ lookupParentObjId()

static assQuestion::lookupParentObjId ( int  $question_id)
static

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

2209 : ?int
2210 {
2211 global $DIC;
2212 $ilDB = $DIC['ilDB'];
2213
2214 $query = "SELECT obj_fi FROM qpl_questions WHERE question_id = %s";
2215
2216 $res = $ilDB->queryF($query, ['integer'], [$question_id]);
2217 $row = $ilDB->fetchAssoc($res);
2218
2219 return $row['obj_fi'] ?? null;
2220 }

References $DIC, $ilDB, and $res.

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

+ Here is the caller graph for this function:

◆ migrateContentForLearningModule()

assQuestion::migrateContentForLearningModule ( ilAssSelfAssessmentMigrator  $migrator)

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

2168 : void
2169 {
2170 $this->lmMigrateQuestionTypeGenericContent($migrator);
2171 $this->lmMigrateQuestionTypeSpecificContent($migrator);
2172 $this->saveToDb();
2173
2174 $this->feedbackOBJ->migrateContentForLearningModule($migrator, $this->getId());
2175 }
lmMigrateQuestionTypeGenericContent(ilAssSelfAssessmentMigrator $migrator)
lmMigrateQuestionTypeSpecificContent(ilAssSelfAssessmentMigrator $migrator)
saveToDb(?int $original_id=null)

References ILIAS\Survey\Mode\getId().

Referenced by ilAssSelfAssessmentQuestionFormatter\prepareQuestionForLearningModule().

+ 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 1443 of file class.assQuestion.php.

1443 : void
1444 {
1445 $this->copySuggestedSolutions($targetQuestionId);
1446 $this->duplicateSuggestedSolutionFiles($sourceParentId, $sourceQuestionId);
1447 $this->feedbackOBJ->duplicateFeedback($sourceQuestionId, $targetQuestionId);
1448 $this->duplicateSkillAssignments($sourceParentId, $sourceQuestionId, $targetParentId, $targetQuestionId);
1449 $this->duplicateComments($sourceParentId, $sourceQuestionId, $targetParentId, $targetQuestionId);
1450 }
copySuggestedSolutions(int $target_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.
duplicateSkillAssignments(int $srcParentId, int $srcQuestionId, int $trgParentId, int $trgQuestionId)

◆ onDuplicate()

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

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

1426 : void {
1427 $this->copySuggestedSolutions($duplicate_question_id);
1428 $this->cloneSuggestedSolutionFiles($original_parent_id, $original_question_id);
1429 $this->feedbackOBJ->duplicateFeedback($original_question_id, $duplicate_question_id);
1430 $this->duplicateSkillAssignments($original_parent_id, $original_question_id, $duplicate_parent_id, $duplicate_question_id);
1431 $this->duplicateComments($original_parent_id, $original_question_id, $duplicate_parent_id, $duplicate_question_id);
1432 }

◆ persistPreviewState()

assQuestion::persistPreviewState ( ilAssQuestionPreviewSession  $preview_session)
final

persists the preview state for current user and question

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

656 : bool
657 {
658 $this->savePreviewData($preview_session);
659 return $this->validateSolutionSubmit();
660 }
savePreviewData(ilAssQuestionPreviewSession $preview_session)

◆ 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 626 of file class.assQuestion.php.

626 : bool
627 {
628 if (!$this instanceof QuestionPartiallySaveable && !$this->validateSolutionSubmit()) {
629 return false;
630 }
631
632 $saveStatus = false;
633
634 $this->getProcessLocker()->executePersistWorkingStateLockOperation(function () use ($active_id, $pass, $authorized, &$saveStatus) {
635 if ($pass === null) {
636 $pass = ilObjTest::_getPass($active_id);
637 }
638
639 $saveStatus = $this->saveWorkingData($active_id, $pass, $authorized);
640
641 if ($authorized) {
642 // fau: testNav - remove an intermediate solution if the authorized solution is saved
643 // the intermediate solution would set the displayed question status as "editing ..."
644 $this->removeIntermediateSolution($active_id, $pass);
645 // fau.
646 $this->calculateResultsFromSolution($active_id, $pass);
647 }
648 });
649
650 return $saveStatus;
651 }
calculateResultsFromSolution(int $active_id, int $pass)
Calculates the question results from a previously saved question solution.
removeIntermediateSolution(int $active_id, int $pass)
saveWorkingData(int $active_id, ?int $pass=null, bool $authorized=true)
static _getPass($active_id)
Retrieves the actual pass of a given user for a given test.

References ilObjTest\_getPass().

Referenced by ilTestPlayerAbstractGUI\save().

+ 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 1955 of file class.assQuestion.php.

1955 : string
1956 {
1957 $purified_content = $this->getHtmlQuestionContentPurifier()->purify($content);
1959 || !(new ilSetting('advanced_editing'))->get('advanced_editing_javascript_editor') === 'tinymce') {
1960 $purified_content = nl2br($purified_content);
1961 }
1963 $purified_content,
1964 true,
1965 true
1966 );
1967 }
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,...
ILIAS Setting Class.

References ILIAS\Questions\AnswerFormTypes\Cloze\Migration\getHtmlQuestionContentPurifier(), and ilLegacyFormElementsUtil\prepareTextareaOutput().

+ Here is the call graph for this function:

◆ removeAllExistingSolutions()

assQuestion::removeAllExistingSolutions ( )

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

2759 : void
2760 {
2761 $query = "DELETE FROM tst_solutions WHERE question_fi = %s";
2762 $this->db->manipulateF($query, ['integer'], [$this->getId()]);
2763 }

References ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ removeAllImageFiles()

assQuestion::removeAllImageFiles ( string  $image_target_path)
protected

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

1380 : void
1381 {
1382 $target = opendir($image_target_path);
1383 while ($target_file = readdir($target)) {
1384 if ($target_file === '.' || $target_file === '..') {
1385 continue;
1386 }
1387 copy(
1388 $image_target_path . DIRECTORY_SEPARATOR . $target_file,
1389 $image_target_path . DIRECTORY_SEPARATOR . $target_file
1390 );
1391 }
1392 }

References ILIAS\Scripts\PHPStan\$target, and ILIAS\UI\examples\Symbol\Glyph\Copy\copy().

+ Here is the call graph for this function:

◆ removeCurrentSolution()

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

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

2446 : int
2447 {
2448 if ($this->getStep() !== null) {
2449 $query = '
2450 DELETE FROM tst_solutions
2451 WHERE active_fi = %s
2452 AND question_fi = %s
2453 AND pass = %s
2454 AND step = %s
2455 AND authorized = %s
2456 ';
2457
2458 return $this->db->manipulateF(
2459 $query,
2460 ['integer', 'integer', 'integer', 'integer', 'integer'],
2461 [$active_id, $this->getId(), $pass, $this->getStep(), (int) $authorized]
2462 );
2463 }
2464
2465 $query = "
2466 DELETE FROM tst_solutions
2467 WHERE active_fi = %s
2468 AND question_fi = %s
2469 AND pass = %s
2470 AND authorized = %s
2471 ";
2472
2473 return $this->db->manipulateF(
2474 $query,
2475 ['integer', 'integer', 'integer', 'integer'],
2476 [$active_id, $this->getId(), $pass, (int) $authorized]
2477 );
2478 }

References ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ removeExistingSolutions()

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

Reimplemented in assFormulaQuestion.

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

2765 : int
2766 {
2767 $query = "
2768 DELETE FROM tst_solutions
2769 WHERE active_fi = %s
2770 AND question_fi = %s
2771 AND pass = %s
2772 ";
2773
2774 if ($this->getStep() !== null) {
2775 $query .= " AND step = " . $this->db->quote((int) $this->getStep(), 'integer') . " ";
2776 }
2777
2778 return $this->db->manipulateF(
2779 $query,
2780 ['integer', 'integer', 'integer'],
2781 [$activeId, $this->getId(), $pass]
2782 );
2783 }

References ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ removeIntermediateSolution()

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

Reimplemented in assFileUpload.

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

2436 : void
2437 {
2438 $this->getProcessLocker()->executeUserSolutionUpdateLockOperation(function () use ($active_id, $pass) {
2439 $this->removeCurrentSolution($active_id, $pass, false);
2440 });
2441 }
removeCurrentSolution(int $active_id, int $pass, bool $authorized=true)

◆ removeResultRecord()

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

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

2792 : int
2793 {
2794 $query = "
2795 DELETE FROM tst_test_result
2796 WHERE active_fi = %s
2797 AND question_fi = %s
2798 AND pass = %s
2799 ";
2800
2801 if ($this->getStep() !== null) {
2802 $query .= " AND step = " . $this->db->quote((int) $this->getStep(), 'integer') . " ";
2803 }
2804
2805 return $this->db->manipulateF(
2806 $query,
2807 ['integer', 'integer', 'integer'],
2808 [$activeId, $this->getId(), $pass]
2809 );
2810 }

References ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ removeSolutionRecordById()

assQuestion::removeSolutionRecordById ( int  $solutionId)
protected

Reimplemented in assFileUpload.

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

2408 : int
2409 {
2410 return $this->db->manipulateF(
2411 "DELETE FROM tst_solutions WHERE solution_id = %s",
2412 ['integer'],
2413 [$solutionId]
2414 );
2415 }

◆ resetOriginalId()

static assQuestion::resetOriginalId ( int  $questionId)
static

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

1407 : void
1408 {
1409 global $DIC;
1410 $ilDB = $DIC->database();
1411
1412 $query = "UPDATE qpl_questions SET tstamp = %s, original_id = NULL WHERE question_id = %s";
1413
1414 $ilDB->manipulateF(
1415 $query,
1416 ['integer', 'text'],
1417 [time(), $questionId]
1418 );
1419 }

References $DIC, and $ilDB.

Referenced by ilTestRandomQuestionSetPoolDeriver\updateTestQuestionStage().

+ Here is the caller graph for this function:

◆ resetUsersAnswer()

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

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

2785 : void
2786 {
2787 $this->removeExistingSolutions($activeId, $pass);
2788 $this->removeResultRecord($activeId, $pass);
2789 $this->test_result_repository->updateTestAttemptResult($activeId, $pass, $this->getProcessLocker(), $this->getTestId());
2790 }
removeResultRecord(int $activeId, int $pass)
removeExistingSolutions(int $activeId, int $pass)

◆ resolveInternalLink()

assQuestion::resolveInternalLink ( string  $internal_link)

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

1607 : string
1608 {
1609 if (preg_match("/il_(\d+)_(\w+)_(\d+)/", $internal_link, $matches) === false) {
1610 return $internal_link;
1611 }
1612 switch ($matches[2]) {
1613 case "lm":
1614 $resolved_link = ilLMObject::_getIdForImportId($internal_link);
1615 break;
1616 case "pg":
1617 $resolved_link = ilInternalLink::_getIdForImportId("PageObject", $internal_link);
1618 break;
1619 case "st":
1620 $resolved_link = ilInternalLink::_getIdForImportId("StructureObject", $internal_link);
1621 break;
1622 case "git":
1623 $resolved_link = ilInternalLink::_getIdForImportId("GlossaryItem", $internal_link);
1624 break;
1625 case "mob":
1626 $resolved_link = ilInternalLink::_getIdForImportId("MediaObject", $internal_link);
1627 break;
1628 }
1629 if ($resolved_link === null) {
1630 return "il__{$matches[2]}_{$matches[3]}";
1631 }
1632 return $internal_link;
1633 }
static _getIdForImportId(string $a_import_id)
get current object id for import id (static)

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

+ Here is the call graph for this function:

◆ resolveSuggestedSolutionLinks()

assQuestion::resolveSuggestedSolutionLinks ( )

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

1638 : void
1639 {
1640 $resolvedlinks = 0;
1641 $result_pre = $this->db->queryF(
1642 "SELECT internal_link, suggested_solution_id FROM qpl_sol_sug WHERE question_fi = %s",
1643 ['integer'],
1644 [$this->getId()]
1645 );
1646 if ($this->db->numRows($result_pre) < 1) {
1647 return;
1648 }
1649
1650 while ($row = $this->db->fetchAssoc($result_pre)) {
1651 $internal_link = $row["internal_link"];
1652 $resolved_link = $this->resolveInternalLink($internal_link);
1653 if ($internal_link === $resolved_link) {
1654 continue;
1655 }
1656 // internal link was resolved successfully
1657 $this->db->manipulateF(
1658 "UPDATE qpl_sol_sug SET internal_link = %s WHERE suggested_solution_id = %s",
1659 ['text','integer'],
1660 [$resolved_link, $row["suggested_solution_id"]]
1661 );
1662 $resolvedlinks++;
1663 }
1664 if ($resolvedlinks === 0) {
1665 return;
1666 }
1667
1669
1670 $result_post = $this->db->queryF(
1671 "SELECT internal_link FROM qpl_sol_sug WHERE question_fi = %s",
1672 ['integer'],
1673 [$this->getId()]
1674 );
1675 if ($this->db->numRows($result_post) < 1) {
1676 return;
1677 }
1678
1679 while ($row = $this->db->fetchAssoc($result_post)) {
1680 if (preg_match("/il_(\d*?)_(\w+)_(\d+)/", $row["internal_link"], $matches)) {
1681 ilInternalLink::_saveLink("qst", $this->getId(), $matches[2], $matches[3], $matches[1]);
1682 }
1683 }
1684 }
resolveInternalLink(string $internal_link)

References ilInternalLink\_deleteAllLinksOfSource(), ilInternalLink\_saveLink(), and ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ saveCurrentSolution()

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

Reimplemented in assFormulaQuestion.

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

2481 : int
2482 {
2483 $next_id = $this->db->nextId("tst_solutions");
2484
2485 $fieldData = [
2486 "solution_id" => ["integer", $next_id],
2487 "active_fi" => ["integer", $active_id],
2488 "question_fi" => ["integer", $this->getId()],
2489 "value1" => ["clob", $value1],
2490 "value2" => ["clob", $value2],
2491 "pass" => ["integer", $pass],
2492 "tstamp" => ["integer", ((int) $tstamp > 0) ? (int) $tstamp : time()],
2493 'authorized' => ['integer', (int) $authorized]
2494 ];
2495
2496 if ($this->getStep() !== null) {
2497 $fieldData['step'] = ["integer", $this->getStep()];
2498 }
2499
2500 return $this->db->insert("tst_solutions", $fieldData);
2501 }

References ILIAS\Survey\Mode\getId(), and ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ saveOriginalId()

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

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

1394 : void
1395 {
1396 global $DIC;
1397 $ilDB = $DIC->database();
1398 $query = "UPDATE qpl_questions SET tstamp = %s, original_id = %s WHERE question_id = %s";
1399
1400 $ilDB->manipulateF(
1401 $query,
1402 ['integer','integer', 'text'],
1403 [time(), $originalId, $questionId]
1404 );
1405 }

References $DIC, and $ilDB.

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

+ Here is the caller graph for this function:

◆ savePreviewData()

assQuestion::savePreviewData ( ilAssQuestionPreviewSession  $preview_session)
protected

Reimplemented in assLongMenu, assErrorText, assFileUpload, assFormulaQuestion, assImagemapQuestion, assMatchingQuestion, assNumeric, assOrderingQuestion, and assSingleChoice.

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

667 : void
668 {
669 $preview_session->setParticipantsSolution($this->getSolutionSubmit());
670 }

References ilAssQuestionPreviewSession\setParticipantsSolution().

+ Here is the call graph for this function:

◆ saveQuestionDataToDb()

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

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

1184 : void
1185 {
1186 if ($this->getId() === -1) {
1187 $next_id = $this->db->nextId('qpl_questions');
1188 $this->db->insert("qpl_questions", [
1189 "question_id" => ["integer", $next_id],
1190 "question_type_fi" => ["integer", $this->getQuestionTypeID()],
1191 "obj_fi" => ["integer", $this->getObjId()],
1192 "title" => ["text", mb_substr($this->getTitle(), 0, 124)],
1193 "description" => ["text", mb_substr($this->getComment(), 0, 1000)],
1194 "author" => ["text", mb_substr($this->getAuthor(), 0, 512)],
1195 "owner" => ["integer", $this->getOwner()],
1196 "question_text" => ["clob", ilRTE::_replaceMediaObjectImageSrc($this->getQuestion(), 0)],
1197 "points" => ["float", $this->getMaximumPoints()],
1198 "nr_of_tries" => ["integer", $this->getNrOfTries()],
1199 "created" => ["integer", time()],
1200 "original_id" => ["integer", $original_id],
1201 "tstamp" => ["integer", time()],
1202 "external_id" => ["text", $this->getExternalId()],
1203 'add_cont_edit_mode' => ['text', $this->getAdditionalContentEditingMode()]
1204 ]);
1205 $this->setId($next_id);
1206 // create page object of question
1207 $this->createPageObject();
1208 return;
1209 }
1210
1211 // Vorhandenen Datensatz aktualisieren
1212 $this->db->update("qpl_questions", [
1213 "obj_fi" => ["integer", $this->getObjId()],
1214 "title" => ["text", mb_substr($this->getTitle(), 0, 124)],
1215 "description" => ["text", mb_substr($this->getComment(), 0, 1000)],
1216 "author" => ["text", mb_substr($this->getAuthor(), 0, 512)],
1217 "question_text" => ["clob", ilRTE::_replaceMediaObjectImageSrc($this->getQuestion(), 0)],
1218 "points" => ["float", $this->getMaximumPoints()],
1219 "nr_of_tries" => ["integer", $this->getNrOfTries()],
1220 "tstamp" => ["integer", time()],
1221 'complete' => ['integer', $this->isComplete()],
1222 "external_id" => ["text", $this->getExternalId()]
1223 ], [
1224 "question_id" => ["integer", $this->getId()]
1225 ]);
1226 }
static _replaceMediaObjectImageSrc(string $a_text, int $a_direction=0, string $nic='')
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...

References ilRTE\_replaceMediaObjectImageSrc(), ILIAS\Survey\Mode\getId(), and ILIAS\GlobalScreen\Scope\Footer\Factory\getTitle().

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

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

◆ saveToDb()

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

Reimplemented in assClozeTest, assErrorText, assFileUpload, assFormulaQuestion, assImagemapQuestion, assKprimChoice, assLongMenu, assMatchingQuestion, assMultipleChoice, assNumeric, assOrderingHorizontal, assOrderingQuestion, assSingleChoice, assTextQuestion, and assTextSubset.

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

1354 : void
1355 {
1356 // remove unused media objects from ILIAS
1357 $this->cleanupMediaObjectUsage();
1358
1359 $complete = "0";
1360 if ($this->isComplete()) {
1361 $complete = "1";
1362 }
1363
1364 $this->db->update(
1365 'qpl_questions',
1366 [
1367 'tstamp' => ['integer', time()],
1368 'owner' => ['integer', $this->getOwner()],
1369 'complete' => ['integer', $complete],
1370 'lifecycle' => ['text', $this->getLifecycle()->getIdentifier()],
1371 ],
1372 [
1373 'question_id' => ['integer', $this->getId()]
1374 ]
1375 );
1376
1378 }

References ilObjQuestionPool\_updateQuestionCount(), and ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ saveWorkingData()

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

◆ setAdditionalContentEditingMode()

assQuestion::setAdditionalContentEditingMode ( ?string  $additionalContentEditingMode)

◆ setAuthor()

assQuestion::setAuthor ( string  $author = "")

◆ setComment()

◆ setDefaultNrOfTries()

assQuestion::setDefaultNrOfTries ( int  $defaultnroftries)

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

2197 : void
2198 {
2199 $this->defaultnroftries = $defaultnroftries;
2200 }

◆ setExportImagePath()

assQuestion::setExportImagePath ( string  $path)

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

2124 : void
2125 {
2126 $this->export_image_path = $path;
2127 }

◆ setExternalId()

assQuestion::setExternalId ( ?string  $external_id)

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

444 : void
445 {
446 $this->external_id = $external_id;
447 }

◆ setForcePassResultUpdateEnabled()

static assQuestion::setForcePassResultUpdateEnabled ( bool  $force_pass_results_update_enabled)
static

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

219 : void
220 {
221 self::$force_pass_results_update_enabled = $force_pass_results_update_enabled;
222 }

References $force_pass_results_update_enabled.

◆ setId()

◆ setLastChange()

assQuestion::setLastChange ( int  $lastChange)

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

2362 : void
2363 {
2364 $this->lastChange = $lastChange;
2365 }

Referenced by assKprimChoice\loadFromDb().

+ Here is the caller graph for this function:

◆ setLifecycle()

◆ setNrOfTries()

◆ setObjId()

◆ setOriginalId()

◆ setOwner()

◆ setPoints()

◆ setPreventRteUsage()

assQuestion::setPreventRteUsage ( bool  $prevent_rte_usage)

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

2158 : void
2159 {
2160 $this->prevent_rte_usage = $prevent_rte_usage;
2161 }

◆ setProcessLocker()

assQuestion::setProcessLocker ( ilAssQuestionProcessLocker  $processLocker)

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

254 : void
255 {
256 $this->processLocker = $processLocker;
257 }

References $processLocker.

◆ setQuestion()

◆ setSelfAssessmentEditingMode()

assQuestion::setSelfAssessmentEditingMode ( bool  $selfassessmenteditingmode)

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

2187 : void
2188 {
2189 $this->selfassessmenteditingmode = $selfassessmenteditingmode;
2190 }

◆ setShuffle()

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

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

327 : void
328 {
329 $this->shuffle = $shuffle ?? false;
330 }

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

+ Here is the caller graph for this function:

◆ setShuffler()

assQuestion::setShuffler ( Transformation  $shuffler)

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

249 : void
250 {
251 $this->shuffler = $shuffler;
252 }

References $shuffler.

◆ setStep()

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

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

2643 : void
2644 {
2645 $this->step = $step;
2646 }

◆ setTestId()

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

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

317 : void
318 {
319 $this->test_id = $id;
320 }

References $id.

◆ setThumbSize()

assQuestion::setThumbSize ( int  $a_size)

Reimplemented in assKprimChoice.

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

390 : void
391 {
392 if ($a_size >= self::MINIMUM_THUMB_SIZE) {
393 $this->thumb_size = $a_size;
394 } else {
395 throw new ilException("Thumb size must be at least " . self::MINIMUM_THUMB_SIZE . "px");
396 }
397 }
Base class for ILIAS Exception handling.

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

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

Reimplemented in assClozeTest, assErrorText, assFileUpload, assFormulaQuestion, assImagemapQuestion, assKprimChoice, assLongMenu, assMatchingQuestion, assMultipleChoice, assNumeric, assOrderingHorizontal, assOrderingQuestion, assSingleChoice, assTextQuestion, and assTextSubset.

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

Reimplemented in assClozeTest, assErrorText, assFileUpload, assFormulaQuestion, assImagemapQuestion, assKprimChoice, assLongMenu, assMatchingQuestion, assMultipleChoice, assNumeric, assOrderingHorizontal, assOrderingQuestion, assSingleChoice, assTextQuestion, and assTextSubset.

◆ syncSkillAssignments()

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

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

2243 : void
2244 {
2245 $assignmentList = new ilAssQuestionSkillAssignmentList($this->db);
2246 $assignmentList->setParentObjId($trgParentId);
2247 $assignmentList->setQuestionIdFilter($trgQuestionId);
2248 $assignmentList->loadFromDb();
2249
2250 foreach ($assignmentList->getAssignmentsByQuestionId($trgQuestionId) as $assignment) {
2251 $assignment->deleteFromDb();
2252
2253 // remove skill usage
2254 if (!$assignment->isSkillUsed()) {
2255 $this->skillUsageService->removeUsage(
2256 $assignment->getParentObjId(),
2257 $assignment->getSkillBaseId(),
2258 $assignment->getSkillTrefId()
2259 );
2260 }
2261 }
2262
2263 $this->duplicateSkillAssignments($srcParentId, $srcQuestionId, $trgParentId, $trgQuestionId);
2264 }

Referenced by ilAssQuestionSkillAssignmentsGUI\syncOriginalCmd().

+ Here is the caller graph for this function:

◆ syncWithOriginal()

assQuestion::syncWithOriginal ( )

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

1717 : void
1718 {
1719 if ($this->getOriginalId() === null) {
1720 return;
1721 }
1722
1723 $original_parent_id = self::lookupParentObjId($this->getOriginalId());
1724
1725 if ($original_parent_id === null) {
1726 return;
1727 }
1728
1729 $this->cloneSuggestedSolutions($this->getId(), $this->getOriginalId());
1730 $original = clone $this;
1731 // Now we become the original
1732 $original->setId($this->getOriginalId());
1733 $original->setOriginalId(null);
1734 $original->setObjId($original_parent_id);
1735
1736 $original->saveToDb();
1737
1738 $original->deletePageOfQuestion($this->getOriginalId());
1739 $original->createPageObject();
1740 $original->clonePageOfQuestion($this->getId());
1741 $original = $this->cloneQuestionTypeSpecificProperties($original);
1742 $this->cloneXHTMLMediaObjectsOfQuestion($original->getId());
1743 $this->afterSyncWithOriginal($this->getOriginalId(), $this->getId(), $this->getObjId(), $original_parent_id);
1744 $this->afterSyncWithOriginal($this->getOriginalId(), $this->getId(), $original_parent_id, $this->getObjId());
1745 }
static lookupParentObjId(int $question_id)
cloneXHTMLMediaObjectsOfQuestion(int $source_question_id)
afterSyncWithOriginal(int $original_question_id, int $clone_question_id, int $original_parent_id, int $clone_parent_id)
cloneSuggestedSolutions(int $source_question_id, int $target_question_id)

References ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ toJSON()

assQuestion::toJSON ( )

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

Reimplemented in assClozeTest, assErrorText, assFileUpload, assFormulaQuestion, assImagemapQuestion, assKprimChoice, assLongMenu, assMatchingQuestion, assMultipleChoice, assNumeric, assOrderingHorizontal, assOrderingQuestion, assSingleChoice, assTextQuestion, and assTextSubset.

◆ toNormalized()

assQuestion::toNormalized ( Transformations  $transformations,
array  $context = [] 
)
Parameters
array<string,mixed>$context
Returns
array<array-key, mixed>|float|bool|int|string|null

Reimplemented in assClozeTest, assErrorText, assFileUpload, assFormulaQuestion, assImagemapQuestion, assKprimChoice, assLongMenu, assMatchingQuestion, assMultipleChoice, assNumeric, assOrderingHorizontal, assOrderingQuestion, assSingleChoice, assTextQuestion, and assTextSubset.

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

2974 : array|float|bool|int|string|null
2975 {
2976 return [
2977 'id' => $transformations->normalize(new Id($this->id, 'question')),
2978 'parent_id' => $transformations->normalize(new Id($this->obj_id, 'object')),
2979 'original_id' => $this->original_id,
2980 'external_id' => $this->external_id,
2981 'type' => $this->getQuestionType(),
2982 'owner' => $this->owner,
2983 'title' => $this->title,
2984 'description' => $this->comment,
2985 'question_text' => $this->question,
2986 'available_points' => $this->points,
2987 'nr_of_tries' => $this->nr_of_tries,
2988 'lifecycle' => $transformations->normalize($this->lifecycle),
2989 'author' => $this->author,
2990 'updated_timestamp' => $this->lastChange,
2991 'additional_content_editing_mode' => $this->additionalContentEditingMode,
2992 'thumb_size' => $this->thumb_size,
2993 'shuffle' => $this->shuffle,
2994 'suggested_solutions' => $transformations->normalize($this->suggested_solutions),
2995 ];
2996 }
Wrapper object for an object identifier and an optional object type the identifier belongs to.
Definition: Id.php:33

References $comment, and ILIAS\TestQuestionPool\ExportImport\Foundation\Normalize\Transformations\normalize().

+ Here is the call 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 2912 of file class.assQuestion.php.

2918 $test_ref_id,
2919 $this->id,
2920 $this->current_user->getId(),
2921 $interaction_type,
2922 time(),
2923 $this->toLog($additional_info)
2924 );
2925 }
toLog(AdditionalInformationGenerator $additional_info)
MUST return an array of the question settings that can be stored in the log.

◆ 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
Deprecated:
12: use question normalizing and serialization instead

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

301 : string {
302 $classname = $this->getQuestionType() . "Export";
303 $export = new $classname($this);
304 return $export->toXML($a_include_header, $a_include_binary, $a_shuffle, $test_output, $force_image_references);
305 }

◆ updateCurrentSolution()

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

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

2504 : int
2505 {
2506 $fieldData = [
2507 "value1" => ["clob", $value1],
2508 "value2" => ["clob", $value2],
2509 "tstamp" => ["integer", time()],
2510 'authorized' => ['integer', (int) $authorized]
2511 ];
2512
2513 if ($this->getStep() !== null) {
2514 $fieldData['step'] = ["integer", $this->getStep()];
2515 }
2516
2517 return $this->db->update("tst_solutions", $fieldData, [
2518 'solution_id' => ['integer', $solutionId]
2519 ]);
2520 }

References ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ updateCurrentSolutionsAuthorization()

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

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

2523 : int
2524 {
2525 $fieldData = [
2526 'authorized' => ['integer', (int) $authorized]
2527 ];
2528
2529 if (!$keepTime) {
2530 $fieldData['tstamp'] = ['integer', time()];
2531 }
2532
2533 $whereData = [
2534 'question_fi' => ['integer', $this->getId()],
2535 'active_fi' => ['integer', $activeId],
2536 'pass' => ['integer', $pass]
2537 ];
2538
2539 if ($this->getStep() !== null) {
2540 $whereData['step'] = ["integer", $this->getStep()];
2541 }
2542
2543 return $this->db->update('tst_solutions', $fieldData, $whereData);
2544 }

References ILIAS\Survey\Mode\getId(), and ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ updateOriginalId()

assQuestion::updateOriginalId ( ?int  $original_id = null)
Deprecated:
This is a momentary helper function to update the original id, when cloning a test. Do not use anywhere else. 2026-06-25, sk

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

1233 : void
1234 {
1235 $this->original_id = $original_id;
1236 $this->db->update(
1237 'qpl_questions',
1238 [
1239 'original_id' => [ilDBConstants::T_INTEGER, $original_id],
1240 ],
1241 [
1242 'question_id' => [ilDBConstants::T_INTEGER, $this->getId()]
1243 ]
1244 );
1245 }

References ILIAS\Survey\Mode\getId(), and ilDBConstants\T_INTEGER.

+ Here is the call graph for this function:

◆ updateTimestamp()

assQuestion::updateTimestamp ( )

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

2834 : void
2835 {
2836 $this->db->manipulateF(
2837 "UPDATE qpl_questions SET tstamp = %s WHERE question_id = %s",
2838 ['integer', 'integer'],
2839 [time(), $this->getId()]
2840 );
2841 }

References ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ validateSolutionSubmit()

assQuestion::validateSolutionSubmit ( )

Implements ILIAS\TestQuestionPool\Questions\Question.

Reimplemented in assFormulaQuestion, assMultipleChoice, assNumeric, and assOrderingQuestion.

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

662 : bool
663 {
664 return true;
665 }

Field Documentation

◆ $additionalContentEditingMode

string assQuestion::$additionalContentEditingMode = ''
private

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

◆ $author

◆ $comment

◆ $current_user

ilObjUser assQuestion::$current_user
protected

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

Referenced by getCurrentUser().

◆ $db

ilDBInterface assQuestion::$db
protected

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

◆ $defaultnroftries

int assQuestion::$defaultnroftries = 0

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

◆ $dic

Container assQuestion::$dic
protected

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

◆ $export_image_path

string assQuestion::$export_image_path
private

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

◆ $external_id

string assQuestion::$external_id = null
protected

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

◆ $feedbackOBJ

ilAssQuestionFeedback assQuestion::$feedbackOBJ

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

◆ $force_pass_results_update_enabled

assQuestion::$force_pass_results_update_enabled = false
staticprotected

◆ $http

HTTPServices assQuestion::$http
protected

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

◆ $id

int assQuestion::$id
protected

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

◆ $ilias

ILIAS assQuestion::$ilias
protected

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

◆ $imageSourceFixReplaceMap

assQuestion::$imageSourceFixReplaceMap
staticprotected
Initial value:
= [
'ok.svg' => 'ok.png',
'not_ok.svg' => 'not_ok.png',
'object/checkbox_checked.svg' => 'checkbox_checked.png',
'object/checkbox_unchecked.svg' => 'checkbox_unchecked.png',
'object/radiobutton_checked.svg' => 'radiobutton_checked.png',
'object/radiobutton_unchecked.svg' => 'radiobutton_unchecked.png'
]

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

◆ $lastChange

int assQuestion::$lastChange = null
protected

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

◆ $lifecycle

ilAssQuestionLifecycle assQuestion::$lifecycle
protected

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

◆ $lng

ilLanguage assQuestion::$lng
protected

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

◆ $log

LoggingServices assQuestion::$log
protected

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

◆ $nr_of_tries

int assQuestion::$nr_of_tries
private

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

◆ $obj_id

int assQuestion::$obj_id = 0
protected

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

◆ $original_id

◆ $owner

◆ $page

ilAssQuestionPage assQuestion::$page
protected

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

◆ $points

◆ $prevent_rte_usage

bool assQuestion::$prevent_rte_usage = false

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

◆ $processLocker

ilAssQuestionProcessLocker assQuestion::$processLocker
protected

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

Referenced by getProcessLocker(), and setProcessLocker().

◆ $question

◆ $question_files

QuestionFiles assQuestion::$question_files
protected

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

◆ $questionActionCmd

string assQuestion::$questionActionCmd = 'handleQuestionAction'

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

◆ $questionpool_request

RequestDataCollector assQuestion::$questionpool_request
protected

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

◆ $questionrepository

GeneralQuestionPropertiesRepository assQuestion::$questionrepository
protected

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

◆ $refinery

Refinery assQuestion::$refinery
protected

◆ $selfassessmenteditingmode

bool assQuestion::$selfassessmenteditingmode = false

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

◆ $shuffle

bool assQuestion::$shuffle = true
protected

◆ $shuffler

Transformation assQuestion::$shuffler
protected

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

Referenced by getShuffler(), and setShuffler().

◆ $skillUsageService

SkillUsageService assQuestion::$skillUsageService
protected

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

◆ $step

int assQuestion::$step = null
protected

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

◆ $suggested_solutions

array assQuestion::$suggested_solutions
protected

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

◆ $suggestedsolution_repo

SuggestedSolutionsDatabaseRepository assQuestion::$suggestedsolution_repo
protected

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

◆ $test_id

int assQuestion::$test_id
protected

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

◆ $test_question_config

ilTestQuestionConfig assQuestion::$test_question_config = null
private

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

◆ $test_result_repository

TestResultRepository assQuestion::$test_result_repository
protected

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

◆ $testQuestionConfig

ilTestQuestionConfig assQuestion::$testQuestionConfig
protected

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

◆ $thumb_size

int assQuestion::$thumb_size
protected

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

◆ $title

◆ $tpl

ilGlobalPageTemplate assQuestion::$tpl
protected

Definition at line 76 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 61 of file class.assQuestion.php.

◆ HAS_SPECIFIC_FEEDBACK

const assQuestion::HAS_SPECIFIC_FEEDBACK = true
protected

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

◆ KEY_VALUES_IMPLOSION_SEPARATOR

const assQuestion::KEY_VALUES_IMPLOSION_SEPARATOR = ':'

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

Referenced by explodeKeyValues(), and implodeKeyValues().

◆ MAXIMUM_THUMB_SIZE

const assQuestion::MAXIMUM_THUMB_SIZE = 8192
private

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

◆ MINIMUM_THUMB_SIZE

const assQuestion::MINIMUM_THUMB_SIZE = 20
private

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

◆ TRIM_PATTERN

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

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


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