ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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)
 Returns a QTI xml representation of the question. More...
 
 setTitle (string $title="")
 
 setId (int $id=-1)
 
 setTestId (int $id=-1)
 
 setComment (string $comment="")
 
 setShuffle (?bool $shuffle=true)
 
 setAuthor (string $author="")
 
 setOwner (int $owner=-1)
 
 getTitle ()
 
 getTitleForHTMLOutput ()
 
 getTitleFilenameCompliant ()
 
 getId ()
 
 getShuffle ()
 
 getTestId ()
 
 getComment ()
 
 getDescriptionForHTMLOutput ()
 
 getThumbSize ()
 
 setThumbSize (int $a_size)
 
 getMinimumThumbSize ()
 
 getMaximumThumbSize ()
 
 getAuthor ()
 
 getAuthorForHTMLOutput ()
 
 getOwner ()
 
 getObjId ()
 
 setObjId (int $obj_id=0)
 
 getLifecycle ()
 
 setLifecycle (ilAssQuestionLifecycle $lifecycle)
 
 setExternalId (?string $external_id)
 
 getExternalId ()
 
 getSuggestedSolutionOutput ()
 
 getSuggestedSolutions ()
 
 getReachedPoints (int $active_id, int $pass)
 
 getMaximumPoints ()
 
 getAdjustedReachedPoints (int $active_id, int $pass, bool $authorized_solution=true)
 
 calculateResultsFromSolution (int $active_id, int $pass)
 Calculates the question results from a previously saved question solution. More...
 
 persistWorkingState (int $active_id, $pass, bool $authorized=true)
 persists the working state for current testactive and testpass More...
 
 persistPreviewState (ilAssQuestionPreviewSession $preview_session)
 persists the preview state for current user and question More...
 
 validateSolutionSubmit ()
 
 getSuggestedSolutionPath ()
 
 getImagePath ($question_id=null, $object_id=null)
 Returns the image path for web accessable images of a question. More...
 
 getSuggestedSolutionPathWeb ()
 
 getImagePathWeb ()
 Returns the web image path for web accessable images of a question. More...
 
 getTestOutputSolutions (int $activeId, int $pass)
 
 getUserSolutionPreferingIntermediate (int $active_id, ?int $pass=null)
 
 getSolutionValues (int $active_id, ?int $pass=null, bool $authorized=true)
 Loads solutions of a given user from the database an returns it. More...
 
 deleteAnswers (int $question_id)
 
 deleteAdditionalTableData (int $question_id)
 
 delete (int $question_id)
 
 getTotalAnswers ()
 
 cloneXHTMLMediaObjectsOfQuestion (int $source_question_id)
 
 createPageObject ()
 
 clonePageOfQuestion (int $a_q_id)
 
 getPageOfQuestion ()
 
 setOriginalId (?int $original_id)
 
 getOriginalId ()
 
 fixSvgToPng (string $imageFilenameContainingString)
 
 fixUnavailableSkinImageSources (string $html)
 
 loadFromDb (int $question_id)
 
 createNewQuestion (bool $a_create_page=true)
 Creates a new question without an owner when a new question is created This assures that an ID is given to the question if a file upload or something else occurs. More...
 
 saveQuestionDataToDb (?int $original_id=null)
 
 duplicate (bool $for_test=true, string $title='', string $author='', int $owner=-1, $test_obj_id=null)
 
 copyObject (int $target_parent_id, string $title='')
 
 createNewOriginalFromThisDuplicate (int $target_parent_id, string $target_question_title='')
 
 saveToDb (?int $original_id=null)
 
 deleteSuggestedSolutions ()
 
 getSuggestedSolution (int $subquestion_index=0)
 
 resolveInternalLink (string $internal_link)
 
 resolveSuggestedSolutionLinks ()
 
 getInternalLinkHref (string $target)
 
 syncWithOriginal ()
 
 getPoints ()
 
 setPoints (float $points)
 
 getSolutionMaxPass (int $active_id)
 
 isWriteable ()
 
 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)
 
 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 514 of file class.assQuestion.php.

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

References $DIC, and $ilDB.

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

+ Here is the caller graph for this function:

◆ _getSolutionMaxPass()

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

Returns the maximum pass a users question solution.

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

1775 : ?int
1776 {
1777 // the following code was the old solution which added the non answered
1778 // questions of a pass from the answered questions of the previous pass
1779 // with the above solution, only the answered questions of the last pass are counted
1780 global $DIC;
1781 $ilDB = $DIC['ilDB'];
1782
1783 $result = $ilDB->queryF(
1784 "SELECT MAX(pass) maxpass FROM tst_test_result WHERE active_fi = %s AND question_fi = %s",
1785 ['integer','integer'],
1786 [$active_id, $question_id]
1787 );
1788 if ($result->numRows() === 1) {
1789 $row = $ilDB->fetchAssoc($result);
1790 return $row["maxpass"];
1791 }
1792
1793 return null;
1794 }

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

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

◆ _questionExistsInTest()

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

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

2114 : bool
2115 {
2116 global $DIC;
2117 $ilDB = $DIC['ilDB'];
2118
2119 if ($question_id < 1) {
2120 return false;
2121 }
2122
2123 $result = $ilDB->queryF(
2124 "SELECT question_fi FROM tst_test_question WHERE question_fi = %s AND test_fi = %s",
2125 ['integer', 'integer'],
2126 [$question_id, $test_id]
2127 );
2128 return $ilDB->numRows($result) == 1;
2129 }

References $DIC, and $ilDB.

◆ addAnswerOptionValue()

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

Reimplemented in assClozeTest, and assTextSubset.

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

2740 : void
2741 {
2742 }

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

1830 : float
1831 {
1832 $count_system = ilObjTest::_getCountSystem($active_id);
1833 if ($count_system == 1) {
1834 if (abs($this->getMaximumPoints() - $points) > 0.0000000001) {
1835 $points = 0;
1836 }
1837 }
1838 $score_cutting = ilObjTest::_getScoreCutting($active_id);
1839 if ($score_cutting == 0) {
1840 if ($points < 0) {
1841 $points = 0;
1842 }
1843 }
1844 return $points;
1845 }
static _getCountSystem($active_id)
static _getScoreCutting(int $active_id)
Determines if the score of a question should be cut at 0 points or the score of the whole test.

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

1423 : void {
1424 $this->feedbackOBJ->cloneFeedback($original_question_id, $clone_question_id);
1425 }

◆ answerToLog()

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

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

2917 : array {
2918 return [
2919 AdditionalInformationGenerator::KEY_PASS => $pass,
2920 AdditionalInformationGenerator::KEY_REACHED_POINTS => $this->getReachedPoints($active_id, $pass),
2921 AdditionalInformationGenerator::KEY_PAX_ANSWER => $this->solutionValuesToLog(
2922 $additional_info,
2923 $this->getSolutionValues($active_id, $pass)
2924 )
2925 ];
2926 }
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 2879 of file class.assQuestion.php.

2887 return new TestParticipantInteraction(
2888 $test_ref_id,
2889 $this->id,
2890 $this->current_user->getId(),
2891 $source_ip,
2892 $interaction_type,
2893 time(),
2894 $this->answerToLog($additional_info, $active_id, $pass)
2895 );
2896 }
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 2674 of file class.assQuestion.php.

2674 : bool
2675 {
2676 $solutionAvailability = $this->lookupForExistingSolutions($active_id, $pass);
2677 return $solutionAvailability['authorized'] || $solutionAvailability['intermediate'];
2678 }
lookupForExistingSolutions(int $activeId, int $pass)
Lookup if an authorized or intermediate solution exists.

◆ authorizedSolutionExists()

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

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

2665 : bool
2666 {
2667 if ($pass === null) {
2668 return false;
2669 }
2670 $solutionAvailability = $this->lookupForExistingSolutions($active_id, $pass);
2671 return (bool) $solutionAvailability['authorized'];
2672 }

◆ buildHashedImageFilename()

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

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

1846 : string
1847 {
1848 $extension = "";
1849
1850 if (preg_match("/.*\.(png|jpg|gif|jpeg)$/i", $plain_image_filename, $matches)) {
1851 $extension = "." . $matches[1];
1852 }
1853
1854 if ($unique) {
1855 $plain_image_filename = uniqid($plain_image_filename . microtime(true), true);
1856 }
1857
1858 return md5($plain_image_filename) . $extension;
1859 }

◆ buildQuestionDataQuery()

assQuestion::buildQuestionDataQuery ( )
protected

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

2335 : string
2336 {
2337 return "
2338 SELECT qpl_questions.*,
2339 {$this->getAdditionalTableName()}.*
2340 FROM qpl_questions
2341 LEFT JOIN {$this->getAdditionalTableName()}
2342 ON {$this->getAdditionalTableName()}.question_fi = qpl_questions.question_id
2343 WHERE qpl_questions.question_id = %s
2344 ";
2345 }

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

2838 {
2839 return new ilTestQuestionConfig();
2840 }
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 1801 of file class.assQuestion.php.

1802 {
1803 $reached_points = $this->calculateReachedPointsForSolution($preview_session->getParticipantsSolution());
1804 return $this->ensureNonNegativePoints($reached_points);
1805 }
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 556 of file class.assQuestion.php.

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

1983 : void
1984 {
1985 $combinedtext = $this->getRTETextWithMediaObjects();
1986 ilRTE::_cleanupMediaObjectUsage($combinedtext, "qpl:html", $this->getId());
1987 }
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 1028 of file class.assQuestion.php.

1028 : void
1029 {
1030 if ($a_q_id > 0) {
1031 $page = new ilAssQuestionPage($a_q_id);
1032 $page->buildDom();
1033 ilPCPlugged::handleCopiedPluggedContent($page, $page->getDomDoc());
1034 $xml = str_replace("il__qst_" . $a_q_id, "il__qst_" . $this->id, $page->getXMLFromDom());
1035 $this->page->setXMLContent($xml);
1036 $this->page->updateFromXML();
1037 }
1038 }
ilAssQuestionPage $page
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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)

◆ cloneQuestionTypeSpecificProperties()

assQuestion::cloneQuestionTypeSpecificProperties ( self  $target)
protected

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

1334 : self {
1335 return $target;
1336 }

◆ cloneSuggestedSolutionFiles()

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

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

1559 : void {
1560 $filepath_target = $this->getSuggestedSolutionPath();
1561 $filepath_original = str_replace("/$target_question_id/solution", "/$source_question_id/solution", $filepath_target);
1562 ilFileUtils::delDir($filepath_original);
1563 foreach ($this->suggested_solutions as $solution) {
1564 if (!$solution->isOfTypeFile()
1565 || $solution->getFilename() === '') {
1566 continue;
1567 }
1568
1569 if (!file_exists($filepath_original)) {
1570 ilFileUtils::makeDirParents($filepath_original);
1571 }
1572
1573 if (!is_file($filepath_original . $solution->getFilename())
1574 || copy($filepath_target . $solution->getFilename(), $filepath_target . $solution->getFilename())) {
1575 $this->log->root()->error('File for suggested solutions could not be cloned:');
1576 $this->log->root()->error("Question-Id: {$this->id}; Question-Title: {$this->title}; File: {$filepath_original}{$solution->getFilename()}");
1577 }
1578 }
1579 }
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 1520 of file class.assQuestion.php.

1523 : void {
1524 $this->getSuggestedSolutionsRepo()->clone($source_question_id, $target_question_id);
1525 $this->cloneSuggestedSolutionFiles($source_question_id, $target_question_id);
1526 }
cloneSuggestedSolutionFiles(int $source_question_id, int $target_question_id)

◆ cloneXHTMLMediaObjectsOfQuestion()

assQuestion::cloneXHTMLMediaObjectsOfQuestion ( int  $source_question_id)

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

1008 : void
1009 {
1010 $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $source_question_id);
1011 foreach ($mobs as $mob) {
1012 ilObjMediaObject::_saveUsage($mob, "qpl:html", $this->getId());
1013 }
1014 }
static _getMobsOfObject(string $a_type, int $a_id, int $a_usage_hist_nr=0, string $a_lang="-")
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.

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

2641 : int
2642 {
2643 $sec = 0;
2644 $time_array = explode(':', $time);
2645 if (count($time_array) == 3) {
2646 $sec += (int) $time_array[0] * 3600;
2647 $sec += (int) $time_array[1] * 60;
2648 $sec += (int) $time_array[2];
2649 }
2650 return $sec;
2651 }

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

1278 : int {
1279 if ($this->getId() <= 0) {
1280 throw new RuntimeException('The question has not been saved. It cannot be duplicated');
1281 }
1282 // duplicate the question in database
1283 $clone = clone $this;
1284 $clone->id = -1;
1285 $source_parent_id = $this->getObjId();
1286 $clone->setObjId($target_parent_id);
1287 if ($title) {
1288 $clone->setTitle($title);
1289 }
1290 $clone->saveToDb();
1291 $clone->clonePageOfQuestion($this->id);
1292 $clone->cloneXHTMLMediaObjectsOfQuestion($this->id);
1293 $clone = $this->cloneQuestionTypeSpecificProperties($clone);
1294
1295 $clone->onCopy($source_parent_id, $this->id, $clone->getObjId(), $clone->getId());
1296
1297 return $clone->id;
1298 }
cloneQuestionTypeSpecificProperties(self $target)

◆ copySuggestedSolutions()

assQuestion::copySuggestedSolutions ( int  $target_question_id)
protected

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

1581 : void
1582 {
1583 $update = [];
1584 foreach ($this->getSuggestedSolutions() as $index => $solution) {
1585 $solution = $solution->withQuestionId($target_question_id);
1586 $update[] = $solution;
1587 }
1588 $this->getSuggestedSolutionsRepo()->update($update);
1589 }

◆ createNewOriginalFromThisDuplicate()

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

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

1303 : int {
1304 if ($this->getId() <= 0) {
1305 throw new RuntimeException('The question has not been saved. It cannot be duplicated');
1306 }
1307
1308 $source_question_id = $this->id;
1309 $source_parent_id = $this->getObjId();
1310
1311 // duplicate the question in database
1312 $clone = clone $this;
1313 $clone->id = -1;
1314
1315 $clone->setObjId($target_parent_id);
1316
1317 if ($target_question_title) {
1318 $clone->setTitle($target_question_title);
1319 }
1320
1321 $clone->saveToDb();
1322 $clone->clonePageOfQuestion($source_question_id);
1323 $clone->cloneXHTMLMediaObjectsOfQuestion($source_question_id);
1324
1325 $clone = $this->cloneQuestionTypeSpecificProperties($clone);
1326
1327 $clone->onCopy($source_parent_id, $source_question_id, $clone->getObjId(), $clone->getId());
1328
1329 return $clone->id;
1330 }

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

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

References ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ createPageObject()

assQuestion::createPageObject ( )

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

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

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

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

817 : void
818 {
819 $additional_table_name = $this->getAdditionalTableName();
820
821 if (!is_array($additional_table_name)) {
822 $additional_table_name = [$additional_table_name];
823 }
824
825 foreach ($additional_table_name as $table) {
826 if (strlen($table)) {
827 $this->db->manipulateF(
828 "DELETE FROM $table WHERE question_fi = %s",
829 ['integer'],
830 [$question_id]
831 );
832 }
833 }
834 }
getAdditionalTableName()

◆ deleteAnswers()

assQuestion::deleteAnswers ( int  $question_id)

Reimplemented in assFormulaQuestion.

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

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

◆ deleteComments()

assQuestion::deleteComments ( )
protected

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

1470 : void
1471 {
1472 $repo = $this->getNotesRepo();
1473 $manager = $this->getNotesManager();
1474 $source_id = $this->getId();
1475 $notes = $manager->getNotesForRepositoryObjIds([$this->getObjId()], Note::PUBLIC);
1476 $notes = array_filter(
1477 $notes,
1478 fn($n) => $n->getContext()->getSubObjId() === $source_id
1479 );
1480 foreach ($notes as $note) {
1481 $repo->deleteNote($note->getId());
1482 }
1483 }

References ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ deleteDummySolutionRecord()

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

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

2545 : void
2546 {
2547 foreach ($this->getSolutionValues($activeId, $passIndex, false) as $solutionRec) {
2548 if ($solutionRec['value1'] == '' && $solutionRec['value2'] == '') {
2549 $this->removeSolutionRecordById($solutionRec['solution_id']);
2550 }
2551 }
2552 }
removeSolutionRecordById(int $solutionId)

◆ deletePageOfQuestion()

assQuestion::deletePageOfQuestion ( int  $question_id)
protected

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

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

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

2559 : void
2560 {
2561 $types = ["integer", "integer", "integer", "integer"];
2562 $values = [$activeId, $this->getId(), $passIndex, (int) $authorized];
2563 $valuesCondition = [];
2564
2565 foreach ($matchValues as $valueField => $value) {
2566 switch ($valueField) {
2567 case 'value1':
2568 case 'value2':
2569 $valuesCondition[] = "{$valueField} = %s";
2570 $types[] = 'text';
2571 $values[] = $value;
2572 break;
2573
2574 default:
2575 throw new ilTestQuestionPoolException('invalid value field given: ' . $valueField);
2576 }
2577 }
2578
2579 $valuesCondition = implode(' AND ', $valuesCondition);
2580
2581 $query = "
2582 DELETE FROM tst_solutions
2583 WHERE active_fi = %s
2584 AND question_fi = %s
2585 AND pass = %s
2586 AND authorized = %s
2587 AND $valuesCondition
2588 ";
2589
2590 if ($this->getStep() !== null) {
2591 $query .= " AND step = %s ";
2592 $types[] = 'integer';
2593 $values[] = $this->getStep();
2594 }
2595
2596 $this->db->manipulateF($query, $types, $values);
2597 }

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

+ Here is the call graph for this function:

◆ deleteSuggestedSolutions()

assQuestion::deleteSuggestedSolutions ( )

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

1503 : void
1504 {
1505 $this->getSuggestedSolutionsRepo()->deleteForQuestion($this->getId());
1508 $this->suggested_solutions = [];
1509 }

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

960 : void
961 {
962 $taxIds = ilObjTaxonomy::getUsageOfObject($this->getObjId());
963
964 foreach ($taxIds as $taxId) {
965 $taxNodeAssignment = new ilTaxNodeAssignment('qpl', $this->getObjId(), 'quest', $taxId);
966 $taxNodeAssignment->deleteAssignmentsOfItem($this->getId());
967 }
968 }
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  $for_test = true,
string  $title = '',
string  $author = '',
int  $owner = -1,
  $test_obj_id = null 
)

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

1237 : int {
1238 if ($this->id <= 0) {
1239 // The question has not been saved. It cannot be duplicated
1240 return -1;
1241 }
1242
1243 $clone = clone $this;
1244 $clone->id = -1;
1245
1246 if ((int) $test_obj_id > 0) {
1247 $clone->setObjId($test_obj_id);
1248 }
1249
1250 if ($title) {
1251 $clone->setTitle($title);
1252 }
1253 if ($author) {
1254 $clone->setAuthor($author);
1255 }
1256 if ($owner) {
1257 $clone->setOwner($owner);
1258 }
1259 if ($for_test) {
1260 $clone->saveToDb($this->id);
1261 } else {
1262 $clone->saveToDb();
1263 }
1264
1265 $clone->clonePageOfQuestion($this->getId());
1266 $clone->cloneXHTMLMediaObjectsOfQuestion($this->getId());
1267
1268 $clone = $this->cloneQuestionTypeSpecificProperties($clone);
1269
1270 $clone->onDuplicate($this->getObjId(), $this->getId(), $clone->getObjId(), $clone->getId());
1271
1272 return $clone->id;
1273 }

◆ duplicateComments()

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

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

1441 : void {
1442 $manager = $this->getNotesManager();
1443 $data_service = $this->getNotesDataService();
1444 $notes = $manager->getNotesForRepositoryObjIds([$parent_source_id], Note::PUBLIC);
1445 $notes = array_filter(
1446 $notes,
1447 fn($n) => $n->getContext()->getSubObjId() === $source_id
1448 );
1449
1450 foreach ($notes as $note) {
1451 $new_context = $data_service->context(
1452 $parent_target_id,
1453 $target_id,
1454 $note->getContext()->getType()
1455 );
1456 $new_note = $data_service->note(
1457 -1,
1458 $new_context,
1459 $note->getText(),
1460 $note->getAuthor(),
1461 $note->getType(),
1462 $note->getCreationDate(),
1463 $note->getUpdateDate(),
1464 $note->getRecipient()
1465 );
1466 $manager->createNote($new_note, [], true);
1467 }
1468 }

◆ duplicateIntermediateSolutionAuthorized()

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

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

2599 : void
2600 {
2601 foreach ($this->getSolutionValues($activeId, $passIndex, false) as $rec) {
2602 $this->saveCurrentSolution($activeId, $passIndex, $rec['value1'], $rec['value2'], true, $rec['tstamp']);
2603 }
2604 }
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 2207 of file class.assQuestion.php.

2207 : void
2208 {
2209 $assignmentList = new ilAssQuestionSkillAssignmentList($this->db);
2210 $assignmentList->setParentObjId($srcParentId);
2211 $assignmentList->setQuestionIdFilter($srcQuestionId);
2212 $assignmentList->loadFromDb();
2213
2214 foreach ($assignmentList->getAssignmentsByQuestionId($srcQuestionId) as $assignment) {
2215 $assignment->setParentObjId($trgParentId);
2216 $assignment->setQuestionId($trgQuestionId);
2217 $assignment->saveToDb();
2218
2219 // add skill usage
2220 $this->skillUsageService->addUsage(
2221 $trgParentId,
2222 $assignment->getSkillBaseId(),
2223 $assignment->getSkillTrefId()
2224 );
2225 }
2226 }

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

1531 : void
1532 {
1533 foreach ($this->suggested_solutions as $solution) {
1534 if (!$solution->isOfTypeFile()
1535 || $solution->getFilename() === '') {
1536 continue;
1537 }
1538
1539 $filepath = $this->getSuggestedSolutionPath();
1540 $filepath_original = str_replace(
1541 "/{$this->obj_id}/{$this->id}/solution",
1542 "/{$parent_id}/{$question_id}/solution",
1543 $filepath
1544 );
1545 if (!file_exists($filepath)) {
1546 ilFileUtils::makeDirParents($filepath);
1547 }
1548 if (!is_file($filepath_original . $solution->getFilename())
1549 || !copy($filepath_original . $solution->getFilename(), $filepath . $solution->getFilename())) {
1550 $this->log->root()->error('File for suggested solutions could not be duplicated:');
1551 $this->log->root()->error("Question-Id: {$this->id}; Question-Title: {$this->title}; File: {$filepath_original}{$solution->getFilename()}");
1552 }
1553 }
1554 }

References ilFileUtils\makeDirParents().

+ Here is the call graph for this function:

◆ ensureNonNegativePoints()

assQuestion::ensureNonNegativePoints ( float  $points)
protected

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

1807 : float
1808 {
1809 return $points > 0.0 ? $points : 0.0;
1810 }

Referenced by assNumeric\calculateReachedPointsFromPreviewSession().

+ Here is the caller graph for this function:

◆ explodeKeyValues()

static assQuestion::explodeKeyValues ( string  $keyValues)
static

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

2540 : array
2541 {
2542 return explode(assQuestion::KEY_VALUES_IMPLOSION_SEPARATOR, $keyValues);
2543 }
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 2867 of file class.assQuestion.php.

2867 : string
2868 {
2869 return preg_replace(self::TRIM_PATTERN, '', $value);
2870 }

Referenced by assTextSubsetGUI\writeAnswerSpecificPostData().

+ Here is the caller graph for this function:

◆ fetchIndexedValuesFromValuePairs()

assQuestion::fetchIndexedValuesFromValuePairs ( array  $value_pairs)

Reimplemented in assMatchingQuestion.

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

2808 : array
2809 {
2810 $indexed_values = [];
2811
2812 foreach ($value_pairs as $valuePair) {
2813 $indexed_values[$valuePair['value1']] = $valuePair['value2'];
2814 }
2815
2816 return $indexed_values;
2817 }

◆ fetchValuePairsFromIndexedValues()

assQuestion::fetchValuePairsFromIndexedValues ( array  $indexedValues)

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

2797 : array
2798 {
2799 $valuePairs = [];
2800
2801 foreach ($indexedValues as $value1 => $value2) {
2802 $valuePairs[] = ['value1' => $value1, 'value2' => $value2];
2803 }
2804
2805 return $valuePairs;
2806 }

◆ fixSvgToPng()

assQuestion::fixSvgToPng ( string  $imageFilenameContainingString)

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

1065 : string
1066 {
1067 $needles = array_keys(self::$imageSourceFixReplaceMap);
1068 $replacements = array_values(self::$imageSourceFixReplaceMap);
1069 return str_replace($needles, $replacements, $imageFilenameContainingString);
1070 }

◆ fixUnavailableSkinImageSources()

assQuestion::fixUnavailableSkinImageSources ( string  $html)

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

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

2606 : void
2607 {
2608 $intermediateSolution = $this->getSolutionValues($activeId, $passIndex, false);
2609
2610 if (!count($intermediateSolution)) {
2611 $this->updateCurrentSolutionsAuthorization($activeId, $passIndex, false, true);
2612
2613 // create a backup as authorized solution again (keeping timestamps)
2614 $this->duplicateIntermediateSolutionAuthorized($activeId, $passIndex);
2615
2616 if ($considerDummyRecordCreation) {
2617 // create an additional dummy record to indicate the existence of an intermediate solution
2618 // even if all entries are deleted from the intermediate solution later
2619 $this->saveCurrentSolution($activeId, $passIndex, null, null, false);
2620 }
2621 }
2622 }
updateCurrentSolutionsAuthorization(int $activeId, int $pass, bool $authorized, bool $keepTime=false)
duplicateIntermediateSolutionAuthorized(int $activeId, int $passIndex)

◆ formatSAQuestion()

assQuestion::formatSAQuestion (   $a_q)

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

2131 : string
2132 {
2133 return $this->getSelfAssessmentFormatter()->format($a_q);
2134 }

◆ 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

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

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

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

2033 : array
2034 {
2035 $result = $this->db->queryF(
2036 "SELECT * FROM tst_active WHERE active_id = %s",
2037 ['integer'],
2038 [$active_id]
2039 );
2040 if ($this->db->numRows($result)) {
2041 $row = $this->db->fetchAssoc($result);
2042 return ["user_id" => $row["user_fi"], "test_id" => $row["test_fi"]];
2043 }
2044
2045 return [];
2046 }

◆ getAdditionalContentEditingMode()

assQuestion::getAdditionalContentEditingMode ( )

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

2283 : string
2284 {
2286 }
string $additionalContentEditingMode

◆ getAdditionalTableName()

◆ getAdjustedReachedPoints()

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

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

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

◆ getAnswerTableName()

◆ getAuthor()

assQuestion::getAuthor ( )

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

406 : string
407 {
408 return $this->author;
409 }

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

+ Here is the caller graph for this function:

◆ getAuthorForHTMLOutput()

assQuestion::getAuthorForHTMLOutput ( )

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

411 : string
412 {
413 return $this->refinery->string()->stripTags()->transform($this->author);
414 }

References ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ getComment()

assQuestion::getComment ( )

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

372 : string
373 {
374 return $this->comment;
375 }

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

2940 : array|string {
2941 return $this->solutionValuesToText(
2942 $this->getSolutionValues($active_id, $pass)
2943 );
2944 }
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 2357 of file class.assQuestion.php.

2358 {
2359 if ($this->getStep() !== null) {
2360 $query = "
2361 SELECT *
2362 FROM tst_solutions
2363 WHERE active_fi = %s
2364 AND question_fi = %s
2365 AND pass = %s
2366 AND step = %s
2367 AND authorized = %s
2368 ";
2369
2370 return $this->db->queryF(
2371 $query,
2372 ['integer', 'integer', 'integer', 'integer', 'integer'],
2373 [$active_id, $this->getId(), $pass, $this->getStep(), (int) $authorized]
2374 );
2375 }
2376
2377 $query = "
2378 SELECT *
2379 FROM tst_solutions
2380 WHERE active_fi = %s
2381 AND question_fi = %s
2382 AND pass = %s
2383 AND authorized = %s
2384 ";
2385
2386 return $this->db->queryF(
2387 $query,
2388 ['integer', 'integer', 'integer', 'integer'],
2389 [$active_id, $this->getId(), $pass, (int) $authorized]
2390 );
2391 }
Interface ilDBStatement.

References ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ getCurrentUser()

assQuestion::getCurrentUser ( )

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

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

References $current_user.

◆ getDefaultNrOfTries()

assQuestion::getDefaultNrOfTries ( )

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

2187 : int
2188 {
2190 }

◆ getDescriptionForHTMLOutput()

assQuestion::getDescriptionForHTMLOutput ( )

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

377 : string
378 {
379 return $this->refinery->encode()->htmlSpecialCharsAsEntities()->transform($this->comment);
380 }

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

446 : string
447 {
448 if ($this->external_id === null || $this->external_id === '') {
449 if ($this->getId() > 0) {
450 return 'il_' . IL_INST_ID . '_qst_' . $this->getId();
451 }
452 return uniqid('', true);
453 }
454 return $this->external_id;
455 }
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 2053 of file class.assQuestion.php.

2053 : string
2054 {
2055 return str_replace('ass', 'ilAss', $questionType) . 'Feedback';
2056 }

Referenced by assQuestionGUI\_getQuestionGUI().

+ Here is the caller graph for this function:

◆ getHtmlQuestionContentPurifier()

assQuestion::getHtmlQuestionContentPurifier ( )
Returns
ilHtmlPurifierInterface|ilAssHtmlUserSolutionPurifier

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

2331 {
2332 return ilHtmlPurifierFactory::getInstanceByType('qpl_usersolution');
2333 }
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 2322 of file class.assQuestion.php.

2323 {
2324 return ilHtmlPurifierFactory::getInstanceByType('qpl_usersolution');
2325 }

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

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

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

707 : string
708 {
709 if (!$this->export_image_path) {
711 . "/assessment/{$this->obj_id}/{$this->id}/images/";
712 return str_replace(
713 ilFileUtils::removeTrailingPathSeparators(ILIAS_ABSOLUTE_PATH . '/public'),
715 $webdir
716 );
717 }
719 }
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 1989 of file class.assQuestion.php.

1989 : array
1990 {
1991 $result = $this->db->queryF(
1992 "SELECT question_id FROM qpl_questions WHERE original_id = %s",
1993 ["integer"],
1994 [$this->getId()]
1995 );
1996 $instances = [];
1997 $ids = [];
1998 while ($row = $this->db->fetchAssoc($result)) {
1999 $ids[] = $row["question_id"];
2000 }
2001 foreach ($ids as $question_id) {
2002 // check non random tests
2003 $result = $this->db->queryF(
2004 "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",
2005 ["integer"],
2006 [$question_id]
2007 );
2008 while ($row = $this->db->fetchAssoc($result)) {
2009 $instances[$row['obj_fi']] = ilObject::_lookupTitle($row['obj_fi']);
2010 }
2011 // check random tests
2012 $result = $this->db->queryF(
2013 "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",
2014 ["integer"],
2015 [$question_id]
2016 );
2017 while ($row = $this->db->fetchAssoc($result)) {
2018 $instances[$row['obj_fi']] = ilObject::_lookupTitle($row['obj_fi']);
2019 }
2020 }
2021 foreach ($instances as $key => $value) {
2022 $instances[$key] = ["obj_id" => $key, "title" => $value, "author" => ilObjTest::_lookupAuthor($key), "refs" => ilObject::_getAllReferences($key)];
2023 }
2024 return $instances;
2025 }
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 1670 of file class.assQuestion.php.

1670 : string
1671 {
1672 $linktypes = [
1673 "lm" => "LearningModule",
1674 "pg" => "PageObject",
1675 "st" => "StructureObject",
1676 "git" => "GlossaryItem",
1677 "mob" => "MediaObject"
1678 ];
1679 $href = "";
1680 if (preg_match("/il__(\w+)_(\d+)/", $target, $matches)) {
1681 $type = $matches[1];
1682 $target_id = $matches[2];
1683 switch ($linktypes[$matches[1]]) {
1684 case "MediaObject":
1685 $href = "./ilias.php?baseClass=ilLMPresentationGUI&obj_type=" . $linktypes[$type]
1686 . "&cmd=media&ref_id=" . $this->questionpool_request->getRefId()
1687 . "&mob_id=" . $target_id;
1688 break;
1689 case "StructureObject":
1690 case "GlossaryItem":
1691 case "PageObject":
1692 case "LearningModule":
1693 default:
1694 $href = "./goto.php?target=" . $type . "_" . $target_id;
1695 break;
1696 }
1697 }
1698 return $href;
1699 }

◆ getLastChange()

assQuestion::getLastChange ( )

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

2352 : ?int
2353 {
2354 return $this->lastChange;
2355 }

◆ getLifecycle()

assQuestion::getLifecycle ( )

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

References $lifecycle.

◆ getMaximumPoints()

◆ getMaximumThumbSize()

assQuestion::getMaximumThumbSize ( )

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

401 : int
402 {
404 }
const MAXIMUM_THUMB_SIZE

◆ getMinimumThumbSize()

assQuestion::getMinimumThumbSize ( )

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

396 : int
397 {
399 }
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 1491 of file class.assQuestion.php.

1491 : NotesInternalDataService
1492 {
1493 $service = new NotesService($this->dic);
1494 return $service->internal()->data();
1495 }
$service
Definition: ltiresult.php:36

References $service.

◆ getNotesManager()

assQuestion::getNotesManager ( )
protected

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

1485 : NotesManager
1486 {
1487 $service = new NotesService($this->dic);
1488 return $service->internal()->domain()->notes();
1489 }

References $service.

◆ getNotesRepo()

assQuestion::getNotesRepo ( )
protected

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

1497 : NotesRepo
1498 {
1499 $service = new NotesService($this->dic);
1500 return $service->internal()->repo()->note();
1501 }

References $service.

◆ getNrOfTries()

assQuestion::getNrOfTries ( )

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

2099 : int
2100 {
2101 return $this->nr_of_tries;
2102 }

◆ getNumExistingSolutionRecords()

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

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

2257 : int
2258 {
2259 global $DIC;
2260 $ilDB = $DIC['ilDB'];
2261
2262 $query = "
2263 SELECT count(active_fi) cnt
2264
2265 FROM tst_solutions
2266
2267 WHERE active_fi = %s
2268 AND question_fi = %s
2269 AND pass = %s
2270 ";
2271
2272 $res = $ilDB->queryF(
2273 $query,
2274 ['integer','integer','integer'],
2275 [$activeId, $questionId, $pass]
2276 );
2277
2278 $row = $ilDB->fetchAssoc($res);
2279
2280 return (int) $row['cnt'];
2281 }
$res
Definition: ltiservices.php:69

References $DIC, $ilDB, and $res.

Referenced by isAnswered().

+ Here is the caller graph for this function:

◆ getObjId()

assQuestion::getObjId ( )

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

421 : int
422 {
423 return $this->obj_id;
424 }

Referenced by ilAssQuestionSkillAssignmentsGUI\syncOriginalCmd().

+ Here is the caller graph for this function:

◆ getOriginalId()

assQuestion::getOriginalId ( )

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

1051 : ?int
1052 {
1053 return $this->original_id;
1054 }

Referenced by ilAssQuestionSkillAssignmentsGUI\syncOriginalCmd().

+ Here is the caller graph for this function:

◆ getOwner()

assQuestion::getOwner ( )

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

416 : int
417 {
418 return $this->owner;
419 }

◆ getPageOfQuestion()

assQuestion::getPageOfQuestion ( )

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

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

◆ getPoints()

assQuestion::getPoints ( )

◆ getPreventRteUsage()

assQuestion::getPreventRteUsage ( )

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

2148 : bool
2149 {
2151 }

◆ getProcessLocker()

assQuestion::getProcessLocker ( )

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

References $processLocker.

◆ getQuestion()

assQuestion::getQuestion ( )

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

1929 : string
1930 {
1931 return $this->question;
1932 }

Referenced by assOrderingQuestion\isComplete().

+ Here is the caller graph for this function:

◆ getQuestionAction()

assQuestion::getQuestionAction ( )
protected

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

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

◆ getQuestionForHTMLOutput()

assQuestion::getQuestionForHTMLOutput ( )

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

1934 : string
1935 {
1936 return $this->purifyAndPrepareTextAreaOutput($this->question);
1937 }
purifyAndPrepareTextAreaOutput(string $content)

◆ getQuestionType()

◆ getQuestionTypeID()

assQuestion::getQuestionTypeID ( )

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

1958 : int
1959 {
1960 $result = $this->db->queryF(
1961 "SELECT question_type_id FROM qpl_qst_type WHERE type_tag = %s",
1962 ['text'],
1963 [$this->getQuestionType()]
1964 );
1965 if ($this->db->numRows($result) == 1) {
1966 $row = $this->db->fetchAssoc($result);
1967 return (int) $row["question_type_id"];
1968 }
1969 return 0;
1970 }

◆ getReachedPoints()

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

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

533 : float
534 {
535 return round(self::_getReachedPoints($active_id, $this->getId(), $pass), 2);
536 }

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

1972 : string
1973 {
1974 // must be called in parent classes. add additional RTE text in the parent
1975 // classes and call this method to add the standard RTE text
1976 $collected = $this->getQuestion();
1977 $collected .= $this->feedbackOBJ->getGenericFeedbackContent($this->getId(), false);
1978 $collected .= $this->feedbackOBJ->getGenericFeedbackContent($this->getId(), true);
1979 $collected .= $this->feedbackOBJ->getAllSpecificAnswerFeedbackContents($this->getId());
1980 return $collected;
1981 }

References ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ getSelfAssessmentEditingMode()

assQuestion::getSelfAssessmentEditingMode ( )

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

2177 : bool
2178 {
2180 }
bool $selfassessmenteditingmode

Referenced by ilAssQuestionAuthoringFormGUI\addGenericAssessmentQuestionCommandButtons().

+ Here is the caller graph for this function:

◆ getSelfAssessmentFormatter()

assQuestion::getSelfAssessmentFormatter ( )
protected

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

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

◆ getShuffle()

assQuestion::getShuffle ( )

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

362 : bool
363 {
364 return $this->shuffle;
365 }

◆ getShuffler()

assQuestion::getShuffler ( )

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

243 {
244 return $this->shuffler;
245 }
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 2928 of file class.assQuestion.php.

2931 : array|string {
2932 return $this->solutionValuesToText(
2933 $this->getSolutionValues($active_id, $pass)
2934 );
2935 }

◆ getSolutionMaxPass()

assQuestion::getSolutionMaxPass ( int  $active_id)

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

1767 : ?int
1768 {
1769 return self::_getSolutionMaxPass($this->getId(), $active_id);
1770 }
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 2406 of file class.assQuestion.php.

2406 : array
2407 {
2408 $result = $this->db->queryF(
2409 "SELECT * FROM tst_solutions WHERE solution_id = %s",
2410 ['integer'],
2411 [$solutionId]
2412 );
2413
2414 if ($this->db->numRows($result) > 0) {
2415 return $this->db->fetchAssoc($result);
2416 }
2417 return [];
2418 }

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

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

2636 : ?int
2637 {
2638 return $this->step;
2639 }

◆ getSuggestedSolution()

assQuestion::getSuggestedSolution ( int  $subquestion_index = 0)

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

1513 {
1514 if (array_key_exists($subquestion_index, $this->suggested_solutions)) {
1515 return $this->suggested_solutions[$subquestion_index];
1516 }
1517 return null;
1518 }

◆ getSuggestedSolutionOutput()

assQuestion::getSuggestedSolutionOutput ( )

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

466 : string
467 {
468 $output = [];
469 foreach ($this->suggested_solutions as $solution) {
470 switch ($solution->getType()) {
471 case SuggestedSolution::TYPE_LM:
472 case SuggestedSolution::TYPE_LM_CHAPTER:
473 case SuggestedSolution::TYPE_LM_PAGE:
474 case SuggestedSolution::TYPE_GLOSARY_TERM:
475 $output[] = '<a href="'
476 . $this->getInternalLinkHref($solution->getInternalLink())
477 . '">'
478 . $this->lng->txt("solution_hint")
479 . '</a>';
480 break;
481
482 case SuggestedSolution::TYPE_FILE:
483 $possible_texts = array_values(
484 array_filter(
485 [
486 ilLegacyFormElementsUtil::prepareFormOutput($solution->getTitle()),
487 ilLegacyFormElementsUtil::prepareFormOutput($solution->getFilename()),
488 $this->lng->txt('tst_show_solution_suggested')
489 ]
490 )
491 );
492
494 $path_to_solution = $this->getSuggestedSolutionPathWeb() . $solution->getFilename();
495 if (!file_exists($path_to_solution)) {
496 break;
497 }
498 $output[] = '<a href="'
499 . ilWACSignedPath::signFile($path_to_solution)
500 . '">'
501 . $possible_texts[0]
502 . '</a>';
503 break;
504 }
505 }
506 return implode("<br />", $output);
507 }
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 669 of file class.assQuestion.php.

669 : string
670 {
671 return CLIENT_WEB_DIR . "/assessment/$this->obj_id/$this->id/solution/";
672 }

References CLIENT_WEB_DIR.

◆ getSuggestedSolutionPathWeb()

assQuestion::getSuggestedSolutionPathWeb ( )

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

691 : string
692 {
694 . "/assessment/{$this->obj_id}/{$this->id}/solution/";
695 return str_replace(
696 ilFileUtils::removeTrailingPathSeparators(ILIAS_ABSOLUTE_PATH . '/public'),
698 $webdir
699 );
700 }

References CLIENT_WEB_DIR, and ilFileUtils\removeTrailingPathSeparators().

+ Here is the call graph for this function:

◆ getSuggestedSolutions()

assQuestion::getSuggestedSolutions ( )

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

509 : array
510 {
512 }
array $suggested_solutions

◆ getSuggestedSolutionsRepo()

assQuestion::getSuggestedSolutionsRepo ( )
protected

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

◆ getTestId()

assQuestion::getTestId ( )

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

367 : int
368 {
369 return $this->test_id;
370 }

◆ getTestOutputSolutions()

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

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

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

◆ getTestPresentationConfig()

assQuestion::getTestPresentationConfig ( )

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

2829 {
2830 if ($this->test_question_config === null) {
2831 $this->test_question_config = $this->buildTestPresentationConfig();
2832 }
2833
2835 }
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 382 of file class.assQuestion.php.

382 : int
383 {
384 return $this->thumb_size;
385 }

◆ getTitle()

assQuestion::getTitle ( )

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

342 : string
343 {
344 return $this->title;
345 }

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

+ Here is the caller graph for this function:

◆ getTitleFilenameCompliant()

assQuestion::getTitleFilenameCompliant ( )

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

352 : string
353 {
355 }
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 347 of file class.assQuestion.php.

347 : string
348 {
349 return $this->refinery->encode()->htmlSpecialCharsAsEntities()->transform($this->title);
350 }

References ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ getTotalAnswers()

assQuestion::getTotalAnswers ( )

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

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

◆ getUserSolutionPreferingIntermediate()

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

Reimplemented in assFileUpload.

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

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

◆ getValidAdditionalContentEditingModes()

assQuestion::getValidAdditionalContentEditingModes ( )

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

2311 : array
2312 {
2313 return [
2316 ];
2317 }
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 2946 of file class.assQuestion.php.

2949 : array {
2950 return [];
2951 }

◆ hasSpecificFeedback()

assQuestion::hasSpecificFeedback ( )

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

2048 : bool
2049 {
2050 return static::HAS_SPECIFIC_FEEDBACK;
2051 }

◆ hasWritableOriginalInQuestionPool()

assQuestion::hasWritableOriginalInQuestionPool ( )

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

2872 : bool
2873 {
2874 return !is_null($this->original_id)
2875 && $this->questionrepository->questionExistsInPool($this->original_id)
2876 && assQuestion::instantiateQuestion($this->original_id)->isWriteable();
2877 }

References instantiateQuestion().

+ Here is the call graph for this function:

◆ implodeKeyValues()

static assQuestion::implodeKeyValues ( array  $keyValues)
static

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

2535 : string
2536 {
2537 return implode(assQuestion::KEY_VALUES_IMPLOSION_SEPARATOR, $keyValues);
2538 }

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

1736 : assQuestion
1737 {
1738 global $DIC;
1739 $ilCtrl = $DIC['ilCtrl'];
1740 $ilDB = $DIC['ilDB'];
1741 $lng = $DIC['lng'];
1742 $questionrepository = QuestionPoolDIC::dic()['question.general_properties.repository'];
1743 $question_type = $questionrepository->getForQuestionId($question_id)?->getClassName() ?? '';
1744 if ($question_type === '') {
1745 throw new InvalidArgumentException('No question with ID ' . $question_id . ' exists');
1746 }
1747
1748 $question = new $question_type();
1749 $question->loadFromDb($question_id);
1750
1751 $feedbackObjectClassname = self::getFeedbackClassNameByQuestionType($question_type);
1752 $question->feedbackOBJ = new $feedbackObjectClassname($question, $ilCtrl, $ilDB, $lng);
1753
1754 return $question;
1755 }
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(), 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 2659 of file class.assQuestion.php.

2659 : bool
2660 {
2661 $solutionAvailability = $this->lookupForExistingSolutions($active_id, $pass);
2662 return (bool) $solutionAvailability['intermediate'];
2663 }

◆ isAddableAnswerOptionValue()

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

Reimplemented in assClozeTest, and assTextSubset.

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

2735 : bool
2736 {
2737 return false;
2738 }

◆ isAdditionalContentEditingModePageObject()

assQuestion::isAdditionalContentEditingModePageObject ( )

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

2297 : bool
2298 {
2300 }

References ADDITIONAL_CONTENT_EDITING_MODE_IPE.

◆ isAnswered()

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

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

2251 : bool
2252 {
2253 $numExistingSolutionRecords = assQuestion::getNumExistingSolutionRecords($active_id, $pass, $this->getId());
2254 return $numExistingSolutionRecords > 0;
2255 }
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 2554 of file class.assQuestion.php.

2554 : bool
2555 {
2556 return !strlen($solutionRecord['value1']) && !strlen($solutionRecord['value2']);
2557 }

◆ isFileAvailable()

static assQuestion::isFileAvailable ( string  $file)
static

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

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

◆ isForcePassResultUpdateEnabled()

static assQuestion::isForcePassResultUpdateEnabled ( )
static

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

222 : bool
223 {
225 }
static $force_pass_results_update_enabled

References $force_pass_results_update_enabled.

◆ isNonEmptyItemListPostSubmission()

assQuestion::isNonEmptyItemListPostSubmission ( string  $post_submission_field_name)
protected

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

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

◆ isPreviewSolutionCorrect()

assQuestion::isPreviewSolutionCorrect ( ilAssQuestionPreviewSession  $preview_session)

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

1812 : bool
1813 {
1814 $reached_points = $this->calculateReachedPointsFromPreviewSession($preview_session);
1815
1816 return !($reached_points < $this->getMaximumPoints());
1817 }
calculateReachedPointsFromPreviewSession(ilAssQuestionPreviewSession $preview_session)

◆ isValidAdditionalContentEditingMode()

assQuestion::isValidAdditionalContentEditingMode ( string  $additionalContentEditingMode)

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

2302 : bool
2303 {
2305 return true;
2306 }
2307
2308 return false;
2309 }
getValidAdditionalContentEditingModes()

◆ isWriteable()

assQuestion::isWriteable ( )

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

1796 : bool
1797 {
1798 return ilObjQuestionPool::_isWriteable($this->getObjId(), $this->getCurrentUser()->getId());
1799 }
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 2162 of file class.assQuestion.php.

2162 : void
2163 {
2164 $this->setQuestion($migrator->migrateToLmContent($this->getQuestion()));
2165 }
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 2167 of file class.assQuestion.php.

2167 : void
2168 {
2169 // overwrite if any question type specific content except feedback needs to be migrated
2170 }

◆ loadFromDb()

assQuestion::loadFromDb ( int  $question_id)

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

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

1109 : void
1110 {
1111 $result = $this->db->queryF(
1112 'SELECT external_id FROM qpl_questions WHERE question_id = %s',
1113 ['integer'],
1114 [$question_id]
1115 );
1116 if ($this->db->numRows($result) === 1) {
1117 $data = $this->db->fetchAssoc($result);
1118 $this->external_id = $data['external_id'];
1119 }
1120
1122 $this->suggested_solutions = [];
1124 foreach ($suggested_solutions as $solution) {
1125 $this->suggested_solutions[$solution->getSubquestionIndex()] = $solution;
1126 }
1127 }
1128 }

References $data.

◆ loadSuggestedSolutions()

assQuestion::loadSuggestedSolutions ( )
protected

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

2847 : array
2848 {
2849 $question_id = $this->getId();
2850 return $this->getSuggestedSolutionsRepo()->selectFor($question_id);
2851 }

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

2699 : array
2700 {
2701 $return = [
2702 'authorized' => false,
2703 'intermediate' => false
2704 ];
2705
2706 $query = "
2707 SELECT authorized, COUNT(*) cnt
2708 FROM tst_solutions
2709 WHERE active_fi = %s
2710 AND question_fi = %s
2711 AND pass = %s
2712 ";
2713
2714 if ($this->getStep() !== null) {
2715 $query .= " AND step = " . $this->db->quote((int) $this->getStep(), 'integer') . " ";
2716 }
2717
2718 $query .= "
2719 GROUP BY authorized
2720 ";
2721
2722 $result = $this->db->queryF($query, ['integer', 'integer', 'integer'], [$activeId, $this->getId(), $pass]);
2723
2724 while ($row = $this->db->fetchAssoc($result)) {
2725 if ($row['authorized']) {
2726 $return['authorized'] = $row['cnt'] > 0;
2727 } else {
2728 $return['intermediate'] = $row['cnt'] > 0;
2729 }
2730 }
2731 return $return;
2732 }

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

2681 : int
2682 {
2683 $result = $this->db->queryF(
2684 "SELECT MAX(step) max_step FROM tst_solutions WHERE active_fi = %s AND pass = %s AND question_fi = %s",
2685 ["integer", "integer", "integer"],
2686 [$active_id, $pass, $this->getId()]
2687 );
2688
2689 $row = $this->db->fetchAssoc($result);
2690
2691 return (int) $row['max_step'];
2692 }

References ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ lookupParentObjId()

static assQuestion::lookupParentObjId ( int  $question_id)
static

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

2194 : ?int
2195 {
2196 global $DIC;
2197 $ilDB = $DIC['ilDB'];
2198
2199 $query = "SELECT obj_fi FROM qpl_questions WHERE question_id = %s";
2200
2201 $res = $ilDB->queryF($query, ['integer'], [$question_id]);
2202 $row = $ilDB->fetchAssoc($res);
2203
2204 return $row['obj_fi'] ?? null;
2205 }

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

2153 : void
2154 {
2155 $this->lmMigrateQuestionTypeGenericContent($migrator);
2156 $this->lmMigrateQuestionTypeSpecificContent($migrator);
2157 $this->saveToDb();
2158
2159 $this->feedbackOBJ->migrateContentForLearningModule($migrator, $this->getId());
2160 }
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 1427 of file class.assQuestion.php.

1427 : void
1428 {
1429 $this->copySuggestedSolutions($targetQuestionId);
1430 $this->duplicateSuggestedSolutionFiles($sourceParentId, $sourceQuestionId);
1431 $this->feedbackOBJ->duplicateFeedback($sourceQuestionId, $targetQuestionId);
1432 $this->duplicateSkillAssignments($sourceParentId, $sourceQuestionId, $targetParentId, $targetQuestionId);
1433 $this->duplicateComments($sourceParentId, $sourceQuestionId, $targetParentId, $targetQuestionId);
1434 }
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 1405 of file class.assQuestion.php.

1410 : void {
1411 $this->copySuggestedSolutions($duplicate_question_id);
1412 $this->cloneSuggestedSolutionFiles($original_parent_id, $original_question_id);
1413 $this->feedbackOBJ->duplicateFeedback($original_question_id, $duplicate_question_id);
1414 $this->duplicateSkillAssignments($original_parent_id, $original_question_id, $duplicate_parent_id, $duplicate_question_id);
1415 $this->duplicateComments($original_parent_id, $original_question_id, $duplicate_parent_id, $duplicate_question_id);
1416 }

◆ persistPreviewState()

assQuestion::persistPreviewState ( ilAssQuestionPreviewSession  $preview_session)
final

persists the preview state for current user and question

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

653 : bool
654 {
655 $this->savePreviewData($preview_session);
656 return $this->validateSolutionSubmit();
657 }
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 623 of file class.assQuestion.php.

623 : bool
624 {
625 if (!$this instanceof QuestionPartiallySaveable && !$this->validateSolutionSubmit()) {
626 return false;
627 }
628
629 $saveStatus = false;
630
631 $this->getProcessLocker()->executePersistWorkingStateLockOperation(function () use ($active_id, $pass, $authorized, &$saveStatus) {
632 if ($pass === null) {
633 $pass = ilObjTest::_getPass($active_id);
634 }
635
636 $saveStatus = $this->saveWorkingData($active_id, $pass, $authorized);
637
638 if ($authorized) {
639 // fau: testNav - remove an intermediate solution if the authorized solution is saved
640 // the intermediate solution would set the displayed question status as "editing ..."
641 $this->removeIntermediateSolution($active_id, $pass);
642 // fau.
643 $this->calculateResultsFromSolution($active_id, $pass);
644 }
645 });
646
647 return $saveStatus;
648 }
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 1939 of file class.assQuestion.php.

1939 : string
1940 {
1941 $purified_content = $this->getHtmlQuestionContentPurifier()->purify($content);
1943 || !(new ilSetting('advanced_editing'))->get('advanced_editing_javascript_editor') === 'tinymce') {
1944 $purified_content = nl2br($purified_content);
1945 }
1947 $purified_content,
1948 true,
1949 true
1950 );
1951 }
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 ilLegacyFormElementsUtil\prepareTextareaOutput().

+ Here is the call graph for this function:

◆ removeAllExistingSolutions()

assQuestion::removeAllExistingSolutions ( )

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

2744 : void
2745 {
2746 $query = "DELETE FROM tst_solutions WHERE question_fi = %s";
2747 $this->db->manipulateF($query, ['integer'], [$this->getId()]);
2748 }

References ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ removeAllImageFiles()

assQuestion::removeAllImageFiles ( string  $image_target_path)
protected

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

1364 : void
1365 {
1366 $target = opendir($image_target_path);
1367 while ($target_file = readdir($target)) {
1368 if ($target_file === '.' || $target_file === '..') {
1369 continue;
1370 }
1371 copy(
1372 $image_target_path . DIRECTORY_SEPARATOR . $target_file,
1373 $image_target_path . DIRECTORY_SEPARATOR . $target_file
1374 );
1375 }
1376 }

◆ removeCurrentSolution()

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

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

2431 : int
2432 {
2433 if ($this->getStep() !== null) {
2434 $query = '
2435 DELETE FROM tst_solutions
2436 WHERE active_fi = %s
2437 AND question_fi = %s
2438 AND pass = %s
2439 AND step = %s
2440 AND authorized = %s
2441 ';
2442
2443 return $this->db->manipulateF(
2444 $query,
2445 ['integer', 'integer', 'integer', 'integer', 'integer'],
2446 [$active_id, $this->getId(), $pass, $this->getStep(), (int) $authorized]
2447 );
2448 }
2449
2450 $query = "
2451 DELETE FROM tst_solutions
2452 WHERE active_fi = %s
2453 AND question_fi = %s
2454 AND pass = %s
2455 AND authorized = %s
2456 ";
2457
2458 return $this->db->manipulateF(
2459 $query,
2460 ['integer', 'integer', 'integer', 'integer'],
2461 [$active_id, $this->getId(), $pass, (int) $authorized]
2462 );
2463 }

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

2750 : int
2751 {
2752 $query = "
2753 DELETE FROM tst_solutions
2754 WHERE active_fi = %s
2755 AND question_fi = %s
2756 AND pass = %s
2757 ";
2758
2759 if ($this->getStep() !== null) {
2760 $query .= " AND step = " . $this->db->quote((int) $this->getStep(), 'integer') . " ";
2761 }
2762
2763 return $this->db->manipulateF(
2764 $query,
2765 ['integer', 'integer', 'integer'],
2766 [$activeId, $this->getId(), $pass]
2767 );
2768 }

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

2421 : void
2422 {
2423 $this->getProcessLocker()->executeUserSolutionUpdateLockOperation(function () use ($active_id, $pass) {
2424 $this->removeCurrentSolution($active_id, $pass, false);
2425 });
2426 }
removeCurrentSolution(int $active_id, int $pass, bool $authorized=true)

◆ removeResultRecord()

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

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

2777 : int
2778 {
2779 $query = "
2780 DELETE FROM tst_test_result
2781 WHERE active_fi = %s
2782 AND question_fi = %s
2783 AND pass = %s
2784 ";
2785
2786 if ($this->getStep() !== null) {
2787 $query .= " AND step = " . $this->db->quote((int) $this->getStep(), 'integer') . " ";
2788 }
2789
2790 return $this->db->manipulateF(
2791 $query,
2792 ['integer', 'integer', 'integer'],
2793 [$activeId, $this->getId(), $pass]
2794 );
2795 }

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

2393 : int
2394 {
2395 return $this->db->manipulateF(
2396 "DELETE FROM tst_solutions WHERE solution_id = %s",
2397 ['integer'],
2398 [$solutionId]
2399 );
2400 }

◆ resetOriginalId()

static assQuestion::resetOriginalId ( int  $questionId)
static

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

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

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

2770 : void
2771 {
2772 $this->removeExistingSolutions($activeId, $pass);
2773 $this->removeResultRecord($activeId, $pass);
2774 $this->test_result_repository->updateTestAttemptResult($activeId, $pass, $this->getProcessLocker(), $this->getTestId());
2775 }
removeResultRecord(int $activeId, int $pass)
removeExistingSolutions(int $activeId, int $pass)

◆ resolveInternalLink()

assQuestion::resolveInternalLink ( string  $internal_link)

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

1591 : string
1592 {
1593 if (preg_match("/il_(\d+)_(\w+)_(\d+)/", $internal_link, $matches) === false) {
1594 return $internal_link;
1595 }
1596 switch ($matches[2]) {
1597 case "lm":
1598 $resolved_link = ilLMObject::_getIdForImportId($internal_link);
1599 break;
1600 case "pg":
1601 $resolved_link = ilInternalLink::_getIdForImportId("PageObject", $internal_link);
1602 break;
1603 case "st":
1604 $resolved_link = ilInternalLink::_getIdForImportId("StructureObject", $internal_link);
1605 break;
1606 case "git":
1607 $resolved_link = ilInternalLink::_getIdForImportId("GlossaryItem", $internal_link);
1608 break;
1609 case "mob":
1610 $resolved_link = ilInternalLink::_getIdForImportId("MediaObject", $internal_link);
1611 break;
1612 }
1613 if ($resolved_link === null) {
1614 return "il__{$matches[2]}_{$matches[3]}";
1615 }
1616 return $internal_link;
1617 }
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 1622 of file class.assQuestion.php.

1622 : void
1623 {
1624 $resolvedlinks = 0;
1625 $result_pre = $this->db->queryF(
1626 "SELECT internal_link, suggested_solution_id FROM qpl_sol_sug WHERE question_fi = %s",
1627 ['integer'],
1628 [$this->getId()]
1629 );
1630 if ($this->db->numRows($result_pre) < 1) {
1631 return;
1632 }
1633
1634 while ($row = $this->db->fetchAssoc($result_pre)) {
1635 $internal_link = $row["internal_link"];
1636 $resolved_link = $this->resolveInternalLink($internal_link);
1637 if ($internal_link === $resolved_link) {
1638 continue;
1639 }
1640 // internal link was resolved successfully
1641 $this->db->manipulateF(
1642 "UPDATE qpl_sol_sug SET internal_link = %s WHERE suggested_solution_id = %s",
1643 ['text','integer'],
1644 [$resolved_link, $row["suggested_solution_id"]]
1645 );
1646 $resolvedlinks++;
1647 }
1648 if ($resolvedlinks === 0) {
1649 return;
1650 }
1651
1653
1654 $result_post = $this->db->queryF(
1655 "SELECT internal_link FROM qpl_sol_sug WHERE question_fi = %s",
1656 ['integer'],
1657 [$this->getId()]
1658 );
1659 if ($this->db->numRows($result_post) < 1) {
1660 return;
1661 }
1662
1663 while ($row = $this->db->fetchAssoc($result_post)) {
1664 if (preg_match("/il_(\d*?)_(\w+)_(\d+)/", $row["internal_link"], $matches)) {
1665 ilInternalLink::_saveLink("qst", $this->getId(), $matches[2], $matches[3], $matches[1]);
1666 }
1667 }
1668 }
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 2466 of file class.assQuestion.php.

2466 : int
2467 {
2468 $next_id = $this->db->nextId("tst_solutions");
2469
2470 $fieldData = [
2471 "solution_id" => ["integer", $next_id],
2472 "active_fi" => ["integer", $active_id],
2473 "question_fi" => ["integer", $this->getId()],
2474 "value1" => ["clob", $value1],
2475 "value2" => ["clob", $value2],
2476 "pass" => ["integer", $pass],
2477 "tstamp" => ["integer", ((int) $tstamp > 0) ? (int) $tstamp : time()],
2478 'authorized' => ['integer', (int) $authorized]
2479 ];
2480
2481 if ($this->getStep() !== null) {
2482 $fieldData['step'] = ["integer", $this->getStep()];
2483 }
2484
2485 return $this->db->insert("tst_solutions", $fieldData);
2486 }

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

1378 : void
1379 {
1380 global $DIC;
1381 $ilDB = $DIC->database();
1382 $query = "UPDATE qpl_questions SET tstamp = %s, original_id = %s WHERE question_id = %s";
1383
1384 $ilDB->manipulateF(
1385 $query,
1386 ['integer','integer', 'text'],
1387 [time(), $originalId, $questionId]
1388 );
1389 }

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

664 : void
665 {
666 $preview_session->setParticipantsSolution($this->getSolutionSubmit());
667 }

References ilAssQuestionPreviewSession\setParticipantsSolution().

+ Here is the call graph for this function:

◆ saveQuestionDataToDb()

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

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

1187 : void
1188 {
1189 if ($this->getId() === -1) {
1190 $next_id = $this->db->nextId('qpl_questions');
1191 $this->db->insert("qpl_questions", [
1192 "question_id" => ["integer", $next_id],
1193 "question_type_fi" => ["integer", $this->getQuestionTypeID()],
1194 "obj_fi" => ["integer", $this->getObjId()],
1195 "title" => ["text", mb_substr($this->getTitle(), 0, 124)],
1196 "description" => ["text", mb_substr($this->getComment(), 0, 1000)],
1197 "author" => ["text", mb_substr($this->getAuthor(), 0, 512)],
1198 "owner" => ["integer", $this->getOwner()],
1199 "question_text" => ["clob", ilRTE::_replaceMediaObjectImageSrc($this->getQuestion(), 0)],
1200 "points" => ["float", $this->getMaximumPoints()],
1201 "nr_of_tries" => ["integer", $this->getNrOfTries()],
1202 "created" => ["integer", time()],
1203 "original_id" => ["integer", $original_id],
1204 "tstamp" => ["integer", time()],
1205 "external_id" => ["text", $this->getExternalId()],
1206 'add_cont_edit_mode' => ['text', $this->getAdditionalContentEditingMode()]
1207 ]);
1208 $this->setId($next_id);
1209 // create page object of question
1210 $this->createPageObject();
1211 return;
1212 }
1213
1214 // Vorhandenen Datensatz aktualisieren
1215 $this->db->update("qpl_questions", [
1216 "obj_fi" => ["integer", $this->getObjId()],
1217 "title" => ["text", mb_substr($this->getTitle(), 0, 124)],
1218 "description" => ["text", mb_substr($this->getComment(), 0, 1000)],
1219 "author" => ["text", mb_substr($this->getAuthor(), 0, 512)],
1220 "question_text" => ["clob", ilRTE::_replaceMediaObjectImageSrc($this->getQuestion(), 0)],
1221 "points" => ["float", $this->getMaximumPoints()],
1222 "nr_of_tries" => ["integer", $this->getNrOfTries()],
1223 "tstamp" => ["integer", time()],
1224 'complete' => ['integer', $this->isComplete()],
1225 "external_id" => ["text", $this->getExternalId()]
1226 ], [
1227 "question_id" => ["integer", $this->getId()]
1228 ]);
1229 }
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 1338 of file class.assQuestion.php.

1338 : void
1339 {
1340 // remove unused media objects from ILIAS
1341 $this->cleanupMediaObjectUsage();
1342
1343 $complete = "0";
1344 if ($this->isComplete()) {
1345 $complete = "1";
1346 }
1347
1348 $this->db->update(
1349 'qpl_questions',
1350 [
1351 'tstamp' => ['integer', time()],
1352 'owner' => ['integer', $this->getOwner()],
1353 'complete' => ['integer', $complete],
1354 'lifecycle' => ['text', $this->getLifecycle()->getIdentifier()],
1355 ],
1356 [
1357 'question_id' => ['integer', $this->getId()]
1358 ]
1359 );
1360
1362 }

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

2182 : void
2183 {
2184 $this->defaultnroftries = $defaultnroftries;
2185 }

◆ setExportImagePath()

assQuestion::setExportImagePath ( string  $path)

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

2109 : void
2110 {
2111 $this->export_image_path = $path;
2112 }
$path
Definition: ltiservices.php:30

References $path.

◆ setExternalId()

assQuestion::setExternalId ( ?string  $external_id)

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

441 : void
442 {
443 $this->external_id = $external_id;
444 }

◆ setForcePassResultUpdateEnabled()

static assQuestion::setForcePassResultUpdateEnabled ( bool  $force_pass_results_update_enabled)
static

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

217 : void
218 {
219 self::$force_pass_results_update_enabled = $force_pass_results_update_enabled;
220 }

References $force_pass_results_update_enabled.

◆ setId()

◆ setLastChange()

assQuestion::setLastChange ( int  $lastChange)

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

2347 : void
2348 {
2349 $this->lastChange = $lastChange;
2350 }

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

2143 : void
2144 {
2145 $this->prevent_rte_usage = $prevent_rte_usage;
2146 }

◆ setProcessLocker()

assQuestion::setProcessLocker ( ilAssQuestionProcessLocker  $processLocker)

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

252 : void
253 {
254 $this->processLocker = $processLocker;
255 }

References $processLocker.

◆ setQuestion()

◆ setSelfAssessmentEditingMode()

assQuestion::setSelfAssessmentEditingMode ( bool  $selfassessmenteditingmode)

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

2172 : void
2173 {
2174 $this->selfassessmenteditingmode = $selfassessmenteditingmode;
2175 }

◆ setShuffle()

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

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

324 : void
325 {
326 $this->shuffle = $shuffle ?? false;
327 }

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

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

References $shuffler.

◆ setStep()

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

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

2628 : void
2629 {
2630 $this->step = $step;
2631 }

◆ setTestId()

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

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

314 : void
315 {
316 $this->test_id = $id;
317 }

References $id.

◆ setThumbSize()

assQuestion::setThumbSize ( int  $a_size)

Reimplemented in assKprimChoice.

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

387 : void
388 {
389 if ($a_size >= self::MINIMUM_THUMB_SIZE) {
390 $this->thumb_size = $a_size;
391 } else {
392 throw new ilException("Thumb size must be at least " . self::MINIMUM_THUMB_SIZE . "px");
393 }
394 }
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 2228 of file class.assQuestion.php.

2228 : void
2229 {
2230 $assignmentList = new ilAssQuestionSkillAssignmentList($this->db);
2231 $assignmentList->setParentObjId($trgParentId);
2232 $assignmentList->setQuestionIdFilter($trgQuestionId);
2233 $assignmentList->loadFromDb();
2234
2235 foreach ($assignmentList->getAssignmentsByQuestionId($trgQuestionId) as $assignment) {
2236 $assignment->deleteFromDb();
2237
2238 // remove skill usage
2239 if (!$assignment->isSkillUsed()) {
2240 $this->skillUsageService->removeUsage(
2241 $assignment->getParentObjId(),
2242 $assignment->getSkillBaseId(),
2243 $assignment->getSkillTrefId()
2244 );
2245 }
2246 }
2247
2248 $this->duplicateSkillAssignments($srcParentId, $srcQuestionId, $trgParentId, $trgQuestionId);
2249 }

Referenced by ilAssQuestionSkillAssignmentsGUI\syncOriginalCmd().

+ Here is the caller graph for this function:

◆ syncWithOriginal()

assQuestion::syncWithOriginal ( )

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

1701 : void
1702 {
1703 if ($this->getOriginalId() === null) {
1704 return;
1705 }
1706
1707 $original_parent_id = self::lookupParentObjId($this->getOriginalId());
1708
1709 if ($original_parent_id === null) {
1710 return;
1711 }
1712
1713 $this->cloneSuggestedSolutions($this->getId(), $this->getOriginalId());
1714 $original = clone $this;
1715 // Now we become the original
1716 $original->setId($this->getOriginalId());
1717 $original->setOriginalId(null);
1718 $original->setObjId($original_parent_id);
1719
1720 $original->saveToDb();
1721
1722 $original->deletePageOfQuestion($this->getOriginalId());
1723 $original->createPageObject();
1724 $original->clonePageOfQuestion($this->getId());
1725 $original = $this->cloneQuestionTypeSpecificProperties($original);
1726 $this->cloneXHTMLMediaObjectsOfQuestion($original->getId());
1727 $this->afterSyncWithOriginal($this->getOriginalId(), $this->getId(), $this->getObjId(), $original_parent_id);
1728 $this->afterSyncWithOriginal($this->getOriginalId(), $this->getId(), $original_parent_id, $this->getObjId());
1729 }
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.

◆ toQuestionAdministrationInteraction()

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

Implements ILIAS\TestQuestionPool\Questions\Question.

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

2904 $test_ref_id,
2905 $this->id,
2906 $this->current_user->getId(),
2907 $interaction_type,
2908 time(),
2909 $this->toLog($additional_info)
2910 );
2911 }
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

Returns a QTI xml representation of the question.

Returns
string The QTI xml representation of the question

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

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

◆ updateCurrentSolution()

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

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

2489 : int
2490 {
2491 $fieldData = [
2492 "value1" => ["clob", $value1],
2493 "value2" => ["clob", $value2],
2494 "tstamp" => ["integer", time()],
2495 'authorized' => ['integer', (int) $authorized]
2496 ];
2497
2498 if ($this->getStep() !== null) {
2499 $fieldData['step'] = ["integer", $this->getStep()];
2500 }
2501
2502 return $this->db->update("tst_solutions", $fieldData, [
2503 'solution_id' => ['integer', $solutionId]
2504 ]);
2505 }

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

2508 : int
2509 {
2510 $fieldData = [
2511 'authorized' => ['integer', (int) $authorized]
2512 ];
2513
2514 if (!$keepTime) {
2515 $fieldData['tstamp'] = ['integer', time()];
2516 }
2517
2518 $whereData = [
2519 'question_fi' => ['integer', $this->getId()],
2520 'active_fi' => ['integer', $activeId],
2521 'pass' => ['integer', $pass]
2522 ];
2523
2524 if ($this->getStep() !== null) {
2525 $whereData['step'] = ["integer", $this->getStep()];
2526 }
2527
2528 return $this->db->update('tst_solutions', $fieldData, $whereData);
2529 }

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

+ Here is the call graph for this function:

◆ updateTimestamp()

assQuestion::updateTimestamp ( )

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

2819 : void
2820 {
2821 $this->db->manipulateF(
2822 "UPDATE qpl_questions SET tstamp = %s WHERE question_id = %s",
2823 ['integer', 'integer'],
2824 [time(), $this->getId()]
2825 );
2826 }

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

659 : bool
660 {
661 return true;
662 }

Field Documentation

◆ $additionalContentEditingMode

string assQuestion::$additionalContentEditingMode = ''
private

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

◆ $author

◆ $comment

◆ $current_user

ilObjUser assQuestion::$current_user
protected

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

Referenced by getCurrentUser().

◆ $db

ilDBInterface assQuestion::$db
protected

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

◆ $defaultnroftries

int assQuestion::$defaultnroftries = 0

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

◆ $dic

Container assQuestion::$dic
protected

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

◆ $export_image_path

string assQuestion::$export_image_path
private

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

◆ $external_id

string assQuestion::$external_id = null
protected

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

◆ $feedbackOBJ

ilAssQuestionFeedback assQuestion::$feedbackOBJ

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

◆ $id

int assQuestion::$id
protected

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

◆ $ilias

ILIAS assQuestion::$ilias
protected

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

◆ $lastChange

int assQuestion::$lastChange = null
protected

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

◆ $lifecycle

ilAssQuestionLifecycle assQuestion::$lifecycle
protected

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

◆ $lng

ilLanguage assQuestion::$lng
protected

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

◆ $log

LoggingServices assQuestion::$log
protected

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

◆ $nr_of_tries

int assQuestion::$nr_of_tries
private

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

◆ $obj_id

int assQuestion::$obj_id = 0
protected

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

◆ $original_id

◆ $owner

◆ $page

ilAssQuestionPage assQuestion::$page
protected

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

◆ $points

◆ $prevent_rte_usage

bool assQuestion::$prevent_rte_usage = false

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

◆ $processLocker

ilAssQuestionProcessLocker assQuestion::$processLocker
protected

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

Referenced by getProcessLocker(), and setProcessLocker().

◆ $question

◆ $question_files

QuestionFiles assQuestion::$question_files
protected

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

◆ $questionActionCmd

string assQuestion::$questionActionCmd = 'handleQuestionAction'

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

◆ $questionpool_request

RequestDataCollector assQuestion::$questionpool_request
protected

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

◆ $questionrepository

GeneralQuestionPropertiesRepository assQuestion::$questionrepository
protected

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

◆ $refinery

Refinery assQuestion::$refinery
protected

◆ $selfassessmenteditingmode

bool assQuestion::$selfassessmenteditingmode = false

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

◆ $shuffle

bool assQuestion::$shuffle = true
protected

◆ $shuffler

Transformation assQuestion::$shuffler
protected

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

Referenced by getShuffler(), and setShuffler().

◆ $skillUsageService

SkillUsageService assQuestion::$skillUsageService
protected

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

◆ $step

int assQuestion::$step = null
protected

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

◆ $suggested_solutions

array assQuestion::$suggested_solutions
protected

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

◆ $suggestedsolution_repo

SuggestedSolutionsDatabaseRepository assQuestion::$suggestedsolution_repo
protected

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

◆ $test_id

int assQuestion::$test_id
protected

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

◆ $test_question_config

ilTestQuestionConfig assQuestion::$test_question_config = null
private

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

◆ $test_result_repository

TestResultRepository assQuestion::$test_result_repository
protected

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

◆ $testQuestionConfig

ilTestQuestionConfig assQuestion::$testQuestionConfig
protected

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

◆ $thumb_size

int assQuestion::$thumb_size
protected

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

◆ $title

◆ $tpl

ilGlobalPageTemplate assQuestion::$tpl
protected

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

◆ HAS_SPECIFIC_FEEDBACK

const assQuestion::HAS_SPECIFIC_FEEDBACK = true
protected

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

◆ KEY_VALUES_IMPLOSION_SEPARATOR

const assQuestion::KEY_VALUES_IMPLOSION_SEPARATOR = ':'

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

Referenced by explodeKeyValues(), and implodeKeyValues().

◆ MAXIMUM_THUMB_SIZE

const assQuestion::MAXIMUM_THUMB_SIZE = 8192
private

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

◆ MINIMUM_THUMB_SIZE

const assQuestion::MINIMUM_THUMB_SIZE = 20
private

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

◆ TRIM_PATTERN

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

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


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