ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
assQuestion Class Reference

Abstract basic class which is to be extended by the concrete assessment question type classes. More...

+ Inheritance diagram for assQuestion:
+ Collaboration diagram for assQuestion:

Public Member Functions

 __construct (string $title="", string $comment="", string $author="", int $owner=-1, string $question="")
 assQuestion constructor More...
 
 getShuffler ()
 
 setShuffler (Transformation $shuffler)
 
 setProcessLocker (ilAssQuestionProcessLocker $processLocker)
 
 getProcessLocker ()
 
 fromXML ($item, int $questionpool_id, ?int $tst_id, &$tst_object, int &$question_counter, array $import_mapping, array &$solutionhints=[])
 Receives parameters from a QTI parser and creates a valid ILIAS question object. More...
 
 toXML (bool $a_include_header=true, bool $a_include_binary=true, bool $a_shuffle=false, bool $test_output=false, bool $force_image_references=false)
 Returns a QTI xml representation of the question. More...
 
 isComplete ()
 Returns true, if a question is complete for use. More...
 
 setTitle (string $title="")
 
 setId (int $id=-1)
 
 setTestId (int $id=-1)
 
 setComment (string $comment="")
 
 setShuffle (?bool $shuffle=true)
 
 setAuthor (string $author="")
 
 setOwner (int $owner=-1)
 
 getTitle ()
 
 getTitleForHTMLOutput ()
 
 getTitleFilenameCompliant ()
 
 getId ()
 
 getShuffle ()
 
 getTestId ()
 
 getComment ()
 
 getDescriptionForHTMLOutput ()
 
 getThumbSize ()
 
 setThumbSize (int $a_size)
 
 getMinimumThumbSize ()
 
 getMaximumThumbSize ()
 
 getAuthor ()
 
 getAuthorForHTMLOutput ()
 
 getOwner ()
 
 getObjId ()
 
 setObjId (int $obj_id=0)
 
 getLifecycle ()
 
 setLifecycle (ilAssQuestionLifecycle $lifecycle)
 
 setExternalId (?string $external_id)
 
 getExternalId ()
 
 getSuggestedSolutionOutput ()
 
 getSuggestedSolutions ()
 
 getReachedPoints (int $active_id, int $pass)
 
 getMaximumPoints ()
 
 getAdjustedReachedPoints (int $active_id, int $pass, bool $authorizedSolution=true)
 returns the reached points ... More...
 
 calculateResultsFromSolution (int $active_id, int $pass, bool $obligationsEnabled=false)
 Calculates the question results from a previously saved question solution. More...
 
 persistWorkingState (int $active_id, $pass, bool $obligationsEnabled=false, bool $authorized=true)
 persists the working state for current testactive and testpass More...
 
 persistPreviewState (ilAssQuestionPreviewSession $previewSession)
 persists the preview state for current user and question More...
 
 validateSolutionSubmit ()
 
 saveWorkingData (int $active_id, int $pass, bool $authorized=true)
 Saves the learners input of the question to the database. More...
 
 getSuggestedSolutionPath ()
 
 getImagePath ($question_id=null, $object_id=null)
 Returns the image path for web accessable images of a question. More...
 
 getSuggestedSolutionPathWeb ()
 
 getImagePathWeb ()
 Returns the web image path for web accessable images of a question. More...
 
 getTestOutputSolutions (int $activeId, int $pass)
 
 getUserSolutionPreferingIntermediate (int $active_id, $pass=null)
 
 getSolutionValues ($active_id, $pass=null, bool $authorized=true)
 Loads solutions of a given user from the database an returns it. More...
 
 getAdditionalTableName ()
 
 getAnswerTableName ()
 
 deleteAnswers (int $question_id)
 
 deleteAdditionalTableData (int $question_id)
 
 delete (int $question_id)
 
 getTotalAnswers ()
 
 copyXHTMLMediaObjectsOfQuestion (int $a_q_id)
 
 syncXHTMLMediaObjectsOfQuestion ()
 
 createPageObject ()
 
 copyPageOfQuestion (int $a_q_id)
 
 getPageOfQuestion ()
 
 setOriginalId (?int $original_id)
 
 getOriginalId ()
 
 fixSvgToPng (string $imageFilenameContainingString)
 
 fixUnavailableSkinImageSources (string $html)
 
 loadFromDb (int $question_id)
 
 createNewQuestion (bool $a_create_page=true)
 Creates a new question without an owner when a new question is created This assures that an ID is given to the question if a file upload or something else occurs. More...
 
 saveQuestionDataToDb (int $original_id=-1)
 
 saveToDb ()
 
 deleteSuggestedSolutions ()
 
 getSuggestedSolution (int $subquestion_index=0)
 
 resolveInternalLink (string $internal_link)
 
 resolveSuggestedSolutionLinks ()
 
 syncWithOriginal ()
 
 getPoints ()
 
 setPoints (float $points)
 
 getSolutionMaxPass (int $active_id)
 
 calculateReachedPoints ($active_id, $pass=null, $authorizedSolution=true, $returndetails=false)
 Returns the points, a learner has reached answering the question. More...
 
 deductHintPointsFromReachedPoints (ilAssQuestionPreviewSession $previewSession, $reachedPoints)
 
 calculateReachedPointsFromPreviewSession (ilAssQuestionPreviewSession $previewSession)
 
 isPreviewSolutionCorrect (ilAssQuestionPreviewSession $previewSession)
 
 adjustReachedPointsByScoringOptions ($points, $active_id, $pass=null)
 Adjust the given reached points by checks for all special scoring options in the test container. More...
 
 buildHashedImageFilename (string $plain_image_filename, bool $unique=false)
 
 getQuestion ()
 
 getQuestionForHTMLOutput ()
 
 setQuestion (string $question="")
 
 getQuestionType ()
 Returns the question type of the question. More...
 
 getQuestionTypeID ()
 
 syncHints ()
 
 cleanupMediaObjectUsage ()
 
 getInstances ()
 
 getActiveUserData (int $active_id)
 Returns the user id and the test id for a given active id. More...
 
 hasSpecificFeedback ()
 
 setExportDetailsXLSX (ilAssExcelFormatHelper $worksheet, int $startrow, int $col, int $active_id, int $pass)
 
 getNrOfTries ()
 
 setNrOfTries (int $a_nr_of_tries)
 
 setExportImagePath (string $path)
 
 formatSAQuestion ($a_q)
 
 setPreventRteUsage (bool $prevent_rte_usage)
 
 getPreventRteUsage ()
 
 migrateContentForLearningModule (ilAssSelfAssessmentMigrator $migrator)
 
 setSelfAssessmentEditingMode (bool $selfassessmenteditingmode)
 
 getSelfAssessmentEditingMode ()
 
 setDefaultNrOfTries (int $defaultnroftries)
 
 getDefaultNrOfTries ()
 
 syncSkillAssignments (int $srcParentId, int $srcQuestionId, int $trgParentId, int $trgQuestionId)
 
 ensureHintPageObjectExists ($pageObjectId)
 
 isAnswered (int $active_id, int $pass)
 
 getAdditionalContentEditingMode ()
 
 setAdditionalContentEditingMode (?string $additionalContentEditingMode)
 
 isAdditionalContentEditingModePageObject ()
 
 isValidAdditionalContentEditingMode (string $additionalContentEditingMode)
 
 getValidAdditionalContentEditingModes ()
 
 getHtmlUserSolutionPurifier ()
 
 getHtmlQuestionContentPurifier ()
 
 setLastChange ($lastChange)
 
 getLastChange ()
 
 removeIntermediateSolution (int $active_id, int $pass)
 
 removeCurrentSolution (int $active_id, int $pass, bool $authorized=true)
 
 saveCurrentSolution (int $active_id, int $pass, $value1, $value2, bool $authorized=true, $tstamp=0)
 
 updateCurrentSolution (int $solutionId, $value1, $value2, bool $authorized=true)
 
 updateCurrentSolutionsAuthorization (int $activeId, int $pass, bool $authorized, bool $keepTime=false)
 
 setStep ($step)
 
 getStep ()
 
 toJSON ()
 
 duplicate (bool $for_test=true, string $title="", string $author="", int $owner=-1, $testObjId=null)
 
 intermediateSolutionExists (int $active_id, int $pass)
 
 authorizedSolutionExists (int $active_id, ?int $pass)
 
 authorizedOrIntermediateSolutionExists (int $active_id, int $pass)
 
 lookupForExistingSolutions (int $activeId, int $pass)
 Lookup if an authorized or intermediate solution exists. More...
 
 isAddableAnswerOptionValue (int $qIndex, string $answerOptionValue)
 
 addAnswerOptionValue (int $qIndex, string $answerOptionValue, float $points)
 
 removeAllExistingSolutions ()
 
 removeExistingSolutions (int $activeId, int $pass)
 
 resetUsersAnswer (int $activeId, int $pass)
 
 removeResultRecord (int $activeId, int $pass)
 
 fetchValuePairsFromIndexedValues (array $indexedValues)
 
 fetchIndexedValuesFromValuePairs (array $valuePairs)
 
 areObligationsToBeConsidered ()
 
 setObligationsToBeConsidered (bool $obligationsToBeConsidered)
 
 updateTimestamp ()
 
 getTestPresentationConfig ()
 

Static Public Member Functions

static setForcePassResultUpdateEnabled (bool $forcePassResultsUpdateEnabled)
 
static isForcePassResultUpdateEnabled ()
 
static _getSuggestedSolutionOutput (int $question_id)
 
static _getReachedPoints (int $active_id, int $question_id, int $pass)
 
static logAction (string $logtext, int $active_id, int $question_id)
 
static isFileAvailable (string $file)
 
static saveOriginalId (int $questionId, int $originalId)
 
static resetOriginalId (int $questionId)
 
static _getInternalLinkHref (string $target="")
 
static instantiateQuestion (int $question_id)
 
static _getSolutionMaxPass (int $question_id, int $active_id)
 Returns the maximum pass a users question solution. More...
 
static _isWriteable (int $question_id, int $user_id)
 
static _setReachedPoints (int $active_id, int $question_id, float $points, float $maxpoints, int $pass, bool $manualscoring, bool $obligationsEnabled, ?int $test_id=null)
 Sets the points, a learner has reached answering the question Additionally objective results are updated. More...
 
static _needsManualScoring (int $question_id)
 
static getFeedbackClassNameByQuestionType (string $questionType)
 
static instantiateQuestionGUI (int $a_question_id)
 
static _questionExistsInTest (int $question_id, int $test_id)
 
static lookupParentObjId (int $questionId)
 
static isObligationPossible (int $questionId)
 
static implodeKeyValues (array $keyValues)
 
static explodeKeyValues (string $keyValues)
 
static convertISO8601FormatH_i_s_ExtendedToSeconds (string $time)
 
static extendedTrim (string $value)
 Trim non-printable characters from the beginning and end of a string. More...
 

Data Fields

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

Protected Member Functions

 getQuestionAction ()
 
 isNonEmptyItemListPostSubmission (string $postSubmissionFieldname)
 
 log (int $active_id, string $langVar)
 
 savePreviewData (ilAssQuestionPreviewSession $previewSession)
 
 deletePageOfQuestion (int $question_id)
 
 onDuplicate (int $originalParentId, int $originalQuestionId, int $duplicateParentId, int $duplicateQuestionId)
 
 beforeSyncWithOriginal (int $origQuestionId, int $dupQuestionId, int $origParentObjId, int $dupParentObjId)
 
 afterSyncWithOriginal (int $origQuestionId, int $dupQuestionId, int $origParentObjId, int $dupParentObjId)
 
 onCopy (int $sourceParentId, int $sourceQuestionId, int $targetParentId, int $targetQuestionId)
 
 duplicateComments (int $parent_source_id, int $source_id, int $parent_target_id, int $target_id)
 
 deleteComments ()
 
 getNotesManager ()
 
 getNotesDataService ()
 
 getNotesRepo ()
 
 syncSuggestedSolutions (int $target_question_id, int $target_obj_id)
 
 duplicateSuggestedSolutionFiles (int $parent_id, int $question_id)
 Duplicates the files of a suggested solution if the question is duplicated. More...
 
 syncSuggestedSolutionFiles (int $target_question_id, int $target_obj_id)
 
 copySuggestedSolutionFiles (int $source_questionpool_id, int $source_question_id)
 
 copySuggestedSolutions (int $target_question_id)
 
 ensureNonNegativePoints ($points)
 
 purifyAndPrepareTextAreaOutput (string $content)
 
 getRTETextWithMediaObjects ()
 
 getSelfAssessmentFormatter ()
 
 lmMigrateQuestionTypeGenericContent (ilAssSelfAssessmentMigrator $migrator)
 
 lmMigrateQuestionTypeSpecificContent (ilAssSelfAssessmentMigrator $migrator)
 
 duplicateQuestionHints (int $originalQuestionId, int $duplicateQuestionId)
 
 duplicateSkillAssignments (int $srcParentId, int $srcQuestionId, int $trgParentId, int $trgQuestionId)
 
 buildQuestionDataQuery ()
 
 getCurrentSolutionResultSet (int $active_id, int $pass, bool $authorized=true)
 
 removeSolutionRecordById (int $solutionId)
 
 getSolutionRecordById (int $solutionId)
 
 deleteDummySolutionRecord (int $activeId, int $passIndex)
 
 isDummySolutionRecord (array $solutionRecord)
 
 deleteSolutionRecordByValues (int $activeId, int $passIndex, bool $authorized, array $matchValues)
 
 duplicateIntermediateSolutionAuthorized (int $activeId, int $passIndex)
 
 forceExistingIntermediateSolution (int $activeId, int $passIndex, bool $considerDummyRecordCreation)
 
 lookupMaxStep (int $active_id, int $pass)
 
 buildTestPresentationConfig ()
 build basic test question configuration instance More...
 
 getSuggestedSolutionsRepo ()
 
 loadSuggestedSolutions ()
 

Static Protected Member Functions

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

Protected Attributes

const HAS_SPECIFIC_FEEDBACK = true
 
ILIAS TestQuestionPool QuestionInfoService $questioninfo
 
ILIAS Test TestParticipantInfoService $testParticipantInfo
 
ILIAS HTTP Services $http
 
ILIAS Refinery Factory $refinery
 
ILIAS TestQuestionPool QuestionFilesService $questionFilesService
 
ILIAS DI LoggingServices $ilLog
 
int $id
 
string $title
 
string $comment
 
string $owner
 
string $author
 
int $thumb_size
 
string $question
 The question text. More...
 
float $points
 The maximum available points for the question. More...
 
bool $shuffle
 Indicates whether the answers will be shuffled or not. More...
 
int $test_id
 The database id of a test in which the question is contained. More...
 
int $obj_id = 0
 Object id of the container object. More...
 
 $ilias
 
ilGlobalPageTemplate $tpl
 
ilLanguage $lng
 
ilDBInterface $db
 
Container $dic
 
array $suggested_solutions
 
int $original_id = null
 
 $page
 
string $external_id = null
 
ilAssQuestionProcessLocker $processLocker
 
 $step
 
 $lastChange
 
Transformation $shuffler
 
ilTestQuestionConfig $testQuestionConfig
 
ilAssQuestionLifecycle $lifecycle
 
ilObjUser $current_user
 
SkillUsageService $skillUsageService
 
assQuestionSuggestedSolutionsDatabaseRepository $suggestedsolution_repo = null
 

Static Protected Attributes

static $forcePassResultsUpdateEnabled = false
 
static $imageSourceFixReplaceMap
 

Private Member Functions

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

Private Attributes

const DEFAULT_THUMB_SIZE = 150
 
const MINIMUM_THUMB_SIZE = 20
 
const MAXIMUM_THUMB_SIZE = 8192
 
int $nr_of_tries
 
string $export_image_path
 (Web) Path to images More...
 
string $additionalContentEditingMode = ''
 
bool $obligationsToBeConsidered = false
 
ilTestQuestionConfig $testQuestionConfigInstance = null
 

Detailed Description

Abstract basic class which is to be extended by the concrete assessment question type classes.

The assQuestion class defines and encapsulates basic/common methods and attributes as well as it provides abstract methods that are to be implemented by concrete question type classes.

Author
Helmut Schottmüller helmu.nosp@m.t.sc.nosp@m.hottm.nosp@m.uell.nosp@m.er@ma.nosp@m.c.co.nosp@m.m
Björn Heyser bheys.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

assQuestion::__construct ( string  $title = "",
string  $comment = "",
string  $author = "",
int  $owner = -1,
string  $question = "" 
)

assQuestion constructor

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

References $comment, $DIC, $ilDB, $ilLog, $lng, $title, $tpl, ILIAS\UI\examples\Symbol\Glyph\Comment\comment(), ilAssQuestionLifecycle\getDraftInstance(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), setAuthor(), setExternalId(), setOwner(), and setQuestion().

180  {
181  global $DIC;
182  $this->dic = $DIC;
183  $lng = $DIC['lng'];
184  $tpl = $DIC['tpl'];
185  $ilDB = $DIC['ilDB'];
186  $ilLog = $DIC->logger();
187  $this->questioninfo = $DIC->testQuestionPool()->questionInfo();
188  $this->questionFilesService = $DIC->testQuestionPool()->questionFiles();
189  $this->testParticipantInfo = $DIC->test()->testParticipantInfo();
190  $this->current_user = $DIC['ilUser'];
191  $this->lng = $lng;
192  $this->tpl = $tpl;
193  $this->db = $ilDB;
194  $this->ilLog = $ilLog;
195  $this->http = $DIC->http();
196  $this->refinery = $DIC->refinery();
197 
198  $this->thumb_size = self::DEFAULT_THUMB_SIZE;
199 
200  $this->title = $title;
201  $this->comment = $comment;
202  $this->setAuthor($author);
203  $this->setOwner($owner);
204 
205  $this->setQuestion($question);
206 
207  $this->id = -1;
208  $this->test_id = -1;
209  $this->suggested_solutions = [];
210  $this->shuffle = 1;
211  $this->nr_of_tries = 0;
212  $this->setExternalId(null);
213 
214  $this->questionActionCmd = 'handleQuestionAction';
215  $this->export_image_path = '';
216  $this->shuffler = $DIC->refinery()->random()->dontShuffle();
217  $this->lifecycle = ilAssQuestionLifecycle::getDraftInstance();
218  $this->skillUsageService = $DIC->skills()->usage();
219  }
ilGlobalPageTemplate $tpl
setOwner(int $owner=-1)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: class.ilLog.php:30
global $DIC
Definition: feed.php:28
static http()
Fetches the global http state from ILIAS.
string $question
The question text.
setExternalId(?string $external_id)
ILIAS DI LoggingServices $ilLog
setAuthor(string $author="")
setQuestion(string $question="")
+ Here is the call graph for this function:

Member Function Documentation

◆ _getInternalLinkHref()

static assQuestion::_getInternalLinkHref ( string  $target = "")
static

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

References $DIC.

Referenced by getSuggestedSolutionOutput(), and assQuestionGUI\suggestedsolution().

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

◆ _getReachedPoints()

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

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

References $DIC, $ilDB, and $points.

Referenced by ilTestScoringByQuestionsGUI\appendFormToModal(), ilTestScoringGUI\buildManScoringParticipantForm(), ilTestServiceGUI\getPassListOfAnswersWithScoring(), ilTestScoringByQuestionsGUI\saveManScoringByQuestion(), ilTestScoringGUI\saveManScoringParticipantScreen(), and ilTestScoringByQuestionsGUI\showManScoringByQuestionParticipantsTable().

565  : float
566  {
567  global $DIC;
568  $ilDB = $DIC['ilDB'];
569 
570  $points = 0.0;
571 
572  $result = $ilDB->queryF(
573  "SELECT * FROM tst_test_result WHERE active_fi = %s AND question_fi = %s AND pass = %s",
574  array('integer','integer','integer'),
575  array($active_id, $question_id, $pass)
576  );
577  if ($result->numRows() == 1) {
578  $row = $ilDB->fetchAssoc($result);
579  $points = (float) $row["points"];
580  }
581  return $points;
582  }
float $points
The maximum available points for the question.
global $DIC
Definition: feed.php:28
+ 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 1796 of file class.assQuestion.php.

References $DIC, and $ilDB.

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

1796  : ?int
1797  {
1798  // the following code was the old solution which added the non answered
1799  // questions of a pass from the answered questions of the previous pass
1800  // with the above solution, only the answered questions of the last pass are counted
1801  global $DIC;
1802  $ilDB = $DIC['ilDB'];
1803 
1804  $result = $ilDB->queryF(
1805  "SELECT MAX(pass) maxpass FROM tst_test_result WHERE active_fi = %s AND question_fi = %s",
1806  array('integer','integer'),
1807  array($active_id, $question_id)
1808  );
1809  if ($result->numRows() === 1) {
1810  $row = $ilDB->fetchAssoc($result);
1811  return $row["maxpass"];
1812  }
1813 
1814  return null;
1815  }
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ _getSuggestedSolutionOutput()

static assQuestion::_getSuggestedSolutionOutput ( int  $question_id)
static

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

Referenced by ilTestScoringByQuestionsGUI\getAnswerDetail(), and ilObjTest\getTestResult().

510  : string
511  {
512  $question = self::instantiateQuestion($question_id);
513  if (!is_object($question)) {
514  return "";
515  }
516  return $question->getSuggestedSolutionOutput();
517  }
string $question
The question text.
+ Here is the caller graph for this function:

◆ _isWriteable()

static assQuestion::_isWriteable ( int  $question_id,
int  $user_id 
)
static

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

References $DIC, $ilDB, ilObjQuestionPool\_isWriteable(), calculateReachedPoints(), and ILIAS\Repository\int().

Referenced by ilAssQuestionFeedbackEditingGUI\isSyncAfterSaveRequired(), ilAssQuestionHintsGUI\performDeleteCmd(), assQuestionGUI\saveEdit(), ilAssQuestionHintGUI\saveFormCmd(), ilAssQuestionHintsGUI\saveListOrderCmd(), assQuestionGUI\saveQuestionToTest(), and assQuestionGUI\suggestedsolution().

1817  : bool
1818  {
1819  global $DIC;
1820  $ilDB = $DIC['ilDB'];
1821 
1822  if (($question_id < 1) || ($user_id < 1)) {
1823  return false;
1824  }
1825 
1826  $result = $ilDB->queryF(
1827  "SELECT obj_fi FROM qpl_questions WHERE question_id = %s",
1828  array('integer'),
1829  array($question_id)
1830  );
1831  if ($ilDB->numRows($result) == 1) {
1832  $row = $ilDB->fetchAssoc($result);
1833  $qpl_object_id = (int) $row["obj_fi"];
1834  return ilObjQuestionPool::_isWriteable($qpl_object_id, $user_id);
1835  }
1836 
1837  return false;
1838  }
static _isWriteable($object_id, $user_id)
Returns true, if the question pool is writeable by a given user.
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _needsManualScoring()

static assQuestion::_needsManualScoring ( int  $question_id)
static

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

References $DIC, and ilObjAssessmentFolder\_getManualScoringTypes().

Referenced by ilTestExpressPageObjectGUI\insertQuestions(), ilTestQuestionBrowserTableGUI\insertQuestionsCmd(), and ilObjTestGUI\insertQuestionsObject().

2175  : bool
2176  {
2177  global $DIC;
2178  $questioninfo = $DIC->testQuestionPool()->questionInfo();
2180  $questiontype = $questioninfo->getQuestionType($question_id);
2181  if (in_array($questiontype, $scoring)) {
2182  return true;
2183  }
2184 
2185  return false;
2186  }
static _getManualScoringTypes()
Retrieve the manual scoring settings as type strings.
global $DIC
Definition: feed.php:28
ILIAS TestQuestionPool QuestionInfoService $questioninfo
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _questionExistsInTest()

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

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

References $DIC, and $ilDB.

Referenced by assQuestionGUI\saveQuestionToTest().

2279  : bool
2280  {
2281  global $DIC;
2282  $ilDB = $DIC['ilDB'];
2283 
2284  if ($question_id < 1) {
2285  return false;
2286  }
2287 
2288  $result = $ilDB->queryF(
2289  "SELECT question_fi FROM tst_test_question WHERE question_fi = %s AND test_fi = %s",
2290  array('integer', 'integer'),
2291  array($question_id, $test_id)
2292  );
2293  return $ilDB->numRows($result) == 1;
2294  }
global $DIC
Definition: feed.php:28
int $test_id
The database id of a test in which the question is contained.
+ Here is the caller graph for this function:

◆ _setReachedPoints()

static assQuestion::_setReachedPoints ( int  $active_id,
int  $question_id,
float  $points,
float  $maxpoints,
int  $pass,
bool  $manualscoring,
bool  $obligationsEnabled,
?int  $test_id = null 
)
static

Sets the points, a learner has reached answering the question Additionally objective results are updated.

Parameters
integer$user_idThe database ID of the learner
integer$test_idThe database Id of the test containing the question
integer$pointsThe points the user has reached answering the question
Returns
boolean true on success, otherwise false public

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

References $DIC, Vendor\Package\$e, $ilDB, $points, ilObjAssessmentFolder\_enabledAssessmentLogging(), ilObjAssessmentFolder\_getLogLanguage(), ilObjTest\_getObjectIDFromTestID(), ilObjTestAccess\_getParticipantData(), _getSolutionMaxPass(), ilObjTest\_getUserIdFromActiveId(), ilObjTest\_lookupTestObjIdForQuestionId(), ilCourseObjectiveResult\_updateObjectiveResult(), ILIAS\Repository\int(), logAction(), and ilLanguage\txtlng().

Referenced by assFileUpload\handleSubmission(), ilTestScoringByQuestionsGUI\saveManScoringByQuestion(), and ilTestScoringGUI\saveManScoringParticipantScreen().

1945  : bool {
1946  global $DIC;
1947  $ilDB = $DIC['ilDB'];
1948  $refinery = $DIC['refinery'];
1949 
1950  $float_trafo = $refinery->kindlyTo()->float();
1951  try {
1952  $points = $float_trafo->transform($points);
1953  } catch (ILIAS\Refinery\ConstraintViolationException $e) {
1954  return false;
1955  }
1956 
1957  if ($points <= $maxpoints) {
1958  if ($pass === null) {
1959  $pass = assQuestion::_getSolutionMaxPass($question_id, $active_id);
1960  }
1961 
1962  $rowsnum = 0;
1963  $old_points = 0;
1964 
1965  if ($pass !== null) {
1966  $result = $ilDB->queryF(
1967  "SELECT points FROM tst_test_result WHERE active_fi = %s AND question_fi = %s AND pass = %s",
1968  array('integer','integer','integer'),
1969  array($active_id, $question_id, $pass)
1970  );
1971  $manual = ($manualscoring) ? 1 : 0;
1972  $rowsnum = $result->numRows();
1973  }
1974  if ($rowsnum > 0) {
1975  $row = $ilDB->fetchAssoc($result);
1976  $old_points = $row["points"];
1977  if ($old_points != $points) {
1978  $affectedRows = $ilDB->manipulateF(
1979  "UPDATE tst_test_result SET points = %s, manual = %s, tstamp = %s WHERE active_fi = %s AND question_fi = %s AND pass = %s",
1980  array('float', 'integer', 'integer', 'integer', 'integer', 'integer'),
1981  array($points, $manual, time(), $active_id, $question_id, $pass)
1982  );
1983  }
1984  } else {
1985  $next_id = $ilDB->nextId('tst_test_result');
1986  $affectedRows = $ilDB->manipulateF(
1987  "INSERT INTO tst_test_result (test_result_id, active_fi, question_fi, points, pass, manual, tstamp) VALUES (%s, %s, %s, %s, %s, %s, %s)",
1988  array('integer', 'integer','integer', 'float', 'integer', 'integer','integer'),
1989  array($next_id, $active_id, $question_id, $points, $pass, $manual, time())
1990  );
1991  }
1992 
1993  if (self::isForcePassResultUpdateEnabled() || $old_points != $points || $rowsnum == 0) {
1994  $test_id = $test_id ? (int) ilObjTest::_getObjectIDFromTestID($test_id) : ilObjTest::_lookupTestObjIdForQuestionId($question_id);
1995  if ($test_id === null || $test_id == 0) {
1996  return false;
1997  }
1998  $test = new ilObjTest(
1999  $test_id,
2000  false
2001  );
2002  $test->updateTestPassResults($active_id, $pass, $obligationsEnabled);
2005  global $DIC;
2006  $lng = $DIC['lng'];
2007  $ilUser = $DIC['ilUser'];
2008  $username = ilObjTestAccess::_getParticipantData($active_id);
2009  assQuestion::logAction(sprintf(
2010  $lng->txtlng(
2011  "assessment",
2012  "log_answer_changed_points",
2014  ),
2015  $username,
2016  $old_points,
2017  $points,
2018  $ilUser->getFullname() . " (" . $ilUser->getLogin() . ")"
2019  ), $active_id, $question_id);
2020  }
2021  }
2022 
2023  return true;
2024  }
2025 
2026  return false;
2027  }
static _getObjectIDFromTestID($test_id)
Returns the ILIAS test object id for a given test id.
static _getParticipantData($active_id)
Retrieves a participant name from active id.
txtlng(string $a_module, string $a_topic, string $a_language)
gets the text for a given topic in a given language if the topic is not in the list, the topic itself with "-" will be returned
Class ChatMainBarProvider .
float $points
The maximum available points for the question.
global $DIC
Definition: feed.php:28
static _getUserIdFromActiveId(int $active_id)
static logAction(string $logtext, int $active_id, int $question_id)
static _getSolutionMaxPass(int $question_id, int $active_id)
Returns the maximum pass a users question solution.
int $test_id
The database id of a test in which the question is contained.
static _updateObjectiveResult(int $a_user_id, int $a_active_id, int $a_question_id)
ILIAS Refinery Factory $refinery
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addAnswerOptionValue()

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

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

2943  : void
2944  {
2945  }

◆ adjustReachedPointsByScoringOptions()

assQuestion::adjustReachedPointsByScoringOptions (   $points,
  $active_id,
  $pass = null 
)
final

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

public

Parameters
integer$points
integer$active_id
integer$pass

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

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

Referenced by calculateResultsFromSolution(), and getAdjustedReachedPoints().

1895  : float
1896  {
1897  $count_system = ilObjTest::_getCountSystem($active_id);
1898  if ($count_system == 1) {
1899  if (abs($this->getMaximumPoints() - $points) > 0.0000000001) {
1900  $points = 0;
1901  }
1902  }
1903  $score_cutting = ilObjTest::_getScoreCutting($active_id);
1904  if ($score_cutting == 0) {
1905  if ($points < 0) {
1906  $points = 0;
1907  }
1908  }
1909  return $points;
1910  }
float $points
The maximum available points for the question.
static _getScoreCutting($active_id)
Determines if the score of a question should be cut at 0 points or the score of the whole test...
static _getCountSystem($active_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ afterSyncWithOriginal()

assQuestion::afterSyncWithOriginal ( int  $origQuestionId,
int  $dupQuestionId,
int  $origParentObjId,
int  $dupParentObjId 
)
protected

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

Referenced by syncWithOriginal().

1419  : void
1420  {
1421  $this->feedbackOBJ->syncFeedback($origQuestionId, $dupQuestionId);
1422  }
+ Here is the caller graph for this function:

◆ areObligationsToBeConsidered()

assQuestion::areObligationsToBeConsidered ( )

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

References $obligationsToBeConsidered.

Referenced by resetUsersAnswer().

3035  : bool
3036  {
3038  }
bool $obligationsToBeConsidered
+ Here is the caller graph for this function:

◆ authorizedOrIntermediateSolutionExists()

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

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

References lookupForExistingSolutions().

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

◆ authorizedSolutionExists()

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

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

References lookupForExistingSolutions().

2868  : bool
2869  {
2870  if ($pass === null) {
2871  return false;
2872  }
2873  $solutionAvailability = $this->lookupForExistingSolutions($active_id, $pass);
2874  return (bool) $solutionAvailability['authorized'];
2875  }
lookupForExistingSolutions(int $activeId, int $pass)
Lookup if an authorized or intermediate solution exists.
+ Here is the call graph for this function:

◆ beforeSyncWithOriginal()

assQuestion::beforeSyncWithOriginal ( int  $origQuestionId,
int  $dupQuestionId,
int  $origParentObjId,
int  $dupParentObjId 
)
protected

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

Referenced by syncWithOriginal().

1415  : void
1416  {
1417  }
+ Here is the caller graph for this function:

◆ buildHashedImageFilename()

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

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

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

1911  : string
1912  {
1913  $extension = "";
1914 
1915  if (preg_match("/.*\.(png|jpg|gif|jpeg)$/i", $plain_image_filename, $matches)) {
1916  $extension = "." . $matches[1];
1917  }
1918 
1919  if ($unique) {
1920  $plain_image_filename = uniqid($plain_image_filename . microtime(true), true);
1921  }
1922 
1923  return md5($plain_image_filename) . $extension;
1924  }
+ Here is the caller graph for this function:

◆ buildQuestionDataQuery()

assQuestion::buildQuestionDataQuery ( )
protected

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

Referenced by assKprimChoice\loadFromDb().

2534  : string
2535  {
2536  return "
2537  SELECT qpl_questions.*,
2538  {$this->getAdditionalTableName()}.*
2539  FROM qpl_questions
2540  LEFT JOIN {$this->getAdditionalTableName()}
2541  ON {$this->getAdditionalTableName()}.question_fi = qpl_questions.question_id
2542  WHERE qpl_questions.question_id = %s
2543  ";
2544  }
+ Here is the caller graph for this function:

◆ buildTestPresentationConfig()

assQuestion::buildTestPresentationConfig ( )
protected

build basic test question configuration instance

method can be overwritten to configure an instance use parent call for building when possible

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

Referenced by getTestPresentationConfig().

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

◆ calculateReachedPoints()

assQuestion::calculateReachedPoints (   $active_id,
  $pass = null,
  $authorizedSolution = true,
  $returndetails = false 
)
abstract

Returns the points, a learner has reached answering the question.

The points are calculated from the given answers.

public

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

Referenced by _isWriteable(), assNumeric\calculateReachedPointsFromPreviewSession(), calculateResultsFromSolution(), getAdjustedReachedPoints(), and assNumeric\getExpressionTypes().

+ Here is the caller graph for this function:

◆ calculateReachedPointsFromPreviewSession()

assQuestion::calculateReachedPointsFromPreviewSession ( ilAssQuestionPreviewSession  $previewSession)

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

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

Referenced by isPreviewSolutionCorrect().

1865  {
1866  $reachedPoints = $this->calculateReachedPointsForSolution($previewSession->getParticipantsSolution());
1867  $reachedPoints = $this->deductHintPointsFromReachedPoints($previewSession, $reachedPoints);
1868 
1869  return $this->ensureNonNegativePoints($reachedPoints);
1870  }
ensureNonNegativePoints($points)
deductHintPointsFromReachedPoints(ilAssQuestionPreviewSession $previewSession, $reachedPoints)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calculateResultsFromSolution()

assQuestion::calculateResultsFromSolution ( int  $active_id,
int  $pass,
bool  $obligationsEnabled = false 
)
final

Calculates the question results from a previously saved question solution.

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

References ilObjAssessmentFolder\_enabledAssessmentLogging(), ilObjAssessmentFolder\_getLogLanguage(), ilCourseObjectiveResult\_updateObjectiveResult(), adjustReachedPointsByScoringOptions(), calculateReachedPoints(), getId(), getObjId(), getProcessLocker(), getStep(), isAnswered(), ilObjTest\isQuestionObligatory(), ILIAS\Repository\lng(), logAction(), and lookupForExistingSolutions().

Referenced by persistWorkingState().

618  : void
619  {
620  // determine reached points for submitted solution
621  $reached_points = $this->calculateReachedPoints($active_id, $pass);
622  $questionHintTracking = new ilAssQuestionHintTracking($this->getId(), $active_id, $pass);
623  $requestsStatisticData = $questionHintTracking->getRequestStatisticDataByQuestionAndTestpass();
624  $reached_points = $reached_points - $requestsStatisticData->getRequestsPoints();
625 
626  // adjust reached points regarding to tests scoring options
627  $reached_points = $this->adjustReachedPointsByScoringOptions($reached_points, $active_id, $pass);
628 
629  if ($obligationsEnabled && ilObjTest::isQuestionObligatory($this->getId())) {
630  $isAnswered = $this->isAnswered($active_id, $pass);
631  } else {
632  $isAnswered = true;
633  }
634 
635  if (is_null($reached_points)) {
636  $reached_points = 0.0;
637  }
638 
639  // fau: testNav - check for existing authorized solution to know if a result record should be written
640  $existingSolutions = $this->lookupForExistingSolutions($active_id, $pass);
641 
642  $this->getProcessLocker()->executeUserQuestionResultUpdateOperation(
643  function () use ($active_id, $pass, $reached_points, $requestsStatisticData, $isAnswered, $existingSolutions) {
644  $query = "
645  DELETE FROM tst_test_result
646 
647  WHERE active_fi = %s
648  AND question_fi = %s
649  AND pass = %s
650  ";
651 
652  $types = ['integer', 'integer', 'integer'];
653  $values = [$active_id, $this->getId(), $pass];
654 
655  if ($this->getStep() !== null) {
656  $query .= "
657  AND step = %s
658  ";
659 
660  $types[] = 'integer';
661  $values[] = $this->getStep();
662  }
663  $this->db->manipulateF($query, $types, $values);
664 
665  if ($existingSolutions['authorized']) {
666  $next_id = $this->db->nextId("tst_test_result");
667  $fieldData = array(
668  'test_result_id' => array('integer', $next_id),
669  'active_fi' => array('integer', $active_id),
670  'question_fi' => array('integer', $this->getId()),
671  'pass' => array('integer', $pass),
672  'points' => array('float', $reached_points),
673  'tstamp' => array('integer', time()),
674  'hint_count' => array('integer', $requestsStatisticData->getRequestsCount()),
675  'hint_points' => array('float', $requestsStatisticData->getRequestsPoints()),
676  'answered' => array('integer', $isAnswered)
677  );
678 
679  if ($this->getStep() !== null) {
680  $fieldData['step'] = array('integer', $this->getStep());
681  }
682 
683  $this->db->insert('tst_test_result', $fieldData);
684  }
685  }
686  );
687 
690  sprintf(
691  $this->lng->txtlng(
692  "assessment",
693  "log_user_answered_question",
695  ),
696  $reached_points
697  ),
698  $active_id,
699  $this->getId()
700  );
701  }
702 
703  // update test pass results
704  $test = new ilObjTest(
705  $this->getObjId(),
706  false
707  );
708  $test->updateTestPassResults($active_id, $pass, $obligationsEnabled, $this->getProcessLocker());
709  ilCourseObjectiveResult::_updateObjectiveResult($this->current_user->getId(), $active_id, $this->getId());
710  }
adjustReachedPointsByScoringOptions($points, $active_id, $pass=null)
Adjust the given reached points by checks for all special scoring options in the test container...
calculateReachedPoints($active_id, $pass=null, $authorizedSolution=true, $returndetails=false)
Returns the points, a learner has reached answering the question.
static isQuestionObligatory($question_id)
checks wether the question with given id is marked as obligatory or not
lookupForExistingSolutions(int $activeId, int $pass)
Lookup if an authorized or intermediate solution exists.
static logAction(string $logtext, int $active_id, int $question_id)
isAnswered(int $active_id, int $pass)
static _updateObjectiveResult(int $a_user_id, int $a_active_id, int $a_question_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cleanupMediaObjectUsage()

assQuestion::cleanupMediaObjectUsage ( )

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

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

Referenced by saveToDb().

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

◆ convertISO8601FormatH_i_s_ExtendedToSeconds()

static assQuestion::convertISO8601FormatH_i_s_ExtendedToSeconds ( string  $time)
static

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

References ILIAS\Repository\int().

2842  : int
2843  {
2844  $sec = 0;
2845  $time_array = explode(':', $time);
2846  if (count($time_array) == 3) {
2847  $sec += (int) $time_array[0] * 3600;
2848  $sec += (int) $time_array[1] * 60;
2849  $sec += (int) $time_array[2];
2850  }
2851  return $sec;
2852  }
+ Here is the call graph for this function:

◆ copyPageOfQuestion()

assQuestion::copyPageOfQuestion ( int  $a_q_id)

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

References $page.

1157  : void
1158  {
1159  if ($a_q_id > 0) {
1160  $page = new ilAssQuestionPage($a_q_id);
1161  $page->buildDom();
1162  ilPCPlugged::handleCopiedPluggedContent($page, $page->getDomDoc());
1163  $xml = str_replace("il__qst_" . $a_q_id, "il__qst_" . $this->id, $page->getXMLFromDom());
1164  $this->page->setXMLContent($xml);
1165  $this->page->updateFromXML();
1166  }
1167  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ copySuggestedSolutionFiles()

assQuestion::copySuggestedSolutionFiles ( int  $source_questionpool_id,
int  $source_question_id 
)
protected

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

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

Referenced by onCopy().

1581  : void
1582  {
1583  foreach ($this->suggested_solutions as $index => $solution) {
1584  if ($solution->isOfTypeFile()) {
1585  $filepath = $this->getSuggestedSolutionPath();
1586  $filepath_original = str_replace("/$this->obj_id/$this->id/solution", "/$source_questionpool_id/$source_question_id/solution", $filepath);
1587  if (!file_exists($filepath)) {
1588  ilFileUtils::makeDirParents($filepath);
1589  }
1590  $filename = $solution->getFilename();
1591  if ($filename !== '') {
1592  if (!copy($filepath_original . $filename, $filepath . $filename)) {
1593  $this->ilLog->root()->error("File could not be copied!!!!");
1594  $this->ilLog->root()->error("object: " . print_r($this, true));
1595  }
1596  }
1597  }
1598  }
1599  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: class.ilLog.php:30
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
$filename
Definition: buildRTE.php:78
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copySuggestedSolutions()

assQuestion::copySuggestedSolutions ( int  $target_question_id)
protected

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

References getSuggestedSolutions(), and getSuggestedSolutionsRepo().

Referenced by onCopy(), and onDuplicate().

1601  : void
1602  {
1603  $update = [];
1604  foreach ($this->getSuggestedSolutions() as $index => $solution) {
1605  $solution = $solution->withQuestionId($target_question_id);
1606  $update[] = $solution;
1607  }
1608  $this->getSuggestedSolutionsRepo()->update($update);
1609  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copyXHTMLMediaObjectsOfQuestion()

assQuestion::copyXHTMLMediaObjectsOfQuestion ( int  $a_q_id)

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

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

1129  : void
1130  {
1131  $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $a_q_id);
1132  foreach ($mobs as $mob) {
1133  ilObjMediaObject::_saveUsage($mob, "qpl:html", $this->getId());
1134  }
1135  }
static _saveUsage(int $a_mob_id, string $a_type, int $a_id, int $a_usage_hist_nr=0, string $a_lang="-")
Save usage of mob within another container (e.g.
static _getMobsOfObject(string $a_type, int $a_id, int $a_usage_hist_nr=0, string $a_lang="-")
+ Here is the call graph for this function:

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

References $current_user, ilObject\_lookupObjId(), createPageObject(), getAdditionalContentEditingMode(), getAuthor(), getDefaultNrOfTries(), getExternalId(), getId(), getObjId(), getQuestionTypeID(), and setId().

1265  : int
1266  {
1267  $ilUser = $this->current_user;
1268 
1269  $complete = "0";
1270  $obj_id = ($this->getObjId() <= 0) ? (ilObject::_lookupObjId((strlen($this->dic->testQuestionPool()->internal()->request()->getRefId())) ? $this->dic->testQuestionPool()->internal()->request()->getRefId() : $_POST["sel_qpl"])) : $this->getObjId();
1271  if ($obj_id > 0) {
1272  if ($a_create_page) {
1273  $tstamp = 0;
1274  } else {
1275  // question pool must not try to purge
1276  $tstamp = time();
1277  }
1278 
1279  $next_id = $this->db->nextId('qpl_questions');
1280  $this->db->insert("qpl_questions", array(
1281  "question_id" => array("integer", $next_id),
1282  "question_type_fi" => array("integer", $this->getQuestionTypeID()),
1283  "obj_fi" => array("integer", $obj_id),
1284  "title" => array("text", null),
1285  "description" => array("text", null),
1286  "author" => array("text", $this->getAuthor()),
1287  "owner" => array("integer", $ilUser->getId()),
1288  "question_text" => array("clob", null),
1289  "points" => array("float", "0.0"),
1290  "nr_of_tries" => array("integer", $this->getDefaultNrOfTries()), // #10771
1291  "complete" => array("text", $complete),
1292  "created" => array("integer", time()),
1293  "original_id" => array("integer", null),
1294  "tstamp" => array("integer", $tstamp),
1295  "external_id" => array("text", $this->getExternalId()),
1296  'add_cont_edit_mode' => array('text', $this->getAdditionalContentEditingMode())
1297  ));
1298  $this->setId($next_id);
1299 
1300  if ($a_create_page) {
1301  // create page object of question
1302  $this->createPageObject();
1303  }
1304  }
1305 
1306  return $this->getId();
1307  }
int $obj_id
Object id of the container object.
static _lookupObjId(int $ref_id)
setId(int $id=-1)
ilObjUser $current_user
+ Here is the call graph for this function:

◆ createPageObject()

assQuestion::createPageObject ( )

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

References getId(), and getObjId().

Referenced by createNewQuestion(), and saveQuestionDataToDb().

1145  : void
1146  {
1147  $qpl_id = $this->getObjId();
1148  $this->page = new ilAssQuestionPage(0);
1149  $this->page->setId($this->getId());
1150  $this->page->setParentId($qpl_id);
1151  $this->page->setXMLContent("<PageObject><PageContent>" .
1152  "<Question QRef=\"il__qst_" . $this->getId() . "\"/>" .
1153  "</PageContent></PageObject>");
1154  $this->page->create(false);
1155  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deductHintPointsFromReachedPoints()

assQuestion::deductHintPointsFromReachedPoints ( ilAssQuestionPreviewSession  $previewSession,
  $reachedPoints 
)

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

References $DIC, and ilAssQuestionPreviewHintTracking\getRequestStatisticData().

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

1853  : ?float
1854  {
1855  global $DIC;
1856 
1857  $hintTracking = new ilAssQuestionPreviewHintTracking($DIC->database(), $previewSession);
1858  $requestsStatisticData = $hintTracking->getRequestStatisticData();
1859  $reachedPoints = $reachedPoints - $requestsStatisticData->getRequestsPoints();
1860 
1861  return $reachedPoints;
1862  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

assQuestion::delete ( int  $question_id)

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

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

967  : void
968  {
969  if ($question_id < 1) {
970  return;
971  }
972 
973  $result = $this->db->queryF(
974  "SELECT obj_fi FROM qpl_questions WHERE question_id = %s",
975  array('integer'),
976  array($question_id)
977  );
978  if ($this->db->numRows($result) == 1) {
979  $row = $this->db->fetchAssoc($result);
980  $obj_id = $row["obj_fi"];
981  } else {
982  return; // nothing to do
983  }
984  try {
985  $this->deletePageOfQuestion($question_id);
986  } catch (Exception $e) {
987  $this->ilLog->root()->error("EXCEPTION: Could not delete page of question $question_id: $e");
988  return;
989  }
990 
991  $affectedRows = $this->db->manipulateF(
992  "DELETE FROM qpl_questions WHERE question_id = %s",
993  array('integer'),
994  array($question_id)
995  );
996  if ($affectedRows == 0) {
997  return;
998  }
999 
1000  try {
1001  $this->deleteAdditionalTableData($question_id);
1002  $this->deleteAnswers($question_id);
1003  $this->feedbackOBJ->deleteGenericFeedbacks($question_id, $this->isAdditionalContentEditingModePageObject());
1004  $this->feedbackOBJ->deleteSpecificAnswerFeedbacks($question_id, $this->isAdditionalContentEditingModePageObject());
1005  } catch (Exception $e) {
1006  $this->ilLog->root()->error("EXCEPTION: Could not delete additional table data of question $question_id: $e");
1007  }
1008 
1009  try {
1010  // delete the question in the tst_test_question table (list of test questions)
1011  $affectedRows = $this->db->manipulateF(
1012  "DELETE FROM tst_test_question WHERE question_fi = %s",
1013  array('integer'),
1014  array($question_id)
1015  );
1016  } catch (Exception $e) {
1017  $this->ilLog->root()->error("EXCEPTION: Could not delete delete question $question_id from a test: $e");
1018  }
1019 
1020  try {
1021  $this->getSuggestedSolutionsRepo()->deleteForQuestion($question_id);
1022  } catch (Exception $e) {
1023  $this->ilLog->root()->error("EXCEPTION: Could not delete suggested solutions of question $question_id: $e");
1024  }
1025 
1026  try {
1027  $directory = CLIENT_WEB_DIR . "/assessment/" . $obj_id . "/$question_id";
1028  if (preg_match("/\d+/", $obj_id) and preg_match("/\d+/", $question_id) and is_dir($directory)) {
1029  ilFileUtils::delDir($directory);
1030  }
1031  } catch (Exception $e) {
1032  $this->ilLog->root()->error("EXCEPTION: Could not delete question file directory $directory of question $question_id: $e");
1033  }
1034 
1035  try {
1036  $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $question_id);
1037  // remaining usages are not in text anymore -> delete them
1038  // and media objects (note: delete method of ilObjMediaObject
1039  // checks whether object is used in another context; if yes,
1040  // the object is not deleted!)
1041  foreach ($mobs as $mob) {
1042  ilObjMediaObject::_removeUsage($mob, "qpl:html", $question_id);
1043  if (ilObjMediaObject::_exists($mob)) {
1044  $mob_obj = new ilObjMediaObject($mob);
1045  $mob_obj->delete();
1046  }
1047  }
1048  } catch (Exception $e) {
1049  $this->ilLog->root()->error("EXCEPTION: Error deleting the media objects of question $question_id: $e");
1050  }
1051  ilAssQuestionHintTracking::deleteRequestsByQuestionIds(array($question_id));
1053  $assignmentList = new ilAssQuestionSkillAssignmentList($this->db);
1054  $assignmentList->setParentObjId($obj_id);
1055  $assignmentList->setQuestionIdFilter($question_id);
1056  $assignmentList->loadFromDb();
1057  foreach ($assignmentList->getAssignmentsByQuestionId($question_id) as $assignment) {
1058  /* @var ilAssQuestionSkillAssignment $assignment */
1059  $assignment->deleteFromDb();
1060 
1061  // remove skill usage
1062  if (!$assignment->isSkillUsed()) {
1063  $this->skillUsageService->removeUsage(
1064  $assignment->getParentObjId(),
1065  $assignment->getSkillBaseId(),
1066  $assignment->getSkillTrefId()
1067  );
1068  }
1069  }
1070 
1071  $this->deleteTaxonomyAssignments();
1072  $this->deleteComments();
1073 
1074  try {
1076  } catch (Exception $e) {
1077  $this->ilLog->root()->error("EXCEPTION: Error updating the question pool question count of question pool " . $this->getObjId() . " when deleting question $question_id: $e");
1078  }
1079  }
deletePageOfQuestion(int $question_id)
deleteAdditionalTableData(int $question_id)
deleteAnswers(int $question_id)
static deleteHintsByQuestionIds(array $questionIds)
Deletes all question hints relating to questions included in given question ids.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: class.ilLog.php:30
int $obj_id
Object id of the container object.
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
const CLIENT_WEB_DIR
Definition: constants.php:47
static _exists(int $id, bool $reference=false, ?string $type=null)
static _getMobsOfObject(string $a_type, int $a_id, int $a_usage_hist_nr=0, string $a_lang="-")
static _removeUsage(int $a_mob_id, string $a_type, int $a_id, int $a_usage_hist_nr=0, string $a_lang="-")
Remove usage of mob in another container.
static _updateQuestionCount(int $object_id)
isAdditionalContentEditingModePageObject()
+ Here is the call graph for this function:

◆ deleteAdditionalTableData()

assQuestion::deleteAdditionalTableData ( int  $question_id)

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

References getAdditionalTableName().

Referenced by delete().

940  : void
941  {
942  $additional_table_name = $this->getAdditionalTableName();
943 
944  if (!is_array($additional_table_name)) {
945  $additional_table_name = array($additional_table_name);
946  }
947 
948  foreach ($additional_table_name as $table) {
949  if (strlen($table)) {
950  $this->db->manipulateF(
951  "DELETE FROM $table WHERE question_fi = %s",
952  array('integer'),
953  array($question_id)
954  );
955  }
956  }
957  }
getAdditionalTableName()
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteAnswers()

assQuestion::deleteAnswers ( int  $question_id)

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

References getAnswerTableName().

Referenced by delete().

921  : void
922  {
923  $answer_table_name = $this->getAnswerTableName();
924 
925  if (!is_array($answer_table_name)) {
926  $answer_table_name = array($answer_table_name);
927  }
928 
929  foreach ($answer_table_name as $table) {
930  if (strlen($table)) {
931  $this->db->manipulateF(
932  "DELETE FROM $table WHERE question_fi = %s",
933  array('integer'),
934  array($question_id)
935  );
936  }
937  }
938  }
getAnswerTableName()
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteComments()

assQuestion::deleteComments ( )
protected

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

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

Referenced by delete().

1468  : void
1469  {
1470  $repo = $this->getNotesRepo();
1471  $manager = $this->getNotesManager();
1472  $source_id = $this->getId();
1473  $notes = $manager->getNotesForRepositoryObjIds([$this->getObjId()], Note::PUBLIC);
1474  $notes = array_filter(
1475  $notes,
1476  fn($n) => $n->getContext()->getSubObjId() === $source_id
1477  );
1478  foreach ($notes as $note) {
1479  $repo->deleteNote($note->getId());
1480  }
1481  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteDummySolutionRecord()

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

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

References getSolutionValues(), and removeSolutionRecordById().

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

2744  : void
2745  {
2746  foreach ($this->getSolutionValues($activeId, $passIndex, false) as $solutionRec) {
2747  if ($solutionRec['value1'] == '' && $solutionRec['value2'] == '') {
2748  $this->removeSolutionRecordById($solutionRec['solution_id']);
2749  }
2750  }
2751  }
getSolutionValues($active_id, $pass=null, bool $authorized=true)
Loads solutions of a given user from the database an returns it.
removeSolutionRecordById(int $solutionId)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deletePageOfQuestion()

assQuestion::deletePageOfQuestion ( int  $question_id)
protected

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

References $page, and ilPageObject\_exists().

Referenced by delete().

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

◆ deleteSolutionRecordByValues()

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

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

References getId(), and getStep().

Referenced by assImagemapQuestion\saveWorkingData().

2758  : void
2759  {
2760  $types = array("integer", "integer", "integer", "integer");
2761  $values = array($activeId, $this->getId(), $passIndex, (int) $authorized);
2762  $valuesCondition = [];
2763 
2764  foreach ($matchValues as $valueField => $value) {
2765  switch ($valueField) {
2766  case 'value1':
2767  case 'value2':
2768  $valuesCondition[] = "{$valueField} = %s";
2769  $types[] = 'text';
2770  $values[] = $value;
2771  break;
2772 
2773  default:
2774  throw new ilTestQuestionPoolException('invalid value field given: ' . $valueField);
2775  }
2776  }
2777 
2778  $valuesCondition = implode(' AND ', $valuesCondition);
2779 
2780  $query = "
2781  DELETE FROM tst_solutions
2782  WHERE active_fi = %s
2783  AND question_fi = %s
2784  AND pass = %s
2785  AND authorized = %s
2786  AND $valuesCondition
2787  ";
2788 
2789  if ($this->getStep() !== null) {
2790  $query .= " AND step = %s ";
2791  $types[] = 'integer';
2792  $values[] = $this->getStep();
2793  }
2794 
2795  $this->db->manipulateF($query, $types, $values);
2796  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteSuggestedSolutions()

assQuestion::deleteSuggestedSolutions ( )

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

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

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

◆ deleteTaxonomyAssignments()

assQuestion::deleteTaxonomyAssignments ( )
private

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

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

Referenced by delete().

1081  : void
1082  {
1083  $taxIds = ilObjTaxonomy::getUsageOfObject($this->getObjId());
1084 
1085  foreach ($taxIds as $taxId) {
1086  $taxNodeAssignment = new ilTaxNodeAssignment('qpl', $this->getObjId(), 'quest', $taxId);
1087  $taxNodeAssignment->deleteAssignmentsOfItem($this->getId());
1088  }
1089  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getUsageOfObject(int $a_obj_id, bool $a_include_titles=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ duplicate()

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

Referenced by toJSON().

+ Here is the caller graph for this function:

◆ duplicateComments()

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

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

References getNotesDataService(), and getNotesManager().

Referenced by onCopy(), and onDuplicate().

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

◆ duplicateIntermediateSolutionAuthorized()

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

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

References getSolutionValues(), and saveCurrentSolution().

Referenced by forceExistingIntermediateSolution().

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

◆ duplicateQuestionHints()

assQuestion::duplicateQuestionHints ( int  $originalQuestionId,
int  $duplicateQuestionId 
)
protected

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

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

Referenced by onCopy(), and onDuplicate().

2372  : void
2373  {
2374  $hintIds = ilAssQuestionHintList::duplicateListForQuestion($originalQuestionId, $duplicateQuestionId);
2375 
2377  foreach ($hintIds as $originalHintId => $duplicateHintId) {
2378  $this->ensureHintPageObjectExists($originalHintId);
2379  $originalPageObject = new ilAssHintPage($originalHintId);
2380  $originalXML = $originalPageObject->getXMLContent();
2381 
2382  $duplicatePageObject = new ilAssHintPage();
2383  $duplicatePageObject->setId($duplicateHintId);
2384  $duplicatePageObject->setParentId($this->getId());
2385  $duplicatePageObject->setXMLContent($originalXML);
2386  $duplicatePageObject->createFromXML();
2387  }
2388  }
2389  }
ensureHintPageObjectExists($pageObjectId)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static duplicateListForQuestion($originalQuestionId, $duplicateQuestionId)
duplicates a hint list from given original question id to given duplicate question id and returns an ...
isAdditionalContentEditingModePageObject()
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ duplicateSkillAssignments()

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

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

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

2391  : void
2392  {
2393  $assignmentList = new ilAssQuestionSkillAssignmentList($this->db);
2394  $assignmentList->setParentObjId($srcParentId);
2395  $assignmentList->setQuestionIdFilter($srcQuestionId);
2396  $assignmentList->loadFromDb();
2397 
2398  foreach ($assignmentList->getAssignmentsByQuestionId($srcQuestionId) as $assignment) {
2399  $assignment->setParentObjId($trgParentId);
2400  $assignment->setQuestionId($trgQuestionId);
2401  $assignment->saveToDb();
2402 
2403  // add skill usage
2404  $this->skillUsageService->addUsage(
2405  $trgParentId,
2406  $assignment->getSkillBaseId(),
2407  $assignment->getSkillTrefId()
2408  );
2409  }
2410  }
+ Here is the caller graph for this function:

◆ duplicateSuggestedSolutionFiles()

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

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

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

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

Referenced by onDuplicate().

1529  : void
1530  {
1531  foreach ($this->suggested_solutions as $index => $solution) {
1532  if (!$solution->isOfTypeFile()) {
1533  continue;
1534  }
1535 
1536  $filepath = $this->getSuggestedSolutionPath();
1537  $filepath_original = str_replace(
1538  "/{$this->obj_id}/{$this->id}/solution",
1539  "/$parent_id/$question_id/solution",
1540  $filepath
1541  );
1542  if (!file_exists($filepath)) {
1543  ilFileUtils::makeDirParents($filepath);
1544  }
1545  $filename = $solution->getFilename();
1546  if (strlen($filename) &&
1547  !copy($filepath_original . $filename, $filepath . $filename)) {
1548  $this->ilLog->root()->error("File could not be duplicated!!!!");
1549  $this->ilLog->root()->error("object: " . print_r($this, true));
1550  }
1551  }
1552  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: class.ilLog.php:30
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
$filename
Definition: buildRTE.php:78
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ensureHintPageObjectExists()

assQuestion::ensureHintPageObjectExists (   $pageObjectId)

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

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

Referenced by duplicateQuestionHints().

2435  : void
2436  {
2437  if (!ilAssHintPage::_exists('qht', $pageObjectId)) {
2438  $pageObject = new ilAssHintPage();
2439  $pageObject->setParentId($this->getId());
2440  $pageObject->setId($pageObjectId);
2441  $pageObject->createFromXML();
2442  }
2443  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ensureNonNegativePoints()

◆ explodeKeyValues()

static assQuestion::explodeKeyValues ( string  $keyValues)
static

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

References KEY_VALUES_IMPLOSION_SEPARATOR.

Referenced by assImagemapQuestion\getReuseSolutionSelectionParameter().

2739  : array
2740  {
2741  return explode(assQuestion::KEY_VALUES_IMPLOSION_SEPARATOR, $keyValues);
2742  }
const KEY_VALUES_IMPLOSION_SEPARATOR
+ Here is the caller graph for this function:

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

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

3112  : string
3113  {
3114  return preg_replace(self::TRIM_PATTERN, '', $value);
3115  }
+ Here is the caller graph for this function:

◆ fetchIndexedValuesFromValuePairs()

assQuestion::fetchIndexedValuesFromValuePairs ( array  $valuePairs)

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

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

3024  : array
3025  {
3026  $indexedValues = [];
3027 
3028  foreach ($valuePairs as $valuePair) {
3029  $indexedValues[ $valuePair['value1'] ] = $valuePair['value2'];
3030  }
3031 
3032  return $indexedValues;
3033  }
+ Here is the caller graph for this function:

◆ fetchValuePairsFromIndexedValues()

assQuestion::fetchValuePairsFromIndexedValues ( array  $indexedValues)

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

3013  : array
3014  {
3015  $valuePairs = [];
3016 
3017  foreach ($indexedValues as $value1 => $value2) {
3018  $valuePairs[] = array('value1' => $value1, 'value2' => $value2);
3019  }
3020 
3021  return $valuePairs;
3022  }

◆ fixSvgToPng()

assQuestion::fixSvgToPng ( string  $imageFilenameContainingString)

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

1194  : string
1195  {
1196  $needles = array_keys(self::$imageSourceFixReplaceMap);
1197  $replacements = array_values(self::$imageSourceFixReplaceMap);
1198  return str_replace($needles, $replacements, $imageFilenameContainingString);
1199  }

◆ fixUnavailableSkinImageSources()

assQuestion::fixUnavailableSkinImageSources ( string  $html)

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

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

1201  : string
1202  {
1203  $matches = null;
1204  if (preg_match_all('/src="(.*?)"/m', $html, $matches)) {
1205  $sources = $matches[1];
1206 
1207  $needleReplacementMap = [];
1208 
1209  foreach ($sources as $src) {
1210  $file = ilFileUtils::removeTrailingPathSeparators(ILIAS_ABSOLUTE_PATH) . DIRECTORY_SEPARATOR . $src;
1211 
1212  if (file_exists($file)) {
1213  continue;
1214  }
1215 
1216  $levels = explode(DIRECTORY_SEPARATOR, $src);
1217  if (count($levels) < 5 || $levels[0] !== 'Customizing' || $levels[2] !== 'skin') {
1218  continue;
1219  }
1220 
1221  $component = '';
1222 
1223  if ($levels[4] === 'Modules' || $levels[4] === 'Services') {
1224  $component = $levels[4] . DIRECTORY_SEPARATOR . $levels[5];
1225  }
1226 
1227  $needleReplacementMap[$src] = ilUtil::getImagePath(basename($src), $component);
1228  }
1229 
1230  if (count($needleReplacementMap)) {
1231  $html = str_replace(array_keys($needleReplacementMap), array_values($needleReplacementMap), $html);
1232  }
1233  }
1234 
1235  return $html;
1236  }
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static removeTrailingPathSeparators(string $path)
+ Here is the call graph for this function:

◆ forceExistingIntermediateSolution()

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

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

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

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

2805  : void
2806  {
2807  $intermediateSolution = $this->getSolutionValues($activeId, $passIndex, false);
2808 
2809  if (!count($intermediateSolution)) {
2810  // make the authorized solution intermediate (keeping timestamps)
2811  // this keeps the solution_ids in synch with eventually selected in $_POST['deletefiles']
2812  $this->updateCurrentSolutionsAuthorization($activeId, $passIndex, false, true);
2813 
2814  // create a backup as authorized solution again (keeping timestamps)
2815  $this->duplicateIntermediateSolutionAuthorized($activeId, $passIndex);
2816 
2817  if ($considerDummyRecordCreation) {
2818  // create an additional dummy record to indicate the existence of an intermediate solution
2819  // even if all entries are deleted from the intermediate solution later
2820  $this->saveCurrentSolution($activeId, $passIndex, null, null, false);
2821  }
2822  }
2823  }
getSolutionValues($active_id, $pass=null, bool $authorized=true)
Loads solutions of a given user from the database an returns it.
updateCurrentSolutionsAuthorization(int $activeId, int $pass, bool $authorized, bool $keepTime=false)
saveCurrentSolution(int $active_id, int $pass, $value1, $value2, bool $authorized=true, $tstamp=0)
duplicateIntermediateSolutionAuthorized(int $activeId, int $passIndex)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ formatSAQuestion()

assQuestion::formatSAQuestion (   $a_q)

◆ fromXML()

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

Receives parameters from a QTI parser and creates a valid ILIAS question object.

Parameters
object$itemThe QTI item object
integer$questionpool_idThe id of the parent questionpool
integer$tst_idThe id of the parent test if the question is part of a test
object$tst_objectA reference to the parent test object
integer$question_counterA reference to a question counter to count the questions of an imported question pool
array$import_mappingAn array containing references to included ILIAS objects

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

References getQuestionType(), and importHint().

301  : array
302  {
303  $classname = $this->getQuestionType() . "Import";
304  $import = new $classname($this);
305  $import_mapping = $import->fromXML($item, $questionpool_id, $tst_id, $tst_object, $question_counter, $import_mapping);
306 
307  foreach ($solutionhints as $hint) {
308  $this->importHint($import->getQuestionId(), $hint);
309  }
310  return $import_mapping;
311  }
getQuestionType()
Returns the question type of the question.
importHint(int $question_id, array $hint_array)
+ Here is the call graph for this function:

◆ getActiveUserData()

assQuestion::getActiveUserData ( int  $active_id)

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

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

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

2194  : array
2195  {
2196  $result = $this->db->queryF(
2197  "SELECT * FROM tst_active WHERE active_id = %s",
2198  array('integer'),
2199  array($active_id)
2200  );
2201  if ($this->db->numRows($result)) {
2202  $row = $this->db->fetchAssoc($result);
2203  return array("user_id" => $row["user_fi"], "test_id" => $row["test_fi"]);
2204  }
2205 
2206  return [];
2207  }

◆ getAdditionalContentEditingMode()

assQuestion::getAdditionalContentEditingMode ( )

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

References $additionalContentEditingMode.

Referenced by createNewQuestion(), importHint(), isAdditionalContentEditingModePageObject(), assMultipleChoice\isForcedEmptySolution(), assSingleChoice\savePreviewData(), and saveQuestionDataToDb().

2482  : string
2483  {
2485  }
string $additionalContentEditingMode
+ Here is the caller graph for this function:

◆ getAdditionalTableName()

assQuestion::getAdditionalTableName ( )
abstract
Returns
string|array Or Array?
See also
Deletion methods here

Referenced by deleteAdditionalTableData(), and getSolutionValues().

+ Here is the caller graph for this function:

◆ getAdjustedReachedPoints()

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

returns the reached points ...

  • calculated by concrete question type class
  • adjusted by hint point deduction
  • adjusted by scoring options ... for given testactive and testpass

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

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

601  : float
602  {
603  // determine reached points for submitted solution
604  $reached_points = $this->calculateReachedPoints($active_id, $pass, $authorizedSolution);
605  $hintTracking = new ilAssQuestionHintTracking($this->getId(), $active_id, $pass);
606  $requestsStatisticData = $hintTracking->getRequestStatisticDataByQuestionAndTestpass();
607  $reached_points = $reached_points - $requestsStatisticData->getRequestsPoints();
608 
609  // adjust reached points regarding to tests scoring options
610  $reached_points = $this->adjustReachedPointsByScoringOptions($reached_points, $active_id, $pass);
611 
612  return $reached_points;
613  }
adjustReachedPointsByScoringOptions($points, $active_id, $pass=null)
Adjust the given reached points by checks for all special scoring options in the test container...
calculateReachedPoints($active_id, $pass=null, $authorizedSolution=true, $returndetails=false)
Returns the points, a learner has reached answering the question.
+ Here is the call graph for this function:

◆ getAnswerTableName()

assQuestion::getAnswerTableName ( )
abstract
Returns
string|array Or Array?
See also
Deletion methods here

Referenced by deleteAnswers(), and getSolutionValues().

+ Here is the caller graph for this function:

◆ getAuthor()

assQuestion::getAuthor ( )

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

References $author.

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

459  : string
460  {
461  return $this->author;
462  }
+ Here is the caller graph for this function:

◆ getAuthorForHTMLOutput()

assQuestion::getAuthorForHTMLOutput ( )

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

References ILIAS\Repository\refinery().

464  : string
465  {
466  return $this->refinery->string()->stripTags()->transform($this->author);
467  }
+ Here is the call graph for this function:

◆ getComment()

assQuestion::getComment ( )

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

References $comment.

Referenced by saveQuestionDataToDb().

425  : string
426  {
427  return $this->comment;
428  }
+ Here is the caller graph for this function:

◆ getCurrentSolutionResultSet()

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

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

References getId(), and getStep().

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

2556  : \ilDBStatement
2557  {
2558  if ($this->getStep() !== null) {
2559  $query = "
2560  SELECT *
2561  FROM tst_solutions
2562  WHERE active_fi = %s
2563  AND question_fi = %s
2564  AND pass = %s
2565  AND step = %s
2566  AND authorized = %s
2567  ";
2568 
2569  return $this->db->queryF(
2570  $query,
2571  array('integer', 'integer', 'integer', 'integer', 'integer'),
2572  array($active_id, $this->getId(), $pass, $this->getStep(), (int) $authorized)
2573  );
2574  }
2575 
2576  $query = "
2577  SELECT *
2578  FROM tst_solutions
2579  WHERE active_fi = %s
2580  AND question_fi = %s
2581  AND pass = %s
2582  AND authorized = %s
2583  ";
2584 
2585  return $this->db->queryF(
2586  $query,
2587  array('integer', 'integer', 'integer', 'integer'),
2588  array($active_id, $this->getId(), $pass, (int) $authorized)
2589  );
2590  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDefaultNrOfTries()

assQuestion::getDefaultNrOfTries ( )

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

References $defaultnroftries.

Referenced by createNewQuestion().

2352  : int
2353  {
2354  return $this->defaultnroftries;
2355  }
+ Here is the caller graph for this function:

◆ getDescriptionForHTMLOutput()

assQuestion::getDescriptionForHTMLOutput ( )

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

References ILIAS\UI\examples\Symbol\Glyph\Comment\comment().

430  : string
431  {
432  return htmlspecialchars($this->comment);
433  }
+ Here is the call graph for this function:

◆ getExternalId()

assQuestion::getExternalId ( )

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

References $external_id, getId(), and IL_INST_ID.

Referenced by createNewQuestion(), and saveQuestionDataToDb().

499  : string
500  {
501  if ($this->external_id === null || $this->external_id === '') {
502  if ($this->getId() > 0) {
503  return 'il_' . IL_INST_ID . '_qst_' . $this->getId();
504  }
505  return uniqid('', true);
506  }
507  return $this->external_id;
508  }
const IL_INST_ID
Definition: constants.php:40
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFeedbackClassNameByQuestionType()

static assQuestion::getFeedbackClassNameByQuestionType ( string  $questionType)
static

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

Referenced by assQuestionGUI\_getQuestionGUI(), and ilObjTest\createQuestionGUI().

2214  : string
2215  {
2216  return str_replace('ass', 'ilAss', $questionType) . 'Feedback';
2217  }
+ Here is the caller graph for this function:

◆ getHtmlQuestionContentPurifier()

assQuestion::getHtmlQuestionContentPurifier ( )
Returns
ilHtmlPurifierInterface|ilAssHtmlUserSolutionPurifier

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

References ilHtmlPurifierFactory\getInstanceByType().

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

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

◆ getHtmlUserSolutionPurifier()

assQuestion::getHtmlUserSolutionPurifier ( )
Returns
ilHtmlPurifierInterface|ilAssHtmlUserSolutionPurifier

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

References ilHtmlPurifierFactory\getInstanceByType().

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

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

◆ getId()

assQuestion::getId ( )

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

References $id.

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

410  : int
411  {
412  return $this->id;
413  }
+ Here is the caller graph for this function:

◆ getImagePath()

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

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

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

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

References $id, and $obj_id.

Referenced by assOrderingQuestion\buildOrderingImagesFormDataConverter(), assOrderingQuestion\cleanImagefiles(), assImagemapQuestion\copyImage(), assOrderingQuestion\copyImages(), assMatchingQuestion\copyImages(), assMultipleChoice\copyImages(), assMultipleChoice\deleteImage(), assSingleChoice\deleteImage(), assImagemapQuestion\deleteImage(), assMatchingQuestion\deleteImagefile(), assOrderingQuestion\dropImageFile(), assImagemapQuestion\duplicateImage(), assOrderingQuestion\duplicateImages(), assMatchingQuestion\duplicateImages(), assSingleChoice\duplicateImages(), assOrderingQuestion\ensureImagePathExists(), assKprimChoice\handleFileUpload(), assMultipleChoice\isForcedEmptySolution(), assOrderingQuestion\isImageFileStored(), assKprimChoice\loadAnswerData(), assSingleChoice\loadFromDb(), assMultipleChoice\loadFromDb(), assOrderingQuestion\rebuildThumbnails(), assMatchingQuestion\rebuildThumbnails(), assSingleChoice\savePreviewData(), assMatchingQuestion\setExportDetailsXLSX(), assMultipleChoice\setImageFile(), assSingleChoice\setImageFile(), assMatchingQuestion\setImageFile(), assImagemapQuestion\setImageFilename(), assOrderingQuestion\storeImageFile(), assMultipleChoice\syncImages(), assSingleChoice\syncImages(), and assOrderingQuestion\updateImageFile().

795  : string
796  {
797  if ($question_id === null) {
798  $question_id = $this->id;
799  }
800 
801  if ($object_id === null) {
802  $object_id = $this->obj_id;
803  }
804 
805  return $this->questionFilesService->buildImagePath($question_id, $object_id);
806  }
int $obj_id
Object id of the container object.
+ 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 823 of file class.assQuestion.php.

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

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

823  : string
824  {
825  if (!$this->export_image_path) {
826  $webdir = ilFileUtils::removeTrailingPathSeparators(CLIENT_WEB_DIR) . "/assessment/$this->obj_id/$this->id/images/";
827  return str_replace(
828  ilFileUtils::removeTrailingPathSeparators(ILIAS_ABSOLUTE_PATH),
830  $webdir
831  );
832  }
834  }
static removeTrailingPathSeparators(string $path)
const CLIENT_WEB_DIR
Definition: constants.php:47
string $export_image_path
(Web) Path to images
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getInstances()

assQuestion::getInstances ( )

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

References ILIAS\LTI\ToolProvider\$key, ilObject\_getAllReferences(), ilObjTest\_lookupAuthor(), ilObject\_lookupTitle(), and getId().

2137  : array
2138  {
2139  $result = $this->db->queryF(
2140  "SELECT question_id FROM qpl_questions WHERE original_id = %s",
2141  array("integer"),
2142  array($this->getId())
2143  );
2144  $instances = [];
2145  $ids = [];
2146  while ($row = $this->db->fetchAssoc($result)) {
2147  $ids[] = $row["question_id"];
2148  }
2149  foreach ($ids as $question_id) {
2150  // check non random tests
2151  $result = $this->db->queryF(
2152  "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",
2153  array("integer"),
2154  array($question_id)
2155  );
2156  while ($row = $this->db->fetchAssoc($result)) {
2157  $instances[$row['obj_fi']] = ilObject::_lookupTitle($row['obj_fi']);
2158  }
2159  // check random tests
2160  $result = $this->db->queryF(
2161  "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",
2162  array("integer"),
2163  array($question_id)
2164  );
2165  while ($row = $this->db->fetchAssoc($result)) {
2166  $instances[$row['obj_fi']] = ilObject::_lookupTitle($row['obj_fi']);
2167  }
2168  }
2169  foreach ($instances as $key => $value) {
2170  $instances[$key] = array("obj_id" => $key, "title" => $value, "author" => ilObjTest::_lookupAuthor($key), "refs" => ilObject::_getAllReferences($key));
2171  }
2172  return $instances;
2173  }
static _getAllReferences(int $id)
get all reference ids for object ID
static _lookupTitle(int $obj_id)
string $key
Consumer key/client ID value.
Definition: System.php:193
static _lookupAuthor($obj_id)
Gets the authors name of the ilObjTest object.
+ Here is the call graph for this function:

◆ getLastChange()

assQuestion::getLastChange ( )

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

References $lastChange.

2552  {
2553  return $this->lastChange;
2554  }

◆ getLifecycle()

assQuestion::getLifecycle ( )

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

References $lifecycle.

Referenced by saveToDb().

485  {
486  return $this->lifecycle;
487  }
ilAssQuestionLifecycle $lifecycle
+ Here is the caller graph for this function:

◆ getMaximumPoints()

assQuestion::getMaximumPoints ( )

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

References $points.

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

589  : float
590  {
591  return $this->points;
592  }
float $points
The maximum available points for the question.
+ Here is the caller graph for this function:

◆ getMaximumThumbSize()

assQuestion::getMaximumThumbSize ( )

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

454  : int
455  {
456  return self::MAXIMUM_THUMB_SIZE;
457  }

◆ getMinimumThumbSize()

assQuestion::getMinimumThumbSize ( )

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

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

449  : int
450  {
451  return self::MINIMUM_THUMB_SIZE;
452  }
+ Here is the caller graph for this function:

◆ getNotesDataService()

assQuestion::getNotesDataService ( )
protected

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

References $service.

Referenced by duplicateComments().

1489  : NotesInternalDataService
1490  {
1491  $service = new NotesService($this->dic);
1492  return $service->internal()->data();
1493  }
$service
Definition: ltiservices.php:43
+ Here is the caller graph for this function:

◆ getNotesManager()

assQuestion::getNotesManager ( )
protected

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

References $service.

Referenced by deleteComments(), and duplicateComments().

1483  : NotesManager
1484  {
1485  $service = new NotesService($this->dic);
1486  return $service->internal()->domain()->notes();
1487  }
$service
Definition: ltiservices.php:43
+ Here is the caller graph for this function:

◆ getNotesRepo()

assQuestion::getNotesRepo ( )
protected

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

References $service.

Referenced by deleteComments().

1495  : NotesRepo
1496  {
1497  $service = new NotesService($this->dic);
1498  return $service->internal()->repo()->note();
1499  }
$service
Definition: ltiservices.php:43
+ Here is the caller graph for this function:

◆ getNrOfTries()

◆ getNumExistingSolutionRecords()

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

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

References $DIC, $ilDB, and $res.

Referenced by isAnswered().

2456  : int
2457  {
2458  global $DIC;
2459  $ilDB = $DIC['ilDB'];
2460 
2461  $query = "
2462  SELECT count(active_fi) cnt
2463 
2464  FROM tst_solutions
2465 
2466  WHERE active_fi = %s
2467  AND question_fi = %s
2468  AND pass = %s
2469  ";
2470 
2471  $res = $ilDB->queryF(
2472  $query,
2473  array('integer','integer','integer'),
2474  array($activeId, $questionId, $pass)
2475  );
2476 
2477  $row = $ilDB->fetchAssoc($res);
2478 
2479  return (int) $row['cnt'];
2480  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ getObjId()

assQuestion::getObjId ( )

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

References $obj_id.

Referenced by calculateResultsFromSolution(), assOrderingHorizontal\copyObject(), assNumeric\copyObject(), assFileUpload\copyObject(), assImagemapQuestion\copyObject(), assOrderingQuestion\copyObject(), assTextSubset\copyObject(), assTextQuestion\copyObject(), assMultipleChoice\copyObject(), assSingleChoice\copyObject(), assErrorText\copyObject(), assMatchingQuestion\copyObject(), assLongMenu\copyObject(), assKprimChoice\copyObject(), assFormulaQuestion\copyObject(), assClozeTest\copyObject(), assOrderingHorizontal\createNewOriginalFromThisDuplicate(), assNumeric\createNewOriginalFromThisDuplicate(), assFileUpload\createNewOriginalFromThisDuplicate(), assTextSubset\createNewOriginalFromThisDuplicate(), assImagemapQuestion\createNewOriginalFromThisDuplicate(), assTextQuestion\createNewOriginalFromThisDuplicate(), assOrderingQuestion\createNewOriginalFromThisDuplicate(), assMultipleChoice\createNewOriginalFromThisDuplicate(), assSingleChoice\createNewOriginalFromThisDuplicate(), assErrorText\createNewOriginalFromThisDuplicate(), assMatchingQuestion\createNewOriginalFromThisDuplicate(), assLongMenu\createNewOriginalFromThisDuplicate(), assKprimChoice\createNewOriginalFromThisDuplicate(), assFormulaQuestion\createNewOriginalFromThisDuplicate(), assClozeTest\createNewOriginalFromThisDuplicate(), createNewQuestion(), createPageObject(), delete(), deleteComments(), deleteTaxonomyAssignments(), assOrderingHorizontal\duplicate(), assNumeric\duplicate(), assFileUpload\duplicate(), assOrderingQuestion\duplicate(), assImagemapQuestion\duplicate(), assTextSubset\duplicate(), assTextQuestion\duplicate(), assSingleChoice\duplicate(), assMultipleChoice\duplicate(), assErrorText\duplicate(), assMatchingQuestion\duplicate(), assLongMenu\duplicate(), assKprimChoice\duplicate(), assFormulaQuestion\duplicate(), assClozeTest\duplicate(), saveQuestionDataToDb(), saveToDb(), and syncWithOriginal().

474  : int
475  {
476  return $this->obj_id;
477  }
int $obj_id
Object id of the container object.
+ Here is the caller graph for this function:

◆ getOriginalId()

assQuestion::getOriginalId ( )

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

References $original_id.

Referenced by syncWithOriginal().

1180  : ?int
1181  {
1182  return $this->original_id;
1183  }
+ Here is the caller graph for this function:

◆ getOwner()

assQuestion::getOwner ( )

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

References $owner.

Referenced by saveQuestionDataToDb(), and saveToDb().

469  : int
470  {
471  return $this->owner;
472  }
+ Here is the caller graph for this function:

◆ getPageOfQuestion()

assQuestion::getPageOfQuestion ( )

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

References $page.

1169  : string
1170  {
1171  $page = new ilAssQuestionPage($this->id);
1172  return $page->getXMLContent();
1173  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ getPoints()

◆ getPreventRteUsage()

assQuestion::getPreventRteUsage ( )

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

References $prevent_rte_usage.

2313  : bool
2314  {
2315  return $this->prevent_rte_usage;
2316  }

◆ getProcessLocker()

◆ getQuestion()

◆ getQuestionAction()

assQuestion::getQuestionAction ( )
protected

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

Referenced by assFileUpload\isFileDeletionAction().

233  : string
234  {
235  if (!isset($_POST['cmd']) || !isset($_POST['cmd'][$this->questionActionCmd])) {
236  return '';
237  }
238 
239  if (!is_array($_POST['cmd'][$this->questionActionCmd]) || $_POST['cmd'][$this->questionActionCmd] === []) {
240  return '';
241  }
242 
243  return key($_POST['cmd'][$this->questionActionCmd]);
244  }
+ Here is the caller graph for this function:

◆ getQuestionForHTMLOutput()

assQuestion::getQuestionForHTMLOutput ( )

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

References purifyAndPrepareTextAreaOutput().

2034  : string
2035  {
2036  return $this->purifyAndPrepareTextAreaOutput($this->question);
2037  }
purifyAndPrepareTextAreaOutput(string $content)
+ Here is the call graph for this function:

◆ getQuestionType()

assQuestion::getQuestionType ( )
abstract

Returns the question type of the question.

Returns
string The question type of the question

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

+ Here is the caller graph for this function:

◆ getQuestionTypeID()

assQuestion::getQuestionTypeID ( )

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

References getQuestionType().

Referenced by createNewQuestion(), and saveQuestionDataToDb().

2065  : int
2066  {
2067  $result = $this->db->queryF(
2068  "SELECT question_type_id FROM qpl_qst_type WHERE type_tag = %s",
2069  array('text'),
2070  array($this->getQuestionType())
2071  );
2072  if ($this->db->numRows($result) == 1) {
2073  $row = $this->db->fetchAssoc($result);
2074  return (int) $row["question_type_id"];
2075  }
2076  return 0;
2077  }
getQuestionType()
Returns the question type of the question.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getReachedPoints()

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

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

References getId().

Referenced by ilLOTestQuestionAdapter\updateQuestionResult().

584  : float
585  {
586  return round(self::_getReachedPoints($active_id, $this->getId(), $pass), 2);
587  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRTETextWithMediaObjects()

assQuestion::getRTETextWithMediaObjects ( )
protected

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

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

Referenced by cleanupMediaObjectUsage().

2113  : string
2114  {
2115  // must be called in parent classes. add additional RTE text in the parent
2116  // classes and call this method to add the standard RTE text
2117  $collected = $this->getQuestion();
2118  $collected .= $this->feedbackOBJ->getGenericFeedbackContent($this->getId(), false);
2119  $collected .= $this->feedbackOBJ->getGenericFeedbackContent($this->getId(), true);
2120  $collected .= $this->feedbackOBJ->getAllSpecificAnswerFeedbackContents($this->getId());
2121 
2122  $questionHintList = ilAssQuestionHintList::getListByQuestionId($this->getId());
2123  foreach ($questionHintList as $questionHint) {
2124  /* @var $questionHint ilAssQuestionHint */
2125  $collected .= $questionHint->getText();
2126  }
2127 
2128  return $collected;
2129  }
static getListByQuestionId($questionId)
instantiates a question hint list for the passed question id
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSelfAssessmentEditingMode()

assQuestion::getSelfAssessmentEditingMode ( )

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

References $selfassessmenteditingmode.

Referenced by ilAssQuestionAuthoringFormGUI\addGenericAssessmentQuestionCommandButtons().

2342  : bool
2343  {
2345  }
bool $selfassessmenteditingmode
+ Here is the caller graph for this function:

◆ getSelfAssessmentFormatter()

assQuestion::getSelfAssessmentFormatter ( )
protected

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

Referenced by formatSAQuestion().

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

◆ getShuffle()

assQuestion::getShuffle ( )

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

References $shuffle.

Referenced by assMultipleChoice\isForcedEmptySolution(), assSingleChoice\savePreviewData(), assTextQuestion\toJSON(), assLongMenu\toJSON(), assErrorText\toJSON(), assImagemapQuestion\toJSON(), assMultipleChoice\toJSON(), assSingleChoice\toJSON(), and assClozeTest\toJSON().

415  : bool
416  {
417  return $this->shuffle;
418  }
bool $shuffle
Indicates whether the answers will be shuffled or not.
+ Here is the caller graph for this function:

◆ getShuffler()

assQuestion::getShuffler ( )

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

References $shuffler.

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

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

◆ getSolutionMaxPass()

◆ getSolutionRecordById()

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

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

Referenced by assFileUpload\saveWorkingData().

2605  : array
2606  {
2607  $result = $this->db->queryF(
2608  "SELECT * FROM tst_solutions WHERE solution_id = %s",
2609  array('integer'),
2610  array($solutionId)
2611  );
2612 
2613  if ($this->db->numRows($result) > 0) {
2614  return $this->db->fetchAssoc($result);
2615  }
2616  return [];
2617  }
+ Here is the caller graph for this function:

◆ getSolutionValues()

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

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

Parameters
int | string$active_id
Returns
array Assoc result from tst_solutions.*

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

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

Referenced by assOrderingQuestion\calculateReachedPoints(), assFormulaQuestion\calculateReachedPoints(), deleteDummySolutionRecord(), duplicateIntermediateSolutionAuthorized(), forceExistingIntermediateSolution(), assOrderingQuestion\getOrderingElementListForSolutionOutput(), ilTestCorrectionsGUI\getSolutions(), ilTestCorrectionsGUI\getSolutionsByParticipantResults(), getTestOutputSolutions(), assFileUpload\getUploadedFilesForWeb(), assFileUpload\getUserSolutionPreferingIntermediate(), getUserSolutionPreferingIntermediate(), assOrderingHorizontal\setExportDetailsXLSX(), assErrorText\setExportDetailsXLSX(), assNumeric\setExportDetailsXLSX(), assTextSubset\setExportDetailsXLSX(), assTextQuestion\setExportDetailsXLSX(), assLongMenu\setExportDetailsXLSX(), assImagemapQuestion\setExportDetailsXLSX(), assFileUpload\setExportDetailsXLSX(), assKprimChoice\setExportDetailsXLSX(), assMultipleChoice\setExportDetailsXLSX(), assSingleChoice\setExportDetailsXLSX(), assOrderingQuestion\setExportDetailsXLSX(), assMatchingQuestion\setExportDetailsXLSX(), assFormulaQuestion\setExportDetailsXLSX(), and assClozeTest\setExportDetailsXLSX().

862  : array
863  {
864  if ($pass === null && is_numeric($active_id)) {
865  $pass = $this->getSolutionMaxPass((int) $active_id);
866  }
867 
868  if ($this->getStep() !== null) {
869  $query = "
870  SELECT *
871  FROM tst_solutions
872  WHERE active_fi = %s
873  AND question_fi = %s
874  AND pass = %s
875  AND step = %s
876  AND authorized = %s
877  ORDER BY solution_id";
878 
879  $result = $this->db->queryF(
880  $query,
881  array('integer', 'integer', 'integer', 'integer', 'integer'),
882  array((int) $active_id, $this->getId(), $pass, $this->getStep(), (int) $authorized)
883  );
884  } else {
885  $query = "
886  SELECT *
887  FROM tst_solutions
888  WHERE active_fi = %s
889  AND question_fi = %s
890  AND pass = %s
891  AND authorized = %s
892  ORDER BY solution_id
893  ";
894 
895  $result = $this->db->queryF(
896  $query,
897  array('integer', 'integer', 'integer', 'integer'),
898  array((int) $active_id, $this->getId(), $pass, (int) $authorized)
899  );
900  }
901 
902  $values = [];
903 
904  while ($row = $this->db->fetchAssoc($result)) {
905  $values[] = $row;
906  }
907 
908  return $values;
909  }
getSolutionMaxPass(int $active_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getStep()

◆ getSuggestedSolution()

assQuestion::getSuggestedSolution ( int  $subquestion_index = 0)

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

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

◆ getSuggestedSolutionOutput()

assQuestion::getSuggestedSolutionOutput ( )

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

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

519  : string
520  {
521  $output = [];
522  foreach ($this->suggested_solutions as $solution) {
523  switch ($solution->getType()) {
524  case assQuestionSuggestedSolution::TYPE_LM:
525  case assQuestionSuggestedSolution::TYPE_LM_CHAPTER:
526  case assQuestionSuggestedSolution::TYPE_LM_PAGE:
527  case assQuestionSuggestedSolution::TYPE_GLOSARY_TERM:
528  $output[] = '<a href="'
529  . assQuestion::_getInternalLinkHref($solution->getInternalLink())
530  . '">'
531  . $this->lng->txt("solution_hint")
532  . '</a>';
533  break;
534 
535  case assQuestionSuggestedSolution::TYPE_FILE:
536  $possible_texts = array_values(
537  array_filter(
538  [
539  ilLegacyFormElementsUtil::prepareFormOutput($solution->getTitle()),
540  ilLegacyFormElementsUtil::prepareFormOutput($solution->getFilename()),
541  $this->lng->txt('tst_show_solution_suggested')
542  ]
543  )
544  );
545 
547  $output[] = '<a href="'
549  $this->getSuggestedSolutionPathWeb() . $solution->getFilename()
550  )
551  . '">'
552  . $possible_texts[0]
553  . '</a>';
554  break;
555  }
556  }
557  return implode("<br />", $output);
558  }
static _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)
+ Here is the call graph for this function:

◆ getSuggestedSolutionPath()

assQuestion::getSuggestedSolutionPath ( )

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

References CLIENT_WEB_DIR.

Referenced by copySuggestedSolutionFiles(), deleteSuggestedSolutions(), duplicateSuggestedSolutionFiles(), and syncSuggestedSolutionFiles().

786  : string
787  {
788  return CLIENT_WEB_DIR . "/assessment/$this->obj_id/$this->id/solution/";
789  }
const CLIENT_WEB_DIR
Definition: constants.php:47
+ Here is the caller graph for this function:

◆ getSuggestedSolutionPathWeb()

assQuestion::getSuggestedSolutionPathWeb ( )

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

References CLIENT_WEB_DIR, and ilFileUtils\removeTrailingPathSeparators().

Referenced by getSuggestedSolutionOutput().

808  : string
809  {
810  $webdir = ilFileUtils::removeTrailingPathSeparators(CLIENT_WEB_DIR) . "/assessment/$this->obj_id/$this->id/solution/";
811  return str_replace(
812  ilFileUtils::removeTrailingPathSeparators(ILIAS_ABSOLUTE_PATH),
814  $webdir
815  );
816  }
static removeTrailingPathSeparators(string $path)
const CLIENT_WEB_DIR
Definition: constants.php:47
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSuggestedSolutions()

assQuestion::getSuggestedSolutions ( )

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

References $suggested_solutions.

Referenced by copySuggestedSolutions().

560  : array
561  {
563  }
array $suggested_solutions
+ Here is the caller graph for this function:

◆ getSuggestedSolutionsRepo()

assQuestion::getSuggestedSolutionsRepo ( )
protected

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

References $suggestedsolution_repo, and ilQuestionPoolDIC\dic().

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

3084  {
3085  if (is_null($this->suggestedsolution_repo)) {
3087  $this->suggestedsolution_repo = $dic['question.repo.suggestedsolutions'];
3088  }
3090  }
assQuestionSuggestedSolutionsDatabaseRepository $suggestedsolution_repo
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTestId()

assQuestion::getTestId ( )

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

References $test_id.

Referenced by resetUsersAnswer().

420  : int
421  {
422  return $this->test_id;
423  }
int $test_id
The database id of a test in which the question is contained.
+ Here is the caller graph for this function:

◆ getTestOutputSolutions()

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

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

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

Referenced by assOrderingQuestion\getSolutionOrderingElementListForTestOutput().

837  : array
838  {
839  if ($this->getTestPresentationConfig()->isSolutionInitiallyPrefilled()) {
840  return $this->getSolutionValues($activeId, $pass, true);
841  }
842  return $this->getUserSolutionPreferingIntermediate($activeId, $pass);
843  }
getSolutionValues($active_id, $pass=null, bool $authorized=true)
Loads solutions of a given user from the database an returns it.
getUserSolutionPreferingIntermediate(int $active_id, $pass=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTestPresentationConfig()

assQuestion::getTestPresentationConfig ( )

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

References $testQuestionConfigInstance, and buildTestPresentationConfig().

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

3063  {
3064  if ($this->testQuestionConfigInstance === null) {
3065  $this->testQuestionConfigInstance = $this->buildTestPresentationConfig();
3066  }
3067 
3069  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
buildTestPresentationConfig()
build basic test question configuration instance
ilTestQuestionConfig $testQuestionConfigInstance
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getThumbSize()

◆ getTitle()

assQuestion::getTitle ( )

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

References $title.

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

395  : string
396  {
397  return $this->title;
398  }
+ Here is the caller graph for this function:

◆ getTitleFilenameCompliant()

assQuestion::getTitleFilenameCompliant ( )

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

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

405  : string
406  {
407  return ilFileUtils::getASCIIFilename($this->getTitle());
408  }
static getASCIIFilename(string $a_filename)
+ Here is the call graph for this function:

◆ getTitleForHTMLOutput()

◆ getTotalAnswers()

assQuestion::getTotalAnswers ( )

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

1091  : int
1092  {
1093  // get all question references to the question id
1094  $result = $this->db->queryF(
1095  "SELECT question_id FROM qpl_questions WHERE original_id = %s OR question_id = %s",
1096  array('integer','integer'),
1097  array($this->id, $this->id)
1098  );
1099  if ($this->db->numRows($result) == 0) {
1100  return 0;
1101  }
1102  $found_id = [];
1103  while ($row = $this->db->fetchAssoc($result)) {
1104  $found_id[] = $row["question_id"];
1105  }
1106 
1107  $result = $this->db->query("SELECT * FROM tst_test_result WHERE " . $this->db->in('question_fi', $found_id, false, 'integer'));
1108 
1109  return $this->db->numRows($result);
1110  }

◆ getUserSolutionPreferingIntermediate()

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

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

References getSolutionValues().

Referenced by getTestOutputSolutions().

846  : array
847  {
848  $solution = $this->getSolutionValues($active_id, $pass, false);
849 
850  if (!count($solution)) {
851  $solution = $this->getSolutionValues($active_id, $pass, true);
852  }
853 
854  return $solution;
855  }
getSolutionValues($active_id, $pass=null, bool $authorized=true)
Loads solutions of a given user from the database an returns it.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getValidAdditionalContentEditingModes()

assQuestion::getValidAdditionalContentEditingModes ( )

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

Referenced by isValidAdditionalContentEditingMode(), and setAdditionalContentEditingMode().

2510  : array
2511  {
2512  return array(
2513  self::ADDITIONAL_CONTENT_EDITING_MODE_RTE,
2514  self::ADDITIONAL_CONTENT_EDITING_MODE_IPE
2515  );
2516  }
+ Here is the caller graph for this function:

◆ hasSpecificFeedback()

assQuestion::hasSpecificFeedback ( )

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

2209  : bool
2210  {
2211  return static::HAS_SPECIFIC_FEEDBACK;
2212  }

◆ implodeKeyValues()

static assQuestion::implodeKeyValues ( array  $keyValues)
static

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

References KEY_VALUES_IMPLOSION_SEPARATOR.

Referenced by assImagemapQuestionGUI\buildSelectionParameter().

2734  : string
2735  {
2736  return implode(assQuestion::KEY_VALUES_IMPLOSION_SEPARATOR, $keyValues);
2737  }
const KEY_VALUES_IMPLOSION_SEPARATOR
+ Here is the caller graph for this function:

◆ importHint()

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

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

References getAdditionalContentEditingMode().

Referenced by fromXML().

313  : void
314  {
315  $hint = new ilAssQuestionHint();
316  $hint->setQuestionId($question_id);
317  $hint->setIndex($hint_array['index'] ?? '');
318  $hint->setPoints($hint_array['points'] ?? '');
319  if ($this->getAdditionalContentEditingMode() === self::ADDITIONAL_CONTENT_EDITING_MODE_IPE) {
320  $hint->save();
321  $hint_page = (new ilAssHintPage());
322  $hint_page->setParentId($question_id);
323  $hint_page->setId($hint->getId());
324  $hint_page->setXMLContent($hint_array['txt']);
325  $hint_page->createFromXML();
326  return;
327  }
328 
329  $hint->setText($hint_array['txt'] ?? '');
330  $hint->save();
331  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ instantiateQuestion()

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

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

References $DIC, $ilDB, and $question.

Referenced by ilObjTest\_instanciateQuestion(), ilTestFixedQuestionSetConfig\cloneQuestionSetRelatedData(), ilObjTestGUI\copyAndLinkQuestionsToPoolObject(), ilPCQuestion\copyPoolQuestionIntoPage(), ilObjQuestionPool\deleteQuestion(), ilTestEvaluationGUI\exportFileUploadsForAllParticipants(), ilTestEvaluationGUI\exportQuestionForAllParticipants(), ilTestResultsToXML\exportTestResults(), ilAssLacQuestionProvider\getQuestion(), ilTestPlayerAbstractGUI\getQuestionInstance(), ilTestExport\getQuestionQtiXml(), ilTestRandomQuestionSetPoolDeriver\getQuestionsForPool(), ilTestSequence\getSequenceSummary(), ilPCQuestion\handleCopiedContent(), ilQuestionPageParser\processPagesToParse(), ilAssIncompleteQuestionPurger\purgeQuestionIds(), ilTestRandomQuestionSetStagingPoolBuilder\removeStagedQuestions(), ilTestScoringByQuestionsGUI\saveManScoringByQuestion(), ilSoapTestAdministration\saveQuestion(), ilSoapTestAdministration\saveQuestionSolution(), ilTestEvaluationGUI\singleResults(), ilTestRandomQuestionSetStagingPoolBuilder\stageQuestionsFromSourcePool(), ilTestRandomQuestionSetStagingPoolBuilder\stageQuestionsFromSourcePoolCheap(), ilAssQuestionSkillAssignmentsGUI\syncOriginalCmd(), and ilExcelTestExport\withUserPages().

1753  : assQuestion
1754  {
1755  global $DIC;
1756  $ilCtrl = $DIC['ilCtrl'];
1757  $ilDB = $DIC['ilDB'];
1758  $lng = $DIC['lng'];
1759  $questioninfo = $DIC->testQuestionPool()->questionInfo();
1760  $question_type = $questioninfo->getQuestionType($question_id);
1761  if ($question_type === '') {
1762  throw new InvalidArgumentException('No question with ID ' . $question_id . ' exists');
1763  }
1764 
1765  $question = new $question_type();
1766  $question->loadFromDb($question_id);
1767 
1768  $feedbackObjectClassname = self::getFeedbackClassNameByQuestionType($question_type);
1769  $question->feedbackOBJ = new $feedbackObjectClassname($question, $ilCtrl, $ilDB, $lng);
1770 
1771  return $question;
1772  }
Abstract basic class which is to be extended by the concrete assessment question type classes...
global $DIC
Definition: feed.php:28
string $question
The question text.
ILIAS TestQuestionPool QuestionInfoService $questioninfo
+ Here is the caller graph for this function:

◆ instantiateQuestionGUI()

static assQuestion::instantiateQuestionGUI ( int  $a_question_id)
static

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

References $DIC, $ilDB, and ilObjAssessmentFolder\_enabledAssessmentLogging().

Referenced by ilObjTestGUI\copyQuestionObject(), ilObjTestGUI\copyQuestionToPool(), ilObjQuestionPool\createQuestion(), ilQuestionPoolPrintViewTableGUI\fillRow(), ilTestCorrectionsGUI\getQuestion(), and ilAssQuestionPreviewGUI\initQuestion().

2221  : assQuestionGUI
2222  {
2223  //Shouldn't you live in assQuestionGUI, Mister?
2224 
2225  global $DIC;
2226  $ilCtrl = $DIC['ilCtrl'];
2227  $ilDB = $DIC['ilDB'];
2228  $lng = $DIC['lng'];
2229  $ilUser = $DIC['ilUser'];
2230  $questioninfo = $DIC->testQuestionPool()->questionInfo();
2231  if (strcmp($a_question_id, "") != 0) {
2232  $question_type = $questioninfo->getQuestionType($a_question_id);
2233 
2234  $question_type_gui = $question_type . 'GUI';
2235  $question_gui = new $question_type_gui();
2236  $question_gui->object->loadFromDb($a_question_id);
2237 
2238  $feedbackObjectClassname = self::getFeedbackClassNameByQuestionType($question_type);
2239  $question_gui->object->feedbackOBJ = new $feedbackObjectClassname($question_gui->object, $ilCtrl, $ilDB, $lng);
2240 
2241  $assSettings = new ilSetting('assessment');
2242  $processLockerFactory = new ilAssQuestionProcessLockerFactory($assSettings, $ilDB);
2243  $processLockerFactory->setQuestionId($question_gui->object->getId());
2244  $processLockerFactory->setUserId($ilUser->getId());
2245  $processLockerFactory->setAssessmentLogEnabled(ilObjAssessmentFolder::_enabledAssessmentLogging());
2246  $question_gui->object->setProcessLocker($processLockerFactory->getLocker());
2247  } else {
2248  global $DIC;
2249  $ilLog = $DIC['ilLog'];
2250  $ilLog->write('Instantiate question called without question id. (instantiateQuestionGUI@assQuestion)', $ilLog->WARNING);
2251  throw new InvalidArgumentException('Instantiate question called without question id. (instantiateQuestionGUI@assQuestion)');
2252  }
2253  return $question_gui;
2254  }
global $DIC
Definition: feed.php:28
Basic GUI class for assessment questions.
ILIAS TestQuestionPool QuestionInfoService $questioninfo
ILIAS DI LoggingServices $ilLog
+ 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 2862 of file class.assQuestion.php.

References lookupForExistingSolutions().

Referenced by assFileUpload\saveWorkingData().

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

◆ isAddableAnswerOptionValue()

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

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

2938  : bool
2939  {
2940  return false;
2941  }

◆ isAdditionalContentEditingModePageObject()

assQuestion::isAdditionalContentEditingModePageObject ( )

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

References ADDITIONAL_CONTENT_EDITING_MODE_IPE, and getAdditionalContentEditingMode().

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

2496  : bool
2497  {
2499  }
const ADDITIONAL_CONTENT_EDITING_MODE_IPE
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isAnswered()

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

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

References getId(), and getNumExistingSolutionRecords().

Referenced by calculateResultsFromSolution().

2445  : bool
2446  {
2447  $numExistingSolutionRecords = assQuestion::getNumExistingSolutionRecords($active_id, $pass, $this->getId());
2448  return $numExistingSolutionRecords > 0;
2449  }
static getNumExistingSolutionRecords(int $activeId, int $pass, int $questionId)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isComplete()

assQuestion::isComplete ( )
abstract

Returns true, if a question is complete for use.

Returns
boolean True, if the question is complete for use, otherwise false

Referenced by saveQuestionDataToDb(), saveToDb(), and toXML().

+ Here is the caller graph for this function:

◆ isDummySolutionRecord()

assQuestion::isDummySolutionRecord ( array  $solutionRecord)
protected

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

Referenced by assFileUpload\calculateReachedPoints().

2753  : bool
2754  {
2755  return !strlen($solutionRecord['value1']) && !strlen($solutionRecord['value2']);
2756  }
+ Here is the caller graph for this function:

◆ isFileAvailable()

static assQuestion::isFileAvailable ( string  $file)
static

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

Referenced by assMatchingQuestion\copyImages().

1112  : bool
1113  {
1114  if (!file_exists($file)) {
1115  return false;
1116  }
1117 
1118  if (!is_file($file)) {
1119  return false;
1120  }
1121 
1122  if (!is_readable($file)) {
1123  return false;
1124  }
1125 
1126  return true;
1127  }
+ Here is the caller graph for this function:

◆ isForcePassResultUpdateEnabled()

static assQuestion::isForcePassResultUpdateEnabled ( )
static

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

228  : bool
229  {
230  return self::$forcePassResultsUpdateEnabled;
231  }

◆ isNonEmptyItemListPostSubmission()

assQuestion::isNonEmptyItemListPostSubmission ( string  $postSubmissionFieldname)
protected

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

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

246  : bool
247  {
248  if (!isset($_POST[$postSubmissionFieldname])) {
249  return false;
250  }
251 
252  if (!is_array($_POST[$postSubmissionFieldname])) {
253  return false;
254  }
255 
256  if (!count($_POST[$postSubmissionFieldname])) {
257  return false;
258  }
259 
260  return true;
261  }
+ Here is the caller graph for this function:

◆ isObligationPossible()

static assQuestion::isObligationPossible ( int  $questionId)
static

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

Referenced by assMultipleChoice\getSpecificFeedbackAllCorrectOptionLabel().

2451  : bool
2452  {
2453  return false;
2454  }
+ Here is the caller graph for this function:

◆ isPreviewSolutionCorrect()

assQuestion::isPreviewSolutionCorrect ( ilAssQuestionPreviewSession  $previewSession)

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

References calculateReachedPointsFromPreviewSession(), and getMaximumPoints().

1877  : bool
1878  {
1879  $reachedPoints = $this->calculateReachedPointsFromPreviewSession($previewSession);
1880 
1881  return !($reachedPoints < $this->getMaximumPoints());
1882  }
calculateReachedPointsFromPreviewSession(ilAssQuestionPreviewSession $previewSession)
+ Here is the call graph for this function:

◆ isValidAdditionalContentEditingMode()

assQuestion::isValidAdditionalContentEditingMode ( string  $additionalContentEditingMode)

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

References getValidAdditionalContentEditingModes().

2501  : bool
2502  {
2504  return true;
2505  }
2506 
2507  return false;
2508  }
getValidAdditionalContentEditingModes()
string $additionalContentEditingMode
+ Here is the call graph for this function:

◆ lmMigrateQuestionTypeGenericContent()

assQuestion::lmMigrateQuestionTypeGenericContent ( ilAssSelfAssessmentMigrator  $migrator)
protected

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

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

Referenced by migrateContentForLearningModule().

2327  : void
2328  {
2329  $this->setQuestion($migrator->migrateToLmContent($this->getQuestion()));
2330  }
setQuestion(string $question="")
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lmMigrateQuestionTypeSpecificContent()

assQuestion::lmMigrateQuestionTypeSpecificContent ( ilAssSelfAssessmentMigrator  $migrator)
protected

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

Referenced by migrateContentForLearningModule().

2332  : void
2333  {
2334  // overwrite if any question type specific content except feedback needs to be migrated
2335  }
+ Here is the caller graph for this function:

◆ loadFromDb()

assQuestion::loadFromDb ( int  $question_id)

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

References $data, and loadSuggestedSolutions().

Referenced by assNumeric\saveToDb().

1238  : void
1239  {
1240  $result = $this->db->queryF(
1241  'SELECT external_id FROM qpl_questions WHERE question_id = %s',
1242  ['integer'],
1243  [$question_id]
1244  );
1245  if ($this->db->numRows($result) === 1) {
1246  $data = $this->db->fetchAssoc($result);
1247  $this->external_id = $data['external_id'];
1248  }
1249 
1251  $this->suggested_solutions = array();
1252  if ($suggested_solutions) {
1253  foreach ($suggested_solutions as $solution) {
1254  $this->suggested_solutions[$solution->getSubquestionIndex()] = $solution;
1255  }
1256  }
1257  }
array $suggested_solutions
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadSuggestedSolutions()

assQuestion::loadSuggestedSolutions ( )
protected

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

References getId(), and getSuggestedSolutionsRepo().

Referenced by loadFromDb().

3092  : array
3093  {
3094  $question_id = $this->getId();
3095  return $this->getSuggestedSolutionsRepo()->selectFor($question_id);
3096  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ log()

assQuestion::log ( int  $active_id,
string  $langVar 
)
protected

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

References $message, ilObjAssessmentFolder\_enabledAssessmentLogging(), ilObjAssessmentFolder\_getLogLanguage(), getId(), ILIAS\Repository\lng(), and logAction().

Referenced by resetUsersAnswer(), and assOrderingQuestion\saveWorkingData().

263  : void
264  {
266  $message = $this->lng->txtlng('assessment', $langVar, ilObjAssessmentFolder::_getLogLanguage());
267  assQuestion::logAction($message, $active_id, $this->getId());
268  }
269  }
static logAction(string $logtext, int $active_id, int $question_id)
$message
Definition: xapiexit.php:32
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ logAction()

static assQuestion::logAction ( string  $logtext,
int  $active_id,
int  $question_id 
)
static

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

References $DIC, $original_id, ilObjAssessmentFolder\_addLog(), and ilObjTest\_getObjectIDFromActiveID().

Referenced by _setReachedPoints(), calculateResultsFromSolution(), assKprimChoice\isComplete(), assMultipleChoice\isForcedEmptySolution(), assNumeric\isValidSolutionSubmit(), log(), assErrorText\logUserAction(), assOrderingHorizontal\saveWorkingData(), assSingleChoice\saveWorkingData(), assTextQuestion\saveWorkingData(), assTextSubset\saveWorkingData(), assLongMenu\saveWorkingData(), assFileUpload\saveWorkingData(), assImagemapQuestion\saveWorkingData(), assFormulaQuestion\saveWorkingData(), assMatchingQuestion\saveWorkingData(), and assClozeTest\saveWorkingData().

772  : void
773  {
774  global $DIC;
775  $original_id = $DIC->testQuestionPool()->questionInfo()->getOriginalId($question_id);
776 
778  $DIC->user()->getId(),
780  $logtext,
781  $question_id,
783  );
784  }
static _addLog( $user_id, $object_id, $logtext, $question_id=0, $original_id=0, $test_only=false, $test_ref_id=0)
Add an assessment log entry.
static _getObjectIDFromActiveID($active_id)
Returns the ILIAS test object id for a given active id.
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lookupForExistingSolutions()

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

Lookup if an authorized or intermediate solution exists.

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

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

References getId(), and getStep().

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

2902  : array
2903  {
2904  $return = array(
2905  'authorized' => false,
2906  'intermediate' => false
2907  );
2908 
2909  $query = "
2910  SELECT authorized, COUNT(*) cnt
2911  FROM tst_solutions
2912  WHERE active_fi = %s
2913  AND question_fi = %s
2914  AND pass = %s
2915  ";
2916 
2917  if ($this->getStep() !== null) {
2918  $query .= " AND step = " . $this->db->quote((int) $this->getStep(), 'integer') . " ";
2919  }
2920 
2921  $query .= "
2922  GROUP BY authorized
2923  ";
2924 
2925  $result = $this->db->queryF($query, array('integer', 'integer', 'integer'), array($activeId, $this->getId(), $pass));
2926 
2927  while ($row = $this->db->fetchAssoc($result)) {
2928  if ($row['authorized']) {
2929  $return['authorized'] = $row['cnt'] > 0;
2930  } else {
2931  $return['intermediate'] = $row['cnt'] > 0;
2932  }
2933  }
2934  return $return;
2935  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lookupMaxStep()

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

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

References getId().

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

2884  : int
2885  {
2886  $result = $this->db->queryF(
2887  "SELECT MAX(step) max_step FROM tst_solutions WHERE active_fi = %s AND pass = %s AND question_fi = %s",
2888  array("integer", "integer", "integer"),
2889  array($active_id, $pass, $this->getId())
2890  );
2891 
2892  $row = $this->db->fetchAssoc($result);
2893 
2894  return (int) $row['max_step'];
2895  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lookupParentObjId()

static assQuestion::lookupParentObjId ( int  $questionId)
static

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

References $DIC, $ilDB, and $res.

Referenced by ilObjTestGUI\copyAndLinkToQuestionpoolObject(), and ilAssQuestionSkillAssignmentsGUI\isSyncOriginalPossibleAndAllowed().

2359  : int
2360  {
2361  global $DIC;
2362  $ilDB = $DIC['ilDB'];
2363 
2364  $query = "SELECT obj_fi FROM qpl_questions WHERE question_id = %s";
2365 
2366  $res = $ilDB->queryF($query, array('integer'), array($questionId));
2367  $row = $ilDB->fetchAssoc($res);
2368 
2369  return $row['obj_fi'];
2370  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ migrateContentForLearningModule()

assQuestion::migrateContentForLearningModule ( ilAssSelfAssessmentMigrator  $migrator)

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

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

Referenced by ilAssSelfAssessmentQuestionFormatter\prepareQuestionForLearningModule().

2318  : void
2319  {
2320  $this->lmMigrateQuestionTypeGenericContent($migrator);
2321  $this->lmMigrateQuestionTypeSpecificContent($migrator);
2322  $this->saveToDb();
2323 
2324  $this->feedbackOBJ->migrateContentForLearningModule($migrator, $this->getId());
2325  }
lmMigrateQuestionTypeSpecificContent(ilAssSelfAssessmentMigrator $migrator)
lmMigrateQuestionTypeGenericContent(ilAssSelfAssessmentMigrator $migrator)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ onCopy()

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

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

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

1424  : void
1425  {
1426  $this->copySuggestedSolutions($targetQuestionId);
1427  $this->copySuggestedSolutionFiles($sourceParentId, $sourceQuestionId);
1428  $this->feedbackOBJ->duplicateFeedback($sourceQuestionId, $targetQuestionId);
1429  $this->duplicateQuestionHints($sourceQuestionId, $targetQuestionId);
1430  $this->duplicateSkillAssignments($sourceParentId, $sourceQuestionId, $targetParentId, $targetQuestionId);
1431  $this->duplicateComments($sourceParentId, $sourceQuestionId, $targetParentId, $targetQuestionId);
1432  }
duplicateSkillAssignments(int $srcParentId, int $srcQuestionId, int $trgParentId, int $trgQuestionId)
duplicateComments(int $parent_source_id, int $source_id, int $parent_target_id, int $target_id)
copySuggestedSolutionFiles(int $source_questionpool_id, int $source_question_id)
duplicateQuestionHints(int $originalQuestionId, int $duplicateQuestionId)
copySuggestedSolutions(int $target_question_id)
+ Here is the call graph for this function:

◆ onDuplicate()

assQuestion::onDuplicate ( int  $originalParentId,
int  $originalQuestionId,
int  $duplicateParentId,
int  $duplicateQuestionId 
)
protected

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

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

1405  : void
1406  {
1407  $this->copySuggestedSolutions($duplicateQuestionId);
1408  $this->duplicateSuggestedSolutionFiles($originalParentId, $originalQuestionId);
1409  $this->feedbackOBJ->duplicateFeedback($originalQuestionId, $duplicateQuestionId);
1410  $this->duplicateQuestionHints($originalQuestionId, $duplicateQuestionId);
1411  $this->duplicateSkillAssignments($originalParentId, $originalQuestionId, $duplicateParentId, $duplicateQuestionId);
1412  $this->duplicateComments($originalParentId, $originalQuestionId, $duplicateParentId, $duplicateQuestionId);
1413  }
duplicateSkillAssignments(int $srcParentId, int $srcQuestionId, int $trgParentId, int $trgQuestionId)
duplicateComments(int $parent_source_id, int $source_id, int $parent_target_id, int $target_id)
duplicateQuestionHints(int $originalQuestionId, int $duplicateQuestionId)
duplicateSuggestedSolutionFiles(int $parent_id, int $question_id)
Duplicates the files of a suggested solution if the question is duplicated.
copySuggestedSolutions(int $target_question_id)
+ Here is the call graph for this function:

◆ persistPreviewState()

assQuestion::persistPreviewState ( ilAssQuestionPreviewSession  $previewSession)
final

persists the preview state for current user and question

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

References savePreviewData(), and validateSolutionSubmit().

746  : bool
747  {
748  $this->savePreviewData($previewSession);
749  return $this->validateSolutionSubmit();
750  }
savePreviewData(ilAssQuestionPreviewSession $previewSession)
+ Here is the call graph for this function:

◆ persistWorkingState()

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

persists the working state for current testactive and testpass

Returns
bool if saving happened

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

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

716  : bool
717  {
718  if (!$this instanceof ilAssQuestionPartiallySaveable && !$this->validateSolutionSubmit()) {
719  return false;
720  }
721 
722  $saveStatus = false;
723 
724  $this->getProcessLocker()->executePersistWorkingStateLockOperation(function () use ($active_id, $pass, $authorized, $obligationsEnabled, &$saveStatus) {
725  if ($pass === null) {
726  $pass = ilObjTest::_getPass($active_id);
727  }
728 
729  $saveStatus = $this->saveWorkingData($active_id, $pass, $authorized);
730 
731  if ($authorized) {
732  // fau: testNav - remove an intermediate solution if the authorized solution is saved
733  // the intermediate solution would set the displayed question status as "editing ..."
734  $this->removeIntermediateSolution($active_id, $pass);
735  // fau.
736  $this->calculateResultsFromSolution($active_id, $pass, $obligationsEnabled);
737  }
738  });
739 
740  return $saveStatus;
741  }
static _getPass($active_id)
Retrieves the actual pass of a given user for a given test.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
saveWorkingData(int $active_id, int $pass, bool $authorized=true)
Saves the learners input of the question to the database.
removeIntermediateSolution(int $active_id, int $pass)
calculateResultsFromSolution(int $active_id, int $pass, bool $obligationsEnabled=false)
Calculates the question results from a previously saved question solution.
+ Here is the call graph for this function:

◆ purifyAndPrepareTextAreaOutput()

assQuestion::purifyAndPrepareTextAreaOutput ( string  $content)
protected

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

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

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

2039  : string
2040  {
2041  $purified_content = $this->getHtmlQuestionContentPurifier()->purify($content);
2043  || !(new ilSetting('advanced_editing'))->get('advanced_editing_javascript_editor') === 'tinymce') {
2044  $purified_content = nl2br($purified_content);
2045  }
2047  $purified_content,
2048  true,
2049  true
2050  );
2051  }
isAdditionalContentEditingModePageObject()
static prepareTextareaOutput(string $txt_output, bool $prepare_for_latex_output=false, bool $omitNl2BrWhenTextArea=false)
Prepares a string for a text area output where latex code may be in it If the text is HTML-free...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeAllExistingSolutions()

assQuestion::removeAllExistingSolutions ( )

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

References getId().

2947  : void
2948  {
2949  $query = "DELETE FROM tst_solutions WHERE question_fi = %s";
2950  $this->db->manipulateF($query, array('integer'), array($this->getId()));
2951  }
+ Here is the call graph for this function:

◆ removeCurrentSolution()

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

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

References getId(), and getStep().

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

2630  : int
2631  {
2632  if ($this->getStep() !== null) {
2633  $query = '
2634  DELETE FROM tst_solutions
2635  WHERE active_fi = %s
2636  AND question_fi = %s
2637  AND pass = %s
2638  AND step = %s
2639  AND authorized = %s
2640  ';
2641 
2642  return $this->db->manipulateF(
2643  $query,
2644  array('integer', 'integer', 'integer', 'integer', 'integer'),
2645  array($active_id, $this->getId(), $pass, $this->getStep(), (int) $authorized)
2646  );
2647  }
2648 
2649  $query = "
2650  DELETE FROM tst_solutions
2651  WHERE active_fi = %s
2652  AND question_fi = %s
2653  AND pass = %s
2654  AND authorized = %s
2655  ";
2656 
2657  return $this->db->manipulateF(
2658  $query,
2659  array('integer', 'integer', 'integer', 'integer'),
2660  array($active_id, $this->getId(), $pass, (int) $authorized)
2661  );
2662  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeExistingSolutions()

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

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

References getId(), and getStep().

Referenced by resetUsersAnswer().

2953  : int
2954  {
2955  $query = "
2956  DELETE FROM tst_solutions
2957  WHERE active_fi = %s
2958  AND question_fi = %s
2959  AND pass = %s
2960  ";
2961 
2962  if ($this->getStep() !== null) {
2963  $query .= " AND step = " . $this->db->quote((int) $this->getStep(), 'integer') . " ";
2964  }
2965 
2966  return $this->db->manipulateF(
2967  $query,
2968  array('integer', 'integer', 'integer'),
2969  array($activeId, $this->getId(), $pass)
2970  );
2971  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeIntermediateSolution()

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

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

References getProcessLocker(), and removeCurrentSolution().

Referenced by persistWorkingState().

2620  : void
2621  {
2622  $this->getProcessLocker()->executeUserSolutionUpdateLockOperation(function () use ($active_id, $pass) {
2623  $this->removeCurrentSolution($active_id, $pass, false);
2624  });
2625  }
removeCurrentSolution(int $active_id, int $pass, bool $authorized=true)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeResultRecord()

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

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

References getId(), and getStep().

Referenced by resetUsersAnswer().

2993  : int
2994  {
2995  $query = "
2996  DELETE FROM tst_test_result
2997  WHERE active_fi = %s
2998  AND question_fi = %s
2999  AND pass = %s
3000  ";
3001 
3002  if ($this->getStep() !== null) {
3003  $query .= " AND step = " . $this->db->quote((int) $this->getStep(), 'integer') . " ";
3004  }
3005 
3006  return $this->db->manipulateF(
3007  $query,
3008  array('integer', 'integer', 'integer'),
3009  array($activeId, $this->getId(), $pass)
3010  );
3011  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeSolutionRecordById()

assQuestion::removeSolutionRecordById ( int  $solutionId)
protected

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

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

2592  : int
2593  {
2594  return $this->db->manipulateF(
2595  "DELETE FROM tst_solutions WHERE solution_id = %s",
2596  array('integer'),
2597  array($solutionId)
2598  );
2599  }
+ Here is the caller graph for this function:

◆ resetOriginalId()

static assQuestion::resetOriginalId ( int  $questionId)
static

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

References $DIC, and $ilDB.

Referenced by ilTestRandomQuestionSetPoolDeriver\updateTestQuestionStage().

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  }
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ resetUsersAnswer()

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

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

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

2973  : void
2974  {
2975  $this->removeExistingSolutions($activeId, $pass);
2976  $this->removeResultRecord($activeId, $pass);
2977 
2978  $this->log($activeId, "log_user_solution_willingly_deleted");
2979 
2980  $test = new ilObjTest(
2981  $this->test_id,
2982  false
2983  );
2984  $test->updateTestPassResults(
2985  $activeId,
2986  $pass,
2988  $this->getProcessLocker(),
2989  $this->getTestId()
2990  );
2991  }
removeResultRecord(int $activeId, int $pass)
log(int $active_id, string $langVar)
removeExistingSolutions(int $activeId, int $pass)
+ Here is the call graph for this function:

◆ resolveInternalLink()

assQuestion::resolveInternalLink ( string  $internal_link)

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

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

Referenced by resolveSuggestedSolutionLinks().

1611  : string
1612  {
1613  if (preg_match("/il_(\d+)_(\w+)_(\d+)/", $internal_link, $matches)) {
1614  switch ($matches[2]) {
1615  case "lm":
1616  $resolved_link = ilLMObject::_getIdForImportId($internal_link);
1617  break;
1618  case "pg":
1619  $resolved_link = ilInternalLink::_getIdForImportId("PageObject", $internal_link);
1620  break;
1621  case "st":
1622  $resolved_link = ilInternalLink::_getIdForImportId("StructureObject", $internal_link);
1623  break;
1624  case "git":
1625  $resolved_link = ilInternalLink::_getIdForImportId("GlossaryItem", $internal_link);
1626  break;
1627  case "mob":
1628  $resolved_link = ilInternalLink::_getIdForImportId("MediaObject", $internal_link);
1629  break;
1630  }
1631  if ($resolved_link === null | $resolved_link === 0) {
1632  $resolved_link = "il__{$matches[2]}_{$matches[3]}";
1633  }
1634  } else {
1635  $resolved_link = $internal_link;
1636  }
1637  return $resolved_link ?? '';
1638  }
static _getIdForImportId(string $a_import_id)
get current object id for import id (static)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resolveSuggestedSolutionLinks()

assQuestion::resolveSuggestedSolutionLinks ( )

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

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

1640  : void
1641  {
1642  $resolvedlinks = 0;
1643  $result = $this->db->queryF(
1644  "SELECT * FROM qpl_sol_sug WHERE question_fi = %s",
1645  array('integer'),
1646  array($this->getId())
1647  );
1648  if ($this->db->numRows($result) > 0) {
1649  while ($row = $this->db->fetchAssoc($result)) {
1650  $internal_link = $row["internal_link"];
1651  $resolved_link = $this->resolveInternalLink($internal_link);
1652  if ($internal_link !== $resolved_link) {
1653  // internal link was resolved successfully
1654  $this->db->manipulateF(
1655  "UPDATE qpl_sol_sug SET internal_link = %s WHERE suggested_solution_id = %s",
1656  array('text','integer'),
1657  array($resolved_link, $row["suggested_solution_id"])
1658  );
1659  $resolvedlinks++;
1660  }
1661  }
1662  }
1663  if ($resolvedlinks) {
1664  // there are resolved links -> reenter theses links to the database
1665  // delete all internal links from the database
1667 
1668  $result = $this->db->queryF(
1669  "SELECT * FROM qpl_sol_sug WHERE question_fi = %s",
1670  array('integer'),
1671  array($this->getId())
1672  );
1673  if ($this->db->numRows($result) > 0) {
1674  while ($row = $this->db->fetchAssoc($result)) {
1675  if (preg_match("/il_(\d*?)_(\w+)_(\d+)/", $row["internal_link"], $matches)) {
1676  ilInternalLink::_saveLink("qst", $this->getId(), $matches[2], $matches[3], $matches[1]);
1677  }
1678  }
1679  }
1680  }
1681  }
resolveInternalLink(string $internal_link)
+ Here is the call graph for this function:

◆ saveCurrentSolution()

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

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

References getId(), and getStep().

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

2665  : int
2666  {
2667  $next_id = $this->db->nextId("tst_solutions");
2668 
2669  $fieldData = array(
2670  "solution_id" => array("integer", $next_id),
2671  "active_fi" => array("integer", $active_id),
2672  "question_fi" => array("integer", $this->getId()),
2673  "value1" => array("clob", $value1),
2674  "value2" => array("clob", $value2),
2675  "pass" => array("integer", $pass),
2676  "tstamp" => array("integer", ((int) $tstamp > 0) ? (int) $tstamp : time()),
2677  'authorized' => array('integer', (int) $authorized)
2678  );
2679 
2680  if ($this->getStep() !== null) {
2681  $fieldData['step'] = array("integer", $this->getStep());
2682  }
2683 
2684  return $this->db->insert("tst_solutions", $fieldData);
2685  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveOriginalId()

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

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

References $DIC, and $ilDB.

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

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  }
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ savePreviewData()

assQuestion::savePreviewData ( ilAssQuestionPreviewSession  $previewSession)
protected

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

References ilAssQuestionPreviewSession\setParticipantsSolution().

Referenced by persistPreviewState().

767  : void
768  {
769  $previewSession->setParticipantsSolution($this->getSolutionSubmit());
770  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveQuestionDataToDb()

assQuestion::saveQuestionDataToDb ( int  $original_id = -1)

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

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

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

1309  : void
1310  {
1311  if ($this->getId() == -1) {
1312  $next_id = $this->db->nextId('qpl_questions');
1313  $this->db->insert("qpl_questions", array(
1314  "question_id" => array("integer", $next_id),
1315  "question_type_fi" => array("integer", $this->getQuestionTypeID()),
1316  "obj_fi" => array("integer", $this->getObjId()),
1317  "title" => ["text", mb_substr($this->getTitle(), 0, 124)],
1318  "description" => ["text", mb_substr($this->getComment(), 0, 1000)],
1319  "author" => ["text", mb_substr($this->getAuthor(), 0, 512)],
1320  "owner" => array("integer", $this->getOwner()),
1321  "question_text" => array("clob", ilRTE::_replaceMediaObjectImageSrc($this->getQuestion(), 0)),
1322  "points" => array("float", $this->getMaximumPoints()),
1323  "nr_of_tries" => array("integer", $this->getNrOfTries()),
1324  "created" => array("integer", time()),
1325  "original_id" => array("integer", ($original_id != -1) ? $original_id : null),
1326  "tstamp" => array("integer", time()),
1327  "external_id" => array("text", $this->getExternalId()),
1328  'add_cont_edit_mode' => array('text', $this->getAdditionalContentEditingMode())
1329  ));
1330  $this->setId($next_id);
1331  // create page object of question
1332  $this->createPageObject();
1333  } else {
1334  // Vorhandenen Datensatz aktualisieren
1335  $this->db->update("qpl_questions", array(
1336  "obj_fi" => array("integer", $this->getObjId()),
1337  "title" => ["text", mb_substr($this->getTitle(), 0, 124)],
1338  "description" => ["text", mb_substr($this->getComment(), 0, 1000)],
1339  "author" => ["text", mb_substr($this->getAuthor(), 0, 512)],
1340  "question_text" => array("clob", ilRTE::_replaceMediaObjectImageSrc($this->getQuestion(), 0)),
1341  "points" => array("float", $this->getMaximumPoints()),
1342  "nr_of_tries" => array("integer", $this->getNrOfTries()),
1343  "tstamp" => array("integer", time()),
1344  'complete' => array('integer', $this->isComplete()),
1345  "external_id" => array("text", $this->getExternalId())
1346  ), array(
1347  "question_id" => array("integer", $this->getId())
1348  ));
1349  }
1350  }
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...
isComplete()
Returns true, if a question is complete for use.
setId(int $id=-1)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveToDb()

assQuestion::saveToDb ( )

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

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

Referenced by assSingleChoice\isComplete(), and migrateContentForLearningModule().

1352  : void
1353  {
1354  // remove unused media objects from ILIAS
1355  $this->cleanupMediaObjectUsage();
1356 
1357  $complete = "0";
1358  if ($this->isComplete()) {
1359  $complete = "1";
1360  }
1361 
1362  $this->db->update(
1363  'qpl_questions',
1364  [
1365  'tstamp' => ['integer', time()],
1366  'owner' => ['integer', $this->getOwner()],
1367  'complete' => ['integer', $complete],
1368  'lifecycle' => ['text', $this->getLifecycle()->getIdentifier()],
1369  ],
1370  [
1371  'question_id' => array('integer', $this->getId())
1372  ]
1373  );
1374 
1376  }
isComplete()
Returns true, if a question is complete for use.
static _updateQuestionCount(int $object_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveWorkingData()

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

Saves the learners input of the question to the database.

Parameters
int$active_idActive id of the user
int$passTest pass
bool$authorized
Returns
bool $status

Referenced by assKprimChoice\isComplete(), assMultipleChoice\isForcedEmptySolution(), assNumeric\isValidSolutionSubmit(), persistWorkingState(), and validateSolutionSubmit().

+ Here is the caller graph for this function:

◆ setAdditionalContentEditingMode()

assQuestion::setAdditionalContentEditingMode ( ?string  $additionalContentEditingMode)

◆ setAuthor()

◆ setComment()

◆ setDefaultNrOfTries()

assQuestion::setDefaultNrOfTries ( int  $defaultnroftries)

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

References $defaultnroftries.

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

◆ setExportDetailsXLSX()

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

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

References ilExcel\getColumnCoord(), getQuestionType(), getTitle(), ILIAS\Repository\lng(), and ilAssExcelFormatHelper\setFormattedExcelTitle().

2256  : int
2257  {
2258  $worksheet->setFormattedExcelTitle($worksheet->getColumnCoord($col) . $startrow, $this->lng->txt($this->getQuestionType()));
2259  $worksheet->setFormattedExcelTitle($worksheet->getColumnCoord($col + 1) . $startrow, $this->getTitle());
2260 
2261  return $startrow;
2262  }
getQuestionType()
Returns the question type of the question.
getColumnCoord(int $a_col)
Get column "name" from number.
setFormattedExcelTitle($coordinates, $value)
+ Here is the call graph for this function:

◆ setExportImagePath()

assQuestion::setExportImagePath ( string  $path)

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

References $path.

2274  : void
2275  {
2276  $this->export_image_path = $path;
2277  }
$path
Definition: ltiservices.php:32

◆ setExternalId()

assQuestion::setExternalId ( ?string  $external_id)

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

References $external_id.

Referenced by __construct().

494  : void
495  {
496  $this->external_id = $external_id;
497  }
+ Here is the caller graph for this function:

◆ setForcePassResultUpdateEnabled()

static assQuestion::setForcePassResultUpdateEnabled ( bool  $forcePassResultsUpdateEnabled)
static

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

References $forcePassResultsUpdateEnabled.

223  : void
224  {
225  self::$forcePassResultsUpdateEnabled = $forcePassResultsUpdateEnabled;
226  }
static $forcePassResultsUpdateEnabled

◆ setId()

◆ setLastChange()

assQuestion::setLastChange (   $lastChange)

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

References $lastChange.

Referenced by assKprimChoice\loadFromDb().

2546  : void
2547  {
2548  $this->lastChange = $lastChange;
2549  }
+ Here is the caller graph for this function:

◆ setLifecycle()

◆ setNrOfTries()

◆ setObjId()

◆ setObligationsToBeConsidered()

assQuestion::setObligationsToBeConsidered ( bool  $obligationsToBeConsidered)

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

References $obligationsToBeConsidered.

3040  : void
3041  {
3042  $this->obligationsToBeConsidered = $obligationsToBeConsidered;
3043  }
bool $obligationsToBeConsidered

◆ setOriginalId()

◆ setOwner()

◆ setPoints()

◆ setPreventRteUsage()

assQuestion::setPreventRteUsage ( bool  $prevent_rte_usage)

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

References $prevent_rte_usage.

2308  : void
2309  {
2310  $this->prevent_rte_usage = $prevent_rte_usage;
2311  }

◆ setProcessLocker()

assQuestion::setProcessLocker ( ilAssQuestionProcessLocker  $processLocker)

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

References $processLocker.

281  : void
282  {
283  $this->processLocker = $processLocker;
284  }
ilAssQuestionProcessLocker $processLocker

◆ setQuestion()

◆ setSelfAssessmentEditingMode()

assQuestion::setSelfAssessmentEditingMode ( bool  $selfassessmenteditingmode)

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

References $selfassessmenteditingmode.

2337  : void
2338  {
2339  $this->selfassessmenteditingmode = $selfassessmenteditingmode;
2340  }
bool $selfassessmenteditingmode

◆ setShuffle()

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

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

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

377  : void
378  {
379  $this->shuffle = $shuffle ?? false;
380  }
bool $shuffle
Indicates whether the answers will be shuffled or not.
+ Here is the caller graph for this function:

◆ setShuffler()

assQuestion::setShuffler ( Transformation  $shuffler)

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

References $shuffler.

Referenced by assMatchingQuestion\toJSON().

276  : void
277  {
278  $this->shuffler = $shuffler;
279  }
Transformation $shuffler
+ Here is the caller graph for this function:

◆ setStep()

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

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

References $step.

Referenced by assFileUpload\getUploadedFilesForWeb().

2829  : void
2830  {
2831  $this->step = $step;
2832  }
+ Here is the caller graph for this function:

◆ setTestId()

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

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

References $id.

367  : void
368  {
369  $this->test_id = $id;
370  }

◆ setThumbSize()

assQuestion::setThumbSize ( int  $a_size)

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

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

440  : void
441  {
442  if ($a_size >= self::MINIMUM_THUMB_SIZE) {
443  $this->thumb_size = $a_size;
444  } else {
445  throw new ilException("Thumb size must be at least " . self::MINIMUM_THUMB_SIZE . "px");
446  }
447  }
+ Here is the caller graph for this function:

◆ setTitle()

◆ syncHints()

assQuestion::syncHints ( )

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

References getId().

Referenced by syncWithOriginal().

2079  : void
2080  {
2081  // delete hints of the original
2082  $this->db->manipulateF(
2083  "DELETE FROM qpl_hints WHERE qht_question_fi = %s",
2084  array('integer'),
2085  array($this->original_id)
2086  );
2087 
2088  // get hints of the actual question
2089  $result = $this->db->queryF(
2090  "SELECT * FROM qpl_hints WHERE qht_question_fi = %s",
2091  array('integer'),
2092  array($this->getId())
2093  );
2094 
2095  // save hints to the original
2096  if ($this->db->numRows($result) > 0) {
2097  while ($row = $this->db->fetchAssoc($result)) {
2098  $next_id = $this->db->nextId('qpl_hints');
2099  $this->db->insert(
2100  'qpl_hints',
2101  array(
2102  'qht_hint_id' => array('integer', $next_id),
2103  'qht_question_fi' => array('integer', $this->original_id),
2104  'qht_hint_index' => array('integer', $row["qht_hint_index"]),
2105  'qht_hint_points' => array('float', $row["qht_hint_points"]),
2106  'qht_hint_text' => array('text', $row["qht_hint_text"]),
2107  )
2108  );
2109  }
2110  }
2111  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ syncSkillAssignments()

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

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

References duplicateSkillAssignments().

2412  : void
2413  {
2414  $assignmentList = new ilAssQuestionSkillAssignmentList($this->db);
2415  $assignmentList->setParentObjId($trgParentId);
2416  $assignmentList->setQuestionIdFilter($trgQuestionId);
2417  $assignmentList->loadFromDb();
2418 
2419  foreach ($assignmentList->getAssignmentsByQuestionId($trgQuestionId) as $assignment) {
2420  $assignment->deleteFromDb();
2421 
2422  // remove skill usage
2423  if (!$assignment->isSkillUsed()) {
2424  $this->skillUsageService->removeUsage(
2425  $assignment->getParentObjId(),
2426  $assignment->getSkillBaseId(),
2427  $assignment->getSkillTrefId()
2428  );
2429  }
2430  }
2431 
2432  $this->duplicateSkillAssignments($srcParentId, $srcQuestionId, $trgParentId, $trgQuestionId);
2433  }
duplicateSkillAssignments(int $srcParentId, int $srcQuestionId, int $trgParentId, int $trgQuestionId)
+ Here is the call graph for this function:

◆ syncSuggestedSolutionFiles()

assQuestion::syncSuggestedSolutionFiles ( int  $target_question_id,
int  $target_obj_id 
)
protected

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

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

Referenced by syncSuggestedSolutions().

1557  : void {
1558  $filepath = $this->getSuggestedSolutionPath();
1559  $filepath_original = str_replace(
1560  "{$this->getObjId()}/{$this->id}/solution",
1561  "{$target_obj_id}/{$target_question_id}/solution",
1562  $filepath
1563  );
1564  ilFileUtils::delDir($filepath_original);
1565  foreach ($this->suggested_solutions as $index => $solution) {
1566  if ($solution->isOfTypeFile()) {
1567  if (!file_exists($filepath_original)) {
1568  ilFileUtils::makeDirParents($filepath_original);
1569  }
1570  $filename = $solution->getFilename();
1571  if (strlen($filename)) {
1572  if (!@copy($filepath . $filename, $filepath_original . $filename)) {
1573  $this->ilLog->root()->error("File could not be duplicated!!!!");
1574  $this->ilLog->root()->error("object: " . print_r($this, true));
1575  }
1576  }
1577  }
1578  }
1579  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: class.ilLog.php:30
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
$filename
Definition: buildRTE.php:78
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ syncSuggestedSolutions()

assQuestion::syncSuggestedSolutions ( int  $target_question_id,
int  $target_obj_id 
)
protected

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

References getId(), getSuggestedSolutionsRepo(), and syncSuggestedSolutionFiles().

Referenced by syncWithOriginal().

1521  : void {
1522  $this->getSuggestedSolutionsRepo()->syncForQuestion($this->getId(), $target_question_id);
1523  $this->syncSuggestedSolutionFiles($target_question_id, $target_obj_id);
1524  }
syncSuggestedSolutionFiles(int $target_question_id, int $target_obj_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ syncWithOriginal()

assQuestion::syncWithOriginal ( )

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

References afterSyncWithOriginal(), beforeSyncWithOriginal(), getId(), getObjId(), getOriginalId(), syncHints(), syncSuggestedSolutions(), and syncXHTMLMediaObjectsOfQuestion().

1715  : void
1716  {
1717  $original_id = $this->getOriginalId();
1718  if ($original_id === null) {
1719  return; // No original -> no sync
1720  }
1721 
1722  $original_obj_id = self::lookupParentObjId($this->getOriginalId());
1723 
1724  if (!$original_obj_id) {
1725  return; // Original does not exist -> no sync
1726  }
1727 
1728  $this->beforeSyncWithOriginal($this->getOriginalId(), $this->getId(), $original_obj_id, $this->getObjId());
1729 
1730  $original = clone $this;
1731  // Now we become the original
1732  $original->setId($this->getOriginalId());
1733  $original->setOriginalId(null);
1734  $original->setObjId($original_obj_id);
1735 
1736  $original->saveToDb();
1737 
1738  $original->deletePageOfQuestion($this->getOriginalId());
1739  $original->createPageObject();
1740  $original->copyPageOfQuestion($this->getId());
1741 
1742  $this->syncSuggestedSolutions($this->getOriginalId(), $original_obj_id);
1744  $this->afterSyncWithOriginal($this->getOriginalId(), $this->getId(), $original_obj_id, $this->getObjId());
1745  $this->syncHints();
1746  }
syncSuggestedSolutions(int $target_question_id, int $target_obj_id)
afterSyncWithOriginal(int $origQuestionId, int $dupQuestionId, int $origParentObjId, int $dupParentObjId)
beforeSyncWithOriginal(int $origQuestionId, int $dupQuestionId, int $origParentObjId, int $dupParentObjId)
+ Here is the call graph for this function:

◆ syncXHTMLMediaObjectsOfQuestion()

assQuestion::syncXHTMLMediaObjectsOfQuestion ( )

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

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

Referenced by syncWithOriginal().

1137  : void
1138  {
1139  $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $this->getId());
1140  foreach ($mobs as $mob) {
1141  ilObjMediaObject::_saveUsage($mob, "qpl:html", $this->original_id);
1142  }
1143  }
static _saveUsage(int $a_mob_id, string $a_type, int $a_id, int $a_usage_hist_nr=0, string $a_lang="-")
Save usage of mob within another container (e.g.
static _getMobsOfObject(string $a_type, int $a_id, int $a_usage_hist_nr=0, string $a_lang="-")
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toJSON()

assQuestion::toJSON ( )

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

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

2854  : string
2855  {
2856  return json_encode([]);
2857  }
+ Here is the call graph for this function:

◆ toXML()

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

Returns a QTI xml representation of the question.

Returns
string The QTI xml representation of the question

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

References getQuestionType(), and isComplete().

344  : string {
345  $classname = $this->getQuestionType() . "Export";
346  $export = new $classname($this);
347  return $export->toXML($a_include_header, $a_include_binary, $a_shuffle, $test_output, $force_image_references);
348  }
getQuestionType()
Returns the question type of the question.
+ Here is the call graph for this function:

◆ updateCurrentSolution()

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

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

References getStep().

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

2688  : int
2689  {
2690  $fieldData = array(
2691  "value1" => array("clob", $value1),
2692  "value2" => array("clob", $value2),
2693  "tstamp" => array("integer", time()),
2694  'authorized' => array('integer', (int) $authorized)
2695  );
2696 
2697  if ($this->getStep() !== null) {
2698  $fieldData['step'] = array("integer", $this->getStep());
2699  }
2700 
2701  return $this->db->update("tst_solutions", $fieldData, array(
2702  'solution_id' => array('integer', $solutionId)
2703  ));
2704  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateCurrentSolutionsAuthorization()

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

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

References getId(), and getStep().

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

2707  : int
2708  {
2709  $fieldData = array(
2710  'authorized' => array('integer', (int) $authorized)
2711  );
2712 
2713  if (!$keepTime) {
2714  $fieldData['tstamp'] = array('integer', time());
2715  }
2716 
2717  $whereData = array(
2718  'question_fi' => array('integer', $this->getId()),
2719  'active_fi' => array('integer', $activeId),
2720  'pass' => array('integer', $pass)
2721  );
2722 
2723  if ($this->getStep() !== null) {
2724  $whereData['step'] = array("integer", $this->getStep());
2725  }
2726 
2727  return $this->db->update('tst_solutions', $fieldData, $whereData);
2728  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateTimestamp()

assQuestion::updateTimestamp ( )

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

References getId().

3045  : void
3046  {
3047  $this->db->manipulateF(
3048  "UPDATE qpl_questions SET tstamp = %s WHERE question_id = %s",
3049  array('integer', 'integer'),
3050  array(time(), $this->getId())
3051  );
3052  }
+ Here is the call graph for this function:

◆ validateSolutionSubmit()

assQuestion::validateSolutionSubmit ( )

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

References saveWorkingData().

Referenced by persistPreviewState(), and persistWorkingState().

752  : bool
753  {
754  return true;
755  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $additionalContentEditingMode

string assQuestion::$additionalContentEditingMode = ''
private

◆ $author

◆ $comment

◆ $current_user

ilObjUser assQuestion::$current_user
protected

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

Referenced by createNewQuestion().

◆ $db

ilDBInterface assQuestion::$db
protected

◆ $defaultnroftries

int assQuestion::$defaultnroftries = 0

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

Referenced by getDefaultNrOfTries(), and setDefaultNrOfTries().

◆ $dic

Container assQuestion::$dic
protected

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

◆ $export_image_path

string assQuestion::$export_image_path
private

(Web) Path to images

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

Referenced by getImagePathWeb().

◆ $external_id

string assQuestion::$external_id = null
protected

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

Referenced by getExternalId(), and setExternalId().

◆ $feedbackOBJ

ilAssQuestionFeedback assQuestion::$feedbackOBJ

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

◆ $forcePassResultsUpdateEnabled

assQuestion::$forcePassResultsUpdateEnabled = false
staticprotected

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

Referenced by setForcePassResultUpdateEnabled().

◆ $http

ILIAS HTTP Services assQuestion::$http
protected

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

◆ $id

◆ $ilias

assQuestion::$ilias
protected

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

◆ $ilLog

◆ $imageSourceFixReplaceMap

assQuestion::$imageSourceFixReplaceMap
staticprotected
Initial value:
= array(
'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 1185 of file class.assQuestion.php.

◆ $lastChange

assQuestion::$lastChange
protected

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

Referenced by getLastChange(), and setLastChange().

◆ $lifecycle

ilAssQuestionLifecycle assQuestion::$lifecycle
protected

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

Referenced by getLifecycle(), and setLifecycle().

◆ $lng

ilLanguage assQuestion::$lng
protected

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

Referenced by __construct().

◆ $nr_of_tries

int assQuestion::$nr_of_tries
private

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

Referenced by getNrOfTries().

◆ $obj_id

int assQuestion::$obj_id = 0
protected

Object id of the container object.

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

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

◆ $obligationsToBeConsidered

bool assQuestion::$obligationsToBeConsidered = false
private

◆ $original_id

◆ $owner

◆ $page

assQuestion::$page
protected

◆ $points

float assQuestion::$points
protected

The maximum available points for the question.

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

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

◆ $prevent_rte_usage

bool assQuestion::$prevent_rte_usage = false

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

Referenced by getPreventRteUsage(), and setPreventRteUsage().

◆ $processLocker

ilAssQuestionProcessLocker assQuestion::$processLocker
protected

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

Referenced by getProcessLocker(), and setProcessLocker().

◆ $question

◆ $questionActionCmd

string assQuestion::$questionActionCmd = 'handleQuestionAction'

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

◆ $questionFilesService

ILIAS TestQuestionPool QuestionFilesService assQuestion::$questionFilesService
protected

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

◆ $questioninfo

ILIAS TestQuestionPool QuestionInfoService assQuestion::$questioninfo
protected

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

◆ $refinery

ILIAS Refinery Factory assQuestion::$refinery
protected

◆ $selfassessmenteditingmode

bool assQuestion::$selfassessmenteditingmode = false

◆ $shuffle

bool assQuestion::$shuffle
protected

◆ $shuffler

Transformation assQuestion::$shuffler
protected

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

Referenced by getShuffler(), and setShuffler().

◆ $skillUsageService

SkillUsageService assQuestion::$skillUsageService
protected

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

◆ $step

assQuestion::$step
protected

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

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

◆ $suggested_solutions

array assQuestion::$suggested_solutions
protected

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

Referenced by getSuggestedSolutions().

◆ $suggestedsolution_repo

assQuestionSuggestedSolutionsDatabaseRepository assQuestion::$suggestedsolution_repo = null
protected

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

Referenced by getSuggestedSolutionsRepo().

◆ $test_id

int assQuestion::$test_id
protected

The database id of a test in which the question is contained.

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

Referenced by getTestId(), assFileUpload\getUploadedFilesForWeb(), assFileUpload\removeIntermediateSolution(), and assFileUpload\saveWorkingData().

◆ $testParticipantInfo

ILIAS Test TestParticipantInfoService assQuestion::$testParticipantInfo
protected

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

◆ $testQuestionConfig

ilTestQuestionConfig assQuestion::$testQuestionConfig
protected

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

◆ $testQuestionConfigInstance

ilTestQuestionConfig assQuestion::$testQuestionConfigInstance = null
private

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

Referenced by getTestPresentationConfig().

◆ $thumb_size

int assQuestion::$thumb_size
protected

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

Referenced by getThumbSize().

◆ $title

◆ $tpl

ilGlobalPageTemplate assQuestion::$tpl
protected

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

Referenced by __construct().

◆ ADDITIONAL_CONTENT_EDITING_MODE_IPE

◆ ADDITIONAL_CONTENT_EDITING_MODE_RTE

◆ DEFAULT_THUMB_SIZE

const assQuestion::DEFAULT_THUMB_SIZE = 150
private

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

◆ HAS_SPECIFIC_FEEDBACK

const assQuestion::HAS_SPECIFIC_FEEDBACK = true
protected

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

◆ KEY_VALUES_IMPLOSION_SEPARATOR

const assQuestion::KEY_VALUES_IMPLOSION_SEPARATOR = ':'

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

Referenced by explodeKeyValues(), and implodeKeyValues().

◆ MAXIMUM_THUMB_SIZE

const assQuestion::MAXIMUM_THUMB_SIZE = 8192
private

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

◆ MINIMUM_THUMB_SIZE

const assQuestion::MINIMUM_THUMB_SIZE = 20
private

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

◆ TRIM_PATTERN

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

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


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