ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 ( $title="", $comment="", $author="", $owner=-1, $question="")
 assQuestion constructor More...
 
 getShuffler ()
 
 setShuffler (ilArrayElementShuffler $shuffler)
 
 setProcessLocker ($processLocker)
 
 getProcessLocker ()
 
 fromXML (&$item, &$questionpool_id, &$tst_id, &$tst_object, &$question_counter, &$import_mapping)
 Receives parameters from a QTI parser and creates a valid ILIAS question object. More...
 
 toXML ($a_include_header=true, $a_include_binary=true, $a_shuffle=false, $test_output=false, $force_image_references=false)
 Returns a QTI xml representation of the question. More...
 
 isComplete ()
 Returns true, if a question is complete for use. More...
 
 questionTitleExists ($questionpool_id, $title)
 Returns TRUE if the question title exists in the database. More...
 
 setTitle ($title="")
 Sets the title string of the assQuestion object. More...
 
 setId ($id=-1)
 Sets the id of the assQuestion object. More...
 
 setTestId ($id=-1)
 Sets the test id of the assQuestion object. More...
 
 setComment ($comment="")
 Sets the comment string of the assQuestion object. More...
 
 setOutputType ($outputType=OUTPUT_HTML)
 Sets the output type. More...
 
 setShuffle ($shuffle=true)
 Sets the shuffle flag. More...
 
 setEstimatedWorkingTime ($hour=0, $min=0, $sec=0)
 Sets the estimated working time of a question from given hour, minute and second. More...
 
 setEstimatedWorkingTimeFromDurationString ($durationString)
 Sets the estimated working time of a question from a given datetime string. More...
 
 keyInArray ($searchkey, $array)
 returns TRUE if the key occurs in an array More...
 
 setAuthor ($author="")
 Sets the authors name of the assQuestion object. More...
 
 setOwner ($owner="")
 Sets the creator/owner ID of the assQuestion object. More...
 
 getTitle ()
 Gets the title string of the assQuestion object. More...
 
 getTitleFilenameCompliant ()
 returns the object title prepared to be used as a filename More...
 
 getId ()
 Gets the id of the assQuestion object. More...
 
 getShuffle ()
 Gets the shuffle flag. More...
 
 getTestId ()
 Gets the test id of the assQuestion object. More...
 
 getComment ()
 Gets the comment string of the assQuestion object. More...
 
 getOutputType ()
 Gets the output type. More...
 
 supportsJavascriptOutput ()
 Returns true if the question type supports JavaScript output. More...
 
 supportsNonJsOutput ()
 
 requiresJsSwitch ()
 
 getEstimatedWorkingTime ()
 Gets the estimated working time of a question. More...
 
 getAuthor ()
 Gets the authors name of the assQuestion object. More...
 
 getOwner ()
 Gets the creator/owner ID of the assQuestion object. More...
 
 getObjId ()
 Get the object id of the container object. More...
 
 setObjId ($obj_id=0)
 Set the object id of the container object. More...
 
 setExternalId ($external_id)
 
 getExternalId ()
 
 getSuggestedSolutionOutput ()
 
_getSuggestedSolution ($question_id, $subquestion_index=0)
 Returns a suggested solution for a given subquestion index. More...
 
 getSuggestedSolutions ()
 Return the suggested solutions. More...
 
 getReachedPoints ($active_id, $pass=null)
 Returns the points, a learner has reached answering the question This is the fast way to get the points directly from the database. More...
 
 getMaximumPoints ()
 Returns the maximum points, a learner can reach answering the question. More...
 
 getAdjustedReachedPoints ($active_id, $pass=null, $authorizedSolution=true)
 returns the reached points ... More...
 
 calculateResultsFromSolution ($active_id, $pass=null, $obligationsEnabled=false)
 Calculates the question results from a previously saved question solution. More...
 
 persistWorkingState ($active_id, $pass=null, $obligationsEnabled=false, $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 ($active_id, $pass=null, $authorized=true)
 Saves the learners input of the question to the database. More...
 
 moveUploadedMediaFile ($file, $name)
 Move an uploaded media file to an public accessible temp dir to present it. More...
 
 getSuggestedSolutionPath ()
 Returns the path for a suggested solution. More...
 
 getJavaPath ()
 Returns the image path for web accessable images of a question. More...
 
 getImagePath ($question_id=null, $object_id=null)
 Returns the image path for web accessable images of a question. More...
 
 buildImagePath ($questionId, $parentObjectId)
 
 getFlashPath ()
 Returns the image path for web accessable flash files of a question. More...
 
 getJavaPathWeb ()
 Returns the web image path for web accessable java applets of a question. More...
 
 getSuggestedSolutionPathWeb ()
 Returns the web path for a suggested solution. More...
 
 getImagePathWeb ()
 Returns the web image path for web accessable images of a question. More...
 
 getFlashPathWeb ()
 Returns the web image path for web accessable flash applications of a question. More...
 
 getTestOutputSolutions ($activeId, $pass)
 
 getUserSolutionPreferingIntermediate ($active_id, $pass=null)
 
 getSolutionValues ($active_id, $pass=null, $authorized=true)
 Loads solutions of a given user from the database an returns it. More...
 
 isInUse ($question_id="")
 Checks whether the question is in use or not. More...
 
 isClone ($question_id="")
 Checks whether the question is a clone of another question or not. More...
 
 pcArrayShuffle ($array)
 Shuffles the values of a given array. More...
 
 getAdditionalTableName ()
 Returns the name of the additional question data table in the database. More...
 
 getAnswerTableName ()
 Returns the name of the answer table in the database. More...
 
 deleteAnswers ($question_id)
 Deletes datasets from answers tables. More...
 
 deleteAdditionalTableData ($question_id)
 Deletes datasets from the additional question table in the database. More...
 
 delete ($question_id)
 Deletes a question and all materials from the database. More...
 
 getTotalAnswers ()
 get total number of answers More...
 
 _getTotalAnswers ($a_q_id)
 get number of answers for question id (static) note: do not use $this inside this method More...
 
 copyXHTMLMediaObjectsOfQuestion ($a_q_id)
 
 syncXHTMLMediaObjectsOfQuestion ()
 
 createPageObject ()
 create page object of question More...
 
 copyPageOfQuestion ($a_q_id)
 
 getPageOfQuestion ()
 
 setOriginalId ($original_id)
 
 getOriginalId ()
 
 fixSvgToPng ($imageFilenameContainingString)
 
 fixUnavailableSkinImageSources ($html)
 
 loadFromDb ($question_id)
 Loads the question from the database. More...
 
 createNewQuestion ($a_create_page=true)
 Creates a new question without an owner when a new question is created This assures that an ID is given to the question if a file upload or something else occurs. More...
 
 saveQuestionDataToDb ($original_id="")
 
 saveToDb ($original_id="")
 Saves the question to the database. More...
 
 setNewOriginalId ($newId)
 
 deleteSuggestedSolutions ()
 Deletes all suggestes solutions in the database. More...
 
 getSuggestedSolution ($subquestion_index=0)
 Returns a suggested solution for a given subquestion index. More...
 
 getSuggestedSolutionTitle ($subquestion_index=0)
 Returns the title of a suggested solution at a given subquestion_index. More...
 
 setSuggestedSolution ($solution_id="", $subquestion_index=0, $is_import=false)
 Sets a suggested solution for the question. More...
 
 _resolveInternalLink ($internal_link)
 
 _resolveIntLinks ($question_id)
 
 syncWithOriginal ()
 
 createRandomSolution ($test_id, $user_id)
 
 _questionExists ($question_id)
 Returns true if the question already exists in the database. More...
 
 _questionExistsInPool ($question_id)
 Returns true if the question already exists in the database and is assigned to a question pool. More...
 
 getPoints ()
 Returns the maximum available points for the question. More...
 
 setPoints ($a_points)
 Sets the maximum available points for the question. More...
 
 getSolutionMaxPass ($active_id)
 Returns the maximum pass a users question solution. More...
 
 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...
 
 isHTML ($a_text)
 Checks if a given string contains HTML or not. More...
 
 prepareTextareaOutput ($txt_output, $prepare_for_latex_output=false, $omitNl2BrWhenTextArea=false)
 Prepares a string for a text area output in tests. More...
 
 QTIMaterialToString ($a_material)
 Reads an QTI material tag an creates a text string. More...
 
 addQTIMaterial (&$a_xml_writer, $a_material, $close_material_tag=true, $add_mobs=true)
 Creates a QTI material tag from a plain text or xhtml text. More...
 
 buildHashedImageFilename ($plain_image_filename, $unique=false)
 
 getQuestion ()
 Gets the question string of the question object. More...
 
 setQuestion ($question="")
 Sets the question string of the question object. More...
 
 getQuestionType ()
 Returns the question type of the question. More...
 
 getQuestionTypeID ()
 Returns the question type of the question. More...
 
 cleanupMediaObjectUsage ()
 synchronises appearances of media objects in the question with media object usage table More...
 
getInstances ()
 Gets all instances of the question. More...
 
 getActiveUserData ($active_id)
 Returns the user id and the test id for a given active id. More...
 
 setExportDetailsXLS ($worksheet, $startrow, $active_id, $pass)
 Creates an Excel worksheet for the detailed cumulated results of this question. More...
 
 __get ($value)
 Object getter. More...
 
 __set ($key, $value)
 Object setter. More...
 
 getNrOfTries ()
 
 setNrOfTries ($a_nr_of_tries)
 
 setExportImagePath ($a_path)
 
 formatSAQuestion ($a_q)
 Format self assessment question. More...
 
 setPreventRteUsage ($a_val)
 Set prevent rte usage. More...
 
 getPreventRteUsage ()
 Get prevent rte usage. More...
 
 migrateContentForLearningModule (ilAssSelfAssessmentMigrator $migrator)
 
 setSelfAssessmentEditingMode ($a_selfassessmenteditingmode)
 Set Self-Assessment Editing Mode. More...
 
 getSelfAssessmentEditingMode ()
 Get Self-Assessment Editing Mode. More...
 
 setDefaultNrOfTries ($a_defaultnroftries)
 Set Default Nr of Tries. More...
 
 getDefaultNrOfTries ()
 Get Default Nr of Tries. More...
 
 syncSkillAssignments ($srcParentId, $srcQuestionId, $trgParentId, $trgQuestionId)
 
 isAnswered ($active_id, $pass=null)
 returns boolean wether the question is answered during test pass or not More...
 
 isAutosaveable ()
 
 getAdditionalContentEditingMode ()
 getter for additional content editing mode for this question More...
 
 setAdditionalContentEditingMode ($additinalContentEditingMode)
 setter for additional content editing mode for this question More...
 
 isAdditionalContentEditingModePageObject ()
 isser for additional "pageobject" content editing mode More...
 
 isValidAdditionalContentEditingMode ($additionalContentEditingMode)
 returns the fact wether the passed additional content mode is valid or not More...
 
 getValidAdditionalContentEditingModes ()
 getter for valid additional content editing modes More...
 
 addQuestionChangeListener (ilQuestionChangeListener $listener)
 
 getQuestionChangeListeners ()
 
 getHtmlUserSolutionPurifier ()
 
 getHtmlQuestionContentPurifier ()
 
 setLastChange ($lastChange)
 
 getLastChange ()
 
 removeIntermediateSolution ($active_id, $pass)
 
 removeCurrentSolution ($active_id, $pass, $authorized=true)
 
 saveCurrentSolution ($active_id, $pass, $value1, $value2, $authorized=true, $tstamp=null)
 
 updateCurrentSolution ($solutionId, $value1, $value2, $authorized=true)
 
 updateCurrentSolutionsAuthorization ($activeId, $pass, $authorized, $keepTime=false)
 
 setStep ($step)
 
 getStep ()
 
 toJSON ()
 
 duplicate ($for_test=true, $title="", $author="", $owner="", $testObjId=null)
 
 intermediateSolutionExists ($active_id, $pass)
 
 authorizedSolutionExists ($active_id, $pass)
 
 authorizedOrIntermediateSolutionExists ($active_id, $pass)
 
 isAddableAnswerOptionValue ($qIndex, $answerOptionValue)
 
 addAnswerOptionValue ($qIndex, $answerOptionValue, $points)
 
 removeAllExistingSolutions ()
 
 removeExistingSolutions ($activeId, $pass)
 
 resetUsersAnswer ($activeId, $pass)
 
 removeResultRecord ($activeId, $pass)
 
 fetchValuePairsFromIndexedValues (array $indexedValues)
 
 fetchIndexedValuesFromValuePairs (array $valuePairs)
 
 areObligationsToBeConsidered ()
 
 setObligationsToBeConsidered ($obligationsToBeConsidered)
 
 updateTimestamp ()
 
 getTestPresentationConfig ()
 Get the test question configuration (initialised once) More...
 
 savePartial ()
 

Static Public Member Functions

static setForcePassResultUpdateEnabled ($forcePassResultsUpdateEnabled)
 
static isForcePassResultUpdateEnabled ()
 
static isAllowedImageMimeType ($mimeType)
 
static fetchMimeTypeIdentifier ($contentTypeString)
 
static getAllowedFileExtensionsForMimeType ($mimeType)
 
static isAllowedImageFileExtension ($mimeType, $fileExtension)
 
static getAllowedImageMaterialFileExtensions ()
 
static _getMaximumPoints ($question_id)
 Returns the maximum points, a learner can reach answering the question. More...
 
static _getQuestionInfo ($question_id)
 Returns question information from the database. More...
 
static _getSuggestedSolutionCount ($question_id)
 Returns the number of suggested solutions associated with a question. More...
 
static _getSuggestedSolutionOutput ($question_id)
 Returns the output of the suggested solution. More...
 
static _getReachedPoints ($active_id, $question_id, $pass=null)
 Returns the points, a learner has reached answering the question. More...
 
static _updateTestResultCache ($active_id, ilAssQuestionProcessLocker $processLocker=null)
 @TODO Move this to a proper place. More...
 
static logAction ($logtext="", $active_id="", $question_id="")
 Logs an action into the Test&Assessment log. More...
 
static getQuestionTypeFromDb ($question_id)
 get question type for question id More...
 
static _getTotalRightAnswers ($a_q_id)
 get number of answers for question id (static) note: do not use $this inside this method More...
 
static _getTitle ($a_q_id)
 Returns the title of a question. More...
 
static _getQuestionText ($a_q_id)
 Returns question text. More...
 
static isFileAvailable ($file)
 
static _getQuestionType ($question_id)
 Returns the question type of a question with a given id. More...
 
static _getQuestionTitle ($question_id)
 Returns the question title of a question with a given id. More...
 
static saveOriginalId ($questionId, $originalId)
 
static resetOriginalId ($questionId)
 
static _getInternalLinkHref ($target="")
 
static _getOriginalId ($question_id)
 Returns the original id of a question. More...
 
static originalQuestionExists ($questionId)
 
static _instanciateQuestion ($question_id)
 Creates an instance of a question with a given question id. More...
 
static _instantiateQuestion ($question_id)
 
static _getSolutionMaxPass ($question_id, $active_id)
 Returns the maximum pass a users question solution. More...
 
static _isWriteable ($question_id, $user_id)
 Returns true if the question is writeable by a certain user. More...
 
static _isUsedInRandomTest ($question_id="")
 Checks whether the question is used in a random test or not. More...
 
static _isWorkedThrough ($active_id, $question_id, $pass=null)
 Returns true if the question was worked through in the given pass Worked through means that the user entered at least one value. More...
 
static _areAnswered ($a_user_id, $a_question_ids)
 Checks if an array of question ids is answered by an user or not. More...
 
static _setReachedPoints ($active_id, $question_id, $points, $maxpoints, $pass, $manualscoring, $obligationsEnabled)
 Sets the points, a learner has reached answering the question Additionally objective results are updated. More...
 
static _needsManualScoring ($question_id)
 
static _includeClass ($question_type, $gui=0)
 Include the php class file for a given question type. More...
 
static getGuiClassNameByQuestionType ($questionType)
 
static getObjectClassNameByQuestionType ($questionType)
 
static getFeedbackClassNameByQuestionType ($questionType)
 
static isCoreQuestionType ($questionType)
 
static includeCoreClass ($questionType, $withGuiClass)
 
static includePluginClass ($questionType, $withGuiClass)
 
static _getQuestionTypeName ($type_tag)
 Return the translation for a given question type tag. More...
 
static & _instanciateQuestionGUI ($question_id)
 Creates an instance of a question gui with a given question id. More...
 
static instantiateQuestionGUI ($a_question_id)
 Creates an instance of a question gui with a given question id. More...
 
static _questionExistsInTest ($question_id, $test_id)
 
static lookupParentObjId ($questionId)
 @global ilDBInterface $ilDB More...
 
static lookupOriginalParentObjId ($originalQuestionId)
 returns the parent object id for given original question id (should be a qpl id, but theoretically it can be a tst id, too) More...
 
static isObligationPossible ($questionId)
 returns boolean wether it is possible to set this question type as obligatory or not considering the current question configuration More...
 
static implodeKeyValues ($keyValues)
 
static explodeKeyValues ($keyValues)
 
static setResultGateway ($resultGateway)
 
static getResultGateway ()
 
static sumTimesInISO8601FormatH_i_s_Extended ($time1, $time2)
 
static convertISO8601FormatH_i_s_ExtendedToSeconds ($time)
 
static missingResultRecordExists ($activeId, $pass, $questionIds)
 
static getQuestionsMissingResultRecord ($activeId, $pass, $questionIds)
 
static lookupResultRecordExist ($activeId, $questionId, $pass)
 

Data Fields

const IMG_MIME_TYPE_JPG = 'image/jpeg'
 
const IMG_MIME_TYPE_PNG = 'image/png'
 
const IMG_MIME_TYPE_GIF = 'image/gif'
 
const ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT = 'default'
 constant for additional content editing mode "default" More...
 
const ADDITIONAL_CONTENT_EDITING_MODE_PAGE_OBJECT = 'pageobject'
 constant for additional content editing mode "pageobject" More...
 
 $feedbackOBJ = null
 
 $prevent_rte_usage = false
 
 $selfassessmenteditingmode = false
 
 $defaultnroftries = 0
 
 $questionActionCmd = 'handleQuestionAction'
 
const KEY_VALUES_IMPLOSION_SEPARATOR = ':'
 

Protected Member Functions

 getQuestionAction ()
 
 isNonEmptyItemListPostSubmission ($postSubmissionFieldname)
 
 ensureCurrentTestPass ($active_id, $pass)
 
 lookupCurrentTestPass ($active_id, $pass)
 
 lookupTestId ($active_id)
 
 log ($active_id, $langVar)
 
 savePreviewData (ilAssQuestionPreviewSession $previewSession)
 
 deletePageOfQuestion ($question_id)
 Deletes the page object of a question with a given ID. More...
 
 onDuplicate ($originalParentId, $originalQuestionId, $duplicateParentId, $duplicateQuestionId)
 Will be called when a question is duplicated (inside a question pool or for insertion in a test) More...
 
 beforeSyncWithOriginal ($origQuestionId, $dupQuestionId, $origParentObjId, $dupParentObjId)
 
 afterSyncWithOriginal ($origQuestionId, $dupQuestionId, $origParentObjId, $dupParentObjId)
 
 onCopy ($sourceParentId, $sourceQuestionId, $targetParentId, $targetQuestionId)
 Will be called when a question is copied (into another question pool) More...
 
 duplicateSuggestedSolutionFiles ($parent_id, $question_id)
 Duplicates the files of a suggested solution if the question is duplicated. More...
 
 syncSuggestedSolutionFiles ($original_id)
 Syncs the files of a suggested solution if the question is synced. More...
 
 copySuggestedSolutionFiles ($source_questionpool_id, $source_question_id)
 
 ensureNonNegativePoints ($points)
 
 getRTETextWithMediaObjects ()
 Collects all text in the question which could contain media objects which were created with the Rich Text Editor. More...
 
 getSelfAssessmentFormatter ()
 
 lmMigrateQuestionTypeGenericContent (ilAssSelfAssessmentMigrator $migrator)
 
 lmMigrateQuestionTypeSpecificContent (ilAssSelfAssessmentMigrator $migrator)
 
 duplicateQuestionHints ($originalQuestionId, $duplicateQuestionId)
 
 duplicateSkillAssignments ($srcParentId, $srcQuestionId, $trgParentId, $trgQuestionId)
 
 buildQuestionDataQuery ()
 
 getCurrentSolutionResultSet ($active_id, $pass, $authorized=true)
 Get a restulset for the current user solution for a this question by active_id and pass. More...
 
 removeSolutionRecordById ($solutionId)
 
 getSolutionRecordById ($solutionId)
 
 deleteDummySolutionRecord ($activeId, $passIndex)
 
 isDummySolutionRecord ($solutionRecord)
 
 deleteSolutionRecordByValues ($activeId, $passIndex, $authorized, $matchValues)
 
 duplicateIntermediateSolutionAuthorized ($activeId, $passIndex)
 
 forceExistingIntermediateSolution ($activeId, $passIndex, $considerDummyRecordCreation)
 
 buildTestPresentationConfig ()
 build basic test question configuration instance More...
 

Static Protected Member Functions

static getNumExistingSolutionRecords ($activeId, $pass, $questionId)
 returns the number of existing solution records for the given test active / pass and given question id More...
 
static getKeyValuesImplosionSeparator ()
 

Protected Attributes

 $id
 
 $title
 
 $comment
 
 $owner
 
 $author
 
 $question
 
 $points
 
 $est_working_time
 
 $shuffle
 
 $test_id
 
 $obj_id
 
 $ilias
 
 $tpl
 
 $lng
 
 $db
 
 $outputType = OUTPUT_JAVASCRIPT
 
 $suggested_solutions
 
 $original_id
 
 $page
 
 $external_id = ''
 
 $questionChangeListeners = array()
 
 $processLocker
 
 $step = null
 
 $lastChange
 
 $shuffler
 
 $testQuestionConfig
 

Static Protected Attributes

static $allowedFileExtensionsByMimeType
 
static $allowedCharsetsByMimeType
 
static $allowedImageMaterialFileExtensionsByMimeType
 
static $forcePassResultsUpdateEnabled = false
 
static $imageSourceFixReplaceMap
 

Private Member Functions

 deleteTaxonomyAssignments ()
 
 notifyQuestionCreated ()
 
 notifyQuestionEdited ()
 
 notifyQuestionDeleted ()
 

Private Attributes

 $nr_of_tries
 Number of tries. More...
 
 $arrData
 Associative array to store properties. More...
 
 $export_image_path
 (Web) Path to images More...
 
 $additinalContentEditingMode = null
 
 $obligationsToBeConsidered = false
 
 $testQuestionConfigInstance = null
 

Static Private Attributes

static $resultGateway = 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.

@abstract

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

Constructor & Destructor Documentation

◆ __construct()

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

assQuestion constructor

Parameters
string$titleA title string to describe the question
string$commentA comment string to describe the question
string$authorA string containing the name of the questions author
integer$ownerA numerical ID to identify the owner/creator
string$questionQuestion text @access public

Reimplemented in assClozeTest, assFileUpload, assFlashQuestion, assFormulaQuestion, assLongMenu, assNumeric, assOrderingHorizontal, assTextQuestion, assTextSubset, assErrorText, and assKprimChoice.

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

292 {
293 global $DIC;
294 $ilias = $DIC['ilias'];
295 $lng = $DIC['lng'];
296 $tpl = $DIC['tpl'];
297 $ilDB = $DIC['ilDB'];
298
299 $this->ilias = $ilias;
300 $this->lng = $lng;
301 $this->tpl = $tpl;
302 $this->db = $ilDB;
303
304 $this->original_id = null;
305 $this->title = $title;
306 $this->comment = $comment;
307 $this->page = null;
308 $this->author = $author;
309 $this->setQuestion($question);
310 if (!$this->author) {
311 $this->author = $this->ilias->account->fullname;
312 }
313 $this->owner = $owner;
314 if ($this->owner <= 0) {
315 $this->owner = $this->ilias->account->id;
316 }
317 $this->id = -1;
318 $this->test_id = -1;
319 $this->suggested_solutions = array();
320 $this->shuffle = 1;
321 $this->nr_of_tries = 0;
322 $this->setEstimatedWorkingTime(0, 1, 0);
323 $this->arrData = array();
324 $this->setExternalId('');
325
326 $this->questionActionCmd = 'handleQuestionAction';
327
328 $this->lastChange = null;
329
330 require_once 'Services/Randomization/classes/class.ilArrayElementOrderKeeper.php';
331 $this->shuffler = new ilArrayElementOrderKeeper();
332 }
setEstimatedWorkingTime($hour=0, $min=0, $sec=0)
Sets the estimated working time of a question from given hour, minute and second.
setExternalId($external_id)
setQuestion($question="")
Sets the question string of the question object.
comment()
Definition: comment.php:2
redirection script todo: (a better solution should control the processing via a xml file)
global $DIC
Definition: saml.php:7
global $ilDB

References $author, $comment, $DIC, $ilDB, $ilias, $lng, $owner, $question, $title, $tpl, comment(), setEstimatedWorkingTime(), setExternalId(), and setQuestion().

+ Here is the call graph for this function:

Member Function Documentation

◆ __get()

assQuestion::__get (   $value)

Object getter.

Reimplemented in assErrorText, assFileUpload, assFormulaQuestion, and assOrderingHorizontal.

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

4119 {
4120 switch ($value) {
4121 case "id":
4122 return $this->getId();
4123 break;
4124 case "title":
4125 return $this->getTitle();
4126 break;
4127 case "comment":
4128 return $this->getComment();
4129 break;
4130 case "owner":
4131 return $this->getOwner();
4132 break;
4133 case "author":
4134 return $this->getAuthor();
4135 break;
4136 case "question":
4137 return $this->getQuestion();
4138 break;
4139 case "points":
4140 return $this->getPoints();
4141 break;
4142 case "est_working_time":
4143 return $this->getEstimatedWorkingTime();
4144 break;
4145 case "shuffle":
4146 return $this->getShuffle();
4147 break;
4148 case "test_id":
4149 return $this->getTestId();
4150 break;
4151 case "obj_id":
4152 return $this->getObjId();
4153 break;
4154 case "ilias":
4155 return $this->ilias;
4156 break;
4157 case "tpl":
4158 return $this->tpl;
4159 break;
4160 case "page":
4161 return $this->page;
4162 break;
4163 case "outputType":
4164 return $this->getOutputType();
4165 break;
4166 case "suggested_solutions":
4167 return $this->getSuggestedSolutions();
4168 break;
4169 case "original_id":
4170 return $this->getOriginalId();
4171 break;
4172 default:
4173 if (array_key_exists($value, $this->arrData)) {
4174 return $this->arrData[$value];
4175 } else {
4176 return null;
4177 }
4178 break;
4179 }
4180 }
getId()
Gets the id of the assQuestion object.
getObjId()
Get the object id of the container object.
getOwner()
Gets the creator/owner ID of the assQuestion object.
getPoints()
Returns the maximum available points for the question.
getOutputType()
Gets the output type.
getTestId()
Gets the test id of the assQuestion object.
getShuffle()
Gets the shuffle flag.
getSuggestedSolutions()
Return the suggested solutions.
getTitle()
Gets the title string of the assQuestion object.
getComment()
Gets the comment string of the assQuestion object.
getAuthor()
Gets the authors name of the assQuestion object.
getQuestion()
Gets the question string of the question object.
getEstimatedWorkingTime()
Gets the estimated working time of a question.

References $ilias, $page, $tpl, getAuthor(), getComment(), getEstimatedWorkingTime(), getId(), getObjId(), getOriginalId(), getOutputType(), getOwner(), getPoints(), getQuestion(), getShuffle(), getSuggestedSolutions(), getTestId(), and getTitle().

+ Here is the call graph for this function:

◆ __set()

assQuestion::__set (   $key,
  $value 
)

Object setter.

Reimplemented in assErrorText, assFileUpload, and assOrderingHorizontal.

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

4186 {
4187 switch ($key) {
4188 case "id":
4189 $this->setId($value);
4190 break;
4191 case "title":
4192 $this->setTitle($value);
4193 break;
4194 case "comment":
4195 $this->setComment($value);
4196 break;
4197 case "owner":
4198 $this->setOwner($value);
4199 break;
4200 case "author":
4201 $this->setAuthor($value);
4202 break;
4203 case "question":
4204 $this->setQuestion($value);
4205 break;
4206 case "points":
4207 $this->setPoints($value);
4208 break;
4209 case "est_working_time":
4210 if (is_array($value)) {
4211 $this->setEstimatedWorkingTime($value["h"], $value["m"], $value["s"]);
4212 }
4213 break;
4214 case "shuffle":
4215 $this->setShuffle($value);
4216 break;
4217 case "test_id":
4218 $this->setTestId($value);
4219 break;
4220 case "obj_id":
4221 $this->setObjId($value);
4222 break;
4223 case "outputType":
4224 $this->setOutputType($value);
4225 break;
4226 case "original_id":
4227 $this->setOriginalId($value);
4228 break;
4229 case "page":
4230 $this->page = &$value;
4231 break;
4232 default:
4233 $this->arrData[$key] = $value;
4234 break;
4235 }
4236 }
setShuffle($shuffle=true)
Sets the shuffle flag.
setId($id=-1)
Sets the id of the assQuestion object.
setOriginalId($original_id)
setObjId($obj_id=0)
Set the object id of the container object.
setTitle($title="")
Sets the title string of the assQuestion object.
setOwner($owner="")
Sets the creator/owner ID of the assQuestion object.
setAuthor($author="")
Sets the authors name of the assQuestion object.
setOutputType($outputType=OUTPUT_HTML)
Sets the output type.
setPoints($a_points)
Sets the maximum available points for the question.
setComment($comment="")
Sets the comment string of the assQuestion object.
setTestId($id=-1)
Sets the test id of the assQuestion object.
$key
Definition: croninfo.php:18

References $key, setAuthor(), setComment(), setEstimatedWorkingTime(), setId(), setObjId(), setOriginalId(), setOutputType(), setOwner(), setPoints(), setQuestion(), setShuffle(), setTestId(), and setTitle().

+ Here is the call graph for this function:

◆ _areAnswered()

static assQuestion::_areAnswered (   $a_user_id,
  $a_question_ids 
)
static

Checks if an array of question ids is answered by an user or not.

Parameters
intuser_id
array$question_idsuser id array
Returns
boolean

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

3518 {
3519 global $DIC;
3520 $ilDB = $DIC['ilDB'];
3521
3522 $res = $ilDB->queryF(
3523 "SELECT DISTINCT(question_fi) FROM tst_test_result JOIN tst_active " .
3524 "ON (active_id = active_fi) " .
3525 "WHERE " . $ilDB->in('question_fi', $a_question_ids, false, 'integer') .
3526 " AND user_fi = %s",
3527 array('integer'),
3528 array($a_user_id)
3529 );
3530 return ($res->numRows() == count($a_question_ids)) ? true : false;
3531 }
foreach($_POST as $key=> $value) $res

References $DIC, $ilDB, and $res.

Referenced by ilCourseObjectiveResult\getStatus().

+ Here is the caller graph for this function:

◆ _getInternalLinkHref()

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

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

3053 {
3054 global $DIC;
3055 $ilDB = $DIC['ilDB'];
3056 $linktypes = array(
3057 "lm" => "LearningModule",
3058 "pg" => "PageObject",
3059 "st" => "StructureObject",
3060 "git" => "GlossaryItem",
3061 "mob" => "MediaObject"
3062 );
3063 $href = "";
3064 if (preg_match("/il__(\w+)_(\d+)/", $target, $matches)) {
3065 $type = $matches[1];
3066 $target_id = $matches[2];
3067 include_once "./Services/Utilities/classes/class.ilUtil.php";
3068 switch ($linktypes[$matches[1]]) {
3069 case "LearningModule":
3070 $href = "./goto.php?target=" . $type . "_" . $target_id;
3071 break;
3072 case "PageObject":
3073 case "StructureObject":
3074 $href = "./goto.php?target=" . $type . "_" . $target_id;
3075 break;
3076 case "GlossaryItem":
3077 $href = "./goto.php?target=" . $type . "_" . $target_id;
3078 break;
3079 case "MediaObject":
3080 $href = "./ilias.php?baseClass=ilLMPresentationGUI&obj_type=" . $linktypes[$type] . "&cmd=media&ref_id=" . $_GET["ref_id"] . "&mob_id=" . $target_id;
3081 break;
3082 }
3083 }
3084 return $href;
3085 }
$_GET["client_id"]
$target_id
Definition: goto.php:49
$target
Definition: test.php:19
$type

References $_GET, $DIC, $ilDB, $target, $target_id, and $type.

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

+ Here is the caller graph for this function:

◆ _getMaximumPoints()

static assQuestion::_getMaximumPoints (   $question_id)
static

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

Parameters
integer$question_idThe database Id of the question
See also
$points

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

941 {
942 global $DIC;
943 $ilDB = $DIC['ilDB'];
944
945 $points = 0;
946 $result = $ilDB->queryF(
947 "SELECT points FROM qpl_questions WHERE question_id = %s",
948 array('integer'),
949 array($question_id)
950 );
951 if ($result->numRows() == 1) {
952 $row = $ilDB->fetchAssoc($result);
953 $points = $row["points"];
954 }
955 return $points;
956 }
$result
$row

References $DIC, $ilDB, $points, $result, and $row.

Referenced by _getTotalRightAnswers(), ilCourseObjectiveQuestion\_lookupMaximumPointsOfQuestion(), assFileUpload\handleSubmission(), ilTestManScoringParticipantsBySelectedQuestionAndPassTableGUI\initFilter(), ilCourseObjectiveQuestionAssignmentTableGUI\parse(), ilTestScoringByQuestionsGUI\saveManScoringByQuestion(), and ilTestScoringGUI\saveManScoringParticipantScreen().

+ Here is the caller graph for this function:

◆ _getOriginalId()

static assQuestion::_getOriginalId (   $question_id)
static

Returns the original id of a question.

Parameters
integer$question_idThe database id of the question
Returns
integer The database id of the original question @access public

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

3095 {
3096 global $DIC;
3097 $ilDB = $DIC['ilDB'];
3098 $result = $ilDB->queryF(
3099 "SELECT * FROM qpl_questions WHERE question_id = %s",
3100 array('integer'),
3101 array($question_id)
3102 );
3103 if ($result->numRows() > 0) {
3104 $row = $ilDB->fetchAssoc($result);
3105 if ($row["original_id"] > 0) {
3106 return $row["original_id"];
3107 } else {
3108 return $row["question_id"];
3109 }
3110 } else {
3111 return "";
3112 }
3113 }

References $DIC, $ilDB, $result, and $row.

Referenced by ilTestFixedQuestionSetConfig\cloneQuestionSetRelatedData(), ilObjTestGUI\copyAndLinkToQuestionpoolObject(), assClozeTest\copyObject(), assErrorText\copyObject(), assFileUpload\copyObject(), assFlashQuestion\copyObject(), assFormulaQuestion\copyObject(), assImagemapQuestion\copyObject(), assJavaApplet\copyObject(), assKprimChoice\copyObject(), assLongMenu\copyObject(), assMatchingQuestion\copyObject(), assMultipleChoice\copyObject(), assNumeric\copyObject(), assOrderingHorizontal\copyObject(), assOrderingQuestion\copyObject(), assSingleChoice\copyObject(), assTextQuestion\copyObject(), assTextSubset\copyObject(), assClozeTest\duplicate(), assErrorText\duplicate(), assFileUpload\duplicate(), assFlashQuestion\duplicate(), assFormulaQuestion\duplicate(), assImagemapQuestion\duplicate(), assJavaApplet\duplicate(), assKprimChoice\duplicate(), assLongMenu\duplicate(), assMatchingQuestion\duplicate(), assMultipleChoice\duplicate(), assNumeric\duplicate(), assOrderingHorizontal\duplicate(), assOrderingQuestion\duplicate(), assSingleChoice\duplicate(), assTextQuestion\duplicate(), assTextSubset\duplicate(), logAction(), and ilObjTest\logAction().

+ Here is the caller graph for this function:

◆ _getQuestionInfo()

static assQuestion::_getQuestionInfo (   $question_id)
static

Returns question information from the database.

Parameters
integer$question_idThe database Id of the question
Returns
array The database row containing the question data

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

965 {
966 global $DIC;
967 $ilDB = $DIC['ilDB'];
968
969 $result = $ilDB->queryF(
970 "SELECT qpl_questions.*, qpl_qst_type.type_tag FROM qpl_qst_type, qpl_questions WHERE qpl_questions.question_id = %s AND qpl_questions.question_type_fi = qpl_qst_type.question_type_id",
971 array('integer'),
972 array($question_id)
973 );
974 if ($result->numRows()) {
975 return $ilDB->fetchAssoc($result);
976 } else {
977 return array();
978 }
979 }

References $DIC, $ilDB, and $result.

Referenced by ilObjMediaObject\getParentObjectIdForUsage(), and ilTestManScoringParticipantsBySelectedQuestionAndPassTableGUI\initFilter().

+ Here is the caller graph for this function:

◆ _getQuestionText()

static assQuestion::_getQuestionText (   $a_q_id)
static

Returns question text.

Parameters
int$a_q_idquestion id

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

2254 {
2255 global $DIC;
2256 $ilDB = $DIC['ilDB'];
2257 $result = $ilDB->queryF(
2258 "SELECT question_text FROM qpl_questions WHERE question_id = %s",
2259 array('integer'),
2260 array($a_q_id)
2261 );
2262 if ($result->numRows() == 1) {
2263 $row = $ilDB->fetchAssoc($result);
2264 return $row["question_text"];
2265 } else {
2266 return "";
2267 }
2268 }

References $DIC, $ilDB, $result, and $row.

Referenced by ilLMQuestionListTableGUI\fillRow().

+ Here is the caller graph for this function:

◆ _getQuestionTitle()

static assQuestion::_getQuestionTitle (   $question_id)
static

Returns the question title of a question with a given id.

Parameters
integer$question_idThe database id of the question
Returns
string The question title @access private

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

2375 {
2376 global $DIC;
2377 $ilDB = $DIC['ilDB'];
2378
2379 if ($question_id < 1) {
2380 return "";
2381 }
2382
2383 $result = $ilDB->queryF(
2384 "SELECT title FROM qpl_questions WHERE qpl_questions.question_id = %s",
2385 array('integer'),
2386 array($question_id)
2387 );
2388 if ($result->numRows() == 1) {
2389 $data = $ilDB->fetchAssoc($result);
2390 return $data["title"];
2391 } else {
2392 return "";
2393 }
2394 }
$data
Definition: bench.php:6

References $data, $DIC, $ilDB, and $result.

Referenced by ilObjAssessmentFolderGUI\exportLogObject(), ilObjectivesAlignmentTableGUI\fillRow(), and ilAssessmentFolderLogTableGUI\fillRow().

+ Here is the caller graph for this function:

◆ _getQuestionType()

static assQuestion::_getQuestionType (   $question_id)
static

Returns the question type of a question with a given id.

Parameters
integer$question_idThe database id of the question
Returns
string The question type string

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

2347 {
2348 global $DIC;
2349 $ilDB = $DIC['ilDB'];
2350
2351 if ($question_id < 1) {
2352 return "";
2353 }
2354 $result = $ilDB->queryF(
2355 "SELECT type_tag FROM qpl_questions, qpl_qst_type WHERE qpl_questions.question_id = %s AND qpl_questions.question_type_fi = qpl_qst_type.question_type_id",
2356 array('integer'),
2357 array($question_id)
2358 );
2359 if ($result->numRows() == 1) {
2360 $data = $ilDB->fetchAssoc($result);
2361 return $data["type_tag"];
2362 } else {
2363 return "";
2364 }
2365 }

References $data, $DIC, $ilDB, and $result.

Referenced by _instantiateQuestion(), _needsManualScoring(), ilPageObjectGUI\executeCommand(), ilObjectivesAlignmentTableGUI\fillRow(), instantiateQuestionGUI(), ilObjTest\isQuestionObligationPossible(), and ilPCQuestionGUI\setTabs().

+ Here is the caller graph for this function:

◆ _getQuestionTypeName()

static assQuestion::_getQuestionTypeName (   $type_tag)
static

Return the translation for a given question type tag.

Parameters
string$type_tagThe type tag of the question type @access public

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

4020 {
4021 if (file_exists("./Modules/TestQuestionPool/classes/class." . $type_tag . ".php")) {
4022 global $DIC;
4023 $lng = $DIC['lng'];
4024 return $lng->txt($type_tag);
4025 } else {
4026 global $DIC;
4027 $ilPluginAdmin = $DIC['ilPluginAdmin'];
4028 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_MODULE, "TestQuestionPool", "qst");
4029 foreach ($pl_names as $pl_name) {
4030 $pl = ilPlugin::getPluginObject(IL_COMP_MODULE, "TestQuestionPool", "qst", $pl_name);
4031 if (strcmp($pl->getQuestionType(), $type_tag) == 0) {
4032 return $pl->getQuestionTypeTranslation();
4033 }
4034 }
4035 }
4036 return "";
4037 }
const IL_COMP_MODULE
static getPluginObject(string $a_ctype, string $a_cname, string $a_slot_id, string $a_pname)

References $DIC, $lng, ilPlugin\getPluginObject(), and IL_COMP_MODULE.

Referenced by ilObjQuestionPoolGUI\addLocatorItems(), ilObjTestGUI\createRandomSelectionObject(), ilCopySelfAssQuestionTableGUI\fillRow(), ilTestQuestionBrowserTableGUI\fillRow(), ilTestQuestionsTableGUI\fillRow(), ilQuestionBrowserTableGUI\fillRow(), assQuestionGUI\outQuestionType(), ilObjTestGUI\removeQuestionsForm(), and ilObjQuestionPoolGUI\setTitleAndDescription().

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

◆ _getReachedPoints()

static assQuestion::_getReachedPoints (   $active_id,
  $question_id,
  $pass = null 
)
static

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

Parameters
integer$user_idThe database ID of the learner
integer$test_idThe database Id of the test containing the question
integer$question_idThe database Id of the question

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

1095 {
1096 global $DIC;
1097 $ilDB = $DIC['ilDB'];
1098
1099 $points = 0;
1100 if (is_null($pass)) {
1101 include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
1102 $pass = assQuestion::_getSolutionMaxPass($question_id, $active_id);
1103 }
1104 $result = $ilDB->queryF(
1105 "SELECT * FROM tst_test_result WHERE active_fi = %s AND question_fi = %s AND pass = %s",
1106 array('integer','integer','integer'),
1107 array($active_id, $question_id, $pass)
1108 );
1109 if ($result->numRows() == 1) {
1110 $row = $ilDB->fetchAssoc($result);
1111 $points = $row["points"];
1112 }
1113 return $points;
1114 }
static _getSolutionMaxPass($question_id, $active_id)
Returns the maximum pass a users question solution.

References $DIC, $ilDB, $pass, $points, $result, $row, and _getSolutionMaxPass().

Referenced by ilTestServiceGUI\getPassListOfAnswersWithScoring(), and ilTestPlayerDynamicQuestionSetGUI\isQuestionAnsweredCorrect().

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

◆ _getSolutionMaxPass()

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

Returns the maximum pass a users question solution.

Parameters
returninteger The maximum pass of the users solution @access public

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

3321 {
3322 /* include_once "./Modules/Test/classes/class.ilObjTest.php";
3323 $pass = ilObjTest::_getPass($active_id);
3324 return $pass;*/
3325
3326 // the following code was the old solution which added the non answered
3327 // questions of a pass from the answered questions of the previous pass
3328 // with the above solution, only the answered questions of the last pass are counted
3329 global $DIC;
3330 $ilDB = $DIC['ilDB'];
3331
3332 $result = $ilDB->queryF(
3333 "SELECT MAX(pass) maxpass FROM tst_test_result WHERE active_fi = %s AND question_fi = %s",
3334 array('integer','integer'),
3335 array($active_id, $question_id)
3336 );
3337 if ($result->numRows() == 1) {
3338 $row = $ilDB->fetchAssoc($result);
3339 return $row["maxpass"];
3340 } else {
3341 return 0;
3342 }
3343 }

References $DIC, $ilDB, $result, and $row.

Referenced by _getReachedPoints(), _isWorkedThrough(), _setReachedPoints(), getSolutionMaxPass(), and ilObjTest\getTextAnswer().

+ Here is the caller graph for this function:

◆ _getSuggestedSolution()

& assQuestion::_getSuggestedSolution (   $question_id,
  $subquestion_index = 0 
)

Returns a suggested solution for a given subquestion index.

Parameters
integer$question_idThe database Id of the question
integer$subquestion_indexThe index of a subquestion (i.e. a close test gap). Usually 0
Returns
array A suggested solution array containing the internal link @access public

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

1057 {
1058 global $DIC;
1059 $ilDB = $DIC['ilDB'];
1060
1061 $result = $ilDB->queryF(
1062 "SELECT * FROM qpl_sol_sug WHERE question_fi = %s AND subquestion_index = %s",
1063 array('integer','integer'),
1064 array($question_id, $subquestion_index)
1065 );
1066 if ($result->numRows() == 1) {
1067 $row = $ilDB->fetchAssoc($result);
1068 return array(
1069 "internal_link" => $row["internal_link"],
1070 "import_id" => $row["import_id"]
1071 );
1072 } else {
1073 return array();
1074 }
1075 }

References $DIC, $ilDB, $result, and $row.

◆ _getSuggestedSolutionCount()

static assQuestion::_getSuggestedSolutionCount (   $question_id)
static

Returns the number of suggested solutions associated with a question.

Parameters
integer$question_idThe database Id of the question
Returns
integer The number of suggested solutions

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

988 {
989 global $DIC;
990 $ilDB = $DIC['ilDB'];
991
992 $result = $ilDB->queryF(
993 "SELECT suggested_solution_id FROM qpl_sol_sug WHERE question_fi = %s",
994 array('integer'),
995 array($question_id)
996 );
997 return $result->numRows();
998 }

References $DIC, $ilDB, and $result.

◆ _getSuggestedSolutionOutput()

static assQuestion::_getSuggestedSolutionOutput (   $question_id)
static

Returns the output of the suggested solution.

Parameters
integer$question_idThe database Id of the question
Returns
string Suggested solution

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

1007 {
1009 if (!is_object($question)) {
1010 return "";
1011 }
1012 return $question->getSuggestedSolutionOutput();
1013 }
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.

References $question, and _instanciateQuestion().

Referenced by ilObjTest\getTestResult().

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

◆ _getTitle()

static assQuestion::_getTitle (   $a_q_id)
static

Returns the title of a question.

Parameters
int$a_q_idquestion id

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

2232 {
2233 global $DIC;
2234 $ilDB = $DIC['ilDB'];
2235 $result = $ilDB->queryF(
2236 "SELECT title FROM qpl_questions WHERE question_id = %s",
2237 array('integer'),
2238 array($a_q_id)
2239 );
2240 if ($result->numRows() == 1) {
2241 $row = $ilDB->fetchAssoc($result);
2242 return $row["title"];
2243 } else {
2244 return "";
2245 }
2246 }

References $DIC, $ilDB, $result, and $row.

Referenced by ilSCORM2004ScoGUI\sahs_questions(), and ilLMMailNotification\send().

+ Here is the caller graph for this function:

◆ _getTotalAnswers()

assQuestion::_getTotalAnswers (   $a_q_id)

get number of answers for question id (static) note: do not use $this inside this method

Parameters
int$a_q_idquestion id

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

2159 {
2160 global $DIC;
2161 $ilDB = $DIC['ilDB'];
2162
2163 // get all question references to the question id
2164 $result = $ilDB->queryF(
2165 "SELECT question_id FROM qpl_questions WHERE original_id = %s OR question_id = %s",
2166 array('integer','integer'),
2167 array($a_q_id, $a_q_id)
2168 );
2169 if ($result->numRows() == 0) {
2170 return 0;
2171 }
2172 $found_id = array();
2173 while ($row = $ilDB->fetchAssoc($result)) {
2174 array_push($found_id, $row["question_id"]);
2175 }
2176
2177 $result = $ilDB->query("SELECT * FROM tst_test_result WHERE " . $ilDB->in('question_fi', $found_id, false, 'integer'));
2178
2179 return $result->numRows();
2180 }

References $DIC, $ilDB, $result, and $row.

Referenced by getTotalAnswers().

+ Here is the caller graph for this function:

◆ _getTotalRightAnswers()

static assQuestion::_getTotalRightAnswers (   $a_q_id)
static

get number of answers for question id (static) note: do not use $this inside this method

Parameters
int$a_q_idquestion id

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

2190 {
2191 global $DIC;
2192 $ilDB = $DIC['ilDB'];
2193 $result = $ilDB->queryF(
2194 "SELECT question_id FROM qpl_questions WHERE original_id = %s OR question_id = %s",
2195 array('integer','integer'),
2196 array($a_q_id, $a_q_id)
2197 );
2198 if ($result->numRows() == 0) {
2199 return 0;
2200 }
2201 $found_id = array();
2202 while ($row = $ilDB->fetchAssoc($result)) {
2203 array_push($found_id, $row["question_id"]);
2204 }
2205 $result = $ilDB->query("SELECT * FROM tst_test_result WHERE " . $ilDB->in('question_fi', $found_id, false, 'integer'));
2206 $answers = array();
2207 while ($row = $ilDB->fetchAssoc($result)) {
2208 $reached = $row["points"];
2209 include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
2210 $max = assQuestion::_getMaximumPoints($row["question_fi"]);
2211 array_push($answers, array("reached" => $reached, "max" => $max));
2212 }
2213 $max = 0.0;
2214 $reached = 0.0;
2215 foreach ($answers as $key => $value) {
2216 $max += $value["max"];
2217 $reached += $value["reached"];
2218 }
2219 if ($max > 0) {
2220 return $reached / $max;
2221 } else {
2222 return 0;
2223 }
2224 }
static _getMaximumPoints($question_id)
Returns the maximum points, a learner can reach answering the question.

References $DIC, $ilDB, $key, $result, $row, and _getMaximumPoints().

Referenced by ilQuestionCumulatedStatisticsTableGUI\initData().

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

◆ _includeClass()

static assQuestion::_includeClass (   $question_type,
  $gui = 0 
)
static

Include the php class file for a given question type.

Parameters
string$question_typeThe type tag of the question type
Returns
integer 0 if the class should be included, 1 if the GUI class should be included @access public

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

3941 {
3942 if (self::isCoreQuestionType($question_type)) {
3943 self::includeCoreClass($question_type, $gui);
3944 } else {
3945 self::includePluginClass($question_type, $gui);
3946 }
3947 }
static includePluginClass($questionType, $withGuiClass)
static includeCoreClass($questionType, $withGuiClass)

References includeCoreClass(), and includePluginClass().

Referenced by assQuestionGUI\_getQuestionGUI(), _instantiateQuestion(), ilObjQuestionPool\createQuestion(), ilObjTest\createQuestionGUI(), ilQTIParser\handlerParseEndTag(), instantiateQuestionGUI(), and ilObjTest\isQuestionObligationPossible().

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

◆ _instanciateQuestion()

◆ _instanciateQuestionGUI()

static & assQuestion::_instanciateQuestionGUI (   $question_id)
static

Creates an instance of a question gui with a given question id.

Parameters
integer$question_idThe question id
Returns
\assQuestionGUI The question gui instance
Deprecated:
Use instantiateQuestionGUI (without legacy underscore & typos) instead. @access public

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

4049 {
4050 return self::instantiateQuestionGUI($question_id);
4051 }
static instantiateQuestionGUI($a_question_id)
Creates an instance of a question gui with a given question id.

References instantiateQuestionGUI().

Referenced by ilObjTestGUI\copyQuestionObject(), ilObjQuestionPool\createQuestion(), and ilQuestionPoolPrintViewTableGUI\fillRow().

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

◆ _instantiateQuestion()

static assQuestion::_instantiateQuestion (   $question_id)
static
Parameters
$question_id
Returns
assQuestion

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

3253 {
3254 global $DIC;
3255 $ilCtrl = $DIC['ilCtrl'];
3256 $ilDB = $DIC['ilDB'];
3257 $lng = $DIC['lng'];
3258
3259 if (strcmp($question_id, "") != 0) {
3260 $question_type = assQuestion::_getQuestionType($question_id);
3261 if (!strlen($question_type)) {
3262 return null;
3263 }
3264 assQuestion::_includeClass($question_type);
3265 $objectClassname = self::getObjectClassNameByQuestionType($question_type);
3266 $question = new $objectClassname();
3267 $question->loadFromDb($question_id);
3268
3269 $feedbackObjectClassname = self::getFeedbackClassNameByQuestionType($question_type);
3270 $question->feedbackOBJ = new $feedbackObjectClassname($question, $ilCtrl, $ilDB, $lng);
3271
3272 return $question;
3273 }
3274 }
static getFeedbackClassNameByQuestionType($questionType)
static getObjectClassNameByQuestionType($questionType)
static _includeClass($question_type, $gui=0)
Include the php class file for a given question type.
static _getQuestionType($question_id)
Returns the question type of a question with a given id.
global $ilCtrl
Definition: ilias.php:18

References $DIC, $ilCtrl, $ilDB, $lng, $question, _getQuestionType(), _includeClass(), getFeedbackClassNameByQuestionType(), and getObjectClassNameByQuestionType().

Referenced by _instanciateQuestion(), ilTestExport\exportToExcel(), ilSCORM2004Asset\exportXMLPageObjects(), ilAssLacQuestionProvider\getQuestion(), ilTestPlayerAbstractGUI\getQuestionInstance(), ilTestExport\getQuestionQtiXml(), ilTestRandomQuestionSetPoolDeriver\getQuestionsForPool(), ilPageObject\newQuestionCopies(), ilAssIncompleteQuestionPurger\purgeQuestionIds(), ilTestScoringByQuestionsGUI\saveManScoringByQuestion(), ilTestRandomQuestionSetStagingPoolBuilder\stageQuestionsFromSourcePoolCheap(), and ilAssQuestionSkillAssignmentsGUI\syncOriginalCmd().

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

◆ _isUsedInRandomTest()

static assQuestion::_isUsedInRandomTest (   $question_id = "")
static

Checks whether the question is used in a random test or not.

Returns
boolean The number how often the question is used in a random test @access public

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

3384 {
3385 global $DIC;
3386 $ilDB = $DIC['ilDB'];
3387
3388 if ($question_id < 1) {
3389 return 0;
3390 }
3391 $result = $ilDB->queryF(
3392 "SELECT test_random_question_id FROM tst_test_rnd_qst WHERE question_fi = %s",
3393 array('integer'),
3394 array($question_id)
3395 );
3396 return $result->numRows();
3397 }

References $DIC, $ilDB, and $result.

Referenced by ilObjQuestionPool\getDeleteableQuestionDetails().

+ Here is the caller graph for this function:

◆ _isWorkedThrough()

static assQuestion::_isWorkedThrough (   $active_id,
  $question_id,
  $pass = null 
)
static

Returns true if the question was worked through in the given pass Worked through means that the user entered at least one value.

Parameters
integer$user_idThe database ID of the learner
integer$test_idThe database Id of the test containing the question
integer$question_idThe database Id of the question

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

3485 {
3486 return self::lookupResultRecordExist($active_id, $question_id, $pass);
3487
3488 // oldschool "workedthru"
3489
3490 global $DIC;
3491 $ilDB = $DIC['ilDB'];
3492
3493 $points = 0;
3494 if (is_null($pass)) {
3495 include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
3496 $pass = assQuestion::_getSolutionMaxPass($question_id, $active_id);
3497 }
3498 $result = $ilDB->queryF(
3499 "SELECT solution_id FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
3500 array('integer','integer','integer'),
3501 array($active_id, $question_id, $pass)
3502 );
3503 if ($result->numRows()) {
3504 return true;
3505 } else {
3506 return false;
3507 }
3508 }
static lookupResultRecordExist($activeId, $questionId, $pass)

References $DIC, $ilDB, $pass, $points, $result, _getSolutionMaxPass(), and lookupResultRecordExist().

Referenced by ilObjTest\getAnsweredQuestionCount(), ilTestOutputGUI\handleQuestionPostponing(), ilTestPlayerDynamicQuestionSetGUI\nextQuestionCmd(), ilTestOutputGUI\showQuestionCmd(), and ilTestPlayerDynamicQuestionSetGUI\showQuestionCmd().

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

◆ _isWriteable()

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

Returns true if the question is writeable by a certain user.

Parameters
integer$question_idThe database id of the question
integer$user_idThe database id of the user
Returns
boolean True, if the question exists, otherwise False @access public

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

3354 {
3355 global $DIC;
3356 $ilDB = $DIC['ilDB'];
3357
3358 if (($question_id < 1) || ($user_id < 1)) {
3359 return false;
3360 }
3361
3362 $result = $ilDB->queryF(
3363 "SELECT obj_fi FROM qpl_questions WHERE question_id = %s",
3364 array('integer'),
3365 array($question_id)
3366 );
3367 if ($result->numRows() == 1) {
3368 $row = $ilDB->fetchAssoc($result);
3369 $qpl_object_id = $row["obj_fi"];
3370 include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
3371 return ilObjQuestionPool::_isWriteable($qpl_object_id, $user_id);
3372 } else {
3373 return false;
3374 }
3375 }
static _isWriteable($object_id, $user_id)
Returns true, if the question pool is writeable by a given user.

References $DIC, $ilDB, $result, $row, and ilObjQuestionPool\_isWriteable().

Referenced by ilAssQuestionFeedbackEditingGUI\isSyncAfterSaveRequired(), ilAssQuestionHintsGUI\performDeleteCmd(), assQuestionGUI\save(), assQuestionGUI\saveEdit(), ilAssQuestionHintGUI\saveFormCmd(), ilAssQuestionHintsGUI\saveListOrderCmd(), assQuestionGUI\saveReturn(), assFormulaQuestionGUI\saveReturnFQ(), and assQuestionGUI\suggestedsolution().

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

◆ _needsManualScoring()

static assQuestion::_needsManualScoring (   $question_id)
static

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

3898 {
3899 include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
3901 $questiontype = assQuestion::_getQuestionType($question_id);
3902 if (in_array($questiontype, $scoring)) {
3903 return true;
3904 } else {
3905 return false;
3906 }
3907 }
static _getManualScoringTypes()
Retrieve the manual scoring settings as type strings.

References ilObjAssessmentFolder\_getManualScoringTypes(), and _getQuestionType().

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

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

◆ _questionExists()

assQuestion::_questionExists (   $question_id)

Returns true if the question already exists in the database.

Parameters
integer$question_idThe database id of the question
Returns
boolean True, if the question exists, otherwise False @access public

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

3188 {
3189 global $DIC;
3190 $ilDB = $DIC['ilDB'];
3191
3192 if ($question_id < 1) {
3193 return false;
3194 }
3195
3196 $result = $ilDB->queryF(
3197 "SELECT question_id FROM qpl_questions WHERE question_id = %s",
3198 array('integer'),
3199 array($question_id)
3200 );
3201 if ($result->numRows() == 1) {
3202 return true;
3203 } else {
3204 return false;
3205 }
3206 }

References $DIC, $ilDB, and $result.

◆ _questionExistsInPool()

assQuestion::_questionExistsInPool (   $question_id)

Returns true if the question already exists in the database and is assigned to a question pool.

Parameters
integer$question_idThe database id of the question
Returns
boolean True, if the question exists, otherwise False @access public

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

3216 {
3217 global $DIC;
3218 $ilDB = $DIC['ilDB'];
3219
3220 if ($question_id < 1) {
3221 return false;
3222 }
3223
3224 $result = $ilDB->queryF(
3225 "SELECT question_id FROM qpl_questions INNER JOIN object_data ON obj_fi = obj_id WHERE question_id = %s AND type = 'qpl'",
3226 array('integer'),
3227 array($question_id)
3228 );
3229 if ($result->numRows() == 1) {
3230 return true;
3231 } else {
3232 return false;
3233 }
3234 }

References $DIC, $ilDB, and $result.

◆ _questionExistsInTest()

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

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

4254 {
4255 global $DIC;
4256 $ilDB = $DIC['ilDB'];
4257
4258 if ($question_id < 1) {
4259 return false;
4260 }
4261
4262 $result = $ilDB->queryF(
4263 "SELECT question_fi FROM tst_test_question WHERE question_fi = %s AND test_fi = %s",
4264 array('integer', 'integer'),
4265 array($question_id, $test_id)
4266 );
4267 if ($result->numRows() == 1) {
4268 return true;
4269 } else {
4270 return false;
4271 }
4272 }

References $DIC, $ilDB, $result, and $test_id.

Referenced by assQuestionGUI\save(), assQuestionGUI\saveReturn(), and assFormulaQuestionGUI\saveReturnFQ().

+ Here is the caller graph for this function:

◆ _resolveInternalLink()

assQuestion::_resolveInternalLink (   $internal_link)

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

2973 {
2974 if (preg_match("/il_(\d+)_(\w+)_(\d+)/", $internal_link, $matches)) {
2975 include_once "./Services/Link/classes/class.ilInternalLink.php";
2976 include_once "./Modules/LearningModule/classes/class.ilLMObject.php";
2977 include_once "./Modules/Glossary/classes/class.ilGlossaryTerm.php";
2978 switch ($matches[2]) {
2979 case "lm":
2980 $resolved_link = ilLMObject::_getIdForImportId($internal_link);
2981 break;
2982 case "pg":
2983 $resolved_link = ilInternalLink::_getIdForImportId("PageObject", $internal_link);
2984 break;
2985 case "st":
2986 $resolved_link = ilInternalLink::_getIdForImportId("StructureObject", $internal_link);
2987 break;
2988 case "git":
2989 $resolved_link = ilInternalLink::_getIdForImportId("GlossaryItem", $internal_link);
2990 break;
2991 case "mob":
2992 $resolved_link = ilInternalLink::_getIdForImportId("MediaObject", $internal_link);
2993 break;
2994 }
2995 if (strcmp($resolved_link, "") == 0) {
2996 $resolved_link = $internal_link;
2997 }
2998 } else {
2999 $resolved_link = $internal_link;
3000 }
3001 return $resolved_link;
3002 }
static _getIdForImportId($a_import_id)
get current object id for import id (static)

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

Referenced by _resolveIntLinks(), and setSuggestedSolution().

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

◆ _resolveIntLinks()

assQuestion::_resolveIntLinks (   $question_id)

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

3005 {
3006 global $DIC;
3007 $ilDB = $DIC['ilDB'];
3008 $resolvedlinks = 0;
3009 $result = $ilDB->queryF(
3010 "SELECT * FROM qpl_sol_sug WHERE question_fi = %s",
3011 array('integer'),
3012 array($question_id)
3013 );
3014 if ($result->numRows()) {
3015 while ($row = $ilDB->fetchAssoc($result)) {
3016 $internal_link = $row["internal_link"];
3017 include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
3018 $resolved_link = assQuestion::_resolveInternalLink($internal_link);
3019 if (strcmp($internal_link, $resolved_link) != 0) {
3020 // internal link was resolved successfully
3021 $affectedRows = $ilDB->manipulateF(
3022 "UPDATE qpl_sol_sug SET internal_link = %s WHERE suggested_solution_id = %s",
3023 array('text','integer'),
3024 array($resolved_link, $row["suggested_solution_id"])
3025 );
3026 $resolvedlinks++;
3027 }
3028 }
3029 }
3030 if ($resolvedlinks) {
3031 // there are resolved links -> reenter theses links to the database
3032
3033 // delete all internal links from the database
3034 include_once "./Services/Link/classes/class.ilInternalLink.php";
3035 ilInternalLink::_deleteAllLinksOfSource("qst", $question_id);
3036
3037 $result = $ilDB->queryF(
3038 "SELECT * FROM qpl_sol_sug WHERE question_fi = %s",
3039 array('integer'),
3040 array($question_id)
3041 );
3042 if ($result->numRows()) {
3043 while ($row = $ilDB->fetchAssoc($result)) {
3044 if (preg_match("/il_(\d*?)_(\w+)_(\d+)/", $row["internal_link"], $matches)) {
3045 ilInternalLink::_saveLink("qst", $question_id, $matches[2], $matches[3], $matches[1]);
3046 }
3047 }
3048 }
3049 }
3050 }
_resolveInternalLink($internal_link)

References $DIC, $ilDB, $result, $row, ilInternalLink\_deleteAllLinksOfSource(), _resolveInternalLink(), and ilInternalLink\_saveLink().

Referenced by ilContObjParser\processPagesToParse().

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

◆ _setReachedPoints()

static assQuestion::_setReachedPoints (   $active_id,
  $question_id,
  $points,
  $maxpoints,
  $pass,
  $manualscoring,
  $obligationsEnabled 
)
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 @access public

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

3657 {
3658 global $DIC;
3659 $ilDB = $DIC['ilDB'];
3660
3661 if ($points <= $maxpoints) {
3662 if (is_null($pass)) {
3663 $pass = assQuestion::_getSolutionMaxPass($question_id, $active_id);
3664 }
3665
3666 // retrieve the already given points
3667 $old_points = 0;
3668 $result = $ilDB->queryF(
3669 "SELECT points FROM tst_test_result WHERE active_fi = %s AND question_fi = %s AND pass = %s",
3670 array('integer','integer','integer'),
3671 array($active_id, $question_id, $pass)
3672 );
3673 $manual = ($manualscoring) ? 1 : 0;
3674 $rowsnum = $result->numRows();
3675 if ($rowsnum) {
3676 $row = $ilDB->fetchAssoc($result);
3677 $old_points = $row["points"];
3678 if ($old_points != $points) {
3679 $affectedRows = $ilDB->manipulateF(
3680 "UPDATE tst_test_result SET points = %s, manual = %s, tstamp = %s WHERE active_fi = %s AND question_fi = %s AND pass = %s",
3681 array('float', 'integer', 'integer', 'integer', 'integer', 'integer'),
3682 array($points, $manual, time(), $active_id, $question_id, $pass)
3683 );
3684 }
3685 } else {
3686 $next_id = $ilDB->nextId('tst_test_result');
3687 $affectedRows = $ilDB->manipulateF(
3688 "INSERT INTO tst_test_result (test_result_id, active_fi, question_fi, points, pass, manual, tstamp) VALUES (%s, %s, %s, %s, %s, %s, %s)",
3689 array('integer', 'integer','integer', 'float', 'integer', 'integer','integer'),
3690 array($next_id, $active_id, $question_id, $points, $pass, $manual, time())
3691 );
3692 }
3693
3694 if (self::isForcePassResultUpdateEnabled() || $old_points != $points || !$rowsnum) {
3695 assQuestion::_updateTestPassResults($active_id, $pass, $obligationsEnabled);
3696 // finally update objective result
3697 include_once "./Modules/Test/classes/class.ilObjTest.php";
3698 include_once './Modules/Course/classes/class.ilCourseObjectiveResult.php';
3700
3701 include_once("./Modules/Test/classes/class.ilObjAssessmentFolder.php");
3703 global $DIC;
3704 $lng = $DIC['lng'];
3705 $ilUser = $DIC['ilUser'];
3706 include_once "./Modules/Test/classes/class.ilObjTestAccess.php";
3707 $username = ilObjTestAccess::_getParticipantData($active_id);
3708 assQuestion::logAction(sprintf($lng->txtlng("assessment", "log_answer_changed_points", ilObjAssessmentFolder::_getLogLanguage()), $username, $old_points, $points, $ilUser->getFullname() . " (" . $ilUser->getLogin() . ")"), $active_id, $question_id);
3709 }
3710 }
3711
3712 return true;
3713 } else {
3714 return false;
3715 }
3716 }
static logAction($logtext="", $active_id="", $question_id="")
Logs an action into the Test&Assessment log.
static _updateObjectiveResult($a_user_id, $a_active_id, $a_question_id)
static _getLogLanguage()
retrieve the log language for assessment logging
static _enabledAssessmentLogging()
check wether assessment logging is enabled or not
static _getParticipantData($active_id)
Retrieves a participant name from active id.
static _getUserIdFromActiveId($active_id)
$ilUser
Definition: imgupload.php:18

References $DIC, $ilDB, $ilUser, $lng, $pass, $points, $result, $row, ilObjAssessmentFolder\_enabledAssessmentLogging(), ilObjAssessmentFolder\_getLogLanguage(), ilObjTestAccess\_getParticipantData(), _getSolutionMaxPass(), ilObjTest\_getUserIdFromActiveId(), ilCourseObjectiveResult\_updateObjectiveResult(), and logAction().

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

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

◆ _updateTestResultCache()

static assQuestion::_updateTestResultCache (   $active_id,
ilAssQuestionProcessLocker  $processLocker = null 
)
static

@TODO Move this to a proper place.

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

1359 {
1360 global $DIC;
1361 $ilDB = $DIC['ilDB'];
1362
1363 include_once "./Modules/Test/classes/class.ilObjTest.php";
1364 include_once "./Modules/Test/classes/class.assMarkSchema.php";
1365
1366 $pass = ilObjTest::_getResultPass($active_id);
1367
1368 $query = "
1369 SELECT tst_pass_result.*
1370 FROM tst_pass_result
1371 WHERE active_fi = %s
1372 AND pass = %s
1373 ";
1374
1375 $result = $ilDB->queryF(
1376 $query,
1377 array('integer','integer'),
1378 array($active_id, $pass)
1379 );
1380
1381 $row = $ilDB->fetchAssoc($result);
1382
1383 $max = $row['maxpoints'];
1384 $reached = $row['points'];
1385
1386 $obligationsAnswered = (int) $row['obligations_answered'];
1387
1388 include_once "./Modules/Test/classes/class.assMarkSchema.php";
1389
1390 $percentage = (!$max) ? 0 : ($reached / $max) * 100.0;
1391
1392 $mark = ASS_MarkSchema::_getMatchingMarkFromActiveId($active_id, $percentage);
1393
1394 $isPassed = ($mark["passed"] ? 1 : 0);
1395 $isFailed = (!$mark["passed"] ? 1 : 0);
1396
1397 $userTestResultUpdateCallback = function () use ($ilDB, $active_id, $pass, $max, $reached, $isFailed, $isPassed, $obligationsAnswered, $row, $mark) {
1398 $passedOnceBefore = 0;
1399 $query = "SELECT passed_once FROM tst_result_cache WHERE active_fi = %s";
1400 $res = $ilDB->queryF($query, array('integer'), array($active_id));
1401 while ($row = $ilDB->fetchAssoc($res)) {
1402 $passedOnceBefore = (int) $row['passed_once'];
1403 }
1404
1405 $passedOnce = (int) ($isPassed || $passedOnceBefore);
1406
1407 $ilDB->manipulateF(
1408 "DELETE FROM tst_result_cache WHERE active_fi = %s",
1409 array('integer'),
1410 array($active_id)
1411 );
1412
1413 $ilDB->insert('tst_result_cache', array(
1414 'active_fi' => array('integer', $active_id),
1415 'pass' => array('integer', strlen($pass) ? $pass : 0),
1416 'max_points' => array('float', strlen($max) ? $max : 0),
1417 'reached_points' => array('float', strlen($reached) ? $reached : 0),
1418 'mark_short' => array('text', strlen($mark["short_name"]) ? $mark["short_name"] : " "),
1419 'mark_official' => array('text', strlen($mark["official_name"]) ? $mark["official_name"] : " "),
1420 'passed_once' => array('integer', $passedOnce),
1421 'passed' => array('integer', $isPassed),
1422 'failed' => array('integer', $isFailed),
1423 'tstamp' => array('integer', time()),
1424 'hint_count' => array('integer', $row['hint_count']),
1425 'hint_points' => array('float', $row['hint_points']),
1426 'obligations_answered' => array('integer', $obligationsAnswered)
1427 ));
1428 };
1429
1430 if (is_object($processLocker)) {
1431 $processLocker->executeUserTestResultUpdateLockOperation($userTestResultUpdateCallback);
1432 } else {
1433 $userTestResultUpdateCallback();
1434 }
1435 }
static _getResultPass($active_id)
Retrieves the pass number that should be counted for a given user.
$query

References $DIC, $ilDB, $pass, $processLocker, $query, $res, $result, $row, and ilObjTest\_getResultPass().

Referenced by ilObjTestAccess\_getPassedUsers(), ilObjTestAccess\_isPassed(), ilObjTest\getResultsForActiveId(), ilTestScoring\recalculateSolutions(), ilTestScoring\updatePassAndTestResults(), and ilObjTestAccess\updateTestResultCache().

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

◆ addAnswerOptionValue()

assQuestion::addAnswerOptionValue (   $qIndex,
  $answerOptionValue,
  $points 
)

Reimplemented in assClozeTest.

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

5213 {
5214 }

◆ addQTIMaterial()

assQuestion::addQTIMaterial ( $a_xml_writer,
  $a_material,
  $close_material_tag = true,
  $add_mobs = true 
)

Creates a QTI material tag from a plain text or xhtml text.

Parameters
object$a_xml_writerReference to the ILIAS XML writer
string$a_materialplain text or html text containing the material
Returns
string QTI material tag @access public

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

3596 {
3597 include_once "./Services/RTE/classes/class.ilRTE.php";
3598 include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
3599
3600 $a_xml_writer->xmlStartTag("material");
3601 $attrs = array(
3602 "texttype" => "text/plain"
3603 );
3604 if ($this->isHTML($a_material)) {
3605 $attrs["texttype"] = "text/xhtml";
3606 }
3607 $a_xml_writer->xmlElement("mattext", $attrs, ilRTE::_replaceMediaObjectImageSrc($a_material, 0));
3608 if ($add_mobs) {
3609 $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $this->getId());
3610 foreach ($mobs as $mob) {
3611 $moblabel = "il_" . IL_INST_ID . "_mob_" . $mob;
3612 if (strpos($a_material, "mm_$mob") !== false) {
3613 if (ilObjMediaObject::_exists($mob)) {
3614 $mob_obj = new ilObjMediaObject($mob);
3615 $imgattrs = array(
3616 "label" => $moblabel,
3617 "uri" => "objects/" . "il_" . IL_INST_ID . "_mob_" . $mob . "/" . $mob_obj->getTitle()
3618 );
3619 }
3620 $a_xml_writer->xmlElement("matimage", $imgattrs, null);
3621 }
3622 }
3623 }
3624 if ($close_material_tag) {
3625 $a_xml_writer->xmlEndTag("material");
3626 }
3627 }
isHTML($a_text)
Checks if a given string contains HTML or not.
Class ilObjMediaObject.
static _getMobsOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
get mobs of object
static _exists($a_id, $a_reference=false, $a_type=null)
checks wether a lm content object with specified id exists or not
static _replaceMediaObjectImageSrc($a_text, $a_direction=0, $nic=IL_INST_ID)
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
$mobs

References $mobs, ilObjMediaObject\_exists(), ilObjMediaObject\_getMobsOfObject(), ilRTE\_replaceMediaObjectImageSrc(), getId(), and isHTML().

+ Here is the call graph for this function:

◆ addQuestionChangeListener()

assQuestion::addQuestionChangeListener ( ilQuestionChangeListener  $listener)
Parameters
ilQuestionChangeListener$listener

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

4629 {
4630 $this->questionChangeListeners[] = $listener;
4631 }

Referenced by ilObjQuestionPool\addQuestionChangeListeners().

+ Here is the caller graph for this function:

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

@final @access public

Parameters
integer$points
integer$active_id
integer$pass

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

3459 {
3460 include_once "./Modules/Test/classes/class.ilObjTest.php";
3461 $count_system = ilObjTest::_getCountSystem($active_id);
3462 if ($count_system == 1) {
3463 if (abs($this->getMaximumPoints() - $points) > 0.0000000001) {
3464 $points = 0;
3465 }
3466 }
3467 $score_cutting = ilObjTest::_getScoreCutting($active_id);
3468 if ($score_cutting == 0) {
3469 if ($points < 0) {
3470 $points = 0;
3471 }
3472 }
3473 return $points;
3474 }
getMaximumPoints()
Returns the maximum points, a learner can reach answering the question.
static _getCountSystem($active_id)
Gets the count system for the calculation of points.
static _getScoreCutting($active_id)
Determines if the score of a question should be cut at 0 points or the score of the whole test.

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

Referenced by calculateResultsFromSolution(), and getAdjustedReachedPoints().

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

◆ afterSyncWithOriginal()

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

Reimplemented in assKprimChoice, assMatchingQuestion, assOrderingQuestion, and assSingleChoice.

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

2698 {
2699 // sync question feeback
2700 $this->feedbackOBJ->syncFeedback($origQuestionId, $dupQuestionId);
2701 }

Referenced by syncWithOriginal().

+ Here is the caller graph for this function:

◆ areObligationsToBeConsidered()

assQuestion::areObligationsToBeConsidered ( )
Returns
boolean

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

5398 {
5400 }

References $obligationsToBeConsidered.

Referenced by resetUsersAnswer().

+ Here is the caller graph for this function:

◆ authorizedOrIntermediateSolutionExists()

assQuestion::authorizedOrIntermediateSolutionExists (   $active_id,
  $pass 
)

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

5130 {
5131 $solutionAvailability = $this->lookupForExistingSolutions($active_id, $pass);
5132 return (bool) $solutionAvailability['authorized'] || (bool) $solutionAvailability['intermediate'];
5133 }

References $pass.

◆ authorizedSolutionExists()

assQuestion::authorizedSolutionExists (   $active_id,
  $pass 
)

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

5125 {
5126 $solutionAvailability = $this->lookupForExistingSolutions($active_id, $pass);
5127 return (bool) $solutionAvailability['authorized'];
5128 }

References $pass.

◆ beforeSyncWithOriginal()

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

Reimplemented in assKprimChoice.

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

2694 {
2695 }

Referenced by syncWithOriginal().

+ Here is the caller graph for this function:

◆ buildHashedImageFilename()

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

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

3630 {
3631 $extension = "";
3632
3633 if (preg_match("/.*\.(png|jpg|gif|jpeg)$/i", $plain_image_filename, $matches)) {
3634 $extension = "." . $matches[1];
3635 }
3636
3637 if ($unique) {
3638 $plain_image_filename = uniqid($plain_image_filename . microtime(true));
3639 }
3640
3641 $hashed_filename = md5($plain_image_filename) . $extension;
3642
3643 return $hashed_filename;
3644 }

Referenced by assKprimChoice\handleFileUpload().

+ Here is the caller graph for this function:

◆ buildImagePath()

assQuestion::buildImagePath (   $questionId,
  $parentObjectId 
)

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

1654 {
1655 return CLIENT_WEB_DIR . "/assessment/{$parentObjectId}/{$questionId}/images/";
1656 }

Referenced by assMatchingQuestion\afterSyncWithOriginal(), assSingleChoice\afterSyncWithOriginal(), and getImagePath().

+ Here is the caller graph for this function:

◆ buildQuestionDataQuery()

assQuestion::buildQuestionDataQuery ( )
protected

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

4681 {
4682 return "
4683 SELECT qpl_questions.*,
4684 {$this->getAdditionalTableName()}.*
4685 FROM qpl_questions
4686 LEFT JOIN {$this->getAdditionalTableName()}
4687 ON {$this->getAdditionalTableName()}.question_fi = qpl_questions.question_id
4688 WHERE qpl_questions.question_id = %s
4689 ";
4690 }

Referenced by assKprimChoice\loadFromDb().

+ 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

Returns
ilTestQuestionConfig

Reimplemented in assFileUpload, assFlashQuestion, assJavaApplet, assMultipleChoice, assOrderingHorizontal, and assOrderingQuestion.

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

5455 {
5456 include_once('Modules/TestQuestionPool/classes/class.ilTestQuestionConfig.php');
5457 return new ilTestQuestionConfig();
5458 }
Test Question configuration.

Referenced by getTestPresentationConfig().

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

@abstract @access public

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

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

Referenced by calculateResultsFromSolution(), and getAdjustedReachedPoints().

+ Here is the caller graph for this function:

◆ calculateReachedPointsFromPreviewSession()

assQuestion::calculateReachedPointsFromPreviewSession ( ilAssQuestionPreviewSession  $previewSession)

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

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

3424 {
3425 $reachedPoints = $this->calculateReachedPointsForSolution($previewSession->getParticipantsSolution());
3426 $reachedPoints = $this->deductHintPointsFromReachedPoints($previewSession, $reachedPoints);
3427
3428 return $this->ensureNonNegativePoints($reachedPoints);
3429 }
deductHintPointsFromReachedPoints(ilAssQuestionPreviewSession $previewSession, $reachedPoints)
ensureNonNegativePoints($points)

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

Referenced by isPreviewSolutionCorrect().

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

◆ calculateResultsFromSolution()

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

Calculates the question results from a previously saved question solution.

@final @global ilDBInterface $ilDB @global ilObjUser $ilUser

Parameters
integer$active_idActive id of the user
integer$passTest pass

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

1185 {
1186 global $DIC;
1187 $ilDB = $DIC['ilDB'];
1188 $ilUser = $DIC['ilUser'];
1189
1190 if (is_null($pass)) {
1191 include_once "./Modules/Test/classes/class.ilObjTest.php";
1192 $pass = ilObjTest::_getPass($active_id);
1193 }
1194
1195 // determine reached points for submitted solution
1196 $reached_points = $this->calculateReachedPoints($active_id, $pass);
1197
1198 // deduct points for requested hints from reached points
1199 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintTracking.php';
1200 $questionHintTracking = new ilAssQuestionHintTracking($this->getId(), $active_id, $pass);
1201 $requestsStatisticData = $questionHintTracking->getRequestStatisticDataByQuestionAndTestpass();
1202 $reached_points = $reached_points - $requestsStatisticData->getRequestsPoints();
1203
1204 // adjust reached points regarding to tests scoring options
1205 $reached_points = $this->adjustReachedPointsByScoringOptions($reached_points, $active_id, $pass);
1206
1207 if ($obligationsEnabled && ilObjTest::isQuestionObligatory($this->getId())) {
1208 $isAnswered = $this->isAnswered($active_id, $pass);
1209 } else {
1210 $isAnswered = true;
1211 }
1212
1213 if (is_null($reached_points)) {
1214 $reached_points = 0;
1215 }
1216
1217 // fau: testNav - check for existing authorized solution to know if a result record should be written
1218 $existingSolutions = $this->lookupForExistingSolutions($active_id, $pass);
1219
1220 $this->getProcessLocker()->executeUserQuestionResultUpdateOperation(function () use ($ilDB, $active_id, $pass, $reached_points, $requestsStatisticData, $isAnswered, $existingSolutions) {
1221 $query = "
1222 DELETE FROM tst_test_result
1223
1224 WHERE active_fi = %s
1225 AND question_fi = %s
1226 AND pass = %s
1227 ";
1228
1229 $types = array('integer', 'integer', 'integer');
1230 $values = array($active_id, $this->getId(), $pass);
1231
1232 if ($this->getStep() !== null) {
1233 $query .= "
1234 AND step = %s
1235 ";
1236
1237 $types[] = 'integer';
1238 $values[] = $this->getStep();
1239 }
1240 $ilDB->manipulateF($query, $types, $values);
1241
1242 if ($existingSolutions['authorized']) {
1243 $next_id = $ilDB->nextId("tst_test_result");
1244 $fieldData = array(
1245 'test_result_id' => array('integer', $next_id),
1246 'active_fi' => array('integer', $active_id),
1247 'question_fi' => array('integer', $this->getId()),
1248 'pass' => array('integer', $pass),
1249 'points' => array('float', $reached_points),
1250 'tstamp' => array('integer', time()),
1251 'hint_count' => array('integer', $requestsStatisticData->getRequestsCount()),
1252 'hint_points' => array('float', $requestsStatisticData->getRequestsPoints()),
1253 'answered' => array('integer', $isAnswered)
1254 );
1255
1256 if ($this->getStep() !== null) {
1257 $fieldData['step'] = array('integer', $this->getStep());
1258 }
1259
1260 $ilDB->insert('tst_test_result', $fieldData);
1261 }
1262 });
1263 // fau.
1264
1265 include_once("./Modules/Test/classes/class.ilObjAssessmentFolder.php");
1266
1269 sprintf(
1270 $this->lng->txtlng(
1271 "assessment",
1272 "log_user_answered_question",
1274 ),
1275 $reached_points
1276 ),
1277 $active_id,
1278 $this->getId()
1279 );
1280 }
1281
1282 // update test pass results
1283 self::_updateTestPassResults($active_id, $pass, $obligationsEnabled, $this->getProcessLocker());
1284
1285 // Update objective status
1286 include_once 'Modules/Course/classes/class.ilCourseObjectiveResult.php';
1287 ilCourseObjectiveResult::_updateObjectiveResult($ilUser->getId(), $active_id, $this->getId());
1288 }
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.
isAnswered($active_id, $pass=null)
returns boolean wether the question is answered during test pass or not
static _getPass($active_id)
Retrieves the actual pass of a given user for a given test.
static isQuestionObligatory($question_id)
checks wether the question with given id is marked as obligatory or not
$values

References $DIC, $ilDB, $ilUser, $pass, $query, $values, ilObjAssessmentFolder\_enabledAssessmentLogging(), ilObjAssessmentFolder\_getLogLanguage(), ilObjTest\_getPass(), ilCourseObjectiveResult\_updateObjectiveResult(), adjustReachedPointsByScoringOptions(), calculateReachedPoints(), getId(), getProcessLocker(), getStep(), isAnswered(), ilObjTest\isQuestionObligatory(), and logAction().

Referenced by assSingleChoice\createRandomSolution(), and persistWorkingState().

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

◆ cleanupMediaObjectUsage()

assQuestion::cleanupMediaObjectUsage ( )

synchronises appearances of media objects in the question with media object usage table

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

3844 {
3845 $combinedtext = $this->getRTETextWithMediaObjects();
3846 include_once("./Services/RTE/classes/class.ilRTE.php");
3847 ilRTE::_cleanupMediaObjectUsage($combinedtext, "qpl:html", $this->getId());
3848 }
getRTETextWithMediaObjects()
Collects all text in the question which could contain media objects which were created with the Rich ...
static _cleanupMediaObjectUsage($a_text, $a_usage_type, $a_usage_id)
Synchronises appearances of media objects in $a_text with media object usage table.

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

Referenced by saveToDb().

+ 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 (   $time)
static
Parameters
$time
Returns
int

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

5100 {
5101 $sec = 0;
5102 $time_array = explode(':', $time);
5103 if (sizeof($time_array) == 3) {
5104 $sec += $time_array[0] * 3600;
5105 $sec += $time_array[1] * 60;
5106 $sec += $time_array[2];
5107 }
5108 return $sec;
5109 }
$time
Definition: cron.php:21

References $time.

Referenced by sumTimesInISO8601FormatH_i_s_Extended().

+ Here is the caller graph for this function:

◆ copyPageOfQuestion()

assQuestion::copyPageOfQuestion (   $a_q_id)

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

2323 {
2324 if ($a_q_id > 0) {
2325 include_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php";
2326 $page = new ilAssQuestionPage($a_q_id);
2327
2328 $xml = str_replace("il__qst_" . $a_q_id, "il__qst_" . $this->id, $page->getXMLContent());
2329 $this->page->setXMLContent($xml);
2330 $this->page->updateFromXML();
2331 }
2332 }
Question page object.

References $page, and $xml.

Referenced by syncWithOriginal().

+ Here is the caller graph for this function:

◆ copySuggestedSolutionFiles()

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

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

2857 {
2858 global $DIC;
2859 $ilLog = $DIC['ilLog'];
2860
2861 foreach ($this->suggested_solutions as $index => $solution) {
2862 if (strcmp($solution["type"], "file") == 0) {
2863 $filepath = $this->getSuggestedSolutionPath();
2864 $filepath_original = str_replace("/$this->obj_id/$this->id/solution", "/$source_questionpool_id/$source_question_id/solution", $filepath);
2865 if (!file_exists($filepath)) {
2866 ilUtil::makeDirParents($filepath);
2867 }
2868 $filename = $solution["value"]["name"];
2869 if (strlen($filename)) {
2870 if (!copy($filepath_original . $filename, $filepath . $filename)) {
2871 $ilLog->write("File could not be copied!!!!", $ilLog->ERROR);
2872 $ilLog->write("object: " . print_r($this, true), $ilLog->ERROR);
2873 }
2874 }
2875 }
2876 }
2877 }
$filename
Definition: buildRTE.php:89
getSuggestedSolutionPath()
Returns the path for a suggested solution.
static makeDirParents($a_dir)
Create a new directory and all parent directories.
$index
Definition: metadata.php:60

References $DIC, $filename, $ilLog, $index, getSuggestedSolutionPath(), and ilUtil\makeDirParents().

Referenced by onCopy().

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

◆ copyXHTMLMediaObjectsOfQuestion()

assQuestion::copyXHTMLMediaObjectsOfQuestion (   $a_q_id)

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

2288 {
2289 include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
2290 $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $a_q_id);
2291 foreach ($mobs as $mob) {
2292 ilObjMediaObject::_saveUsage($mob, "qpl:html", $this->getId());
2293 }
2294 }
static _saveUsage($a_mob_id, $a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
Save usage of mob within another container (e.g.

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

+ Here is the call graph for this function:

◆ createNewQuestion()

assQuestion::createNewQuestion (   $a_create_page = true)

Creates a new question without an owner when a new question is created This assures that an ID is given to the question if a file upload or something else occurs.

Returns
integer ID of the new question

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

2507 {
2508 global $DIC;
2509 $ilDB = $DIC['ilDB'];
2510 $ilUser = $DIC['ilUser'];
2511
2512 $complete = "0";
2513 $estw_time = $this->getEstimatedWorkingTime();
2514 $estw_time = sprintf("%02d:%02d:%02d", $estw_time['h'], $estw_time['m'], $estw_time['s']);
2515 $obj_id = ($this->getObjId() <= 0) ? (ilObject::_lookupObjId((strlen($_GET["ref_id"])) ? $_GET["ref_id"] : $_POST["sel_qpl"])) : $this->getObjId();
2516 if ($obj_id > 0) {
2517 if ($a_create_page) {
2518 $tstamp = 0;
2519 } else {
2520 // question pool must not try to purge
2521 $tstamp = time();
2522 }
2523
2524 $next_id = $ilDB->nextId('qpl_questions');
2525 $affectedRows = $ilDB->insert("qpl_questions", array(
2526 "question_id" => array("integer", $next_id),
2527 "question_type_fi" => array("integer", $this->getQuestionTypeID()),
2528 "obj_fi" => array("integer", $obj_id),
2529 "title" => array("text", null),
2530 "description" => array("text", null),
2531 "author" => array("text", $this->getAuthor()),
2532 "owner" => array("integer", $ilUser->getId()),
2533 "question_text" => array("clob", null),
2534 "points" => array("float", 0),
2535 "nr_of_tries" => array("integer", $this->getDefaultNrOfTries()), // #10771
2536 "working_time" => array("text", $estw_time),
2537 "complete" => array("text", $complete),
2538 "created" => array("integer", time()),
2539 "original_id" => array("integer", null),
2540 "tstamp" => array("integer", $tstamp),
2541 "external_id" => array("text", $this->getExternalId()),
2542 'add_cont_edit_mode' => array('text', $this->getAdditionalContentEditingMode())
2543 ));
2544 $this->setId($next_id);
2545
2546 if ($a_create_page) {
2547 // create page object of question
2548 $this->createPageObject();
2549 }
2550 }
2551
2552 $this->notifyQuestionCreated();
2553
2554 return $this->getId();
2555 }
$_POST["username"]
getQuestionTypeID()
Returns the question type of the question.
getAdditionalContentEditingMode()
getter for additional content editing mode for this question
getDefaultNrOfTries()
Get Default Nr of Tries.
createPageObject()
create page object of question
static _lookupObjId($a_id)

References $_GET, $_POST, $DIC, $ilDB, $ilUser, $obj_id, ilObject\_lookupObjId(), createPageObject(), getAdditionalContentEditingMode(), getAuthor(), getDefaultNrOfTries(), getEstimatedWorkingTime(), getExternalId(), getId(), getObjId(), getQuestionTypeID(), notifyQuestionCreated(), and setId().

+ Here is the call graph for this function:

◆ createPageObject()

assQuestion::createPageObject ( )

create page object of question

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

2309 {
2310 $qpl_id = $this->getObjId();
2311
2312 include_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php";
2313 $this->page = new ilAssQuestionPage(0);
2314 $this->page->setId($this->getId());
2315 $this->page->setParentId($qpl_id);
2316 $this->page->setXMLContent("<PageObject><PageContent>" .
2317 "<Question QRef=\"il__qst_" . $this->getId() . "\"/>" .
2318 "</PageContent></PageObject>");
2319 $this->page->create();
2320 }

References getId(), and getObjId().

Referenced by createNewQuestion(), saveQuestionDataToDb(), and syncWithOriginal().

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

◆ createRandomSolution()

assQuestion::createRandomSolution (   $test_id,
  $user_id 
)

Reimplemented in assSingleChoice, and assTextQuestion.

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

3177 {
3178 }

◆ deductHintPointsFromReachedPoints()

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

◆ delete()

assQuestion::delete (   $question_id)

Deletes a question and all materials from the database.

Parameters
integer$question_idThe database id of the question @access private

Reimplemented in assLongMenu.

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

2000 {
2001 global $DIC;
2002 $ilDB = $DIC['ilDB'];
2003 $ilLog = $DIC['ilLog'];
2004
2005 if ($question_id < 1) {
2006 return true;
2007 } // nothing to do
2008
2009 $result = $ilDB->queryF(
2010 "SELECT obj_fi FROM qpl_questions WHERE question_id = %s",
2011 array('integer'),
2012 array($question_id)
2013 );
2014 if ($result->numRows() == 1) {
2015 $row = $ilDB->fetchAssoc($result);
2016 $obj_id = $row["obj_fi"];
2017 } else {
2018 return true; // nothing to do
2019 }
2020 try {
2021 $this->deletePageOfQuestion($question_id);
2022 } catch (Exception $e) {
2023 $ilLog->write("EXCEPTION: Could not delete page of question $question_id: $e");
2024 return false;
2025 }
2026
2027 $affectedRows = $ilDB->manipulateF(
2028 "DELETE FROM qpl_questions WHERE question_id = %s",
2029 array('integer'),
2030 array($question_id)
2031 );
2032 if ($affectedRows == 0) {
2033 return false;
2034 }
2035
2036 try {
2037 $this->deleteAdditionalTableData($question_id);
2038 $this->deleteAnswers($question_id);
2039 $this->feedbackOBJ->deleteGenericFeedbacks($question_id, $this->isAdditionalContentEditingModePageObject());
2040 $this->feedbackOBJ->deleteSpecificAnswerFeedbacks($question_id, $this->isAdditionalContentEditingModePageObject());
2041 } catch (Exception $e) {
2042 $ilLog->write("EXCEPTION: Could not delete additional table data of question $question_id: $e");
2043 return false;
2044 }
2045
2046 try {
2047 // delete the question in the tst_test_question table (list of test questions)
2048 $affectedRows = $ilDB->manipulateF(
2049 "DELETE FROM tst_test_question WHERE question_fi = %s",
2050 array('integer'),
2051 array($question_id)
2052 );
2053 } catch (Exception $e) {
2054 $ilLog->write("EXCEPTION: Could not delete delete question $question_id from a test: $e");
2055 return false;
2056 }
2057
2058 try {
2059 // delete suggested solutions contained in the question
2060 $affectedRows = $ilDB->manipulateF(
2061 "DELETE FROM qpl_sol_sug WHERE question_fi = %s",
2062 array('integer'),
2063 array($question_id)
2064 );
2065 } catch (Exception $e) {
2066 $ilLog->write("EXCEPTION: Could not delete suggested solutions of question $question_id: $e");
2067 return false;
2068 }
2069
2070 try {
2071 $directory = CLIENT_WEB_DIR . "/assessment/" . $obj_id . "/$question_id";
2072 if (preg_match("/\d+/", $obj_id) and preg_match("/\d+/", $question_id) and is_dir($directory)) {
2073 include_once "./Services/Utilities/classes/class.ilUtil.php";
2074 ilUtil::delDir($directory);
2075 }
2076 } catch (Exception $e) {
2077 $ilLog->write("EXCEPTION: Could not delete question file directory $directory of question $question_id: $e");
2078 return false;
2079 }
2080
2081 try {
2082 include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
2083 $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $question_id);
2084 // remaining usages are not in text anymore -> delete them
2085 // and media objects (note: delete method of ilObjMediaObject
2086 // checks whether object is used in another context; if yes,
2087 // the object is not deleted!)
2088 foreach ($mobs as $mob) {
2089 ilObjMediaObject::_removeUsage($mob, "qpl:html", $question_id);
2090 if (ilObjMediaObject::_exists($mob)) {
2091 $mob_obj = new ilObjMediaObject($mob);
2092 $mob_obj->delete();
2093 }
2094 }
2095 } catch (Exception $e) {
2096 $ilLog->write("EXCEPTION: Error deleting the media objects of question $question_id: $e");
2097 return false;
2098 }
2099
2100 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintTracking.php';
2101 ilAssQuestionHintTracking::deleteRequestsByQuestionIds(array($question_id));
2102
2103 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintList.php';
2105
2106 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentList.php';
2107 $assignmentList = new ilAssQuestionSkillAssignmentList($ilDB);
2108 $assignmentList->setParentObjId($obj_id);
2109 $assignmentList->setQuestionIdFilter($question_id);
2110 $assignmentList->loadFromDb();
2111 foreach ($assignmentList->getAssignmentsByQuestionId($question_id) as $assignment) {
2112 /* @var ilAssQuestionSkillAssignment $assignment */
2113 $assignment->deleteFromDb();
2114 }
2115
2117
2118 try {
2119 // update question count of question pool
2120 include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
2122 } catch (Exception $e) {
2123 $ilLog->write("EXCEPTION: Error updating the question pool question count of question pool " . $this->getObjId() . " when deleting question $question_id: $e");
2124 return false;
2125 }
2126
2127 $this->notifyQuestionDeleted($this);
2128
2129 return true;
2130 }
deletePageOfQuestion($question_id)
Deletes the page object of a question with a given ID.
deleteAdditionalTableData($question_id)
Deletes datasets from the additional question table in the database.
isAdditionalContentEditingModePageObject()
isser for additional "pageobject" content editing mode
deleteAnswers($question_id)
Deletes datasets from answers tables.
static deleteHintsByQuestionIds($questionIds)
Deletes all question hints relating to questions included in given question ids.
static _removeUsage($a_mob_id, $a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
Remove usage of mob in another container.
static _updateQuestionCount($object_id)
Updates the number of available questions for a question pool in the database.
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively

References $DIC, $ilDB, $ilLog, $mobs, $obj_id, $result, $row, ilObjMediaObject\_exists(), ilObjMediaObject\_getMobsOfObject(), ilObjMediaObject\_removeUsage(), ilObjQuestionPool\_updateQuestionCount(), ilUtil\delDir(), deleteAdditionalTableData(), deleteAnswers(), ilAssQuestionHintList\deleteHintsByQuestionIds(), deletePageOfQuestion(), deleteTaxonomyAssignments(), getObjId(), isAdditionalContentEditingModePageObject(), and notifyQuestionDeleted().

+ Here is the call graph for this function:

◆ deleteAdditionalTableData()

assQuestion::deleteAdditionalTableData (   $question_id)

Deletes datasets from the additional question table in the database.

Parameters
integer$question_idThe question id which should be deleted in the additional question table @access public

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

1958 {
1959 global $DIC;
1960 $ilDB = $DIC['ilDB'];
1961
1962 $additional_table_name = $this->getAdditionalTableName();
1963
1964 if (!is_array($additional_table_name)) {
1965 $additional_table_name = array($additional_table_name);
1966 }
1967
1968 foreach ($additional_table_name as $table) {
1969 if (strlen($table)) {
1970 $affectedRows = $ilDB->manipulateF(
1971 "DELETE FROM $table WHERE question_fi = %s",
1972 array('integer'),
1973 array($question_id)
1974 );
1975 }
1976 }
1977 }
getAdditionalTableName()
Returns the name of the additional question data table in the database.
if(empty($password)) $table
Definition: pwgen.php:24

References $DIC, $ilDB, $table, and getAdditionalTableName().

Referenced by delete().

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

◆ deleteAnswers()

assQuestion::deleteAnswers (   $question_id)

Deletes datasets from answers tables.

Parameters
integer$question_idThe question id which should be deleted in the answers table @access public

Reimplemented in assFileUpload, assFlashQuestion, assFormulaQuestion, and assOrderingHorizontal.

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

1931 {
1932 global $DIC;
1933 $ilDB = $DIC['ilDB'];
1934 $answer_table_name = $this->getAnswerTableName();
1935
1936 if (!is_array($answer_table_name)) {
1937 $answer_table_name = array($answer_table_name);
1938 }
1939
1940 foreach ($answer_table_name as $table) {
1941 if (strlen($table)) {
1942 $affectedRows = $ilDB->manipulateF(
1943 "DELETE FROM $table WHERE question_fi = %s",
1944 array('integer'),
1945 array($question_id)
1946 );
1947 }
1948 }
1949 }
getAnswerTableName()
Returns the name of the answer table in the database.

References $DIC, $ilDB, $table, and getAnswerTableName().

Referenced by delete().

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

◆ deleteDummySolutionRecord()

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

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

4966 {
4967 foreach ($this->getSolutionValues($activeId, $passIndex, false) as $solutionRec) {
4968 if (0 == strlen($solutionRec['value1']) && 0 == strlen($solutionRec['value2'])) {
4969 $this->removeSolutionRecordById($solutionRec['solution_id']);
4970 }
4971 }
4972 }
getSolutionValues($active_id, $pass=null, $authorized=true)
Loads solutions of a given user from the database an returns it.
removeSolutionRecordById($solutionId)

References getSolutionValues(), and removeSolutionRecordById().

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

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

◆ deletePageOfQuestion()

assQuestion::deletePageOfQuestion (   $question_id)
protected

Deletes the page object of a question with a given ID.

Parameters
integer$question_idThe database id of the question @access protected

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

1986 {
1987 include_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php";
1988 $page = new ilAssQuestionPage($question_id);
1989 $page->delete();
1990 return true;
1991 }

References $page.

Referenced by delete(), and syncWithOriginal().

+ Here is the caller graph for this function:

◆ deleteSolutionRecordByValues()

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

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

4980 {
4981 global $DIC; /* @var ILIAS\DI\Container $DIC */
4982 $ilDB = $DIC['ilDB'];
4983
4984 $types = array("integer", "integer", "integer", "integer");
4985 $values = array($activeId, $this->getId(), $passIndex, (int) $authorized);
4986 $valuesCondition = array();
4987
4988 foreach ($matchValues as $valueField => $value) {
4989 switch ($valueField) {
4990 case 'value1':
4991 case 'value2':
4992 $valuesCondition[] = "{$valueField} = %s";
4993 $types[] = 'text';
4994 $values[] = $value;
4995 break;
4996
4997 default:
4998 require_once 'Modules/TestQuestionPool/exceptions/class.ilTestQuestionPoolException.php';
4999 throw new ilTestQuestionPoolException('invalid value field given: ' . $valueField);
5000 }
5001 }
5002
5003 $valuesCondition = implode(' AND ', $valuesCondition);
5004
5005 $query = "
5006 DELETE FROM tst_solutions
5007 WHERE active_fi = %s
5008 AND question_fi = %s
5009 AND pass = %s
5010 AND authorized = %s
5011 AND $valuesCondition
5012 ";
5013
5014 if ($this->getStep() !== null) {
5015 $query .= " AND step = %s ";
5016 $types[] = 'integer';
5017 $values[] = $this->getStep();
5018 }
5019
5020 $ilDB->manipulateF($query, $types, $values);
5021 }

References $DIC, $ilDB, $query, $values, getId(), and getStep().

Referenced by assImagemapQuestion\saveWorkingData().

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

◆ deleteSuggestedSolutions()

assQuestion::deleteSuggestedSolutions ( )

Deletes all suggestes solutions in the database.

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

2724 {
2725 global $DIC;
2726 $ilDB = $DIC['ilDB'];
2727 // delete the links in the qpl_sol_sug table
2728 $affectedRows = $ilDB->manipulateF(
2729 "DELETE FROM qpl_sol_sug WHERE question_fi = %s",
2730 array('integer'),
2731 array($this->getId())
2732 );
2733 // delete the links in the int_link table
2734 include_once "./Services/Link/classes/class.ilInternalLink.php";
2736 $this->suggested_solutions = array();
2738 }

References $DIC, $ilDB, ilInternalLink\_deleteAllLinksOfSource(), ilUtil\delDir(), getId(), and getSuggestedSolutionPath().

+ Here is the call graph for this function:

◆ deleteTaxonomyAssignments()

assQuestion::deleteTaxonomyAssignments ( )
private

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

2133 {
2134 require_once 'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
2135 require_once 'Services/Taxonomy/classes/class.ilTaxNodeAssignment.php';
2136 $taxIds = ilObjTaxonomy::getUsageOfObject($this->getObjId());
2137
2138 foreach ($taxIds as $taxId) {
2139 $taxNodeAssignment = new ilTaxNodeAssignment('qpl', $this->getObjId(), 'quest', $taxId);
2140 $taxNodeAssignment->deleteAssignmentsOfItem($this->getId());
2141 }
2142 }
static getUsageOfObject($a_obj_id, $a_include_titles=false)
Get usage of object.
Taxonomy node <-> item assignment.

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

Referenced by delete().

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

◆ duplicate()

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

◆ duplicateIntermediateSolutionAuthorized()

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

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

5024 {
5025 foreach ($this->getSolutionValues($activeId, $passIndex, false) as $rec) {
5026 $this->saveCurrentSolution($activeId, $passIndex, $rec['value1'], $rec['value2'], true, $rec['tstamp']);
5027 }
5028 }
saveCurrentSolution($active_id, $pass, $value1, $value2, $authorized=true, $tstamp=null)

References getSolutionValues(), and saveCurrentSolution().

Referenced by forceExistingIntermediateSolution().

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

◆ duplicateQuestionHints()

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

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

4420 {
4421 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintList.php';
4422 $hintIds = ilAssQuestionHintList::duplicateListForQuestion($originalQuestionId, $duplicateQuestionId);
4423
4425 require_once 'Modules/TestQuestionPool/classes/class.ilAssHintPage.php';
4426
4427 foreach ($hintIds as $originalHintId => $duplicateHintId) {
4428 $originalPageObject = new ilAssHintPage($originalHintId);
4429 $originalXML = $originalPageObject->getXMLContent();
4430
4431 $duplicatePageObject = new ilAssHintPage();
4432 $duplicatePageObject->setId($duplicateHintId);
4433 $duplicatePageObject->setParentId($this->getId());
4434 $duplicatePageObject->setXMLContent($originalXML);
4435 $duplicatePageObject->createFromXML();
4436 }
4437 }
4438 }
Assessment hint page object.
static duplicateListForQuestion($originalQuestionId, $duplicateQuestionId)
duplicates a hint list from given original question id to given duplicate question id and returns an ...

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

Referenced by onCopy(), and onDuplicate().

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

◆ duplicateSkillAssignments()

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

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

4441 {
4442 global $DIC;
4443 $ilDB = $DIC['ilDB'];
4444
4445 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentList.php';
4446 $assignmentList = new ilAssQuestionSkillAssignmentList($ilDB);
4447 $assignmentList->setParentObjId($srcParentId);
4448 $assignmentList->setQuestionIdFilter($srcQuestionId);
4449 $assignmentList->loadFromDb();
4450
4451 foreach ($assignmentList->getAssignmentsByQuestionId($srcQuestionId) as $assignment) {
4452 /* @var ilAssQuestionSkillAssignment $assignment */
4453
4454 $assignment->setParentObjId($trgParentId);
4455 $assignment->setQuestionId($trgQuestionId);
4456 $assignment->saveToDb();
4457 }
4458 }

References $DIC, and $ilDB.

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

+ Here is the caller graph for this function:

◆ duplicateSuggestedSolutionFiles()

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

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

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

2803 {
2804 global $DIC;
2805 $ilLog = $DIC['ilLog'];
2806
2807 foreach ($this->suggested_solutions as $index => $solution) {
2808 if (strcmp($solution["type"], "file") == 0) {
2809 $filepath = $this->getSuggestedSolutionPath();
2810 $filepath_original = str_replace(
2811 "/{$this->obj_id}/{$this->id}/solution",
2812 "/$parent_id/$question_id/solution",
2813 $filepath
2814 );
2815 if (!file_exists($filepath)) {
2816 ilUtil::makeDirParents($filepath);
2817 }
2818 $filename = $solution["value"]["name"];
2819 if (strlen($filename)) {
2820 if (!copy($filepath_original . $filename, $filepath . $filename)) {
2821 $ilLog->write("File could not be duplicated!!!!", $ilLog->ERROR);
2822 $ilLog->write("object: " . print_r($this, true), $ilLog->ERROR);
2823 }
2824 }
2825 }
2826 }
2827 }

References $DIC, $filename, $ilLog, $index, getSuggestedSolutionPath(), and ilUtil\makeDirParents().

Referenced by onDuplicate().

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

◆ ensureCurrentTestPass()

assQuestion::ensureCurrentTestPass (   $active_id,
  $pass 
)
protected
Parameters
$active_id
$pass
Returns
int

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

427 {
428 if (is_integer($pass) && $pass >= 0) {
429 return $pass;
430 }
431
432 return $this->lookupCurrentTestPass($active_id, $pass);
433 }
lookupCurrentTestPass($active_id, $pass)

References $pass, and lookupCurrentTestPass().

Referenced by assFileUpload\saveWorkingData().

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

◆ ensureNonNegativePoints()

◆ explodeKeyValues()

static assQuestion::explodeKeyValues (   $keyValues)
static

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

4961 {
4962 return explode(self::getKeyValuesImplosionSeparator(), $keyValues);
4963 }

Referenced by assImagemapQuestion\getReuseSolutionSelectionParameter().

+ Here is the caller graph for this function:

◆ fetchIndexedValuesFromValuePairs()

assQuestion::fetchIndexedValuesFromValuePairs ( array  $valuePairs)
Parameters
array$valuePairs
Returns
array $indexedValues

Reimplemented in assMatchingQuestion.

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

5384 {
5385 $indexedValues = array();
5386
5387 foreach ($valuePairs as $valuePair) {
5388 $indexedValues[ $valuePair['value1'] ] = $valuePair['value2'];
5389 }
5390
5391 return $indexedValues;
5392 }

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

+ Here is the caller graph for this function:

◆ fetchMimeTypeIdentifier()

static assQuestion::fetchMimeTypeIdentifier (   $contentTypeString)
static

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

352 {
353 return current(explode(';', $contentTypeString));
354 }

Referenced by ilQtiMatImageSecurity\validateContent().

+ Here is the caller graph for this function:

◆ fetchValuePairsFromIndexedValues()

assQuestion::fetchValuePairsFromIndexedValues ( array  $indexedValues)
Parameters
array$indexedValues
Returns
array $valuePairs

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

5369 {
5370 $valuePairs = array();
5371
5372 foreach ($indexedValues as $value1 => $value2) {
5373 $valuePairs[] = array('value1' => $value1, 'value2' => $value2);
5374 }
5375
5376 return $valuePairs;
5377 }

◆ fixSvgToPng()

assQuestion::fixSvgToPng (   $imageFilenameContainingString)

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

2415 {
2416 $needles = array_keys(self::$imageSourceFixReplaceMap);
2417 $replacements = array_values(self::$imageSourceFixReplaceMap);
2418 return str_replace($needles, $replacements, $imageFilenameContainingString);
2419 }

Referenced by getSuggestedSolutionOutput().

+ Here is the caller graph for this function:

◆ fixUnavailableSkinImageSources()

assQuestion::fixUnavailableSkinImageSources (   $html)

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

2423 {
2424 $matches = null;
2425 if (preg_match_all('/src="(.*?)"/m', $html, $matches)) {
2426 $sources = $matches[1];
2427
2428 $needleReplacementMap = array();
2429
2430 foreach ($sources as $src) {
2431 $file = ilUtil::removeTrailingPathSeparators(ILIAS_ABSOLUTE_PATH) . DIRECTORY_SEPARATOR . $src;
2432
2433 if (file_exists($file)) {
2434 continue;
2435 }
2436
2437 $levels = explode(DIRECTORY_SEPARATOR, $src);
2438 if (count($levels) < 5 || $levels[0] != 'Customizing' || $levels[2] != 'skin') {
2439 continue;
2440 }
2441
2442 $component = '';
2443
2444 if ($levels[4] == 'Modules' || $levels[4] == 'Services') {
2445 $component = $levels[4] . DIRECTORY_SEPARATOR . $levels[5];
2446 }
2447
2448 $needleReplacementMap[$src] = ilUtil::getImagePath(basename($src), $component);
2449 }
2450
2451 if (count($needleReplacementMap)) {
2452 $html = str_replace(array_keys($needleReplacementMap), array_values($needleReplacementMap), $html);
2453 }
2454 }
2455
2456 return $html;
2457 }
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static removeTrailingPathSeparators($path)
$html
Definition: example_001.php:87

References $html, ilUtil\getImagePath(), and ilUtil\removeTrailingPathSeparators().

Referenced by getSuggestedSolutionOutput().

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

◆ forceExistingIntermediateSolution()

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

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

5031 {
5032 $intermediateSolution = $this->getSolutionValues($activeId, $passIndex, false);
5033
5034 if (!count($intermediateSolution)) {
5035 // make the authorized solution intermediate (keeping timestamps)
5036 // this keeps the solution_ids in synch with eventually selected in $_POST['deletefiles']
5037 $this->updateCurrentSolutionsAuthorization($activeId, $passIndex, false, true);
5038
5039 // create a backup as authorized solution again (keeping timestamps)
5040 $this->duplicateIntermediateSolutionAuthorized($activeId, $passIndex);
5041
5042 if ($considerDummyRecordCreation) {
5043 // create an additional dummy record to indicate the existence of an intermediate solution
5044 // even if all entries are deleted from the intermediate solution later
5045 $this->saveCurrentSolution($activeId, $passIndex, null, null, false, null);
5046 }
5047 }
5048 }
duplicateIntermediateSolutionAuthorized($activeId, $passIndex)
updateCurrentSolutionsAuthorization($activeId, $pass, $authorized, $keepTime=false)

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

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

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

◆ formatSAQuestion()

assQuestion::formatSAQuestion (   $a_q)

Format self assessment question.

Parameters

return

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

4281 {
4282 return $this->getSelfAssessmentFormatter()->format($a_q);
4283 }

References getSelfAssessmentFormatter().

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

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

◆ fromXML()

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

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

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 @access public

Reimplemented in assErrorText, assFileUpload, assFlashQuestion, and assOrderingHorizontal.

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

538 {
539 include_once "./Modules/TestQuestionPool/classes/import/qti12/class." . $this->getQuestionType() . "Import.php";
540 $classname = $this->getQuestionType() . "Import";
541 $import = new $classname($this);
542 $import->fromXML($item, $questionpool_id, $tst_id, $tst_object, $question_counter, $import_mapping);
543 }
getQuestionType()
Returns the question type of the question.

References getQuestionType().

+ Here is the call graph for this function:

◆ getActiveUserData()

assQuestion::getActiveUserData (   $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 @access public

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

3917 {
3918 global $DIC;
3919 $ilDB = $DIC['ilDB'];
3920 $result = $ilDB->queryF(
3921 "SELECT * FROM tst_active WHERE active_id = %s",
3922 array('integer'),
3923 array($active_id)
3924 );
3925 if ($result->numRows()) {
3926 $row = $ilDB->fetchAssoc($result);
3927 return array("user_id" => $row["user_fi"], "test_id" => $row["test_fi"]);
3928 } else {
3929 return array();
3930 }
3931 }

References $DIC, $ilDB, $result, and $row.

◆ getAdditionalContentEditingMode()

assQuestion::getAdditionalContentEditingMode ( )

getter for additional content editing mode for this question

@access public

Returns
string

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

4564 {
4566 }

References $additinalContentEditingMode.

Referenced by createNewQuestion(), isAdditionalContentEditingModePageObject(), and saveQuestionDataToDb().

+ Here is the caller graph for this function:

◆ getAdditionalTableName()

assQuestion::getAdditionalTableName ( )

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

Returns
string The additional table name @access public

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

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

1909 {
1910 return "";
1911 }

Referenced by deleteAdditionalTableData().

+ Here is the caller graph for this function:

◆ getAdjustedReachedPoints()

assQuestion::getAdjustedReachedPoints (   $active_id,
  $pass = null,
  $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
Parameters
integer$active_id
integer$pass
Returns
integer $reached_points

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

1152 {
1153 if (is_null($pass)) {
1154 include_once "./Modules/Test/classes/class.ilObjTest.php";
1155 $pass = ilObjTest::_getPass($active_id);
1156 }
1157
1158 // determine reached points for submitted solution
1159 $reached_points = $this->calculateReachedPoints($active_id, $pass, $authorizedSolution);
1160
1161
1162
1163 // deduct points for requested hints from reached points
1164 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintTracking.php';
1165 $hintTracking = new ilAssQuestionHintTracking($this->getId(), $active_id, $pass);
1166 $requestsStatisticData = $hintTracking->getRequestStatisticDataByQuestionAndTestpass();
1167 $reached_points = $reached_points - $requestsStatisticData->getRequestsPoints();
1168
1169 // adjust reached points regarding to tests scoring options
1170 $reached_points = $this->adjustReachedPointsByScoringOptions($reached_points, $active_id, $pass);
1171
1172 return $reached_points;
1173 }

References $pass, ilObjTest\_getPass(), adjustReachedPointsByScoringOptions(), calculateReachedPoints(), and getId().

+ Here is the call graph for this function:

◆ getAllowedFileExtensionsForMimeType()

static assQuestion::getAllowedFileExtensionsForMimeType (   $mimeType)
static

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

357 {
358 foreach (self::$allowedFileExtensionsByMimeType as $allowedMimeType => $extensions) {
359 $rexCharsets = implode('|', self::$allowedCharsetsByMimeType[$allowedMimeType]);
360 $rexMimeType = preg_quote($allowedMimeType, '/');
361
362 $rex = '/^' . $rexMimeType . '(;(\s)*charset=(' . $rexCharsets . '))*$/';
363
364 if (!preg_match($rex, $mimeType)) {
365 continue;
366 }
367
368 return $extensions;
369 }
370
371 return array();
372 }

◆ getAllowedImageMaterialFileExtensions()

static assQuestion::getAllowedImageMaterialFileExtensions ( )
static
Returns
array all allowed file extensions for image material

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

485 {
486 $extensions = array();
487
488 foreach (self::$allowedImageMaterialFileExtensionsByMimeType as $mimeType => $mimeExtensions) {
489 $extensions = array_merge($extensions, $mimeExtensions);
490 }
491 return array_unique($extensions);
492 }

Referenced by ilImageWizardInputGUI\__construct().

+ Here is the caller graph for this function:

◆ getAnswerTableName()

assQuestion::getAnswerTableName ( )

Returns the name of the answer table in the database.

Returns
string The answer table name @access public

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

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

1920 {
1921 return "";
1922 }

Referenced by deleteAnswers().

+ Here is the caller graph for this function:

◆ getAuthor()

assQuestion::getAuthor ( )

Gets the authors name of the assQuestion object.

Returns
string The string containing the name of the questions author @access public
See also
$author

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

870 {
871 return $this->author;
872 }

References $author.

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

+ Here is the caller graph for this function:

◆ getComment()

assQuestion::getComment ( )

Gets the comment string of the assQuestion object.

Returns
string The comment string to describe the question @access public
See also
$comment

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

810 {
811 return $this->comment;
812 }

References $comment.

Referenced by __get(), and saveQuestionDataToDb().

+ Here is the caller graph for this function:

◆ getCurrentSolutionResultSet()

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

Get a restulset for the current user solution for a this question by active_id and pass.

Parameters
int$active_id
int$pass
bool | true$authorized@global ilDBInterface $ilDB
Returns
object

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

4713 {
4714 global $DIC;
4715 $ilDB = $DIC['ilDB'];
4716
4717 if ($this->getStep() !== null) {
4718 $query = "
4719 SELECT *
4720 FROM tst_solutions
4721 WHERE active_fi = %s
4722 AND question_fi = %s
4723 AND pass = %s
4724 AND step = %s
4725 AND authorized = %s
4726 ";
4727
4728 return $ilDB->queryF(
4729 $query,
4730 array('integer', 'integer', 'integer', 'integer', 'integer'),
4731 array($active_id, $this->getId(), $pass, $this->getStep(), (int) $authorized)
4732 );
4733 } else {
4734 $query = "
4735 SELECT *
4736 FROM tst_solutions
4737 WHERE active_fi = %s
4738 AND question_fi = %s
4739 AND pass = %s
4740 AND authorized = %s
4741 ";
4742
4743 return $ilDB->queryF(
4744 $query,
4745 array('integer', 'integer', 'integer', 'integer'),
4746 array($active_id, $this->getId(), $pass, (int) $authorized)
4747 );
4748 }
4749 }

References $DIC, $ilDB, $query, getId(), and getStep().

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

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

◆ getDefaultNrOfTries()

assQuestion::getDefaultNrOfTries ( )

Get Default Nr of Tries.

Returns
int Default Nr of Tries

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

4380 {
4381 return (int) $this->defaultnroftries;
4382 }

References $defaultnroftries.

Referenced by createNewQuestion().

+ Here is the caller graph for this function:

◆ getEstimatedWorkingTime()

assQuestion::getEstimatedWorkingTime ( )

Gets the estimated working time of a question.

Returns
array Estimated Working Time of a question @access public
See also
$est_working_time

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

855 {
856 if (!$this->est_working_time) {
857 $this->est_working_time = array("h" => 0, "m" => 0, "s" => 0);
858 }
860 }

References $est_working_time.

Referenced by __get(), createNewQuestion(), and saveQuestionDataToDb().

+ Here is the caller graph for this function:

◆ getExternalId()

assQuestion::getExternalId ( )
Returns
string

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

922 {
923 if (!strlen($this->external_id)) {
924 if ($this->getId() > 0) {
925 return 'il_' . IL_INST_ID . '_qst_' . $this->getId();
926 } else {
927 return uniqid('', true);
928 }
929 } else {
930 return $this->external_id;
931 }
932 }

References $external_id, and getId().

Referenced by createNewQuestion(), and saveQuestionDataToDb().

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

◆ getFeedbackClassNameByQuestionType()

static assQuestion::getFeedbackClassNameByQuestionType (   $questionType)
static

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

3960 {
3961 return str_replace('ass', 'ilAss', $questionType) . 'Feedback';
3962 }

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

+ Here is the caller graph for this function:

◆ getFlashPath()

assQuestion::getFlashPath ( )

Returns the image path for web accessable flash files of a question.

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

@access public

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

1665 {
1666 return CLIENT_WEB_DIR . "/assessment/$this->obj_id/$this->id/flash/";
1667 }

Referenced by assFlashQuestion\copyApplet(), assFlashQuestion\deleteApplet(), assFlashQuestion\duplicateApplet(), assFlashQuestion\moveAppletIfExists(), and assFlashQuestion\moveUploadedFile().

+ Here is the caller graph for this function:

◆ getFlashPathWeb()

assQuestion::getFlashPathWeb ( )

Returns the web image path for web accessable flash applications of a question.

The image path is under the web accessable data dir in assessment/REFERENCE_ID_OF_QUESTION_POOL/ID_OF_QUESTION/flash

@access public

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

1720 {
1721 include_once "./Services/Utilities/classes/class.ilUtil.php";
1722 $webdir = ilUtil::removeTrailingPathSeparators(CLIENT_WEB_DIR) . "/assessment/$this->obj_id/$this->id/flash/";
1723 return str_replace(ilUtil::removeTrailingPathSeparators(ILIAS_ABSOLUTE_PATH), ilUtil::removeTrailingPathSeparators(ILIAS_HTTP_PATH), $webdir);
1724 }

References ilUtil\removeTrailingPathSeparators().

+ Here is the call graph for this function:

◆ getGuiClassNameByQuestionType()

static assQuestion::getGuiClassNameByQuestionType (   $questionType)
static

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

3950 {
3951 return $questionType . 'GUI';
3952 }

Referenced by assQuestionGUI\_getQuestionGUI(), ilObjTest\createQuestionGUI(), includeCoreClass(), includePluginClass(), instantiateQuestionGUI(), and isCoreQuestionType().

+ Here is the caller graph for this function:

◆ getHtmlQuestionContentPurifier()

assQuestion::getHtmlQuestionContentPurifier ( )
Returns
ilAssHtmlUserSolutionPurifier

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

4675 {
4676 require_once 'Services/Html/classes/class.ilHtmlPurifierFactory.php';
4677 return ilHtmlPurifierFactory::_getInstanceByType('qpl_usersolution');
4678 }
static _getInstanceByType($a_type)
Factory method for creating purifier instances.

References ilHtmlPurifierFactory\_getInstanceByType().

+ Here is the call graph for this function:

◆ getHtmlUserSolutionPurifier()

assQuestion::getHtmlUserSolutionPurifier ( )
Returns
ilAssHtmlUserSolutionPurifier

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

4666 {
4667 require_once 'Services/Html/classes/class.ilHtmlPurifierFactory.php';
4668 return ilHtmlPurifierFactory::_getInstanceByType('qpl_usersolution');
4669 }

References ilHtmlPurifierFactory\_getInstanceByType().

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

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

◆ getId()

assQuestion::getId ( )

Gets the id of the assQuestion object.

Returns
integer The id of the assQuestion object @access public
See also
$id

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

774 {
775 return $this->id;
776 }

References $id.

Referenced by ilQuestionCumulatedStatisticsTableGUI\__construct(), ilQuestionUsagesTableGUI\__construct(), ilAssQuestionHintsOrderingClipboard\__construct(), __get(), addQTIMaterial(), assLongMenu\buildFolderName(), assOrderingQuestion\buildNestedOrderingElementInputGui(), assClozeTest\calculateCombinationResult(), calculateResultsFromSolution(), cleanupMediaObjectUsage(), assClozeTest\copyObject(), assErrorText\copyObject(), copyXHTMLMediaObjectsOfQuestion(), createNewQuestion(), createPageObject(), deleteSolutionRecordByValues(), deleteSuggestedSolutions(), deleteTaxonomyAssignments(), ilDynamicTestQuestionChangeListener\deleteTestsParticipantsQuestionData(), assClozeTest\duplicate(), assErrorText\duplicate(), assFileUpload\duplicate(), assFlashQuestion\duplicate(), assFormulaQuestion\duplicate(), assImagemapQuestion\duplicate(), assJavaApplet\duplicate(), assKprimChoice\duplicate(), assLongMenu\duplicate(), assMatchingQuestion\duplicate(), assMultipleChoice\duplicate(), assNumeric\duplicate(), assOrderingHorizontal\duplicate(), assOrderingQuestion\duplicate(), assSingleChoice\duplicate(), assTextQuestion\duplicate(), assTextSubset\duplicate(), assTextQuestion\duplicateAnswers(), assOrderingQuestion\duplicateOrderlingElementList(), duplicateQuestionHints(), assOrderingQuestion\fetchSolutionListFromFormSubmissionData(), assOrderingQuestion\fetchSolutionListFromSubmittedForm(), assMatchingQuestion\fetchSubmittedMatchingsFromPost(), getAdjustedReachedPoints(), assLongMenu\getCorrectAnswersAsJson(), getCurrentSolutionResultSet(), getExternalId(), assFileUpload\getFileUploadPath(), assFileUpload\getFileUploadPathWeb(), getInstances(), assTextQuestion\getLatestAutosaveContent(), assClozeTest\getMaximumPoints(), assOrderingQuestion\getOldLeveledOrdering(), assJavaApplet\getReachedInformation(), getReachedPoints(), assImagemapQuestion\getRTETextWithMediaObjects(), assMultipleChoice\getRTETextWithMediaObjects(), getRTETextWithMediaObjects(), assSingleChoice\getRTETextWithMediaObjects(), getSolutionMaxPass(), assOrderingQuestion\getSolutionOrderingElementList(), getSolutionValues(), assFileUpload\getUploadedFiles(), assFileUpload\handleSubmission(), assFileUpload\hasFileUploads(), assFileUpload\isAnswered(), assKprimChoice\isAnswered(), assMultipleChoice\isAnswered(), assSingleChoice\isAnswered(), assTextQuestion\isAnswered(), isInUse(), assOrderingQuestion\loadFromDb(), loadFromDb(), assTextQuestion\loadFromDb(), log(), logAction(), assFormulaQuestion\lookupForExistingSolutions(), assLongMenu\lookupForExistingSolutions(), migrateContentForLearningModule(), ilAssNestedOrderingElementsInputGUI\prepareReprintable(), removeAllExistingSolutions(), removeCurrentSolution(), assFormulaQuestion\removeExistingSolutions(), removeExistingSolutions(), removeResultRecord(), ilAssOrderingQuestionAuthoringFormGUI\renewOrderingElementInput(), assClozeTest\saveAdditionalQuestionDataToDb(), assErrorText\saveAdditionalQuestionDataToDb(), assFileUpload\saveAdditionalQuestionDataToDb(), assFlashQuestion\saveAdditionalQuestionDataToDb(), assImagemapQuestion\saveAdditionalQuestionDataToDb(), assJavaApplet\saveAdditionalQuestionDataToDb(), assKprimChoice\saveAdditionalQuestionDataToDb(), assLongMenu\saveAdditionalQuestionDataToDb(), assMatchingQuestion\saveAdditionalQuestionDataToDb(), assOrderingHorizontal\saveAdditionalQuestionDataToDb(), assClozeTest\saveAnswerSpecificDataToDb(), assErrorText\saveAnswerSpecificDataToDb(), assImagemapQuestion\saveAnswerSpecificDataToDb(), assKprimChoice\saveAnswerSpecificDataToDb(), assLongMenu\saveAnswerSpecificDataToDb(), assMatchingQuestion\saveAnswerSpecificDataToDb(), assOrderingQuestion\saveAnswerSpecificDataToDb(), assClozeTest\saveClozeNumericGapRecordToDb(), assClozeTest\saveClozeSelectGapRecordToDb(), assClozeTest\saveClozeTextGapRecordToDb(), saveCurrentSolution(), assErrorText\savePreviewData(), assSingleChoice\savePreviewData(), saveQuestionDataToDb(), assFormulaQuestion\saveToDb(), assMultipleChoice\saveToDb(), assErrorText\saveWorkingData(), assFormulaQuestion\saveWorkingData(), assFormulaQuestion\setId(), setNewOriginalId(), assTextQuestion\setReachedPoints(), syncWithOriginal(), syncXHTMLMediaObjectsOfQuestion(), assClozeTest\toJSON(), assErrorText\toJSON(), assImagemapQuestion\toJSON(), assKprimChoice\toJSON(), assLongMenu\toJSON(), assMatchingQuestion\toJSON(), assMultipleChoice\toJSON(), assOrderingHorizontal\toJSON(), assOrderingQuestion\toJSON(), assSingleChoice\toJSON(), assTextQuestion\toJSON(), assTextSubset\toJSON(), updateCurrentSolutionsAuthorization(), ilLOTestQuestionAdapter\updateQuestionResult(), and updateTimestamp().

+ 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

@access public

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

1641 {
1642 if ($question_id === null) {
1643 $question_id = $this->id;
1644 }
1645
1646 if ($object_id === null) {
1647 $object_id = $this->obj_id;
1648 }
1649
1650 return $this->buildImagePath($question_id, $object_id);
1651 }
buildImagePath($questionId, $parentObjectId)

References $id, $obj_id, and buildImagePath().

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

+ Here is the call graph for this function:
+ 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

@access public

TODO: in use? refactor and ask for a supported path in all cases, not for THE dynamic highlander path ^^

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

1703 {
1704 if (!$this->export_image_path) {
1705 include_once "./Services/Utilities/classes/class.ilUtil.php";
1706 $webdir = ilUtil::removeTrailingPathSeparators(CLIENT_WEB_DIR) . "/assessment/$this->obj_id/$this->id/images/";
1707 return str_replace(ilUtil::removeTrailingPathSeparators(ILIAS_ABSOLUTE_PATH), ilUtil::removeTrailingPathSeparators(ILIAS_HTTP_PATH), $webdir);
1708 } else {
1710 }
1711 }
$export_image_path
(Web) Path to images

References $export_image_path, and ilUtil\removeTrailingPathSeparators().

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

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

◆ getInstances()

& assQuestion::getInstances ( )

Gets all instances of the question.

Returns
array All instances of question and its copies

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

3856 {
3857 global $DIC;
3858 $ilDB = $DIC['ilDB'];
3859
3860 $result = $ilDB->queryF(
3861 "SELECT question_id FROM qpl_questions WHERE original_id = %s",
3862 array("integer"),
3863 array($this->getId())
3864 );
3865 $instances = array();
3866 $ids = array();
3867 while ($row = $ilDB->fetchAssoc($result)) {
3868 array_push($ids, $row["question_id"]);
3869 }
3870 foreach ($ids as $question_id) {
3871 // check non random tests
3872 $result = $ilDB->queryF(
3873 "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",
3874 array("integer"),
3875 array($question_id)
3876 );
3877 while ($row = $ilDB->fetchAssoc($result)) {
3878 $instances[$row['obj_fi']] = ilObject::_lookupTitle($row['obj_fi']);
3879 }
3880 // check random tests
3881 $result = $ilDB->queryF(
3882 "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",
3883 array("integer"),
3884 array($question_id)
3885 );
3886 while ($row = $ilDB->fetchAssoc($result)) {
3887 $instances[$row['obj_fi']] = ilObject::_lookupTitle($row['obj_fi']);
3888 }
3889 }
3890 include_once "./Modules/Test/classes/class.ilObjTest.php";
3891 foreach ($instances as $key => $value) {
3892 $instances[$key] = array("obj_id" => $key, "title" => $value, "author" => ilObjTest::_lookupAuthor($key), "refs" => ilObject::_getAllReferences($key));
3893 }
3894 return $instances;
3895 }
static _lookupAuthor($obj_id)
Gets the authors name of the ilObjTest object.
static _lookupTitle($a_id)
lookup object title
static _getAllReferences($a_id)
get all reference ids of object

References $DIC, $ilDB, $key, $result, $row, ilObject\_getAllReferences(), ilObjTest\_lookupAuthor(), ilObject\_lookupTitle(), and getId().

+ Here is the call graph for this function:

◆ getJavaPath()

assQuestion::getJavaPath ( )

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

@access public

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

1630 {
1631 return CLIENT_WEB_DIR . "/assessment/$this->obj_id/$this->id/java/";
1632 }

Referenced by assJavaApplet\copyApplet(), assJavaApplet\deleteJavaAppletFilename(), assJavaApplet\duplicateApplet(), and assJavaApplet\setJavaAppletFilename().

+ Here is the caller graph for this function:

◆ getJavaPathWeb()

assQuestion::getJavaPathWeb ( )

Returns the web image path for web accessable java applets of a question.

The image path is under the web accessable data dir in assessment/REFERENCE_ID_OF_QUESTION_POOL/ID_OF_QUESTION/java

@access public

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

1676 {
1677 include_once "./Services/Utilities/classes/class.ilUtil.php";
1678 $webdir = ilUtil::removeTrailingPathSeparators(CLIENT_WEB_DIR) . "/assessment/$this->obj_id/$this->id/java/";
1679 return str_replace(ilUtil::removeTrailingPathSeparators(ILIAS_ABSOLUTE_PATH), ilUtil::removeTrailingPathSeparators(ILIAS_HTTP_PATH), $webdir);
1680 }

References ilUtil\removeTrailingPathSeparators().

+ Here is the call graph for this function:

◆ getKeyValuesImplosionSeparator()

static assQuestion::getKeyValuesImplosionSeparator ( )
staticprotected

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

4953 {
4955 }
const KEY_VALUES_IMPLOSION_SEPARATOR

References KEY_VALUES_IMPLOSION_SEPARATOR.

◆ getLastChange()

assQuestion::getLastChange ( )

Reimplemented in assMultipleChoice.

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

4698 {
4699 return $this->lastChange;
4700 }

References $lastChange.

◆ getMaximumPoints()

assQuestion::getMaximumPoints ( )

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

@access public

See also
$points

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

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

1136 {
1137 return $this->points;
1138 }

References $points.

Referenced by adjustReachedPointsByScoringOptions(), assJavaApplet\getUserQuestionResult(), assKprimChoice\isComplete(), isPreviewSolutionCorrect(), and saveQuestionDataToDb().

+ Here is the caller graph for this function:

◆ getNrOfTries()

◆ getNumExistingSolutionRecords()

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

returns the number of existing solution records for the given test active / pass and given question id

@access protected

@global ilDBInterface $ilDB

Parameters
integer$activeId
integer$pass
integer$questionId
Returns
integer $numberOfExistingSolutionRecords

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

4532 {
4533 global $DIC;
4534 $ilDB = $DIC['ilDB'];
4535
4536 $query = "
4537 SELECT count(active_fi) cnt
4538
4539 FROM tst_solutions
4540
4541 WHERE active_fi = %s
4542 AND question_fi = %s
4543 AND pass = %s
4544 ";
4545
4546 $res = $ilDB->queryF(
4547 $query,
4548 array('integer','integer','integer'),
4549 array($activeId, $questionId, $pass)
4550 );
4551
4552 $row = $ilDB->fetchAssoc($res);
4553
4554 return (int) $row['cnt'];
4555 }

References $DIC, $ilDB, $pass, $query, $res, and $row.

Referenced by assFileUpload\isAnswered(), assKprimChoice\isAnswered(), assMultipleChoice\isAnswered(), assSingleChoice\isAnswered(), and assTextQuestion\isAnswered().

+ Here is the caller graph for this function:

◆ getObjectClassNameByQuestionType()

static assQuestion::getObjectClassNameByQuestionType (   $questionType)
static

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

3955 {
3956 return $questionType;
3957 }

Referenced by _instantiateQuestion(), and includeCoreClass().

+ Here is the caller graph for this function:

◆ getObjId()

assQuestion::getObjId ( )

Get the object id of the container object.

Returns
integer The object id of the container object @access public
See also
$obj_id

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

894 {
895 return $this->obj_id;
896 }

References $obj_id.

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

+ Here is the caller graph for this function:

◆ getOriginalId()

assQuestion::getOriginalId ( )

◆ getOutputType()

assQuestion::getOutputType ( )

Gets the output type.

Returns
integer The output type of the question @access public
See also
$outputType

Reimplemented in assMultipleChoice, and assSingleChoice.

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

822 {
823 return $this->outputType;
824 }

References $outputType.

Referenced by __get().

+ Here is the caller graph for this function:

◆ getOwner()

assQuestion::getOwner ( )

Gets the creator/owner ID of the assQuestion object.

Returns
integer The numerical ID to identify the owner/creator @access public
See also
$owner

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

882 {
883 return $this->owner;
884 }

References $owner.

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

+ Here is the caller graph for this function:

◆ getPageOfQuestion()

assQuestion::getPageOfQuestion ( )

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

2335 {
2336 include_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php";
2337 $page = new ilAssQuestionPage($this->id);
2338 return $page->getXMLContent();
2339 }

References $page.

◆ getPoints()

◆ getPreventRteUsage()

assQuestion::getPreventRteUsage ( )

Get prevent rte usage.

Returns
boolean prevent rte usage

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

4312 {
4314 }

References $prevent_rte_usage.

◆ getProcessLocker()

◆ getQuestion()

◆ getQuestionAction()

assQuestion::getQuestionAction ( )
protected
Returns
string

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

388 {
389 if (!isset($_POST['cmd']) || !isset($_POST['cmd'][$this->questionActionCmd])) {
390 return '';
391 }
392
393 if (!is_array($_POST['cmd'][$this->questionActionCmd]) || !count($_POST['cmd'][$this->questionActionCmd])) {
394 return '';
395 }
396
397 return key($_POST['cmd'][$this->questionActionCmd]);
398 }

References $_POST.

Referenced by assFileUpload\isFileDeletionAction().

+ Here is the caller graph for this function:

◆ getQuestionChangeListeners()

assQuestion::getQuestionChangeListeners ( )
Returns
array[ilQuestionChangeListener]

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

4637 {
4639 }

References $questionChangeListeners.

Referenced by notifyQuestionCreated(), notifyQuestionDeleted(), and notifyQuestionEdited().

+ Here is the caller graph for this function:

◆ getQuestionsMissingResultRecord()

static assQuestion::getQuestionsMissingResultRecord (   $activeId,
  $pass,
  $questionIds 
)
static

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

5312 {
5313 global $DIC;
5314 $ilDB = $DIC['ilDB'];
5315
5316 $IN_questionIds = $ilDB->in('question_fi', $questionIds, false, 'integer');
5317
5318 $query = "
5319 SELECT question_fi
5320 FROM tst_test_result
5321 WHERE active_fi = %s
5322 AND pass = %s
5323 AND $IN_questionIds
5324 ";
5325
5326 $res = $ilDB->queryF(
5327 $query,
5328 array('integer', 'integer'),
5329 array($activeId, $pass)
5330 );
5331
5332 $questionsHavingResultRecord = array();
5333
5334 while ($row = $ilDB->fetchAssoc($res)) {
5335 $questionsHavingResultRecord[] = $row['question_fi'];
5336 }
5337
5338 $questionsMissingResultRecordt = array_diff(
5339 $questionIds,
5340 $questionsHavingResultRecord
5341 );
5342
5343 return $questionsMissingResultRecordt;
5344 }

References $DIC, $ilDB, $pass, $query, $res, and $row.

Referenced by ilTestOutputGUI\handlePrimaryButton().

+ Here is the caller graph for this function:

◆ getQuestionType()

assQuestion::getQuestionType ( )
abstract

Returns the question type of the question.

Returns
string The question type of the question

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

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

+ Here is the caller graph for this function:

◆ getQuestionTypeFromDb()

static assQuestion::getQuestionTypeFromDb (   $question_id)
static

get question type for question id

note: please don't use $this in this class to allow static calls

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

1889 {
1890 global $DIC;
1891 $ilDB = $DIC['ilDB'];
1892
1893 $result = $ilDB->queryF(
1894 "SELECT qpl_qst_type.type_tag FROM qpl_qst_type, qpl_questions WHERE qpl_questions.question_id = %s AND qpl_questions.question_type_fi = qpl_qst_type.question_type_id",
1895 array('integer'),
1896 array($question_id)
1897 );
1898 $data = $ilDB->fetchAssoc($result);
1899 return $data["type_tag"];
1900 }

References $data, $DIC, $ilDB, and $result.

Referenced by assQuestionGUI\_getGUIClassNameForId(), assQuestionGUI\_getQuestionGUI(), and ilObjTestGUI\executeCommand().

+ Here is the caller graph for this function:

◆ getQuestionTypeID()

assQuestion::getQuestionTypeID ( )

Returns the question type of the question.

Returns the question type of the question

Returns
integer The question type of the question @access public

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

3758 {
3759 global $DIC;
3760 $ilDB = $DIC['ilDB'];
3761
3762 $result = $ilDB->queryF(
3763 "SELECT question_type_id FROM qpl_qst_type WHERE type_tag = %s",
3764 array('text'),
3765 array($this->getQuestionType())
3766 );
3767 if ($result->numRows() == 1) {
3768 $row = $ilDB->fetchAssoc($result);
3769 return $row["question_type_id"];
3770 }
3771 return 0;
3772 }

References $DIC, $ilDB, $result, $row, and getQuestionType().

Referenced by createNewQuestion(), and saveQuestionDataToDb().

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

◆ getReachedPoints()

assQuestion::getReachedPoints (   $active_id,
  $pass = null 
)

Returns the points, a learner has reached answering the question This is the fast way to get the points directly from the database.

Parameters
integer$user_idThe database ID of the learner
integer$test_idThe database Id of the test containing the question @access public

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

1125 {
1126 return round(self::_getReachedPoints($active_id, $this->getId(), $pass), 2);
1127 }

References $pass, and getId().

Referenced by ilLOTestQuestionAdapter\updateQuestionResult().

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

◆ getResultGateway()

static assQuestion::getResultGateway ( )
static
Returns
\ilObjTestGateway

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

5063 {
5064 return self::$resultGateway;
5065 }

References $resultGateway.

◆ getRTETextWithMediaObjects()

assQuestion::getRTETextWithMediaObjects ( )
protected

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

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

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

3817 {
3818 // must be called in parent classes. add additional RTE text in the parent
3819 // classes and call this method to add the standard RTE text
3820 $collected = $this->getQuestion();
3821 $collected .= $this->feedbackOBJ->getGenericFeedbackContent($this->getId(), false);
3822 $collected .= $this->feedbackOBJ->getGenericFeedbackContent($this->getId(), true);
3823 $collected .= $this->feedbackOBJ->getAllSpecificAnswerFeedbackContents($this->getId());
3824
3825 foreach ($this->suggested_solutions as $solution_array) {
3826 $collected .= $solution_array["value"];
3827 }
3828
3829 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintList.php';
3830 $questionHintList = ilAssQuestionHintList::getListByQuestionId($this->getId());
3831 foreach ($questionHintList as $questionHint) {
3832 /* @var $questionHint ilAssQuestionHint */
3833 $collected .= $questionHint->getText();
3834 }
3835
3836 return $collected;
3837 }
static getListByQuestionId($questionId)
instantiates a question hint list for the passed question id

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

Referenced by cleanupMediaObjectUsage().

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

◆ getSelfAssessmentEditingMode()

assQuestion::getSelfAssessmentEditingMode ( )

Get Self-Assessment Editing Mode.

Returns
boolean Self-Assessment Editing Mode

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

4360 {
4362 }

References $selfassessmenteditingmode.

Referenced by ilAssQuestionAuthoringFormGUI\addGenericAssessmentQuestionCommandButtons().

+ Here is the caller graph for this function:

◆ getSelfAssessmentFormatter()

assQuestion::getSelfAssessmentFormatter ( )
protected
Returns
\ilAssSelfAssessmentQuestionFormatter

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

4289 {
4290 require_once 'Modules/TestQuestionPool/classes/questions/class.ilAssSelfAssessmentQuestionFormatter.php';
4291 return new \ilAssSelfAssessmentQuestionFormatter();
4292 }

Referenced by formatSAQuestion().

+ Here is the caller graph for this function:

◆ getShuffle()

assQuestion::getShuffle ( )

Gets the shuffle flag.

Returns
boolean The shuffle flag @access public
See also
$shuffle

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

786 {
787 return $this->shuffle;
788 }

References $shuffle.

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

+ Here is the caller graph for this function:

◆ getShuffler()

assQuestion::getShuffler ( )

◆ getSolutionMaxPass()

◆ getSolutionRecordById()

assQuestion::getSolutionRecordById (   $solutionId)
protected
Parameters
$solutionId@global ilDBInterface $ilDB
Returns
int

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

4777 {
4778 global $DIC; /* @var ILIAS\DI\Container $DIC */
4779 $ilDB = $DIC['ilDB'];
4780
4781 $res = $ilDB->queryF(
4782 "SELECT * FROM tst_solutions WHERE solution_id = %s",
4783 array('integer'),
4784 array($solutionId)
4785 );
4786
4787 while ($row = $ilDB->fetchAssoc($res)) {
4788 return $row;
4789 }
4790 }

References $DIC, $ilDB, $res, and $row.

Referenced by assFileUpload\saveWorkingData().

+ Here is the caller graph for this function:

◆ getSolutionValues()

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

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

Reimplemented in assJavaApplet.

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

1754 {
1755 global $DIC;
1756 $ilDB = $DIC['ilDB'];
1757
1758 if (is_null($pass)) {
1759 $pass = $this->getSolutionMaxPass($active_id);
1760 }
1761
1762 if ($this->getStep() !== null) {
1763 $query = "
1764 SELECT *
1765 FROM tst_solutions
1766 WHERE active_fi = %s
1767 AND question_fi = %s
1768 AND pass = %s
1769 AND step = %s
1770 AND authorized = %s
1771 ORDER BY solution_id";
1772
1773 $result = $ilDB->queryF(
1774 $query,
1775 array('integer', 'integer', 'integer', 'integer', 'integer'),
1776 array($active_id, $this->getId(), $pass, $this->getStep(), (int) $authorized)
1777 );
1778 } else {
1779 $query = "
1780 SELECT *
1781 FROM tst_solutions
1782 WHERE active_fi = %s
1783 AND question_fi = %s
1784 AND pass = %s
1785 AND authorized = %s
1786 ORDER BY solution_id
1787 ";
1788
1789 $result = $ilDB->queryF(
1790 $query,
1791 array('integer', 'integer', 'integer', 'integer'),
1792 array($active_id, $this->getId(), $pass, (int) $authorized)
1793 );
1794 }
1795
1796 $values = array();
1797
1798 while ($row = $ilDB->fetchAssoc($result)) {
1799 $values[] = $row;
1800 }
1801
1802 return $values;
1803 }
getSolutionMaxPass($active_id)
Returns the maximum pass a users question solution.

References $DIC, $ilDB, $pass, $query, $result, $row, $values, getId(), getSolutionMaxPass(), and getStep().

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

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

◆ getStep()

◆ getSuggestedSolution()

assQuestion::getSuggestedSolution (   $subquestion_index = 0)

Returns a suggested solution for a given subquestion index.

Parameters
integer$subquestion_indexThe index of a subquestion (i.e. a close test gap). Usually 0
Returns
array A suggested solution array containing the internal link @access public

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

2748 {
2749 if (array_key_exists($subquestion_index, $this->suggested_solutions)) {
2750 return $this->suggested_solutions[$subquestion_index];
2751 } else {
2752 return array();
2753 }
2754 }

◆ getSuggestedSolutionOutput()

assQuestion::getSuggestedSolutionOutput ( )

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

1016 {
1017 $output = array();
1018 foreach ($this->suggested_solutions as $solution) {
1019 switch ($solution["type"]) {
1020 case "lm":
1021 case "st":
1022 case "pg":
1023 case "git":
1024 array_push($output, '<a href="' . assQuestion::_getInternalLinkHref($solution["internal_link"]) . '">' . $this->lng->txt("solution_hint") . '</a>');
1025 break;
1026 case "file":
1027 $possible_texts = array_values(array_filter(array(
1028 ilUtil::prepareFormOutput($solution['value']['filename']),
1029 ilUtil::prepareFormOutput($solution['value']['name']),
1030 $this->lng->txt('tst_show_solution_suggested')
1031 )));
1032
1033 require_once 'Services/WebAccessChecker/classes/class.ilWACSignedPath.php';
1035 array_push($output, '<a href="' . ilWACSignedPath::signFile($this->getSuggestedSolutionPathWeb() . $solution["value"]["name"]) . '">' . $possible_texts[0] . '</a>');
1036 break;
1037 case "text":
1038 $solutionValue = $solution["value"];
1039 $solutionValue = $this->fixSvgToPng($solutionValue);
1040 $solutionValue = $this->fixUnavailableSkinImageSources($solutionValue);
1041 $output[] = $this->prepareTextareaOutput($solutionValue, true);
1042 break;
1043 }
1044 }
1045 return join("<br />", $output);
1046 }
fixUnavailableSkinImageSources($html)
getSuggestedSolutionPathWeb()
Returns the web path for a suggested solution.
prepareTextareaOutput($txt_output, $prepare_for_latex_output=false, $omitNl2BrWhenTextArea=false)
Prepares a string for a text area output in tests.
static _getInternalLinkHref($target="")
fixSvgToPng($imageFilenameContainingString)
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
static signFile($path_to_file)
static setTokenMaxLifetimeInSeconds($token_max_lifetime_in_seconds)

References Sabre\VObject\$output, _getInternalLinkHref(), fixSvgToPng(), fixUnavailableSkinImageSources(), getSuggestedSolutionPathWeb(), ilUtil\prepareFormOutput(), prepareTextareaOutput(), ilWACSignedPath\setTokenMaxLifetimeInSeconds(), and ilWACSignedPath\signFile().

+ Here is the call graph for this function:

◆ getSuggestedSolutionPath()

assQuestion::getSuggestedSolutionPath ( )

Returns the path for a suggested solution.

@access public

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

1619 {
1620 return CLIENT_WEB_DIR . "/assessment/$this->obj_id/$this->id/solution/";
1621 }

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

+ Here is the caller graph for this function:

◆ getSuggestedSolutionPathWeb()

assQuestion::getSuggestedSolutionPathWeb ( )

Returns the web path for a suggested solution.

@access public

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

1688 {
1689 include_once "./Services/Utilities/classes/class.ilUtil.php";
1690 $webdir = ilUtil::removeTrailingPathSeparators(CLIENT_WEB_DIR) . "/assessment/$this->obj_id/$this->id/solution/";
1691 return str_replace(ilUtil::removeTrailingPathSeparators(ILIAS_ABSOLUTE_PATH), ilUtil::removeTrailingPathSeparators(ILIAS_HTTP_PATH), $webdir);
1692 }

References ilUtil\removeTrailingPathSeparators().

Referenced by getSuggestedSolutionOutput().

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

◆ getSuggestedSolutions()

assQuestion::getSuggestedSolutions ( )

Return the suggested solutions.

Returns
array Suggested solutions

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

1083 {
1085 }

References $suggested_solutions.

Referenced by __get().

+ Here is the caller graph for this function:

◆ getSuggestedSolutionTitle()

assQuestion::getSuggestedSolutionTitle (   $subquestion_index = 0)

Returns the title of a suggested solution at a given subquestion_index.

This can be usable for displaying suggested solutions

Parameters
integer$subquestion_indexThe index of a subquestion (i.e. a close test gap). Usually 0
Returns
string A string containing the type and title of the internal link @access public

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

2765 {
2766 if (array_key_exists($subquestion_index, $this->suggested_solutions)) {
2767 $title = $this->suggested_solutions[$subquestion_index]["internal_link"];
2768 // TO DO: resolve internal link an get link type and title
2769 } else {
2770 $title = "";
2771 }
2772 return $title;
2773 }

References $title.

◆ getTestId()

assQuestion::getTestId ( )

Gets the test id of the assQuestion object.

Returns
integer The test id of the assQuestion object @access public
See also
$test_id

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

798 {
799 return $this->test_id;
800 }

References $test_id.

Referenced by __get(), and resetUsersAnswer().

+ Here is the caller graph for this function:

◆ getTestOutputSolutions()

assQuestion::getTestOutputSolutions (   $activeId,
  $pass 
)

Reimplemented in assImagemapQuestion.

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

1728 {
1729 // hey: refactored identifiers
1730 if ($this->getTestPresentationConfig()->isSolutionInitiallyPrefilled()) {
1731 // hey.
1732 return $this->getSolutionValues($activeId, $pass, true);
1733 }
1734
1735 return $this->getUserSolutionPreferingIntermediate($activeId, $pass);
1736 }
getTestPresentationConfig()
Get the test question configuration (initialised once)
getUserSolutionPreferingIntermediate($active_id, $pass=null)

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

Referenced by assOrderingQuestion\getSolutionOrderingElementListForTestOutput().

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

◆ getTestPresentationConfig()

assQuestion::getTestPresentationConfig ( )

Get the test question configuration (initialised once)

Returns
ilTestQuestionConfig

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

5438 {
5439 if ($this->testQuestionConfigInstance === null) {
5440 $this->testQuestionConfigInstance = $this->buildTestPresentationConfig();
5441 }
5442
5444 }
buildTestPresentationConfig()
build basic test question configuration instance

References $testQuestionConfigInstance, and buildTestPresentationConfig().

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

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

◆ getTitle()

◆ getTitleFilenameCompliant()

assQuestion::getTitleFilenameCompliant ( )

returns the object title prepared to be used as a filename

Returns
string

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

761 {
762 require_once 'Services/Utilities/classes/class.ilUtil.php';
763 return ilUtil::getASCIIFilename($this->getTitle());
764 }
static getASCIIFilename($a_filename)
convert utf8 to ascii filename

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

+ Here is the call graph for this function:

◆ getTotalAnswers()

assQuestion::getTotalAnswers ( )

get total number of answers

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

2148 {
2149 return $this->_getTotalAnswers($this->id);
2150 }
_getTotalAnswers($a_q_id)
get number of answers for question id (static) note: do not use $this inside this method

References _getTotalAnswers().

+ Here is the call graph for this function:

◆ getUserSolutionPreferingIntermediate()

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

Reimplemented in assFileUpload.

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

1740 {
1741 $solution = $this->getSolutionValues($active_id, $pass, false);
1742
1743 if (!count($solution)) {
1744 $solution = $this->getSolutionValues($active_id, $pass, true);
1745 }
1746
1747 return $solution;
1748 }

References $pass, and getSolutionValues().

Referenced by getTestOutputSolutions().

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

◆ getValidAdditionalContentEditingModes()

assQuestion::getValidAdditionalContentEditingModes ( )

getter for valid additional content editing modes

@access public

Returns
array

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

4618 {
4619 return array(
4620 self::ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT,
4621 self::ADDITIONAL_CONTENT_EDITING_MODE_PAGE_OBJECT
4622 );
4623 }

Referenced by isValidAdditionalContentEditingMode(), and setAdditionalContentEditingMode().

+ Here is the caller graph for this function:

◆ implodeKeyValues()

static assQuestion::implodeKeyValues (   $keyValues)
static

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

4957 {
4958 return implode(self::getKeyValuesImplosionSeparator(), $keyValues);
4959 }

Referenced by assImagemapQuestionGUI\buildSelectionParameter().

+ Here is the caller graph for this function:

◆ includeCoreClass()

static assQuestion::includeCoreClass (   $questionType,
  $withGuiClass 
)
static

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

3971 {
3972 if ($withGuiClass) {
3973 $guiClassName = self::getGuiClassNameByQuestionType($questionType);
3974 require_once "Modules/TestQuestionPool/classes/class.{$guiClassName}.php";
3975
3976 // object class is included by gui classes constructor
3977 } else {
3978 $objectClassName = self::getObjectClassNameByQuestionType($questionType);
3979 require_once "Modules/TestQuestionPool/classes/class.{$objectClassName}.php";
3980 }
3981
3982 $feedbackClassName = self::getFeedbackClassNameByQuestionType($questionType);
3983 require_once "Modules/TestQuestionPool/classes/feedback/class.{$feedbackClassName}.php";
3984 }
static getGuiClassNameByQuestionType($questionType)

References getFeedbackClassNameByQuestionType(), getGuiClassNameByQuestionType(), and getObjectClassNameByQuestionType().

Referenced by _includeClass().

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

◆ includePluginClass()

static assQuestion::includePluginClass (   $questionType,
  $withGuiClass 
)
static

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

3987 {
3988 global $DIC;
3989 $ilPluginAdmin = $DIC['ilPluginAdmin'];
3990
3991 $classes = array(
3992 self::getObjectClassNameByQuestionType($questionType),
3993 self::getFeedbackClassNameByQuestionType($questionType)
3994 );
3995
3996 if ($withGuiClass) {
3997 $classes[] = self::getGuiClassNameByQuestionType($questionType);
3998 }
3999
4000 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_MODULE, "TestQuestionPool", "qst");
4001 foreach ($pl_names as $pl_name) {
4002 $pl = ilPlugin::getPluginObject(IL_COMP_MODULE, "TestQuestionPool", "qst", $pl_name);
4003 if (strcmp($pl->getQuestionType(), $questionType) == 0) {
4004 foreach ($classes as $class) {
4005 $pl->includeClass("class.{$class}.php");
4006 }
4007
4008 break;
4009 }
4010 }
4011 }

References $DIC, getGuiClassNameByQuestionType(), ilPlugin\getPluginObject(), and IL_COMP_MODULE.

Referenced by _includeClass().

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

◆ instantiateQuestionGUI()

static assQuestion::instantiateQuestionGUI (   $a_question_id)
static

Creates an instance of a question gui with a given question id.

Parameters
integer$a_question_id
Returns
\assQuestionGUI The question gui instance

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

4061 {
4062 global $DIC;
4063 $ilCtrl = $DIC['ilCtrl'];
4064 $ilDB = $DIC['ilDB'];
4065 $lng = $DIC['lng'];
4066 $ilUser = $DIC['ilUser'];
4067
4068 if (strcmp($a_question_id, "") != 0) {
4069 $question_type = assQuestion::_getQuestionType($a_question_id);
4070
4071 assQuestion::_includeClass($question_type, 1);
4072
4073 $question_type_gui = self::getGuiClassNameByQuestionType($question_type);
4074 $question_gui = new $question_type_gui();
4075 $question_gui->object->loadFromDb($a_question_id);
4076
4077 $feedbackObjectClassname = self::getFeedbackClassNameByQuestionType($question_type);
4078 $question_gui->object->feedbackOBJ = new $feedbackObjectClassname($question_gui->object, $ilCtrl, $ilDB, $lng);
4079
4080 $assSettings = new ilSetting('assessment');
4081 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionProcessLockerFactory.php';
4082 $processLockerFactory = new ilAssQuestionProcessLockerFactory($assSettings, $ilDB);
4083 $processLockerFactory->setQuestionId($question_gui->object->getId());
4084 $processLockerFactory->setUserId($ilUser->getId());
4085 include_once("./Modules/Test/classes/class.ilObjAssessmentFolder.php");
4086 $processLockerFactory->setAssessmentLogEnabled(ilObjAssessmentFolder::_enabledAssessmentLogging());
4087 $question_gui->object->setProcessLocker($processLockerFactory->getLocker());
4088 } else {
4089 global $DIC;
4090 $ilLog = $DIC['ilLog'];
4091 $ilLog->write('Instantiate question called without question id. (instantiateQuestionGUI@assQuestion)', $ilLog->WARNING);
4092 return null;
4093 }
4094 return $question_gui;
4095 }
ILIAS Setting Class.

References $DIC, $ilCtrl, $ilDB, $ilLog, $ilUser, $lng, ilObjAssessmentFolder\_enabledAssessmentLogging(), _getQuestionType(), _includeClass(), getFeedbackClassNameByQuestionType(), and getGuiClassNameByQuestionType().

Referenced by _instanciateQuestionGUI(), ilObjTestGUI\copyQuestionToPool(), ilTestCorrectionsGUI\getQuestion(), and ilAssQuestionPreviewGUI\initQuestion().

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

◆ intermediateSolutionExists()

assQuestion::intermediateSolutionExists (   $active_id,
  $pass 
)

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

5120 {
5121 $solutionAvailability = $this->lookupForExistingSolutions($active_id, $pass);
5122 return (bool) $solutionAvailability['intermediate'];
5123 }

References $pass.

Referenced by assFileUpload\saveWorkingData().

+ Here is the caller graph for this function:

◆ isAddableAnswerOptionValue()

assQuestion::isAddableAnswerOptionValue (   $qIndex,
  $answerOptionValue 
)

Reimplemented in assClozeTest.

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

5208 {
5209 return false;
5210 }

◆ isAdditionalContentEditingModePageObject()

assQuestion::isAdditionalContentEditingModePageObject ( )

isser for additional "pageobject" content editing mode

@access public

Returns
boolean

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

4591 {
4593 }
const ADDITIONAL_CONTENT_EDITING_MODE_PAGE_OBJECT
constant for additional content editing mode "pageobject"

References ADDITIONAL_CONTENT_EDITING_MODE_PAGE_OBJECT, and getAdditionalContentEditingMode().

Referenced by delete(), and duplicateQuestionHints().

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

◆ isAllowedImageFileExtension()

static assQuestion::isAllowedImageFileExtension (   $mimeType,
  $fileExtension 
)
static

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

375 {
376 return in_array(
377 strtolower($fileExtension),
378 self::getAllowedFileExtensionsForMimeType($mimeType)
379 );
380 }

Referenced by ilQtiMatImageSecurity\validateLabel().

+ Here is the caller graph for this function:

◆ isAllowedImageMimeType()

static assQuestion::isAllowedImageMimeType (   $mimeType)
static

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

347 {
348 return (bool) count(self::getAllowedFileExtensionsForMimeType($mimeType));
349 }

Referenced by ilQtiMatImageSecurity\validateContent().

+ Here is the caller graph for this function:

◆ isAnswered()

assQuestion::isAnswered (   $active_id,
  $pass = null 
)

returns boolean wether the question is answered during test pass or not

method can be overwritten in derived classes, but be aware of also overwrite the method assQuestion::isObligationPossible()

Parameters
integer$active_id
integer$pass
Returns
boolean $answered

Reimplemented in assFileUpload, assKprimChoice, assMultipleChoice, assSingleChoice, and assTextQuestion.

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

4493 {
4494 return true;
4495 }

Referenced by calculateResultsFromSolution().

+ Here is the caller graph for this function:

◆ isAutosaveable()

assQuestion::isAutosaveable ( )

Reimplemented in assFileUpload, assFlashQuestion, assImagemapQuestion, and assJavaApplet.

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

4515 {
4516 return true;
4517 }

◆ isClone()

assQuestion::isClone (   $question_id = "")

Checks whether the question is a clone of another question or not.

Returns
boolean TRUE if the question is a clone, otherwise FALSE @access public

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

1850 {
1851 global $DIC;
1852 $ilDB = $DIC['ilDB'];
1853
1854 if ($question_id < 1) {
1855 $question_id = $this->id;
1856 }
1857 $result = $ilDB->queryF(
1858 "SELECT original_id FROM qpl_questions WHERE question_id = %s",
1859 array('integer'),
1860 array($question_id)
1861 );
1862 $row = $ilDB->fetchAssoc($result);
1863 return ($row["original_id"] > 0) ? true : false;
1864 }

References $DIC, $id, $ilDB, $result, and $row.

◆ isComplete()

assQuestion::isComplete ( )

Returns true, if a question is complete for use.

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

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

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

566 {
567 return false;
568 }

Referenced by saveQuestionDataToDb(), and saveToDb().

+ Here is the caller graph for this function:

◆ isCoreQuestionType()

static assQuestion::isCoreQuestionType (   $questionType)
static

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

3965 {
3966 $guiClassName = self::getGuiClassNameByQuestionType($questionType);
3967 return file_exists("Modules/TestQuestionPool/classes/class.{$guiClassName}.php");
3968 }

References getGuiClassNameByQuestionType().

+ Here is the call graph for this function:

◆ isDummySolutionRecord()

assQuestion::isDummySolutionRecord (   $solutionRecord)
protected

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

4975 {
4976 return !strlen($solutionRecord['value1']) && !strlen($solutionRecord['value2']);
4977 }

Referenced by assFileUpload\calculateReachedPoints().

+ Here is the caller graph for this function:

◆ isFileAvailable()

static assQuestion::isFileAvailable (   $file)
static

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

2271 {
2272 if (!file_exists($file)) {
2273 return false;
2274 }
2275
2276 if (!is_file($file)) {
2277 return false;
2278 }
2279
2280 if (!is_readable($file)) {
2281 return false;
2282 }
2283
2284 return true;
2285 }

Referenced by assMatchingQuestion\copyImages().

+ Here is the caller graph for this function:

◆ isForcePassResultUpdateEnabled()

static assQuestion::isForcePassResultUpdateEnabled ( )
static

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

342 {
344 }
static $forcePassResultsUpdateEnabled

References $forcePassResultsUpdateEnabled.

◆ isHTML()

assQuestion::isHTML (   $a_text)

Checks if a given string contains HTML or not.

Parameters
string$a_textText which should be checked
Returns
boolean @access public
Deprecated:
use ilUtil::isHTML() instead

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

3542 {
3543 return ilUtil::isHTML($a_text);
3544 }
static isHTML($a_text)
Checks if a given string contains HTML or not.

References ilUtil\isHTML().

Referenced by addQTIMaterial().

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

◆ isInUse()

assQuestion::isInUse (   $question_id = "")

Checks whether the question is in use or not.

Returns
boolean The number of datasets which are affected by the use of the query. @access public

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

1812 {
1813 global $DIC;
1814 $ilDB = $DIC['ilDB'];
1815
1816 if ($question_id < 1) {
1817 $question_id = $this->getId();
1818 }
1819 $result = $ilDB->queryF(
1820 "SELECT COUNT(qpl_questions.question_id) question_count FROM qpl_questions, tst_test_question WHERE qpl_questions.original_id = %s AND qpl_questions.question_id = tst_test_question.question_fi",
1821 array('integer'),
1822 array($question_id)
1823 );
1824 $row = $ilDB->fetchAssoc($result);
1825 $count = $row["question_count"];
1826
1827 $result = $ilDB->queryF(
1828 "
1829 SELECT tst_active.test_fi
1830 FROM qpl_questions
1831 INNER JOIN tst_test_rnd_qst ON tst_test_rnd_qst.question_fi = qpl_questions.question_id
1832 INNER JOIN tst_active ON tst_active.active_id = tst_test_rnd_qst.active_fi
1833 WHERE qpl_questions.original_id = %s
1834 GROUP BY tst_active.test_fi",
1835 array('integer'),
1836 array($question_id)
1837 );
1838 $count += $result->numRows();
1839
1840 return $count;
1841 }

References $DIC, $ilDB, $result, $row, and getId().

+ Here is the call graph for this function:

◆ isNonEmptyItemListPostSubmission()

assQuestion::isNonEmptyItemListPostSubmission (   $postSubmissionFieldname)
protected
Parameters
string$postSubmissionFieldname
Returns
bool

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

405 {
406 if (!isset($_POST[$postSubmissionFieldname])) {
407 return false;
408 }
409
410 if (!is_array($_POST[$postSubmissionFieldname])) {
411 return false;
412 }
413
414 if (!count($_POST[$postSubmissionFieldname])) {
415 return false;
416 }
417
418 return true;
419 }

References $_POST.

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

+ Here is the caller graph for this function:

◆ isObligationPossible()

static assQuestion::isObligationPossible (   $questionId)
static

returns boolean wether it is possible to set this question type as obligatory or not considering the current question configuration

method can be overwritten in derived classes, but be aware of also overwrite the method assQuestion::isAnswered()

Parameters
integer$questionId
Returns
boolean $obligationPossible

Reimplemented in assFileUpload, assKprimChoice, assSingleChoice, and assTextQuestion.

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

4510 {
4511 return false;
4512 }

◆ isPreviewSolutionCorrect()

assQuestion::isPreviewSolutionCorrect ( ilAssQuestionPreviewSession  $previewSession)

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

3437 {
3438 $reachedPoints = $this->calculateReachedPointsFromPreviewSession($previewSession);
3439
3440 if ($reachedPoints < $this->getMaximumPoints()) {
3441 return false;
3442 }
3443
3444 return true;
3445 }
calculateReachedPointsFromPreviewSession(ilAssQuestionPreviewSession $previewSession)

References calculateReachedPointsFromPreviewSession(), and getMaximumPoints().

+ Here is the call graph for this function:

◆ isValidAdditionalContentEditingMode()

assQuestion::isValidAdditionalContentEditingMode (   $additionalContentEditingMode)

returns the fact wether the passed additional content mode is valid or not

@access public

Parameters
string$additionalContentEditingMode
Returns
boolean $isValidAdditionalContentEditingMode

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

4603 {
4604 if (in_array($additionalContentEditingMode, $this->getValidAdditionalContentEditingModes())) {
4605 return true;
4606 }
4607
4608 return false;
4609 }
getValidAdditionalContentEditingModes()
getter for valid additional content editing modes

References getValidAdditionalContentEditingModes().

+ Here is the call graph for this function:

◆ keyInArray()

assQuestion::keyInArray (   $searchkey,
  $array 
)

returns TRUE if the key occurs in an array

Parameters
string$arraykeyA key to an element in array
array$arrayAn array to be searched @access public

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

705 {
706 if ($searchkey) {
707 foreach ($array as $key => $value) {
708 if (strcmp($key, $searchkey) == 0) {
709 return true;
710 }
711 }
712 }
713 return false;
714 }

References $key.

◆ lmMigrateQuestionTypeGenericContent()

assQuestion::lmMigrateQuestionTypeGenericContent ( ilAssSelfAssessmentMigrator  $migrator)
protected
Parameters
ilAssSelfAssessmentMigrator$migrator

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

4332 {
4333 $this->setQuestion($migrator->migrateToLmContent($this->getQuestion()));
4334 }

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

Referenced by migrateContentForLearningModule().

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

◆ lmMigrateQuestionTypeSpecificContent()

assQuestion::lmMigrateQuestionTypeSpecificContent ( ilAssSelfAssessmentMigrator  $migrator)
protected
Parameters
ilAssSelfAssessmentMigrator$migrator

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

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

4340 {
4341 // overwrite if any question type specific content except feedback needs to be migrated
4342 }

Referenced by migrateContentForLearningModule().

+ Here is the caller graph for this function:

◆ loadFromDb()

assQuestion::loadFromDb (   $question_id)

Loads the question from the database.

Parameters
integer$question_idA unique key which defines the question in the database @access public

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

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

2466 {
2467 global $DIC;
2468 $ilDB = $DIC['ilDB'];
2469
2470 $result = $ilDB->queryF(
2471 "SELECT external_id FROM qpl_questions WHERE question_id = %s",
2472 array("integer"),
2473 array($question_id)
2474 );
2475 if ($result->numRows() == 1) {
2476 $data = $ilDB->fetchAssoc($result);
2477 $this->external_id = $data['external_id'];
2478 }
2479
2480 $result = $ilDB->queryF(
2481 "SELECT * FROM qpl_sol_sug WHERE question_fi = %s",
2482 array('integer'),
2483 array($this->getId())
2484 );
2485 $this->suggested_solutions = array();
2486 if ($result->numRows()) {
2487 include_once("./Services/RTE/classes/class.ilRTE.php");
2488 while ($row = $ilDB->fetchAssoc($result)) {
2489 $value = (is_array(unserialize($row["value"]))) ? unserialize($row["value"]) : ilRTE::_replaceMediaObjectImageSrc($row["value"], 1);
2490 $this->suggested_solutions[$row["subquestion_index"]] = array(
2491 "type" => $row["type"],
2492 "value" => $value,
2493 "internal_link" => $row["internal_link"],
2494 "import_id" => $row["import_id"]
2495 );
2496 }
2497 }
2498 }

References $data, $DIC, $ilDB, $result, $row, ilRTE\_replaceMediaObjectImageSrc(), and getId().

+ Here is the call graph for this function:

◆ log()

assQuestion::log (   $active_id,
  $langVar 
)
protected
Parameters
integer$active_id
string$langVar

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

474 {
476 $message = $this->lng->txtlng('assessment', $langVar, ilObjAssessmentFolder::_getLogLanguage());
477 assQuestion::logAction($message, $active_id, $this->getId());
478 }
479 }
catch(Exception $e) $message

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

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

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

◆ logAction()

static assQuestion::logAction (   $logtext = "",
  $active_id = "",
  $question_id = "" 
)
static

Logs an action into the Test&Assessment log.

Parameters
string$logtextThe log text
int | string$active_id
int | string$question_idIf given, saves the question id to the database

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

1572 {
1573 $original_id = "";
1574 if (strlen($question_id)) {
1575 $original_id = self::_getOriginalId($question_id);
1576 }
1577
1578 require_once 'Modules/Test/classes/class.ilObjAssessmentFolder.php';
1579 require_once 'Modules/Test/classes/class.ilObjTest.php';
1580
1582 $GLOBALS['DIC']['ilUser']->getId(),
1584 $logtext,
1585 $question_id,
1587 );
1588 }
static _getOriginalId($question_id)
Returns the original id of a question.
static _addLog($user_id, $object_id, $logtext, $question_id="", $original_id="", $test_only=false, $test_ref_id=null)
Add an assessment log entry.
static _getObjectIDFromActiveID($active_id)
Returns the ILIAS test object id for a given active id.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.

References $GLOBALS, $original_id, ilObjAssessmentFolder\_addLog(), ilObjTest\_getObjectIDFromActiveID(), _getOriginalId(), and getId().

Referenced by _setReachedPoints(), calculateResultsFromSolution(), log(), assClozeTest\saveWorkingData(), assErrorText\saveWorkingData(), assFileUpload\saveWorkingData(), assFormulaQuestion\saveWorkingData(), assImagemapQuestion\saveWorkingData(), assLongMenu\saveWorkingData(), assMatchingQuestion\saveWorkingData(), assOrderingHorizontal\saveWorkingData(), assSingleChoice\saveWorkingData(), assTextQuestion\saveWorkingData(), and assTextSubset\saveWorkingData().

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

◆ lookupCurrentTestPass()

assQuestion::lookupCurrentTestPass (   $active_id,
  $pass 
)
protected
Parameters
$active_id
$pass
Returns
int

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

441 {
442 require_once 'Modules/Test/classes/class.ilObjTest.php';
443 return ilObjTest::_getPass($active_id);
444 }

References ilObjTest\_getPass().

Referenced by ensureCurrentTestPass().

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

◆ lookupOriginalParentObjId()

static assQuestion::lookupOriginalParentObjId (   $originalQuestionId)
static

returns the parent object id for given original question id (should be a qpl id, but theoretically it can be a tst id, too)

@global ilDBInterface $ilDB

Parameters
integer$originalQuestionId
Returns
integer $originalQuestionParentObjectId
Deprecated:
: use assQuestion::lookupParentObjId() instead

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

4415 {
4416 return self::lookupParentObjId($originalQuestionId);
4417 }
static lookupParentObjId($questionId)
@global ilDBInterface $ilDB

References lookupParentObjId().

Referenced by syncWithOriginal().

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

◆ lookupParentObjId()

static assQuestion::lookupParentObjId (   $questionId)
static

@global ilDBInterface $ilDB

Parameters
integer$questionId
Returns
integer $parentObjectId

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

4392 {
4393 global $DIC;
4394 $ilDB = $DIC['ilDB'];
4395
4396 $query = "SELECT obj_fi FROM qpl_questions WHERE question_id = %s";
4397
4398 $res = $ilDB->queryF($query, array('integer'), array((int) $questionId));
4399 $row = $ilDB->fetchAssoc($res);
4400
4401 return $row['obj_fi'];
4402 }

References $DIC, $ilDB, $query, $res, and $row.

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

+ Here is the caller graph for this function:

◆ lookupResultRecordExist()

static assQuestion::lookupResultRecordExist (   $activeId,
  $questionId,
  $pass 
)
static

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

5347 {
5348 global $DIC;
5349 $ilDB = $DIC['ilDB'];
5350
5351 $query = "
5352 SELECT COUNT(*) cnt
5353 FROM tst_test_result
5354 WHERE active_fi = %s
5355 AND question_fi = %s
5356 AND pass = %s
5357 ";
5358
5359 $row = $ilDB->fetchAssoc($ilDB->queryF($query, array('integer', 'integer', 'integer'), array($activeId, $questionId, $pass)));
5360
5361 return $row['cnt'] > 0;
5362 }

References $DIC, $ilDB, $pass, $query, and $row.

Referenced by _isWorkedThrough().

+ Here is the caller graph for this function:

◆ lookupTestId()

assQuestion::lookupTestId (   $active_id)
protected
Parameters
$active_id
Returns
int

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

451 {
452 global $DIC; /* @var ILIAS\DI\Container $DIC */
453 $ilDB = $DIC['ilDB'];
454
455 $result = $ilDB->queryF(
456 "SELECT test_fi FROM tst_active WHERE active_id = %s",
457 array('integer'),
458 array($active_id)
459 );
460
461 while ($row = $ilDB->fetchAssoc($result)) {
462 return $row["test_fi"];
463 }
464
465 return null;
466 }

References $DIC, $ilDB, $result, and $row.

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

+ Here is the caller graph for this function:

◆ migrateContentForLearningModule()

assQuestion::migrateContentForLearningModule ( ilAssSelfAssessmentMigrator  $migrator)
Parameters
ilAssSelfAssessmentMigrator$migrator

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

4320 {
4321 $this->lmMigrateQuestionTypeGenericContent($migrator);
4322 $this->lmMigrateQuestionTypeSpecificContent($migrator);
4323 $this->saveToDb();
4324
4325 $this->feedbackOBJ->migrateContentForLearningModule($migrator, $this->getId());
4326 }
lmMigrateQuestionTypeGenericContent(ilAssSelfAssessmentMigrator $migrator)
lmMigrateQuestionTypeSpecificContent(ilAssSelfAssessmentMigrator $migrator)
saveToDb($original_id="")
Saves the question to the database.

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

Referenced by ilAssSelfAssessmentQuestionFormatter\prepareQuestionForLearningModule().

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

◆ missingResultRecordExists()

static assQuestion::missingResultRecordExists (   $activeId,
  $pass,
  $questionIds 
)
static

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

5288 {
5289 global $DIC;
5290 $ilDB = $DIC['ilDB'];
5291
5292 $IN_questionIds = $ilDB->in('question_fi', $questionIds, false, 'integer');
5293
5294 $query = "
5295 SELECT COUNT(*) cnt
5296 FROM tst_test_result
5297 WHERE active_fi = %s
5298 AND pass = %s
5299 AND $IN_questionIds
5300 ";
5301
5302 $row = $ilDB->fetchAssoc($ilDB->queryF(
5303 $query,
5304 array('integer', 'integer'),
5305 array($activeId, $pass)
5306 ));
5307
5308 return $row['cnt'] < count($questionIds);
5309 }

References $DIC, $ilDB, $pass, $query, and $row.

◆ moveUploadedMediaFile()

assQuestion::moveUploadedMediaFile (   $file,
  $name 
)

Move an uploaded media file to an public accessible temp dir to present it.

Parameters
string$fileFile path
string$nameName of the file @access public

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

1598 {
1599 $mediatempdir = CLIENT_WEB_DIR . "/assessment/temp";
1600 if (!@is_dir($mediatempdir)) {
1601 ilUtil::createDirectory($mediatempdir);
1602 }
1603 $temp_name = tempnam($mediatempdir, $name . "_____");
1604 $temp_name = str_replace("\\", "/", $temp_name);
1605 @unlink($temp_name);
1606 if (!ilUtil::moveUploadedFile($file, $name, $temp_name)) {
1607 return false;
1608 } else {
1609 return $temp_name;
1610 }
1611 }
static createDirectory($a_dir, $a_mod=0755)
create directory

References $name, and ilUtil\createDirectory().

+ Here is the call graph for this function:

◆ notifyQuestionCreated()

assQuestion::notifyQuestionCreated ( )
private

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

4642 {
4643 foreach ($this->getQuestionChangeListeners() as $listener) {
4644 $listener->notifyQuestionCreated($this);
4645 }
4646 }

References getQuestionChangeListeners().

Referenced by createNewQuestion().

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

◆ notifyQuestionDeleted()

assQuestion::notifyQuestionDeleted ( )
private

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

4656 {
4657 foreach ($this->getQuestionChangeListeners() as $listener) {
4658 $listener->notifyQuestionDeleted($this);
4659 }
4660 }

References getQuestionChangeListeners().

Referenced by delete().

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

◆ notifyQuestionEdited()

assQuestion::notifyQuestionEdited ( )
private

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

4649 {
4650 foreach ($this->getQuestionChangeListeners() as $listener) {
4651 $listener->notifyQuestionEdited($this);
4652 }
4653 }

References getQuestionChangeListeners().

Referenced by saveToDb().

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

◆ onCopy()

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

Will be called when a question is copied (into another question pool)

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

2707 {
2708 $this->copySuggestedSolutionFiles($sourceParentId, $sourceQuestionId);
2709
2710 // duplicate question feeback
2711 $this->feedbackOBJ->duplicateFeedback($sourceQuestionId, $targetQuestionId);
2712
2713 // duplicate question hints
2714 $this->duplicateQuestionHints($sourceQuestionId, $targetQuestionId);
2715
2716 // duplicate skill assignments
2717 $this->duplicateSkillAssignments($sourceParentId, $sourceQuestionId, $targetParentId, $targetQuestionId);
2718 }
copySuggestedSolutionFiles($source_questionpool_id, $source_question_id)
duplicateSkillAssignments($srcParentId, $srcQuestionId, $trgParentId, $trgQuestionId)
duplicateQuestionHints($originalQuestionId, $duplicateQuestionId)

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

+ Here is the call graph for this function:

◆ onDuplicate()

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

Will be called when a question is duplicated (inside a question pool or for insertion in a test)

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

2680 {
2681 $this->duplicateSuggestedSolutionFiles($originalParentId, $originalQuestionId);
2682
2683 // duplicate question feeback
2684 $this->feedbackOBJ->duplicateFeedback($originalQuestionId, $duplicateQuestionId);
2685
2686 // duplicate question hints
2687 $this->duplicateQuestionHints($originalQuestionId, $duplicateQuestionId);
2688
2689 // duplicate skill assignments
2690 $this->duplicateSkillAssignments($originalParentId, $originalQuestionId, $duplicateParentId, $duplicateQuestionId);
2691 }
duplicateSuggestedSolutionFiles($parent_id, $question_id)
Duplicates the files of a suggested solution if the question is duplicated.

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

+ Here is the call graph for this function:

◆ originalQuestionExists()

static assQuestion::originalQuestionExists (   $questionId)
static

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

3116 {
3117 global $DIC;
3118 $ilDB = $DIC['ilDB'];
3119
3120 $query = "
3121 SELECT COUNT(dupl.question_id) cnt
3122 FROM qpl_questions dupl
3123 INNER JOIN qpl_questions orig
3124 ON orig.question_id = dupl.original_id
3125 WHERE dupl.question_id = %s
3126 ";
3127
3128 $res = $ilDB->queryF($query, array('integer'), array($questionId));
3129 $row = $ilDB->fetchAssoc($res);
3130
3131 return $row['cnt'] > 0;
3132 }

References $DIC, $ilDB, $query, $res, and $row.

Referenced by ilObjTestGUI\copyAndLinkQuestionsToPoolObject(), and ilObjTestGUI\copyAndLinkToQuestionpoolObject().

+ Here is the caller graph for this function:

◆ pcArrayShuffle()

assQuestion::pcArrayShuffle (   $array)

Shuffles the values of a given array.

Parameters
array$arrayAn array which should be shuffled @access public

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

1873 {
1874 $keys = array_keys($array);
1875 shuffle($keys);
1876 $result = array();
1877 foreach ($keys as $key) {
1878 $result[$key] = $array[$key];
1879 }
1880 return $result;
1881 }
$keys

References $key, $keys, and $result.

◆ persistPreviewState()

assQuestion::persistPreviewState ( ilAssQuestionPreviewSession  $previewSession)
final

persists the preview state for current user and question

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

1331 {
1332 $this->savePreviewData($previewSession);
1333 return $this->validateSolutionSubmit();
1334 }
savePreviewData(ilAssQuestionPreviewSession $previewSession)

References savePreviewData(), and validateSolutionSubmit().

+ Here is the call graph for this function:

◆ persistWorkingState()

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

persists the working state for current testactive and testpass

@final @access public

Parameters
integer$active_idActive id of the user
integer$passTest pass

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

1299 {
1300 if (!$this->validateSolutionSubmit() && !$this->savePartial()) {
1301 return false;
1302 }
1303
1304 $saveStatus = false;
1305
1306 $this->getProcessLocker()->executePersistWorkingStateLockOperation(function () use ($active_id, $pass, $authorized, $obligationsEnabled, &$saveStatus) {
1307
1308 if ($pass === null) {
1309 require_once 'Modules/Test/classes/class.ilObjTest.php';
1310 $pass = ilObjTest::_getPass($active_id);
1311 }
1312
1313 $saveStatus = $this->saveWorkingData($active_id, $pass, $authorized);
1314
1315 if ($authorized) {
1316 // fau: testNav - remove an intermediate solution if the authorized solution is saved
1317 // the intermediate solution would set the displayed question status as "editing ..."
1318 $this->removeIntermediateSolution($active_id, $pass);
1319 // fau.
1320 $this->calculateResultsFromSolution($active_id, $pass, $obligationsEnabled);
1321 }
1322 });
1323
1324 return $saveStatus;
1325 }
calculateResultsFromSolution($active_id, $pass=null, $obligationsEnabled=false)
Calculates the question results from a previously saved question solution.
removeIntermediateSolution($active_id, $pass)
saveWorkingData($active_id, $pass=null, $authorized=true)
Saves the learners input of the question to the database.

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

+ Here is the call graph for this function:

◆ prepareTextareaOutput()

assQuestion::prepareTextareaOutput (   $txt_output,
  $prepare_for_latex_output = false,
  $omitNl2BrWhenTextArea = false 
)

Prepares a string for a text area output in tests.

Parameters
string$txt_outputString which should be prepared for output @access public

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

3553 {
3554 include_once "./Services/Utilities/classes/class.ilUtil.php";
3555 return ilUtil::prepareTextareaOutput($txt_output, $prepare_for_latex_output, $omitNl2BrWhenTextArea);
3556 }
static prepareTextareaOutput($txt_output, $prepare_for_latex_output=false, $omitNl2BrWhenTextArea=false)
Prepares a string for a text area output where latex code may be in it If the text is HTML-free,...

References ilUtil\prepareTextareaOutput().

Referenced by getSuggestedSolutionOutput(), and assClozeTest\updateClozeTextFromGaps().

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

◆ QTIMaterialToString()

assQuestion::QTIMaterialToString (   $a_material)

Reads an QTI material tag an creates a text string.

Parameters
string$a_materialQTI material tag
Returns
string text or xhtml string @access public

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

3566 {
3567 $result = "";
3568 for ($i = 0; $i < $a_material->getMaterialCount(); $i++) {
3569 $material = $a_material->getMaterial($i);
3570 if (strcmp($material["type"], "mattext") == 0) {
3571 $result .= $material["material"]->getContent();
3572 }
3573 if (strcmp($material["type"], "matimage") == 0) {
3574 $matimage = $material["material"];
3575 if (preg_match("/(il_([0-9]+)_mob_([0-9]+))/", $matimage->getLabel(), $matches)) {
3576 // import an mediaobject which was inserted using tiny mce
3577 if (!is_array($_SESSION["import_mob_xhtml"])) {
3578 $_SESSION["import_mob_xhtml"] = array();
3579 }
3580 array_push($_SESSION["import_mob_xhtml"], array("mob" => $matimage->getLabel(), "uri" => $matimage->getUri()));
3581 }
3582 }
3583 }
3584 return $result;
3585 }
$_SESSION["AccountId"]
$i
Definition: disco.tpl.php:19

References $_SESSION, $i, and $result.

◆ questionTitleExists()

assQuestion::questionTitleExists (   $questionpool_id,
  $title 
)

Returns TRUE if the question title exists in the database.

Parameters
string$titleThe title of the question
Returns
boolean The result of the title check @access public

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

578 {
579 global $DIC;
580 $ilDB = $DIC['ilDB'];
581
582 $result = $ilDB->queryF(
583 "SELECT * FROM qpl_questions WHERE obj_fi = %s AND title = %s",
584 array('integer','text'),
585 array($questionpool_id, $title)
586 );
587 return ($result->numRows() > 0) ? true : false;
588 }

References $DIC, $ilDB, $result, and $title.

◆ removeAllExistingSolutions()

assQuestion::removeAllExistingSolutions ( )

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

5217 {
5218 global $DIC; /* @var ILIAS\DI\Container $DIC */
5219
5220 $query = "DELETE FROM tst_solutions WHERE question_fi = %s";
5221
5222 $DIC->database()->manipulateF($query, array('integer'), array($this->getId()));
5223 }

References $DIC, $query, and getId().

+ Here is the call graph for this function:

◆ removeCurrentSolution()

assQuestion::removeCurrentSolution (   $active_id,
  $pass,
  $authorized = true 
)
Parameters
int$active_id
int$pass
bool | true$authorized@global ilDBInterface $ilDB
Returns
int

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

4817 {
4818 global $DIC;
4819 $ilDB = $DIC['ilDB'];
4820
4821 if ($this->getStep() !== null) {
4822 $query = "
4823 DELETE FROM tst_solutions
4824 WHERE active_fi = %s
4825 AND question_fi = %s
4826 AND pass = %s
4827 AND step = %s
4828 AND authorized = %s
4829 ";
4830
4831 return $ilDB->manipulateF(
4832 $query,
4833 array('integer', 'integer', 'integer', 'integer', 'integer'),
4834 array($active_id, $this->getId(), $pass, $this->getStep(), (int) $authorized)
4835 );
4836 } else {
4837 $query = "
4838 DELETE FROM tst_solutions
4839 WHERE active_fi = %s
4840 AND question_fi = %s
4841 AND pass = %s
4842 AND authorized = %s
4843 ";
4844
4845 return $ilDB->manipulateF(
4846 $query,
4847 array('integer', 'integer', 'integer', 'integer'),
4848 array($active_id, $this->getId(), $pass, (int) $authorized)
4849 );
4850 }
4851 }

References $DIC, $ilDB, $query, getId(), and getStep().

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

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

◆ removeExistingSolutions()

assQuestion::removeExistingSolutions (   $activeId,
  $pass 
)

Reimplemented in assFormulaQuestion.

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

5226 {
5227 global $DIC;
5228 $ilDB = $DIC['ilDB'];
5229
5230 $query = "
5231 DELETE FROM tst_solutions
5232 WHERE active_fi = %s
5233 AND question_fi = %s
5234 AND pass = %s
5235 ";
5236
5237 if ($this->getStep() !== null) {
5238 $query .= " AND step = " . $ilDB->quote((int) $this->getStep(), 'integer') . " ";
5239 }
5240
5241 return $ilDB->manipulateF(
5242 $query,
5243 array('integer', 'integer', 'integer'),
5244 array($activeId, $this->getId(), $pass)
5245 );
5246 }

References $DIC, $ilDB, $query, getId(), and getStep().

Referenced by resetUsersAnswer().

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

◆ removeIntermediateSolution()

assQuestion::removeIntermediateSolution (   $active_id,
  $pass 
)
Parameters
int$active_id
int$pass
bool | true$authorized@global ilDBInterface $ilDB
Returns
int

Reimplemented in assFileUpload.

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

4802 {
4803 $this->getProcessLocker()->executeUserSolutionUpdateLockOperation(function () use ($active_id, $pass) {
4804 $this->removeCurrentSolution($active_id, $pass, false);
4805 });
4806 }
removeCurrentSolution($active_id, $pass, $authorized=true)

References $pass, getProcessLocker(), and removeCurrentSolution().

Referenced by persistWorkingState().

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

◆ removeResultRecord()

assQuestion::removeResultRecord (   $activeId,
  $pass 
)

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

5265 {
5266 global $DIC;
5267 $ilDB = $DIC['ilDB'];
5268
5269 $query = "
5270 DELETE FROM tst_test_result
5271 WHERE active_fi = %s
5272 AND question_fi = %s
5273 AND pass = %s
5274 ";
5275
5276 if ($this->getStep() !== null) {
5277 $query .= " AND step = " . $ilDB->quote((int) $this->getStep(), 'integer') . " ";
5278 }
5279
5280 return $ilDB->manipulateF(
5281 $query,
5282 array('integer', 'integer', 'integer'),
5283 array($activeId, $this->getId(), $pass)
5284 );
5285 }

References $DIC, $ilDB, $query, getId(), and getStep().

Referenced by resetUsersAnswer().

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

◆ removeSolutionRecordById()

assQuestion::removeSolutionRecordById (   $solutionId)
protected
Parameters
$solutionId@global ilDBInterface $ilDB
Returns
int

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

4758 {
4759 global $DIC;
4760 $ilDB = $DIC['ilDB'];
4761
4762 return $ilDB->manipulateF(
4763 "DELETE FROM tst_solutions WHERE solution_id = %s",
4764 array('integer'),
4765 array($solutionId)
4766 );
4767 }

References $DIC, and $ilDB.

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

+ Here is the caller graph for this function:

◆ requiresJsSwitch()

assQuestion::requiresJsSwitch ( )

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

843 {
844 return $this->supportsJavascriptOutput() && $this->supportsNonJsOutput();
845 }
supportsJavascriptOutput()
Returns true if the question type supports JavaScript output.

References supportsJavascriptOutput(), and supportsNonJsOutput().

+ Here is the call graph for this function:

◆ resetOriginalId()

static assQuestion::resetOriginalId (   $questionId)
static

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

2666 {
2667 $query = "UPDATE qpl_questions SET tstamp = %s, original_id = NULL WHERE question_id = %s";
2668
2669 $GLOBALS['DIC']['ilDB']->manipulateF(
2670 $query,
2671 array('integer', 'text'),
2672 array(time(), $questionId)
2673 );
2674 }

References $GLOBALS, and $query.

Referenced by assOrderingQuestionImport\fromXML(), and ilTestRandomQuestionSetPoolDeriver\updateTestQuestionStage().

+ Here is the caller graph for this function:

◆ resetUsersAnswer()

assQuestion::resetUsersAnswer (   $activeId,
  $pass 
)

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

5249 {
5250 $this->removeExistingSolutions($activeId, $pass);
5251 $this->removeResultRecord($activeId, $pass);
5252
5253 $this->log($activeId, "log_user_solution_willingly_deleted");
5254
5255 self::_updateTestPassResults(
5256 $activeId,
5257 $pass,
5259 $this->getProcessLocker(),
5260 $this->getTestId()
5261 );
5262 }
removeResultRecord($activeId, $pass)
log($active_id, $langVar)
removeExistingSolutions($activeId, $pass)

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

+ Here is the call graph for this function:

◆ saveCurrentSolution()

assQuestion::saveCurrentSolution (   $active_id,
  $pass,
  $value1,
  $value2,
  $authorized = true,
  $tstamp = null 
)
Parameters
int$active_id
int$pass
mixed$value1
mixed$value2
bool | true$authorized
int | null$tstamp@global ilDBInterface $ilDB
Returns
int

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

4866 {
4867 global $DIC;
4868 $ilDB = $DIC['ilDB'];
4869
4870 $next_id = $ilDB->nextId("tst_solutions");
4871
4872 $fieldData = array(
4873 "solution_id" => array("integer", $next_id),
4874 "active_fi" => array("integer", $active_id),
4875 "question_fi" => array("integer", $this->getId()),
4876 "value1" => array("clob", $value1),
4877 "value2" => array("clob", $value2),
4878 "pass" => array("integer", $pass),
4879 "tstamp" => array("integer", isset($tstamp) ? $tstamp : time()),
4880 'authorized' => array('integer', (int) $authorized)
4881 );
4882
4883 if ($this->getStep() !== null) {
4884 $fieldData['step'] = array("integer", $this->getStep());
4885 }
4886
4887 return $ilDB->insert("tst_solutions", $fieldData);
4888 }

References $DIC, $ilDB, $pass, getId(), and getStep().

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

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

◆ saveOriginalId()

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

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

2655 {
2656 $query = "UPDATE qpl_questions SET tstamp = %s, original_id = %s WHERE question_id = %s";
2657
2658 $GLOBALS['DIC']['ilDB']->manipulateF(
2659 $query,
2660 array('integer','integer', 'text'),
2661 array(time(), $originalId, $questionId)
2662 );
2663 }

References $GLOBALS, and $query.

Referenced by assOrderingQuestionImport\fromXML(), setNewOriginalId(), and ilTestRandomQuestionSetPoolDeriver\updateTestQuestionStage().

+ Here is the caller graph for this function:

◆ savePartial()

assQuestion::savePartial ( )

Reimplemented in assClozeTest.

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

5463 {
5464 return false;
5465 }

Referenced by persistWorkingState().

+ Here is the caller graph for this function:

◆ savePreviewData()

assQuestion::savePreviewData ( ilAssQuestionPreviewSession  $previewSession)
protected

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

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

1353 {
1354 $previewSession->setParticipantsSolution($this->getSolutionSubmit());
1355 }

References ilAssQuestionPreviewSession\setParticipantsSolution().

Referenced by persistPreviewState().

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

◆ saveQuestionDataToDb()

assQuestion::saveQuestionDataToDb (   $original_id = "")

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

2558 {
2559 global $DIC;
2560 $ilDB = $DIC['ilDB'];
2561
2562 $estw_time = $this->getEstimatedWorkingTime();
2563 $estw_time = sprintf("%02d:%02d:%02d", $estw_time['h'], $estw_time['m'], $estw_time['s']);
2564
2565 // cleanup RTE images which are not inserted into the question text
2566 include_once("./Services/RTE/classes/class.ilRTE.php");
2567 if ($this->getId() == -1) {
2568 // Neuen Datensatz schreiben
2569 $next_id = $ilDB->nextId('qpl_questions');
2570 $affectedRows = $ilDB->insert("qpl_questions", array(
2571 "question_id" => array("integer", $next_id),
2572 "question_type_fi" => array("integer", $this->getQuestionTypeID()),
2573 "obj_fi" => array("integer", $this->getObjId()),
2574 "title" => array("text", $this->getTitle()),
2575 "description" => array("text", $this->getComment()),
2576 "author" => array("text", $this->getAuthor()),
2577 "owner" => array("integer", $this->getOwner()),
2578 "question_text" => array("clob", ilRTE::_replaceMediaObjectImageSrc($this->getQuestion(), 0)),
2579 "points" => array("float", $this->getMaximumPoints()),
2580 "working_time" => array("text", $estw_time),
2581 "nr_of_tries" => array("integer", $this->getNrOfTries()),
2582 "created" => array("integer", time()),
2583 "original_id" => array("integer", ($original_id) ? $original_id : null),
2584 "tstamp" => array("integer", time()),
2585 "external_id" => array("text", $this->getExternalId()),
2586 'add_cont_edit_mode' => array('text', $this->getAdditionalContentEditingMode())
2587 ));
2588 $this->setId($next_id);
2589 // create page object of question
2590 $this->createPageObject();
2591 } else {
2592 // Vorhandenen Datensatz aktualisieren
2593 $affectedRows = $ilDB->update("qpl_questions", array(
2594 "obj_fi" => array("integer", $this->getObjId()),
2595 "title" => array("text", $this->getTitle()),
2596 "description" => array("text", $this->getComment()),
2597 "author" => array("text", $this->getAuthor()),
2598 "question_text" => array("clob", ilRTE::_replaceMediaObjectImageSrc($this->getQuestion(), 0)),
2599 "points" => array("float", $this->getMaximumPoints()),
2600 "nr_of_tries" => array("integer", $this->getNrOfTries()),
2601 "working_time" => array("text", $estw_time),
2602 "tstamp" => array("integer", time()),
2603 'complete' => array('integer', $this->isComplete()),
2604 "external_id" => array("text", $this->getExternalId())
2605 ), array(
2606 "question_id" => array("integer", $this->getId())
2607 ));
2608 }
2609 }
isComplete()
Returns true, if a question is complete for use.

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

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

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

◆ saveToDb()

assQuestion::saveToDb (   $original_id = "")

Saves the question to the database.

Parameters
integer$original_id@access public

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

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

2618 {
2619 global $DIC;
2620 $ilDB = $DIC['ilDB'];
2621
2622 $this->updateSuggestedSolutions();
2623
2624 // remove unused media objects from ILIAS
2625 $this->cleanupMediaObjectUsage();
2626
2627 $complete = "0";
2628 if ($this->isComplete()) {
2629 $complete = "1";
2630 }
2631
2632 // update the question time stamp and completion status
2633 $affectedRows = $ilDB->manipulateF(
2634 "UPDATE qpl_questions SET tstamp = %s, owner = %s, complete = %s WHERE question_id = %s",
2635 array('integer','integer', 'integer','text'),
2636 array(time(), ($this->getOwner() <= 0) ? $this->ilias->account->id : $this->getOwner(), $complete, $this->getId())
2637 );
2638
2639 // update question count of question pool
2640 include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
2642
2643 $this->notifyQuestionEdited($this);
2644 }
cleanupMediaObjectUsage()
synchronises appearances of media objects in the question with media object usage table

References $DIC, $ilDB, ilObjQuestionPool\_updateQuestionCount(), cleanupMediaObjectUsage(), getOwner(), isComplete(), and notifyQuestionEdited().

Referenced by migrateContentForLearningModule(), and syncWithOriginal().

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

◆ saveWorkingData()

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

Saves the learners input of the question to the database.

@abstract @access public

Parameters
integer$active_idActive id of the user
integer$passTest pass
Returns
boolean $status

Reimplemented in assClozeTest, assErrorText, assFileUpload, assFlashQuestion, assFormulaQuestion, assImagemapQuestion, assJavaApplet, assLongMenu, assMatchingQuestion, assOrderingHorizontal, assOrderingQuestion, assSingleChoice, assTextQuestion, and assTextSubset.

Referenced by persistWorkingState().

+ Here is the caller graph for this function:

◆ setAdditionalContentEditingMode()

assQuestion::setAdditionalContentEditingMode (   $additinalContentEditingMode)

setter for additional content editing mode for this question

@access public

Returns
string

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

4575 {
4577 require_once 'Modules/TestQuestionPool/exceptions/class.ilTestQuestionPoolException.php';
4578 throw new ilTestQuestionPoolException('invalid additional content editing mode given: ' . $additinalContentEditingMode);
4579 }
4580
4581 $this->additinalContentEditingMode = $additinalContentEditingMode;
4582 }

References $additinalContentEditingMode, and getValidAdditionalContentEditingModes().

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

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

◆ setAuthor()

assQuestion::setAuthor (   $author = "")

Sets the authors name of the assQuestion object.

Parameters
string$authorA string containing the name of the questions author @access public
See also
$author

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

724 {
725 if (!$author) {
726 $author = $this->ilias->account->fullname;
727 }
728 $this->author = $author;
729 }

References $author.

Referenced by __set(), assClozeTest\loadFromDb(), assErrorText\loadFromDb(), assFileUpload\loadFromDb(), assFlashQuestion\loadFromDb(), assFormulaQuestion\loadFromDb(), assImagemapQuestion\loadFromDb(), assJavaApplet\loadFromDb(), assLongMenu\loadFromDb(), assMatchingQuestion\loadFromDb(), assMultipleChoice\loadFromDb(), assOrderingHorizontal\loadFromDb(), assOrderingQuestion\loadFromDb(), assSingleChoice\loadFromDb(), assTextQuestion\loadFromDb(), assTextSubset\loadFromDb(), and assKprimChoice\loadFromDb().

+ Here is the caller graph for this function:

◆ setComment()

assQuestion::setComment (   $comment = "")

◆ setDefaultNrOfTries()

assQuestion::setDefaultNrOfTries (   $a_defaultnroftries)

Set Default Nr of Tries.

Parameters
int$a_defaultnroftriesDefault Nr. of Tries

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

4370 {
4371 $this->defaultnroftries = $a_defaultnroftries;
4372 }

◆ setEstimatedWorkingTime()

assQuestion::setEstimatedWorkingTime (   $hour = 0,
  $min = 0,
  $sec = 0 
)

Sets the estimated working time of a question from given hour, minute and second.

Parameters
integer$hourHour
integer$minMinutes
integer$secSeconds @access public
See also
$comment

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

678 {
679 $this->est_working_time = array("h" => (int) $hour, "m" => (int) $min, "s" => (int) $sec);
680 }

Referenced by __construct(), __set(), assClozeTest\loadFromDb(), assErrorText\loadFromDb(), assFileUpload\loadFromDb(), assFlashQuestion\loadFromDb(), assFormulaQuestion\loadFromDb(), assImagemapQuestion\loadFromDb(), assJavaApplet\loadFromDb(), assLongMenu\loadFromDb(), assMatchingQuestion\loadFromDb(), assMultipleChoice\loadFromDb(), assOrderingHorizontal\loadFromDb(), assOrderingQuestion\loadFromDb(), assSingleChoice\loadFromDb(), assTextQuestion\loadFromDb(), and assTextSubset\loadFromDb().

+ Here is the caller graph for this function:

◆ setEstimatedWorkingTimeFromDurationString()

assQuestion::setEstimatedWorkingTimeFromDurationString (   $durationString)

Sets the estimated working time of a question from a given datetime string.

Parameters
string$datetime

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

689 {
690 $this->est_working_time = array(
691 'h' => (int) substr($durationString, 0, 2),
692 'm' => (int) substr($durationString, 3, 2),
693 's' => (int) substr($durationString, 6, 2)
694 );
695 }

Referenced by assKprimChoice\loadFromDb().

+ Here is the caller graph for this function:

◆ setExportDetailsXLS()

assQuestion::setExportDetailsXLS (   $worksheet,
  $startrow,
  $active_id,
  $pass 
)

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

Parameters
object$worksheetReference to the parent excel worksheet
object$startrowStartrow of the output in the excel worksheet
object$active_idActive id of the participant
object$passTest pass
Returns
object

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

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

4108 {
4109 $worksheet->setFormattedExcelTitle($worksheet->getColumnCoord(0) . $startrow, $this->lng->txt($this->getQuestionType()));
4110 $worksheet->setFormattedExcelTitle($worksheet->getColumnCoord(1) . $startrow, $this->getTitle());
4111
4112 return $startrow;
4113 }

◆ setExportImagePath()

assQuestion::setExportImagePath (   $a_path)

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

4249 {
4250 $this->export_image_path = (string) $a_path;
4251 }

◆ setExternalId()

assQuestion::setExternalId (   $external_id)
Parameters
string$external_id

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

914 {
915 $this->external_id = $external_id;
916 }

References $external_id.

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setForcePassResultUpdateEnabled()

static assQuestion::setForcePassResultUpdateEnabled (   $forcePassResultsUpdateEnabled)
static

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

337 {
338 self::$forcePassResultsUpdateEnabled = $forcePassResultsUpdateEnabled;
339 }

References $forcePassResultsUpdateEnabled.

◆ setId()

◆ setLastChange()

assQuestion::setLastChange (   $lastChange)

Reimplemented in assMultipleChoice.

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

4693 {
4694 $this->lastChange = $lastChange;
4695 }

References $lastChange.

Referenced by assKprimChoice\loadFromDb().

+ Here is the caller graph for this function:

◆ setNewOriginalId()

assQuestion::setNewOriginalId (   $newId)
Deprecated:

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

2650 {
2651 self::saveOriginalId($this->getId(), $newId);
2652 }
static saveOriginalId($questionId, $originalId)

References getId(), and saveOriginalId().

+ Here is the call graph for this function:

◆ setNrOfTries()

◆ setObjId()

◆ setObligationsToBeConsidered()

assQuestion::setObligationsToBeConsidered (   $obligationsToBeConsidered)
Parameters
boolean$obligationsToBeConsidered

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

5406 {
5407 $this->obligationsToBeConsidered = $obligationsToBeConsidered;
5408 }

References $obligationsToBeConsidered.

◆ setOriginalId()

◆ setOutputType()

assQuestion::setOutputType (   $outputType = OUTPUT_HTML)

Sets the output type.

Parameters
integer$outputTypeThe output type of the question @access public
See also
$outputType

Reimplemented in assMultipleChoice, and assSingleChoice.

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

646 {
647 $this->outputType = $outputType;
648 }

References $outputType.

Referenced by __set().

+ Here is the caller graph for this function:

◆ setOwner()

assQuestion::setOwner (   $owner = "")

◆ setPoints()

◆ setPreventRteUsage()

assQuestion::setPreventRteUsage (   $a_val)

Set prevent rte usage.

Parameters
booleanprevent rte usage

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

4302 {
4303 $this->prevent_rte_usage = $a_val;
4304 }

◆ setProcessLocker()

assQuestion::setProcessLocker (   $processLocker)
Parameters
\ilAssQuestionProcessLocker$processLocker

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

514 {
515 $this->processLocker = $processLocker;
516 }

References $processLocker.

◆ setQuestion()

◆ setResultGateway()

static assQuestion::setResultGateway (   $resultGateway)
static
Parameters
\ilObjTestGateway$resultGateway

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

5055 {
5056 self::$resultGateway = $resultGateway;
5057 }

References $resultGateway.

◆ setSelfAssessmentEditingMode()

assQuestion::setSelfAssessmentEditingMode (   $a_selfassessmenteditingmode)

Set Self-Assessment Editing Mode.

Parameters
boolean$a_selfassessmenteditingmodeSelf-Assessment Editing Mode

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

4350 {
4351 $this->selfassessmenteditingmode = $a_selfassessmenteditingmode;
4352 }

◆ setShuffle()

assQuestion::setShuffle (   $shuffle = true)

Sets the shuffle flag.

Parameters
boolean$shuffleA flag indicating whether the answers are shuffled or not @access public
See also
$shuffle

Reimplemented in assMatchingQuestion.

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

659 {
660 if ($shuffle) {
661 $this->shuffle = 1;
662 } else {
663 $this->shuffle = 0;
664 }
665 }

References $shuffle.

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

+ Here is the caller graph for this function:

◆ setShuffler()

assQuestion::setShuffler ( ilArrayElementShuffler  $shuffler)
Parameters
ilArrayElementShuffler$shuffler

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

506 {
507 $this->shuffler = $shuffler;
508 }

References $shuffler.

Referenced by assMatchingQuestion\toJSON().

+ Here is the caller graph for this function:

◆ setStep()

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

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

5071 {
5072 $this->step = $step;
5073 }

References $step.

◆ setSuggestedSolution()

assQuestion::setSuggestedSolution (   $solution_id = "",
  $subquestion_index = 0,
  $is_import = false 
)

Sets a suggested solution for the question.

If there is more than one subquestion (i.e. close questions) may enter a subquestion index.

Parameters
string$solution_idAn internal link pointing to the suggested solution
integer$subquestion_indexThe index of a subquestion (i.e. a close test gap). Usually 0
boolean$is_importA boolean indication that the internal link was imported from another ILIAS installation @access public

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

2785 {
2786 if (strcmp($solution_id, "") != 0) {
2787 $import_id = "";
2788 if ($is_import) {
2789 $import_id = $solution_id;
2790 $solution_id = $this->_resolveInternalLink($import_id);
2791 }
2792 $this->suggested_solutions[$subquestion_index] = array(
2793 "internal_link" => $solution_id,
2794 "import_id" => $import_id
2795 );
2796 }
2797 }

References _resolveInternalLink().

Referenced by assFileUpload\loadFromDb(), assFlashQuestion\loadFromDb(), and assFormulaQuestion\loadFromDb().

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

◆ setTestId()

assQuestion::setTestId (   $id = -1)

Sets the test id of the assQuestion object.

Parameters
integer$idA unique integer value @access public
See also
$test_id

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

622 {
623 $this->test_id = $id;
624 }

References $id.

Referenced by __set().

+ Here is the caller graph for this function:

◆ setTitle()

◆ sumTimesInISO8601FormatH_i_s_Extended()

static assQuestion::sumTimesInISO8601FormatH_i_s_Extended (   $time1,
  $time2 
)
static
Parameters
$time1
$time2
Returns
string

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

5089 {
5092 return gmdate('H:i:s', $time);
5093 }
static convertISO8601FormatH_i_s_ExtendedToSeconds($time)

References $time, and convertISO8601FormatH_i_s_ExtendedToSeconds().

Referenced by ilQuestionBrowserTableGUI\fillRow(), and ilObjTest\getFixedQuestionSetTotalWorkingTime().

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

◆ supportsJavascriptOutput()

assQuestion::supportsJavascriptOutput ( )

Returns true if the question type supports JavaScript output.

Returns
boolean TRUE if the question type supports JavaScript output, FALSE otherwise @access public

Reimplemented in assMatchingQuestion, assOrderingHorizontal, and assOrderingQuestion.

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

833 {
834 return false;
835 }

Referenced by requiresJsSwitch().

+ Here is the caller graph for this function:

◆ supportsNonJsOutput()

assQuestion::supportsNonJsOutput ( )

Reimplemented in assMatchingQuestion, assOrderingHorizontal, and assOrderingQuestion.

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

838 {
839 return true;
840 }

Referenced by requiresJsSwitch().

+ Here is the caller graph for this function:

◆ syncSkillAssignments()

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

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

4461 {
4462 global $DIC;
4463 $ilDB = $DIC['ilDB'];
4464
4465 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentList.php';
4466 $assignmentList = new ilAssQuestionSkillAssignmentList($ilDB);
4467 $assignmentList->setParentObjId($trgParentId);
4468 $assignmentList->setQuestionIdFilter($trgQuestionId);
4469 $assignmentList->loadFromDb();
4470
4471 foreach ($assignmentList->getAssignmentsByQuestionId($trgQuestionId) as $assignment) {
4472 /* @var ilAssQuestionSkillAssignment $assignment */
4473
4474 $assignment->deleteFromDb();
4475 }
4476
4477 $this->duplicateSkillAssignments($srcParentId, $srcQuestionId, $trgParentId, $trgQuestionId);
4478 }

References $DIC, $ilDB, and duplicateSkillAssignments().

+ Here is the call graph for this function:

◆ syncSuggestedSolutionFiles()

assQuestion::syncSuggestedSolutionFiles (   $original_id)
protected

Syncs the files of a suggested solution if the question is synced.

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

2833 {
2834 global $DIC;
2835 $ilLog = $DIC['ilLog'];
2836
2837 $filepath = $this->getSuggestedSolutionPath();
2838 $filepath_original = str_replace("/$this->id/solution", "/$original_id/solution", $filepath);
2839 ilUtil::delDir($filepath_original);
2840 foreach ($this->suggested_solutions as $index => $solution) {
2841 if (strcmp($solution["type"], "file") == 0) {
2842 if (!file_exists($filepath_original)) {
2843 ilUtil::makeDirParents($filepath_original);
2844 }
2845 $filename = $solution["value"]["name"];
2846 if (strlen($filename)) {
2847 if (!@copy($filepath . $filename, $filepath_original . $filename)) {
2848 $ilLog->write("File could not be duplicated!!!!", $ilLog->ERROR);
2849 $ilLog->write("object: " . print_r($this, true), $ilLog->ERROR);
2850 }
2851 }
2852 }
2853 }
2854 }

References $DIC, $filename, $ilLog, $index, ilUtil\delDir(), getSuggestedSolutionPath(), and ilUtil\makeDirParents().

+ Here is the call graph for this function:

◆ syncWithOriginal()

assQuestion::syncWithOriginal ( )

Reimplemented in assImagemapQuestion, and assMultipleChoice.

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

3135 {
3136 global $DIC;
3137 $ilDB = $DIC['ilDB'];
3138
3139 if (!$this->getOriginalId()) {
3140 return;
3141 }
3142
3143 $originalObjId = self::lookupOriginalParentObjId($this->getOriginalId());
3144
3145 if (!$originalObjId) {
3146 return;
3147 }
3148
3149 $id = $this->getId();
3150 $objId = $this->getObjId();
3151 $original = $this->getOriginalId();
3152
3153 $this->beforeSyncWithOriginal($original, $id, $originalObjId, $objId);
3154
3155 $this->setId($original);
3156 $this->setOriginalId(null);
3157 $this->setObjId($originalObjId);
3158
3159 $this->saveToDb();
3160
3161 $this->deletePageOfQuestion($original);
3162 $this->createPageObject();
3163 $this->copyPageOfQuestion($id);
3164
3165 $this->setId($id);
3166 $this->setOriginalId($original);
3167 $this->setObjId($objId);
3168
3169 $this->updateSuggestedSolutions($original);
3171
3172 $this->afterSyncWithOriginal($original, $id, $originalObjId, $objId);
3173 $this->syncHints();
3174 }
beforeSyncWithOriginal($origQuestionId, $dupQuestionId, $origParentObjId, $dupParentObjId)
copyPageOfQuestion($a_q_id)
static lookupOriginalParentObjId($originalQuestionId)
returns the parent object id for given original question id (should be a qpl id, but theoretically it...
afterSyncWithOriginal($origQuestionId, $dupQuestionId, $origParentObjId, $dupParentObjId)

References $DIC, $id, $ilDB, afterSyncWithOriginal(), beforeSyncWithOriginal(), copyPageOfQuestion(), createPageObject(), deletePageOfQuestion(), getId(), getObjId(), getOriginalId(), lookupOriginalParentObjId(), saveToDb(), setId(), setObjId(), setOriginalId(), and syncXHTMLMediaObjectsOfQuestion().

+ Here is the call graph for this function:

◆ syncXHTMLMediaObjectsOfQuestion()

assQuestion::syncXHTMLMediaObjectsOfQuestion ( )

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

2297 {
2298 include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
2299 $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $this->getId());
2300 foreach ($mobs as $mob) {
2301 ilObjMediaObject::_saveUsage($mob, "qpl:html", $this->original_id);
2302 }
2303 }

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

Referenced by syncWithOriginal().

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

◆ toJSON()

assQuestion::toJSON ( )

◆ toXML()

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

Returns a QTI xml representation of the question.

Returns
string The QTI xml representation of the question @access public

Reimplemented in assErrorText, assFileUpload, assFlashQuestion, and assOrderingHorizontal.

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

552 {
553 include_once "./Modules/TestQuestionPool/classes/export/qti12/class." . $this->getQuestionType() . "Export.php";
554 $classname = $this->getQuestionType() . "Export";
555 $export = new $classname($this);
556 return $export->toXML($a_include_header, $a_include_binary, $a_shuffle, $test_output, $force_image_references);
557 }

References getQuestionType().

+ Here is the call graph for this function:

◆ updateCurrentSolution()

assQuestion::updateCurrentSolution (   $solutionId,
  $value1,
  $value2,
  $authorized = true 
)
Parameters
int$active_id
int$pass
mixed$value1
mixed$value2
bool | true$authorized@global ilDBInterface $ilDB
Returns
int

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

4902 {
4903 global $DIC;
4904 $ilDB = $DIC['ilDB'];
4905
4906 $fieldData = array(
4907 "value1" => array("clob", $value1),
4908 "value2" => array("clob", $value2),
4909 "tstamp" => array("integer", time()),
4910 'authorized' => array('integer', (int) $authorized)
4911 );
4912
4913 if ($this->getStep() !== null) {
4914 $fieldData['step'] = array("integer", $this->getStep());
4915 }
4916
4917 return $ilDB->update("tst_solutions", $fieldData, array(
4918 'solution_id' => array('integer', $solutionId)
4919 ));
4920 }

References $DIC, $ilDB, and getStep().

Referenced by assSingleChoice\saveWorkingData().

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

◆ updateCurrentSolutionsAuthorization()

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

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

4924 {
4925 global $DIC;
4926 $ilDB = $DIC['ilDB'];
4927
4928 $fieldData = array(
4929 'authorized' => array('integer', (int) $authorized)
4930 );
4931
4932 if (!$keepTime) {
4933 $fieldData['tstamp'] = array('integer', time());
4934 }
4935
4936 $whereData = array(
4937 'question_fi' => array('integer', $this->getId()),
4938 'active_fi' => array('integer', $activeId),
4939 'pass' => array('integer', $pass)
4940 );
4941
4942 if ($this->getStep() !== null) {
4943 $whereData['step'] = array("integer", $this->getStep());
4944 }
4945
4946 return $ilDB->update('tst_solutions', $fieldData, $whereData);
4947 }

References $DIC, $ilDB, $pass, getId(), and getStep().

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

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

◆ updateTimestamp()

assQuestion::updateTimestamp ( )

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

5411 {
5412 global $DIC;
5413 $ilDB = $DIC['ilDB'];
5414
5415 $ilDB->manipulateF(
5416 "UPDATE qpl_questions SET tstamp = %s WHERE question_id = %s",
5417 array('integer', 'integer'),
5418 array(time(), $this->getId())
5419 );
5420 }

References $DIC, $ilDB, and getId().

+ Here is the call graph for this function:

◆ validateSolutionSubmit()

assQuestion::validateSolutionSubmit ( )

Reimplemented in assClozeTest, assFormulaQuestion, assMultipleChoice, assNumeric, and assOrderingQuestion.

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

1337 {
1338 return true;
1339 }

Referenced by persistPreviewState(), and persistWorkingState().

+ Here is the caller graph for this function:

Field Documentation

◆ $additinalContentEditingMode

assQuestion::$additinalContentEditingMode = null
private

◆ $allowedCharsetsByMimeType

assQuestion::$allowedCharsetsByMimeType
staticprotected
Initial value:
= array(
self::IMG_MIME_TYPE_JPG => array('binary'),
self::IMG_MIME_TYPE_PNG => array('binary'),
self::IMG_MIME_TYPE_GIF => array('binary')
)

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

◆ $allowedFileExtensionsByMimeType

assQuestion::$allowedFileExtensionsByMimeType
staticprotected
Initial value:
= array(
self::IMG_MIME_TYPE_JPG => array('jpg', 'jpeg'),
self::IMG_MIME_TYPE_PNG => array('png'),
self::IMG_MIME_TYPE_GIF => array('gif')
)

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

◆ $allowedImageMaterialFileExtensionsByMimeType

assQuestion::$allowedImageMaterialFileExtensionsByMimeType
staticprotected
Initial value:
= array(
'image/jpeg' => array('jpg', 'jpeg'), 'image/png' => array('png'), 'image/gif' => array('gif')
)

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

◆ $arrData

assQuestion::$arrData
private

Associative array to store properties.

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

◆ $author

◆ $comment

◆ $db

assQuestion::$db
protected

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

◆ $defaultnroftries

assQuestion::$defaultnroftries = 0

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

Referenced by getDefaultNrOfTries().

◆ $est_working_time

assQuestion::$est_working_time
protected

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

Referenced by getEstimatedWorkingTime().

◆ $export_image_path

assQuestion::$export_image_path
private

(Web) Path to images

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

Referenced by getImagePathWeb().

◆ $external_id

assQuestion::$external_id = ''
protected

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

Referenced by getExternalId(), and setExternalId().

◆ $feedbackOBJ

assQuestion::$feedbackOBJ = null

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

◆ $forcePassResultsUpdateEnabled

assQuestion::$forcePassResultsUpdateEnabled = false
staticprotected

◆ $id

◆ $ilias

assQuestion::$ilias
protected

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

Referenced by __construct(), and __get().

◆ $imageSourceFixReplaceMap

assQuestion::$imageSourceFixReplaceMap
staticprotected
Initial value:
= array(
'ok.svg' => 'ok.png', 'not_ok.svg' => 'not_ok.png',
'checkbox_checked.svg' => 'checkbox_checked.png',
'checkbox_unchecked.svg' => 'checkbox_unchecked.png',
'radiobutton_checked.svg' => 'radiobutton_checked.png',
'radiobutton_unchecked.svg' => 'radiobutton_unchecked.png'
)

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

◆ $lastChange

assQuestion::$lastChange
protected

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

Referenced by getLastChange(), and setLastChange().

◆ $lng

◆ $nr_of_tries

assQuestion::$nr_of_tries
private

Number of tries.

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

Referenced by getNrOfTries().

◆ $obj_id

assQuestion::$obj_id
protected

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

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

◆ $obligationsToBeConsidered

assQuestion::$obligationsToBeConsidered = false
private

◆ $original_id

assQuestion::$original_id
protected

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

Referenced by assClozeTest\copyObject(), assErrorText\copyObject(), assFileUpload\copyObject(), assFlashQuestion\copyObject(), assFormulaQuestion\copyObject(), assImagemapQuestion\copyObject(), assJavaApplet\copyObject(), assKprimChoice\copyObject(), assLongMenu\copyObject(), assMatchingQuestion\copyObject(), assMultipleChoice\copyObject(), assNumeric\copyObject(), assOrderingHorizontal\copyObject(), assOrderingQuestion\copyObject(), assSingleChoice\copyObject(), assTextQuestion\copyObject(), assTextSubset\copyObject(), assLongMenu\delete(), assClozeTest\duplicate(), assErrorText\duplicate(), assFileUpload\duplicate(), assFlashQuestion\duplicate(), assFormulaQuestion\duplicate(), assImagemapQuestion\duplicate(), assJavaApplet\duplicate(), assKprimChoice\duplicate(), assLongMenu\duplicate(), assMatchingQuestion\duplicate(), assMultipleChoice\duplicate(), assNumeric\duplicate(), assOrderingHorizontal\duplicate(), assOrderingQuestion\duplicate(), assSingleChoice\duplicate(), assTextQuestion\duplicate(), assTextSubset\duplicate(), assTextQuestion\duplicateAnswers(), getOriginalId(), logAction(), saveQuestionDataToDb(), assClozeTest\saveToDb(), assErrorText\saveToDb(), assFileUpload\saveToDb(), assFlashQuestion\saveToDb(), assFormulaQuestion\saveToDb(), assImagemapQuestion\saveToDb(), assJavaApplet\saveToDb(), assLongMenu\saveToDb(), assMatchingQuestion\saveToDb(), assMultipleChoice\saveToDb(), assNumeric\saveToDb(), assOrderingHorizontal\saveToDb(), assOrderingQuestion\saveToDb(), assTextQuestion\saveToDb(), assTextSubset\saveToDb(), and setOriginalId().

◆ $outputType

assQuestion::$outputType = OUTPUT_JAVASCRIPT
protected

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

Referenced by getOutputType(), and setOutputType().

◆ $owner

◆ $page

assQuestion::$page
protected

◆ $points

assQuestion::$points
protected

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

Referenced by _getMaximumPoints(), _getReachedPoints(), _isWorkedThrough(), _setReachedPoints(), assSingleChoice\addAnswer(), assImagemapQuestion\addAnswer(), assMultipleChoice\addAnswer(), assTextQuestion\addAnswer(), assTextSubset\addAnswer(), assClozeTest\addAnswerOptionValue(), assErrorText\addErrorData(), assMatchingQuestion\addMatchingPair(), adjustReachedPointsByScoringOptions(), assClozeTest\calculateCombinationResult(), assErrorText\calculateReachedPoints(), assFlashQuestion\calculateReachedPoints(), assFormulaQuestion\calculateReachedPoints(), assImagemapQuestion\calculateReachedPoints(), assJavaApplet\calculateReachedPoints(), assKprimChoice\calculateReachedPoints(), assLongMenu\calculateReachedPoints(), assMatchingQuestion\calculateReachedPoints(), assMultipleChoice\calculateReachedPoints(), assOrderingHorizontal\calculateReachedPoints(), assSingleChoice\calculateReachedPoints(), assTextQuestion\calculateReachedPoints(), assTextSubset\calculateReachedPoints(), assTextSubset\calculateReachedPointsForSolution(), assImagemapQuestion\calculateReachedPointsForSolution(), assMatchingQuestion\calculateReachedPointsForSolution(), assKprimChoice\calculateReachedPointsForSolution(), assLongMenu\calculateReachedPointsForSolution(), assMultipleChoice\calculateReachedPointsForSolution(), assTextQuestion\calculateReachedPointsForSolution(), assClozeTest\calculateReachedPointsForSolution(), assOrderingHorizontal\calculateReachedPointsForSolution(), assFlashQuestion\calculateReachedPointsFromPreviewSession(), assFormulaQuestion\calculateReachedPointsFromPreviewSession(), assJavaApplet\calculateReachedPointsFromPreviewSession(), assNumeric\calculateReachedPointsFromPreviewSession(), assSingleChoice\calculateReachedPointsFromPreviewSession(), assLongMenu\checkQuestionCustomPart(), ensureNonNegativePoints(), assErrorText\getBestSelection(), assClozeTest\getMaximumGapPoints(), assClozeTest\getMaximumPoints(), assFlashQuestion\getMaximumPoints(), assFormulaQuestion\getMaximumPoints(), assImagemapQuestion\getMaximumPoints(), assLongMenu\getMaximumPoints(), assMatchingQuestion\getMaximumPoints(), assMultipleChoice\getMaximumPoints(), getMaximumPoints(), assSingleChoice\getMaximumPoints(), assTextQuestion\getMaximumPoints(), assTextSubset\getMaximumPoints(), assTextQuestion\getMinimumPoints(), getPoints(), assLongMenu\getPointsForGap(), assErrorText\getPointsForSelectedPositions(), assJavaApplet\getUserQuestionResult(), assLongMenu\getUserQuestionResult(), assFileUpload\handleSubmission(), assMatchingQuestion\insertMatchingPair(), assLongMenu\saveAnswerSpecificDataToDb(), assErrorText\setErrorData(), assClozeTest\setGapAnswerPoints(), and assTextQuestion\setReachedPoints().

◆ $prevent_rte_usage

assQuestion::$prevent_rte_usage = false

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

Referenced by getPreventRteUsage().

◆ $processLocker

assQuestion::$processLocker
protected

◆ $question

◆ $questionActionCmd

assQuestion::$questionActionCmd = 'handleQuestionAction'

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

◆ $questionChangeListeners

assQuestion::$questionChangeListeners = array()
protected

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

Referenced by getQuestionChangeListeners().

◆ $resultGateway

assQuestion::$resultGateway = null
staticprivate

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

Referenced by getResultGateway(), and setResultGateway().

◆ $selfassessmenteditingmode

assQuestion::$selfassessmenteditingmode = false

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

Referenced by getSelfAssessmentEditingMode().

◆ $shuffle

◆ $shuffler

assQuestion::$shuffler
protected

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

Referenced by getShuffler(), and setShuffler().

◆ $step

assQuestion::$step = null
protected

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

Referenced by getStep(), and setStep().

◆ $suggested_solutions

assQuestion::$suggested_solutions
protected

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

Referenced by getSuggestedSolutions().

◆ $test_id

◆ $testQuestionConfig

assQuestion::$testQuestionConfig
protected

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

◆ $testQuestionConfigInstance

assQuestion::$testQuestionConfigInstance = null
private

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

Referenced by getTestPresentationConfig().

◆ $title

assQuestion::$title
protected

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

Referenced by assClozeTest\__construct(), assFileUpload\__construct(), assFlashQuestion\__construct(), assFormulaQuestion\__construct(), assLongMenu\__construct(), assNumeric\__construct(), assOrderingHorizontal\__construct(), __construct(), assTextQuestion\__construct(), assTextSubset\__construct(), assImagemapQuestion\__construct(), assJavaApplet\__construct(), assMatchingQuestion\__construct(), assOrderingQuestion\__construct(), assMultipleChoice\__construct(), assSingleChoice\__construct(), assErrorText\__construct(), assKprimChoice\__construct(), assClozeTest\copyObject(), assErrorText\copyObject(), assFileUpload\copyObject(), assFlashQuestion\copyObject(), assFormulaQuestion\copyObject(), assImagemapQuestion\copyObject(), assJavaApplet\copyObject(), assKprimChoice\copyObject(), assLongMenu\copyObject(), assMatchingQuestion\copyObject(), assMultipleChoice\copyObject(), assNumeric\copyObject(), assOrderingHorizontal\copyObject(), assOrderingQuestion\copyObject(), assSingleChoice\copyObject(), assTextQuestion\copyObject(), assTextSubset\copyObject(), assClozeTest\duplicate(), assErrorText\duplicate(), assFileUpload\duplicate(), assFlashQuestion\duplicate(), assFormulaQuestion\duplicate(), assImagemapQuestion\duplicate(), assJavaApplet\duplicate(), assKprimChoice\duplicate(), assLongMenu\duplicate(), assMatchingQuestion\duplicate(), assMultipleChoice\duplicate(), assNumeric\duplicate(), assOrderingHorizontal\duplicate(), assOrderingQuestion\duplicate(), assSingleChoice\duplicate(), assTextQuestion\duplicate(), assTextSubset\duplicate(), getSuggestedSolutionTitle(), getTitle(), questionTitleExists(), and setTitle().

◆ $tpl

assQuestion::$tpl
protected

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

Referenced by __construct(), and __get().

◆ ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT

◆ ADDITIONAL_CONTENT_EDITING_MODE_PAGE_OBJECT

const assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_PAGE_OBJECT = 'pageobject'

◆ IMG_MIME_TYPE_GIF

const assQuestion::IMG_MIME_TYPE_GIF = 'image/gif'

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

◆ IMG_MIME_TYPE_JPG

const assQuestion::IMG_MIME_TYPE_JPG = 'image/jpeg'

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

◆ IMG_MIME_TYPE_PNG

const assQuestion::IMG_MIME_TYPE_PNG = 'image/png'

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

◆ KEY_VALUES_IMPLOSION_SEPARATOR

const assQuestion::KEY_VALUES_IMPLOSION_SEPARATOR = ':'

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

Referenced by getKeyValuesImplosionSeparator().


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