ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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)
 
 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...
 

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)
 
 reworkWorkingData ($active_id, $pass, $obligationsAnswered, $authorized)
 Reworks the allready saved working data if neccessary. More...
 
 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)
 
 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 $ilias, $lng, $tpl, $ilDB;
294
295 $this->ilias = $ilias;
296 $this->lng = $lng;
297 $this->tpl = $tpl;
298 $this->db = $ilDB;
299
300 $this->original_id = null;
301 $this->title = $title;
302 $this->comment = $comment;
303 $this->page = null;
304 $this->author = $author;
305 $this->setQuestion($question);
306 if (!$this->author) {
307 $this->author = $this->ilias->account->fullname;
308 }
309 $this->owner = $owner;
310 if ($this->owner <= 0) {
311 $this->owner = $this->ilias->account->id;
312 }
313 $this->id = -1;
314 $this->test_id = -1;
315 $this->suggested_solutions = array();
316 $this->shuffle = 1;
317 $this->nr_of_tries = 0;
318 $this->setEstimatedWorkingTime(0, 1, 0);
319 $this->arrData = array();
320 $this->setExternalId('');
321
322 $this->questionActionCmd = 'handleQuestionAction';
323
324 $this->lastChange = null;
325
326 require_once 'Services/Randomization/classes/class.ilArrayElementOrderKeeper.php';
327 $this->shuffler = new ilArrayElementOrderKeeper();
328 }
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 $ilDB

References $author, $comment, $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 4049 of file class.assQuestion.php.

4050 {
4051 switch ($value) {
4052 case "id":
4053 return $this->getId();
4054 break;
4055 case "title":
4056 return $this->getTitle();
4057 break;
4058 case "comment":
4059 return $this->getComment();
4060 break;
4061 case "owner":
4062 return $this->getOwner();
4063 break;
4064 case "author":
4065 return $this->getAuthor();
4066 break;
4067 case "question":
4068 return $this->getQuestion();
4069 break;
4070 case "points":
4071 return $this->getPoints();
4072 break;
4073 case "est_working_time":
4074 return $this->getEstimatedWorkingTime();
4075 break;
4076 case "shuffle":
4077 return $this->getShuffle();
4078 break;
4079 case "test_id":
4080 return $this->getTestId();
4081 break;
4082 case "obj_id":
4083 return $this->getObjId();
4084 break;
4085 case "ilias":
4086 return $this->ilias;
4087 break;
4088 case "tpl":
4089 return $this->tpl;
4090 break;
4091 case "page":
4092 return $this->page;
4093 break;
4094 case "outputType":
4095 return $this->getOutputType();
4096 break;
4097 case "suggested_solutions":
4098 return $this->getSuggestedSolutions();
4099 break;
4100 case "original_id":
4101 return $this->getOriginalId();
4102 break;
4103 default:
4104 if (array_key_exists($value, $this->arrData)) {
4105 return $this->arrData[$value];
4106 } else {
4107 return null;
4108 }
4109 break;
4110 }
4111 }
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 4116 of file class.assQuestion.php.

4117 {
4118 switch ($key) {
4119 case "id":
4120 $this->setId($value);
4121 break;
4122 case "title":
4123 $this->setTitle($value);
4124 break;
4125 case "comment":
4126 $this->setComment($value);
4127 break;
4128 case "owner":
4129 $this->setOwner($value);
4130 break;
4131 case "author":
4132 $this->setAuthor($value);
4133 break;
4134 case "question":
4135 $this->setQuestion($value);
4136 break;
4137 case "points":
4138 $this->setPoints($value);
4139 break;
4140 case "est_working_time":
4141 if (is_array($value)) {
4142 $this->setEstimatedWorkingTime($value["h"], $value["m"], $value["s"]);
4143 }
4144 break;
4145 case "shuffle":
4146 $this->setShuffle($value);
4147 break;
4148 case "test_id":
4149 $this->setTestId($value);
4150 break;
4151 case "obj_id":
4152 $this->setObjId($value);
4153 break;
4154 case "outputType":
4155 $this->setOutputType($value);
4156 break;
4157 case "original_id":
4158 $this->setOriginalId($value);
4159 break;
4160 case "page":
4161 $this->page =&$value;
4162 break;
4163 default:
4164 $this->arrData[$key] = $value;
4165 break;
4166 }
4167 }
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 3464 of file class.assQuestion.php.

3465 {
3466 global $ilDB;
3467
3468 $res = $ilDB->queryF(
3469 "SELECT DISTINCT(question_fi) FROM tst_test_result JOIN tst_active " .
3470 "ON (active_id = active_fi) " .
3471 "WHERE " . $ilDB->in('question_fi', $a_question_ids, false, 'integer') .
3472 " AND user_fi = %s",
3473 array('integer'),
3474 array($a_user_id)
3475 );
3476 return ($res->numRows() == count($a_question_ids)) ? true : false;
3477 }
foreach($_POST as $key=> $value) $res

References $ilDB, and $res.

Referenced by ilCourseObjectiveResult\getStatus().

+ Here is the caller graph for this function:

◆ _getInternalLinkHref()

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

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

3013 {
3014 global $ilDB;
3015 $linktypes = array(
3016 "lm" => "LearningModule",
3017 "pg" => "PageObject",
3018 "st" => "StructureObject",
3019 "git" => "GlossaryItem",
3020 "mob" => "MediaObject"
3021 );
3022 $href = "";
3023 if (preg_match("/il__(\w+)_(\d+)/", $target, $matches)) {
3024 $type = $matches[1];
3025 $target_id = $matches[2];
3026 include_once "./Services/Utilities/classes/class.ilUtil.php";
3027 switch ($linktypes[$matches[1]]) {
3028 case "LearningModule":
3029 $href = "./goto.php?target=" . $type . "_" . $target_id;
3030 break;
3031 case "PageObject":
3032 case "StructureObject":
3033 $href = "./goto.php?target=" . $type . "_" . $target_id;
3034 break;
3035 case "GlossaryItem":
3036 $href = "./goto.php?target=" . $type . "_" . $target_id;
3037 break;
3038 case "MediaObject":
3039 $href = "./ilias.php?baseClass=ilLMPresentationGUI&obj_type=" . $linktypes[$type] . "&cmd=media&ref_id=" . $_GET["ref_id"] . "&mob_id=" . $target_id;
3040 break;
3041 }
3042 }
3043 return $href;
3044 }
$_GET["client_id"]
$target_id
Definition: goto.php:49
$type

References $_GET, $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 934 of file class.assQuestion.php.

935 {
936 global $ilDB;
937
938 $points = 0;
939 $result = $ilDB->queryF(
940 "SELECT points FROM qpl_questions WHERE question_id = %s",
941 array('integer'),
942 array($question_id)
943 );
944 if ($result->numRows() == 1) {
945 $row = $ilDB->fetchAssoc($result);
946 $points = $row["points"];
947 }
948 return $points;
949 }
$result

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

Referenced by _getTotalRightAnswers(), ilCourseObjectiveQuestion\_lookupMaximumPointsOfQuestion(), ilTestScoringGUI\buildManScoringParticipantForm(), assFileUpload\handleSubmission(), ilTestManScoringParticipantsBySelectedQuestionAndPassTableGUI\initFilter(), ilCourseObjectiveQuestionAssignmentTableGUI\parse(), 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 3053 of file class.assQuestion.php.

3054 {
3055 global $ilDB;
3056 $result = $ilDB->queryF(
3057 "SELECT * FROM qpl_questions WHERE question_id = %s",
3058 array('integer'),
3059 array($question_id)
3060 );
3061 if ($result->numRows() > 0) {
3062 $row = $ilDB->fetchAssoc($result);
3063 if ($row["original_id"] > 0) {
3064 return $row["original_id"];
3065 } else {
3066 return $row["question_id"];
3067 }
3068 } else {
3069 return "";
3070 }
3071 }

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

958 {
959 global $ilDB;
960
961 $result = $ilDB->queryF(
962 "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",
963 array('integer'),
964 array($question_id)
965 );
966 if ($result->numRows()) {
967 return $ilDB->fetchAssoc($result);
968 } else {
969 return array();
970 }
971 }

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

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

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

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

References $data, $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 2320 of file class.assQuestion.php.

2321 {
2322 global $ilDB;
2323
2324 if ($question_id < 1) {
2325 return "";
2326 }
2327 $result = $ilDB->queryF(
2328 "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",
2329 array('integer'),
2330 array($question_id)
2331 );
2332 if ($result->numRows() == 1) {
2333 $data = $ilDB->fetchAssoc($result);
2334 return $data["type_tag"];
2335 } else {
2336 return "";
2337 }
2338 }

References $data, $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 3957 of file class.assQuestion.php.

3958 {
3959 if (file_exists("./Modules/TestQuestionPool/classes/class." . $type_tag . ".php")) {
3960 global $lng;
3961 return $lng->txt($type_tag);
3962 } else {
3963 global $ilPluginAdmin;
3964 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_MODULE, "TestQuestionPool", "qst");
3965 foreach ($pl_names as $pl_name) {
3966 $pl = ilPlugin::getPluginObject(IL_COMP_MODULE, "TestQuestionPool", "qst", $pl_name);
3967 if (strcmp($pl->getQuestionType(), $type_tag) == 0) {
3968 return $pl->getQuestionTypeTranslation();
3969 }
3970 }
3971 }
3972 return "";
3973 }
const IL_COMP_MODULE
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get plugin object.

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

1085 {
1086 global $ilDB;
1087
1088 $points = 0;
1089 if (is_null($pass)) {
1090 include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
1091 $pass = assQuestion::_getSolutionMaxPass($question_id, $active_id);
1092 }
1093 $result = $ilDB->queryF(
1094 "SELECT * FROM tst_test_result WHERE active_fi = %s AND question_fi = %s AND pass = %s",
1095 array('integer','integer','integer'),
1096 array($active_id, $question_id, $pass)
1097 );
1098 if ($result->numRows() == 1) {
1099 $row = $ilDB->fetchAssoc($result);
1100 $points = $row["points"];
1101 }
1102 return $points;
1103 }
static _getSolutionMaxPass($question_id, $active_id)
Returns the maximum pass a users question solution.

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

Referenced by ilTestScoringGUI\buildManScoringParticipantForm(), 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 3271 of file class.assQuestion.php.

3272 {
3273 /* include_once "./Modules/Test/classes/class.ilObjTest.php";
3274 $pass = ilObjTest::_getPass($active_id);
3275 return $pass;*/
3276
3277 // the following code was the old solution which added the non answered
3278 // questions of a pass from the answered questions of the previous pass
3279 // with the above solution, only the answered questions of the last pass are counted
3280 global $ilDB;
3281
3282 $result = $ilDB->queryF(
3283 "SELECT MAX(pass) maxpass FROM tst_test_result WHERE active_fi = %s AND question_fi = %s",
3284 array('integer','integer'),
3285 array($active_id, $question_id)
3286 );
3287 if ($result->numRows() == 1) {
3288 $row = $ilDB->fetchAssoc($result);
3289 return $row["maxpass"];
3290 } else {
3291 return 0;
3292 }
3293 }

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

1048 {
1049 global $ilDB;
1050
1051 $result = $ilDB->queryF(
1052 "SELECT * FROM qpl_sol_sug WHERE question_fi = %s AND subquestion_index = %s",
1053 array('integer','integer'),
1054 array($question_id, $subquestion_index)
1055 );
1056 if ($result->numRows() == 1) {
1057 $row = $ilDB->fetchAssoc($result);
1058 return array(
1059 "internal_link" => $row["internal_link"],
1060 "import_id" => $row["import_id"]
1061 );
1062 } else {
1063 return array();
1064 }
1065 }

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

980 {
981 global $ilDB;
982
983 $result = $ilDB->queryF(
984 "SELECT suggested_solution_id FROM qpl_sol_sug WHERE question_fi = %s",
985 array('integer'),
986 array($question_id)
987 );
988 return $result->numRows();
989 }

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

998 {
1000 if (!is_object($question)) {
1001 return "";
1002 }
1003 return $question->getSuggestedSolutionOutput();
1004 }
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 2207 of file class.assQuestion.php.

2208 {
2209 global $ilDB;
2210 $result = $ilDB->queryF(
2211 "SELECT title FROM qpl_questions WHERE question_id = %s",
2212 array('integer'),
2213 array($a_q_id)
2214 );
2215 if ($result->numRows() == 1) {
2216 $row = $ilDB->fetchAssoc($result);
2217 return $row["title"];
2218 } else {
2219 return "";
2220 }
2221 }

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

2137 {
2138 global $ilDB;
2139
2140 // get all question references to the question id
2141 $result = $ilDB->queryF(
2142 "SELECT question_id FROM qpl_questions WHERE original_id = %s OR question_id = %s",
2143 array('integer','integer'),
2144 array($a_q_id, $a_q_id)
2145 );
2146 if ($result->numRows() == 0) {
2147 return 0;
2148 }
2149 $found_id = array();
2150 while ($row = $ilDB->fetchAssoc($result)) {
2151 array_push($found_id, $row["question_id"]);
2152 }
2153
2154 $result = $ilDB->query("SELECT * FROM tst_test_result WHERE " . $ilDB->in('question_fi', $found_id, false, 'integer'));
2155
2156 return $result->numRows();
2157 }

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

2167 {
2168 global $ilDB;
2169 $result = $ilDB->queryF(
2170 "SELECT question_id FROM qpl_questions WHERE original_id = %s OR question_id = %s",
2171 array('integer','integer'),
2172 array($a_q_id, $a_q_id)
2173 );
2174 if ($result->numRows() == 0) {
2175 return 0;
2176 }
2177 $found_id = array();
2178 while ($row = $ilDB->fetchAssoc($result)) {
2179 array_push($found_id, $row["question_id"]);
2180 }
2181 $result = $ilDB->query("SELECT * FROM tst_test_result WHERE " . $ilDB->in('question_fi', $found_id, false, 'integer'));
2182 $answers = array();
2183 while ($row = $ilDB->fetchAssoc($result)) {
2184 $reached = $row["points"];
2185 include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
2186 $max = assQuestion::_getMaximumPoints($row["question_fi"]);
2187 array_push($answers, array("reached" => $reached, "max" => $max));
2188 }
2189 $max = 0.0;
2190 $reached = 0.0;
2191 foreach ($answers as $key => $value) {
2192 $max += $value["max"];
2193 $reached += $value["reached"];
2194 }
2195 if ($max > 0) {
2196 return $reached / $max;
2197 } else {
2198 return 0;
2199 }
2200 }
static _getMaximumPoints($question_id)
Returns the maximum points, a learner can reach answering the question.

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

3880 {
3881 if (self::isCoreQuestionType($question_type)) {
3882 self::includeCoreClass($question_type, $gui);
3883 } else {
3884 self::includePluginClass($question_type, $gui);
3885 }
3886 }
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 3984 of file class.assQuestion.php.

3985 {
3986 return self::instantiateQuestionGUI($question_id);
3987 }
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 3206 of file class.assQuestion.php.

3207 {
3208 global $ilCtrl, $ilDB, $lng;
3209
3210 if (strcmp($question_id, "") != 0) {
3211 $question_type = assQuestion::_getQuestionType($question_id);
3212 if (!strlen($question_type)) {
3213 return null;
3214 }
3215 assQuestion::_includeClass($question_type);
3216 $objectClassname = self::getObjectClassNameByQuestionType($question_type);
3217 $question = new $objectClassname();
3218 $question->loadFromDb($question_id);
3219
3220 $feedbackObjectClassname = self::getFeedbackClassNameByQuestionType($question_type);
3221 $question->feedbackOBJ = new $feedbackObjectClassname($question, $ilCtrl, $ilDB, $lng);
3222
3223 return $question;
3224 }
3225 }
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 $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(), 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 3332 of file class.assQuestion.php.

3333 {
3334 global $ilDB;
3335
3336 if ($question_id < 1) {
3337 return 0;
3338 }
3339 $result = $ilDB->queryF(
3340 "SELECT test_random_question_id FROM tst_test_rnd_qst WHERE question_fi = %s",
3341 array('integer'),
3342 array($question_id)
3343 );
3344 return $result->numRows();
3345 }

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

3433 {
3434 return self::lookupResultRecordExist($active_id, $question_id, $pass);
3435
3436 // oldschool "workedthru"
3437
3438 global $ilDB;
3439
3440 $points = 0;
3441 if (is_null($pass)) {
3442 include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
3443 $pass = assQuestion::_getSolutionMaxPass($question_id, $active_id);
3444 }
3445 $result = $ilDB->queryF(
3446 "SELECT solution_id FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
3447 array('integer','integer','integer'),
3448 array($active_id, $question_id, $pass)
3449 );
3450 if ($result->numRows()) {
3451 return true;
3452 } else {
3453 return false;
3454 }
3455 }
static lookupResultRecordExist($activeId, $questionId, $pass)

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

3304 {
3305 global $ilDB;
3306
3307 if (($question_id < 1) || ($user_id < 1)) {
3308 return false;
3309 }
3310
3311 $result = $ilDB->queryF(
3312 "SELECT obj_fi FROM qpl_questions WHERE question_id = %s",
3313 array('integer'),
3314 array($question_id)
3315 );
3316 if ($result->numRows() == 1) {
3317 $row = $ilDB->fetchAssoc($result);
3318 $qpl_object_id = $row["obj_fi"];
3319 include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
3320 return ilObjQuestionPool::_isWriteable($qpl_object_id, $user_id);
3321 } else {
3322 return false;
3323 }
3324 }
static _isWriteable($object_id, $user_id)
Returns true, if the question pool is writeable by a given user.

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

3838 {
3839 include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
3841 $questiontype = assQuestion::_getQuestionType($question_id);
3842 if (in_array($questiontype, $scoring)) {
3843 return true;
3844 } else {
3845 return false;
3846 }
3847 }
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 3143 of file class.assQuestion.php.

3144 {
3145 global $ilDB;
3146
3147 if ($question_id < 1) {
3148 return false;
3149 }
3150
3151 $result = $ilDB->queryF(
3152 "SELECT question_id FROM qpl_questions WHERE question_id = %s",
3153 array('integer'),
3154 array($question_id)
3155 );
3156 if ($result->numRows() == 1) {
3157 return true;
3158 } else {
3159 return false;
3160 }
3161 }

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

3171 {
3172 global $ilDB;
3173
3174 if ($question_id < 1) {
3175 return false;
3176 }
3177
3178 $result = $ilDB->queryF(
3179 "SELECT question_id FROM qpl_questions INNER JOIN object_data ON obj_fi = obj_id WHERE question_id = %s AND type = 'qpl'",
3180 array('integer'),
3181 array($question_id)
3182 );
3183 if ($result->numRows() == 1) {
3184 return true;
3185 } else {
3186 return false;
3187 }
3188 }

References $ilDB, and $result.

◆ _questionExistsInTest()

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

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

4185 {
4186 global $ilDB;
4187
4188 if ($question_id < 1) {
4189 return false;
4190 }
4191
4192 $result = $ilDB->queryF(
4193 "SELECT question_fi FROM tst_test_question WHERE question_fi = %s AND test_fi = %s",
4194 array('integer', 'integer'),
4195 array($question_id, $test_id)
4196 );
4197 if ($result->numRows() == 1) {
4198 return true;
4199 } else {
4200 return false;
4201 }
4202 }

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

2934 {
2935 if (preg_match("/il_(\d+)_(\w+)_(\d+)/", $internal_link, $matches)) {
2936 include_once "./Services/Link/classes/class.ilInternalLink.php";
2937 include_once "./Modules/LearningModule/classes/class.ilLMObject.php";
2938 include_once "./Modules/Glossary/classes/class.ilGlossaryTerm.php";
2939 switch ($matches[2]) {
2940 case "lm":
2941 $resolved_link = ilLMObject::_getIdForImportId($internal_link);
2942 break;
2943 case "pg":
2944 $resolved_link = ilInternalLink::_getIdForImportId("PageObject", $internal_link);
2945 break;
2946 case "st":
2947 $resolved_link = ilInternalLink::_getIdForImportId("StructureObject", $internal_link);
2948 break;
2949 case "git":
2950 $resolved_link = ilInternalLink::_getIdForImportId("GlossaryItem", $internal_link);
2951 break;
2952 case "mob":
2953 $resolved_link = ilInternalLink::_getIdForImportId("MediaObject", $internal_link);
2954 break;
2955 }
2956 if (strcmp($resolved_link, "") == 0) {
2957 $resolved_link = $internal_link;
2958 }
2959 } else {
2960 $resolved_link = $internal_link;
2961 }
2962 return $resolved_link;
2963 }
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 2965 of file class.assQuestion.php.

2966 {
2967 global $ilDB;
2968 $resolvedlinks = 0;
2969 $result = $ilDB->queryF(
2970 "SELECT * FROM qpl_sol_sug WHERE question_fi = %s",
2971 array('integer'),
2972 array($question_id)
2973 );
2974 if ($result->numRows()) {
2975 while ($row = $ilDB->fetchAssoc($result)) {
2976 $internal_link = $row["internal_link"];
2977 include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
2978 $resolved_link = assQuestion::_resolveInternalLink($internal_link);
2979 if (strcmp($internal_link, $resolved_link) != 0) {
2980 // internal link was resolved successfully
2981 $affectedRows = $ilDB->manipulateF(
2982 "UPDATE qpl_sol_sug SET internal_link = %s WHERE suggested_solution_id = %s",
2983 array('text','integer'),
2984 array($resolved_link, $row["suggested_solution_id"])
2985 );
2986 $resolvedlinks++;
2987 }
2988 }
2989 }
2990 if ($resolvedlinks) {
2991 // there are resolved links -> reenter theses links to the database
2992
2993 // delete all internal links from the database
2994 include_once "./Services/Link/classes/class.ilInternalLink.php";
2995 ilInternalLink::_deleteAllLinksOfSource("qst", $question_id);
2996
2997 $result = $ilDB->queryF(
2998 "SELECT * FROM qpl_sol_sug WHERE question_fi = %s",
2999 array('integer'),
3000 array($question_id)
3001 );
3002 if ($result->numRows()) {
3003 while ($row = $ilDB->fetchAssoc($result)) {
3004 if (preg_match("/il_(\d*?)_(\w+)_(\d+)/", $row["internal_link"], $matches)) {
3005 ilInternalLink::_saveLink("qst", $question_id, $matches[2], $matches[3], $matches[1]);
3006 }
3007 }
3008 }
3009 }
3010 }
_resolveInternalLink($internal_link)

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

3603 {
3604 global $ilDB;
3605
3606 if ($points <= $maxpoints) {
3607 if (is_null($pass)) {
3608 $pass = assQuestion::_getSolutionMaxPass($question_id, $active_id);
3609 }
3610
3611 // retrieve the already given points
3612 $old_points = 0;
3613 $result = $ilDB->queryF(
3614 "SELECT points FROM tst_test_result WHERE active_fi = %s AND question_fi = %s AND pass = %s",
3615 array('integer','integer','integer'),
3616 array($active_id, $question_id, $pass)
3617 );
3618 $manual = ($manualscoring) ? 1 : 0;
3619 $rowsnum = $result->numRows();
3620 if ($rowsnum) {
3621 $row = $ilDB->fetchAssoc($result);
3622 $old_points = $row["points"];
3623 if ($old_points != $points) {
3624 $affectedRows = $ilDB->manipulateF(
3625 "UPDATE tst_test_result SET points = %s, manual = %s, tstamp = %s WHERE active_fi = %s AND question_fi = %s AND pass = %s",
3626 array('float', 'integer', 'integer', 'integer', 'integer', 'integer'),
3627 array($points, $manual, time(), $active_id, $question_id, $pass)
3628 );
3629 }
3630 } else {
3631 $next_id = $ilDB->nextId('tst_test_result');
3632 $affectedRows = $ilDB->manipulateF(
3633 "INSERT INTO tst_test_result (test_result_id, active_fi, question_fi, points, pass, manual, tstamp) VALUES (%s, %s, %s, %s, %s, %s, %s)",
3634 array('integer', 'integer','integer', 'float', 'integer', 'integer','integer'),
3635 array($next_id, $active_id, $question_id, $points, $pass, $manual, time())
3636 );
3637 }
3638
3639 if (self::isForcePassResultUpdateEnabled() || $old_points != $points || !$rowsnum) {
3640 assQuestion::_updateTestPassResults($active_id, $pass, $obligationsEnabled);
3641 // finally update objective result
3642 include_once "./Modules/Test/classes/class.ilObjTest.php";
3643 include_once './Modules/Course/classes/class.ilCourseObjectiveResult.php';
3645
3646 include_once("./Modules/Test/classes/class.ilObjAssessmentFolder.php");
3648 global $lng, $ilUser;
3649 include_once "./Modules/Test/classes/class.ilObjTestAccess.php";
3650 $username = ilObjTestAccess::_getParticipantData($active_id);
3651 assQuestion::logAction(sprintf($lng->txtlng("assessment", "log_answer_changed_points", ilObjAssessmentFolder::_getLogLanguage()), $username, $old_points, $points, $ilUser->getFullname() . " (" . $ilUser->getLogin() . ")"), $active_id, $question_id);
3652 }
3653 }
3654
3655 return true;
3656 } else {
3657 return false;
3658 }
3659 }
sprintf('%.4f', $callTime)
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 $ilDB, $ilUser, $lng, $pass, $points, $result, $row, ilObjAssessmentFolder\_enabledAssessmentLogging(), ilObjAssessmentFolder\_getLogLanguage(), ilObjTestAccess\_getParticipantData(), _getSolutionMaxPass(), ilObjTest\_getUserIdFromActiveId(), ilCourseObjectiveResult\_updateObjectiveResult(), logAction(), and sprintf.

Referenced by assFileUpload\handleSubmission(), 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 1355 of file class.assQuestion.php.

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

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

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

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

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

3542 {
3543 include_once "./Services/RTE/classes/class.ilRTE.php";
3544 include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
3545
3546 $a_xml_writer->xmlStartTag("material");
3547 $attrs = array(
3548 "texttype" => "text/plain"
3549 );
3550 if ($this->isHTML($a_material)) {
3551 $attrs["texttype"] = "text/xhtml";
3552 }
3553 $a_xml_writer->xmlElement("mattext", $attrs, ilRTE::_replaceMediaObjectImageSrc($a_material, 0));
3554 if ($add_mobs) {
3555 $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $this->getId());
3556 foreach ($mobs as $mob) {
3557 $moblabel = "il_" . IL_INST_ID . "_mob_" . $mob;
3558 if (strpos($a_material, "mm_$mob") !== false) {
3559 if (ilObjMediaObject::_exists($mob)) {
3560 $mob_obj = new ilObjMediaObject($mob);
3561 $imgattrs = array(
3562 "label" => $moblabel,
3563 "uri" => "objects/" . "il_" . IL_INST_ID . "_mob_" . $mob . "/" . $mob_obj->getTitle()
3564 );
3565 }
3566 $a_xml_writer->xmlElement("matimage", $imgattrs, null);
3567 }
3568 }
3569 }
3570 if ($close_material_tag) {
3571 $a_xml_writer->xmlEndTag("material");
3572 }
3573 }
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 4554 of file class.assQuestion.php.

4555 {
4556 $this->questionChangeListeners[] = $listener;
4557 }

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

3407 {
3408 include_once "./Modules/Test/classes/class.ilObjTest.php";
3409 $count_system = ilObjTest::_getCountSystem($active_id);
3410 if ($count_system == 1) {
3411 if (abs($this->getMaximumPoints() - $points) > 0.0000000001) {
3412 $points = 0;
3413 }
3414 }
3415 $score_cutting = ilObjTest::_getScoreCutting($active_id);
3416 if ($score_cutting == 0) {
3417 if ($points < 0) {
3418 $points = 0;
3419 }
3420 }
3421 return $points;
3422 }
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 2664 of file class.assQuestion.php.

2665 {
2666 // sync question feeback
2667 $this->feedbackOBJ->syncFeedback($origQuestionId, $dupQuestionId);
2668 }

Referenced by syncWithOriginal().

+ Here is the caller graph for this function:

◆ areObligationsToBeConsidered()

assQuestion::areObligationsToBeConsidered ( )
Returns
boolean

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

5286 {
5288 }

References $obligationsToBeConsidered.

Referenced by resetUsersAnswer().

+ Here is the caller graph for this function:

◆ authorizedOrIntermediateSolutionExists()

assQuestion::authorizedOrIntermediateSolutionExists (   $active_id,
  $pass 
)

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

5043 {
5044 $solutionAvailability = $this->lookupForExistingSolutions($active_id, $pass);
5045 return (bool) $solutionAvailability['authorized'] || (bool) $solutionAvailability['intermediate'];
5046 }

References $pass.

◆ authorizedSolutionExists()

assQuestion::authorizedSolutionExists (   $active_id,
  $pass 
)

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

5038 {
5039 $solutionAvailability = $this->lookupForExistingSolutions($active_id, $pass);
5040 return (bool) $solutionAvailability['authorized'];
5041 }

References $pass.

◆ beforeSyncWithOriginal()

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

Reimplemented in assKprimChoice.

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

2661 {
2662 }

Referenced by syncWithOriginal().

+ Here is the caller graph for this function:

◆ buildHashedImageFilename()

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

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

3576 {
3577 $extension = "";
3578
3579 if (preg_match("/.*\.(png|jpg|gif|jpeg)$/i", $plain_image_filename, $matches)) {
3580 $extension = "." . $matches[1];
3581 }
3582
3583 if ($unique) {
3584 $plain_image_filename = uniqid($plain_image_filename . microtime(true));
3585 }
3586
3587 $hashed_filename = md5($plain_image_filename) . $extension;
3588
3589 return $hashed_filename;
3590 }

Referenced by assKprimChoice\handleFileUpload().

+ Here is the caller graph for this function:

◆ buildImagePath()

assQuestion::buildImagePath (   $questionId,
  $parentObjectId 
)

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

1640 {
1641 return CLIENT_WEB_DIR . "/assessment/{$parentObjectId}/{$questionId}/images/";
1642 }

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

+ Here is the caller graph for this function:

◆ buildQuestionDataQuery()

assQuestion::buildQuestionDataQuery ( )
protected

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

4607 {
4608 return "
4609 SELECT qpl_questions.*,
4610 {$this->getAdditionalTableName()}.*
4611 FROM qpl_questions
4612 LEFT JOIN {$this->getAdditionalTableName()}
4613 ON {$this->getAdditionalTableName()}.question_fi = qpl_questions.question_id
4614 WHERE qpl_questions.question_id = %s
4615 ";
4616 }

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

5342 {
5343 include_once('Modules/TestQuestionPool/classes/class.ilTestQuestionConfig.php');
5344 return new ilTestQuestionConfig();
5345 }
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 3371 of file class.assQuestion.php.

3372 {
3373 $reachedPoints = $this->calculateReachedPointsForSolution($previewSession->getParticipantsSolution());
3374 $reachedPoints = $this->deductHintPointsFromReachedPoints($previewSession, $reachedPoints);
3375
3376 return $this->ensureNonNegativePoints($reachedPoints);
3377 }
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 1173 of file class.assQuestion.php.

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

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

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

3785 {
3786 $combinedtext = $this->getRTETextWithMediaObjects();
3787 include_once("./Services/RTE/classes/class.ilRTE.php");
3788 ilRTE::_cleanupMediaObjectUsage($combinedtext, "qpl:html", $this->getId());
3789 }
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 5012 of file class.assQuestion.php.

5013 {
5014 $sec = 0;
5015 $time_array = explode(':', $time);
5016 if (sizeof($time_array) == 3) {
5017 $sec += $time_array[0] * 3600;
5018 $sec += $time_array[1] * 60;
5019 $sec += $time_array[2];
5020 }
5021 return $sec;
5022 }
$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 2296 of file class.assQuestion.php.

2297 {
2298 if ($a_q_id > 0) {
2299 include_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php";
2300 $page = new ilAssQuestionPage($a_q_id);
2301
2302 $xml = str_replace("il__qst_" . $a_q_id, "il__qst_" . $this->id, $page->getXMLContent());
2303 $this->page->setXMLContent($xml);
2304 $this->page->updateFromXML();
2305 }
2306 }
Question page object.
$xml
Definition: metadata.php:240

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

2821 {
2822 global $ilLog;
2823
2824 foreach ($this->suggested_solutions as $index => $solution) {
2825 if (strcmp($solution["type"], "file") == 0) {
2826 $filepath = $this->getSuggestedSolutionPath();
2827 $filepath_original = str_replace("/$this->obj_id/$this->id/solution", "/$source_questionpool_id/$source_question_id/solution", $filepath);
2828 if (!file_exists($filepath)) {
2829 ilUtil::makeDirParents($filepath);
2830 }
2831 $filename = $solution["value"]["name"];
2832 if (strlen($filename)) {
2833 if (!copy($filepath_original . $filename, $filepath . $filename)) {
2834 $ilLog->write("File could not be copied!!!!", $ilLog->ERROR);
2835 $ilLog->write("object: " . print_r($this, true), $ilLog->ERROR);
2836 }
2837 }
2838 }
2839 }
2840 }
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 $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 2261 of file class.assQuestion.php.

2262 {
2263 include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
2264 $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $a_q_id);
2265 foreach ($mobs as $mob) {
2266 ilObjMediaObject::_saveUsage($mob, "qpl:html", $this->getId());
2267 }
2268 }
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 2477 of file class.assQuestion.php.

2478 {
2479 global $ilDB, $ilUser;
2480
2481 $complete = "0";
2482 $estw_time = $this->getEstimatedWorkingTime();
2483 $estw_time = sprintf("%02d:%02d:%02d", $estw_time['h'], $estw_time['m'], $estw_time['s']);
2484 $obj_id = ($this->getObjId() <= 0) ? (ilObject::_lookupObjId((strlen($_GET["ref_id"])) ? $_GET["ref_id"] : $_POST["sel_qpl"])) : $this->getObjId();
2485 if ($obj_id > 0) {
2486 if ($a_create_page) {
2487 $tstamp = 0;
2488 } else {
2489 // question pool must not try to purge
2490 $tstamp = time();
2491 }
2492
2493 $next_id = $ilDB->nextId('qpl_questions');
2494 $affectedRows = $ilDB->insert("qpl_questions", array(
2495 "question_id" => array("integer", $next_id),
2496 "question_type_fi" => array("integer", $this->getQuestionTypeID()),
2497 "obj_fi" => array("integer", $obj_id),
2498 "title" => array("text", null),
2499 "description" => array("text", null),
2500 "author" => array("text", $this->getAuthor()),
2501 "owner" => array("integer", $ilUser->getId()),
2502 "question_text" => array("clob", null),
2503 "points" => array("float", 0),
2504 "nr_of_tries" => array("integer", $this->getDefaultNrOfTries()), // #10771
2505 "working_time" => array("text", $estw_time),
2506 "complete" => array("text", $complete),
2507 "created" => array("integer", time()),
2508 "original_id" => array("integer", null),
2509 "tstamp" => array("integer", $tstamp),
2510 "external_id" => array("text", $this->getExternalId()),
2511 'add_cont_edit_mode' => array('text', $this->getAdditionalContentEditingMode())
2512 ));
2513 $this->setId($next_id);
2514
2515 if ($a_create_page) {
2516 // create page object of question
2517 $this->createPageObject();
2518 }
2519 }
2520
2521 $this->notifyQuestionCreated();
2522
2523 return $this->getId();
2524 }
$_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, $ilDB, $ilUser, $obj_id, ilObject\_lookupObjId(), createPageObject(), getAdditionalContentEditingMode(), getAuthor(), getDefaultNrOfTries(), getEstimatedWorkingTime(), getExternalId(), getId(), getObjId(), getQuestionTypeID(), notifyQuestionCreated(), setId(), and sprintf.

+ Here is the call graph for this function:

◆ createPageObject()

assQuestion::createPageObject ( )

create page object of question

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

2283 {
2284 $qpl_id = $this->getObjId();
2285
2286 include_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php";
2287 $this->page = new ilAssQuestionPage(0);
2288 $this->page->setId($this->getId());
2289 $this->page->setParentId($qpl_id);
2290 $this->page->setXMLContent("<PageObject><PageContent>" .
2291 "<Question QRef=\"il__qst_" . $this->getId() . "\"/>" .
2292 "</PageContent></PageObject>");
2293 $this->page->create();
2294 }

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

3133 {
3134 }

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

1980 {
1981 global $ilDB, $ilLog;
1982
1983 if ($question_id < 1) {
1984 return true;
1985 } // nothing to do
1986
1987 $result = $ilDB->queryF(
1988 "SELECT obj_fi FROM qpl_questions WHERE question_id = %s",
1989 array('integer'),
1990 array($question_id)
1991 );
1992 if ($result->numRows() == 1) {
1993 $row = $ilDB->fetchAssoc($result);
1994 $obj_id = $row["obj_fi"];
1995 } else {
1996 return true; // nothing to do
1997 }
1998 try {
1999 $this->deletePageOfQuestion($question_id);
2000 } catch (Exception $e) {
2001 $ilLog->write("EXCEPTION: Could not delete page of question $question_id: $e");
2002 return false;
2003 }
2004
2005 $affectedRows = $ilDB->manipulateF(
2006 "DELETE FROM qpl_questions WHERE question_id = %s",
2007 array('integer'),
2008 array($question_id)
2009 );
2010 if ($affectedRows == 0) {
2011 return false;
2012 }
2013
2014 try {
2015 $this->deleteAdditionalTableData($question_id);
2016 $this->deleteAnswers($question_id);
2017 $this->feedbackOBJ->deleteGenericFeedbacks($question_id, $this->isAdditionalContentEditingModePageObject());
2018 $this->feedbackOBJ->deleteSpecificAnswerFeedbacks($question_id, $this->isAdditionalContentEditingModePageObject());
2019 } catch (Exception $e) {
2020 $ilLog->write("EXCEPTION: Could not delete additional table data of question $question_id: $e");
2021 return false;
2022 }
2023
2024 try {
2025 // delete the question in the tst_test_question table (list of test questions)
2026 $affectedRows = $ilDB->manipulateF(
2027 "DELETE FROM tst_test_question WHERE question_fi = %s",
2028 array('integer'),
2029 array($question_id)
2030 );
2031 } catch (Exception $e) {
2032 $ilLog->write("EXCEPTION: Could not delete delete question $question_id from a test: $e");
2033 return false;
2034 }
2035
2036 try {
2037 // delete suggested solutions contained in the question
2038 $affectedRows = $ilDB->manipulateF(
2039 "DELETE FROM qpl_sol_sug WHERE question_fi = %s",
2040 array('integer'),
2041 array($question_id)
2042 );
2043 } catch (Exception $e) {
2044 $ilLog->write("EXCEPTION: Could not delete suggested solutions of question $question_id: $e");
2045 return false;
2046 }
2047
2048 try {
2049 $directory = CLIENT_WEB_DIR . "/assessment/" . $obj_id . "/$question_id";
2050 if (preg_match("/\d+/", $obj_id) and preg_match("/\d+/", $question_id) and is_dir($directory)) {
2051 include_once "./Services/Utilities/classes/class.ilUtil.php";
2052 ilUtil::delDir($directory);
2053 }
2054 } catch (Exception $e) {
2055 $ilLog->write("EXCEPTION: Could not delete question file directory $directory of question $question_id: $e");
2056 return false;
2057 }
2058
2059 try {
2060 include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
2061 $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $question_id);
2062 // remaining usages are not in text anymore -> delete them
2063 // and media objects (note: delete method of ilObjMediaObject
2064 // checks whether object is used in another context; if yes,
2065 // the object is not deleted!)
2066 foreach ($mobs as $mob) {
2067 ilObjMediaObject::_removeUsage($mob, "qpl:html", $question_id);
2068 if (ilObjMediaObject::_exists($mob)) {
2069 $mob_obj = new ilObjMediaObject($mob);
2070 $mob_obj->delete();
2071 }
2072 }
2073 } catch (Exception $e) {
2074 $ilLog->write("EXCEPTION: Error deleting the media objects of question $question_id: $e");
2075 return false;
2076 }
2077
2078 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintTracking.php';
2079 ilAssQuestionHintTracking::deleteRequestsByQuestionIds(array($question_id));
2080
2081 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintList.php';
2083
2084 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentList.php';
2085 $assignmentList = new ilAssQuestionSkillAssignmentList($ilDB);
2086 $assignmentList->setParentObjId($obj_id);
2087 $assignmentList->setQuestionIdFilter($question_id);
2088 $assignmentList->loadFromDb();
2089 foreach ($assignmentList->getAssignmentsByQuestionId($question_id) as $assignment) {
2090 /* @var ilAssQuestionSkillAssignment $assignment */
2091 $assignment->deleteFromDb();
2092 }
2093
2095
2096 try {
2097 // update question count of question pool
2098 include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
2100 } catch (Exception $e) {
2101 $ilLog->write("EXCEPTION: Error updating the question pool question count of question pool " . $this->getObjId() . " when deleting question $question_id: $e");
2102 return false;
2103 }
2104
2105 $this->notifyQuestionDeleted($this);
2106
2107 return true;
2108 }
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 $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 1938 of file class.assQuestion.php.

1939 {
1940 global $ilDB;
1941
1942 $additional_table_name = $this->getAdditionalTableName();
1943
1944 if (!is_array($additional_table_name)) {
1945 $additional_table_name = array($additional_table_name);
1946 }
1947
1948 foreach ($additional_table_name as $table) {
1949 if (strlen($table)) {
1950 $affectedRows = $ilDB->manipulateF(
1951 "DELETE FROM $table WHERE question_fi = %s",
1952 array('integer'),
1953 array($question_id)
1954 );
1955 }
1956 }
1957 }
getAdditionalTableName()
Returns the name of the additional question data table in the database.
if(empty($password)) $table
Definition: pwgen.php:24

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

1913 {
1914 global $ilDB;
1915 $answer_table_name = $this->getAnswerTableName();
1916
1917 if (!is_array($answer_table_name)) {
1918 $answer_table_name = array($answer_table_name);
1919 }
1920
1921 foreach ($answer_table_name as $table) {
1922 if (strlen($table)) {
1923 $affectedRows = $ilDB->manipulateF(
1924 "DELETE FROM $table WHERE question_fi = %s",
1925 array('integer'),
1926 array($question_id)
1927 );
1928 }
1929 }
1930 }
getAnswerTableName()
Returns the name of the answer table in the database.

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

4885 {
4886 foreach ($this->getSolutionValues($activeId, $passIndex, false) as $solutionRec) {
4887 if (0 == strlen($solutionRec['value1']) && 0 == strlen($solutionRec['value2'])) {
4888 $this->removeSolutionRecordById($solutionRec['solution_id']);
4889 }
4890 }
4891 }
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 1965 of file class.assQuestion.php.

1966 {
1967 include_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php";
1968 $page = new ilAssQuestionPage($question_id);
1969 $page->delete();
1970 return true;
1971 }

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

4894 {
4895 $ilDB = isset($GLOBALS['DIC']) ? $GLOBALS['DIC']['ilDB'] : $GLOBALS['ilDB'];
4896
4897 $types = array("integer", "integer", "integer", "integer");
4898 $values = array($activeId, $this->getId(), $passIndex, (int) $authorized);
4899 $valuesCondition = array();
4900
4901 foreach ($matchValues as $valueField => $value) {
4902 switch ($valueField) {
4903 case 'value1':
4904 case 'value2':
4905 $valuesCondition[] = "{$valueField} = %s";
4906 $types[] = 'text';
4907 $values[] = $value;
4908 break;
4909
4910 default:
4911 require_once 'Modules/TestQuestionPool/exceptions/class.ilTestQuestionPoolException.php';
4912 throw new ilTestQuestionPoolException('invalid value field given: ' . $valueField);
4913 }
4914 }
4915
4916 $valuesCondition = implode(' AND ', $valuesCondition);
4917
4918 $query = "
4919 DELETE FROM tst_solutions
4920 WHERE active_fi = %s
4921 AND question_fi = %s
4922 AND pass = %s
4923 AND authorized = %s
4924 AND $valuesCondition
4925 ";
4926
4927 if ($this->getStep() !== null) {
4928 $query .= " AND step = %s ";
4929 $types[] = 'integer';
4930 $values[] = $this->getStep();
4931 }
4932
4933 $ilDB->manipulateF($query, $types, $values);
4934 }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.

References $GLOBALS, $ilDB, $query, 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 2690 of file class.assQuestion.php.

2691 {
2692 global $ilDB;
2693 // delete the links in the qpl_sol_sug table
2694 $affectedRows = $ilDB->manipulateF(
2695 "DELETE FROM qpl_sol_sug WHERE question_fi = %s",
2696 array('integer'),
2697 array($this->getId())
2698 );
2699 // delete the links in the int_link table
2700 include_once "./Services/Link/classes/class.ilInternalLink.php";
2702 $this->suggested_solutions = array();
2704 }

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

+ Here is the call graph for this function:

◆ deleteTaxonomyAssignments()

assQuestion::deleteTaxonomyAssignments ( )
private

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

2111 {
2112 require_once 'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
2113 require_once 'Services/Taxonomy/classes/class.ilTaxNodeAssignment.php';
2114 $taxIds = ilObjTaxonomy::getUsageOfObject($this->getObjId());
2115
2116 foreach ($taxIds as $taxId) {
2117 $taxNodeAssignment = new ilTaxNodeAssignment('qpl', $this->getObjId(), 'quest', $taxId);
2118 $taxNodeAssignment->deleteAssignmentsOfItem($this->getId());
2119 }
2120 }
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 4936 of file class.assQuestion.php.

4937 {
4938 foreach ($this->getSolutionValues($activeId, $passIndex, false) as $rec) {
4939 $this->saveCurrentSolution($activeId, $passIndex, $rec['value1'], $rec['value2'], true, $rec['tstamp']);
4940 }
4941 }
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 4348 of file class.assQuestion.php.

4349 {
4350 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintList.php';
4351 $hintIds = ilAssQuestionHintList::duplicateListForQuestion($originalQuestionId, $duplicateQuestionId);
4352
4354 require_once 'Modules/TestQuestionPool/classes/class.ilAssHintPage.php';
4355
4356 foreach ($hintIds as $originalHintId => $duplicateHintId) {
4357 $originalPageObject = new ilAssHintPage($originalHintId);
4358 $originalXML = $originalPageObject->getXMLContent();
4359
4360 $duplicatePageObject = new ilAssHintPage();
4361 $duplicatePageObject->setId($duplicateHintId);
4362 $duplicatePageObject->setParentId($this->getId());
4363 $duplicatePageObject->setXMLContent($originalXML);
4364 $duplicatePageObject->createFromXML();
4365 }
4366 }
4367 }
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 4369 of file class.assQuestion.php.

4370 {
4371 global $ilDB;
4372
4373 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentList.php';
4374 $assignmentList = new ilAssQuestionSkillAssignmentList($ilDB);
4375 $assignmentList->setParentObjId($srcParentId);
4376 $assignmentList->setQuestionIdFilter($srcQuestionId);
4377 $assignmentList->loadFromDb();
4378
4379 foreach ($assignmentList->getAssignmentsByQuestionId($srcQuestionId) as $assignment) {
4380 /* @var ilAssQuestionSkillAssignment $assignment */
4381
4382 $assignment->setParentObjId($trgParentId);
4383 $assignment->setQuestionId($trgQuestionId);
4384 $assignment->saveToDb();
4385 }
4386 }

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

2769 {
2770 global $ilLog;
2771
2772 foreach ($this->suggested_solutions as $index => $solution) {
2773 if (strcmp($solution["type"], "file") == 0) {
2774 $filepath = $this->getSuggestedSolutionPath();
2775 $filepath_original = str_replace(
2776 "/{$this->obj_id}/{$this->id}/solution",
2777 "/$parent_id/$question_id/solution",
2778 $filepath
2779 );
2780 if (!file_exists($filepath)) {
2781 ilUtil::makeDirParents($filepath);
2782 }
2783 $filename = $solution["value"]["name"];
2784 if (strlen($filename)) {
2785 if (!copy($filepath_original . $filename, $filepath . $filename)) {
2786 $ilLog->write("File could not be duplicated!!!!", $ilLog->ERROR);
2787 $ilLog->write("object: " . print_r($this, true), $ilLog->ERROR);
2788 }
2789 }
2790 }
2791 }
2792 }

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

423 {
424 if (is_integer($pass) && $pass >= 0) {
425 return $pass;
426 }
427
428 return $this->lookupCurrentTestPass($active_id, $pass);
429 }
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 4879 of file class.assQuestion.php.

4880 {
4881 return explode(self::getKeyValuesImplosionSeparator(), $keyValues);
4882 }

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

5272 {
5273 $indexedValues = array();
5274
5275 foreach ($valuePairs as $valuePair) {
5276 $indexedValues[ $valuePair['value1'] ] = $valuePair['value2'];
5277 }
5278
5279 return $indexedValues;
5280 }

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

348 {
349 return current(explode(';', $contentTypeString));
350 }

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

5257 {
5258 $valuePairs = array();
5259
5260 foreach ($indexedValues as $value1 => $value2) {
5261 $valuePairs[] = array('value1' => $value1, 'value2' => $value2);
5262 }
5263
5264 return $valuePairs;
5265 }

◆ fixSvgToPng()

assQuestion::fixSvgToPng (   $imageFilenameContainingString)

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

2387 {
2388 $needles = array_keys(self::$imageSourceFixReplaceMap);
2389 $replacements = array_values(self::$imageSourceFixReplaceMap);
2390 return str_replace($needles, $replacements, $imageFilenameContainingString);
2391 }

Referenced by getSuggestedSolutionOutput().

+ Here is the caller graph for this function:

◆ fixUnavailableSkinImageSources()

assQuestion::fixUnavailableSkinImageSources (   $html)

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

2395 {
2396 $matches = null;
2397 if (preg_match_all('/src="(.*?)"/m', $html, $matches)) {
2398 $sources = $matches[1];
2399
2400 $needleReplacementMap = array();
2401
2402 foreach ($sources as $src) {
2403 $file = ilUtil::removeTrailingPathSeparators(ILIAS_ABSOLUTE_PATH) . DIRECTORY_SEPARATOR . $src;
2404
2405 if (file_exists($file)) {
2406 continue;
2407 }
2408
2409 $levels = explode(DIRECTORY_SEPARATOR, $src);
2410 if (count($levels) < 5 || $levels[0] != 'Customizing' || $levels[2] != 'skin') {
2411 continue;
2412 }
2413
2414 $component = '';
2415
2416 if ($levels[4] == 'Modules' || $levels[4] == 'Services') {
2417 $component = $levels[4] . DIRECTORY_SEPARATOR . $levels[5];
2418 }
2419
2420 $needleReplacementMap[$src] = ilUtil::getImagePath(basename($src), $component);
2421 }
2422
2423 if (count($needleReplacementMap)) {
2424 $html = str_replace(array_keys($needleReplacementMap), array_values($needleReplacementMap), $html);
2425 }
2426 }
2427
2428 return $html;
2429 }
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
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file

References $file, $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 4943 of file class.assQuestion.php.

4944 {
4945 $intermediateSolution = $this->getSolutionValues($activeId, $passIndex, false);
4946
4947 if (!count($intermediateSolution)) {
4948 // make the authorized solution intermediate (keeping timestamps)
4949 // this keeps the solution_ids in synch with eventually selected in $_POST['deletefiles']
4950 $this->updateCurrentSolutionsAuthorization($activeId, $passIndex, false, true);
4951
4952 // create a backup as authorized solution again (keeping timestamps)
4953 $this->duplicateIntermediateSolutionAuthorized($activeId, $passIndex);
4954
4955 if ($considerDummyRecordCreation) {
4956 // create an additional dummy record to indicate the existence of an intermediate solution
4957 // even if all entries are deleted from the intermediate solution later
4958 $this->saveCurrentSolution($activeId, $passIndex, null, null, false, null);
4959 }
4960 }
4961 }
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 4210 of file class.assQuestion.php.

4211 {
4212 return $this->getSelfAssessmentFormatter()->format($a_q);
4213 }

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

533 {
534 include_once "./Modules/TestQuestionPool/classes/import/qti12/class." . $this->getQuestionType() . "Import.php";
535 $classname = $this->getQuestionType() . "Import";
536 $import = new $classname($this);
537 $import->fromXML($item, $questionpool_id, $tst_id, $tst_object, $question_counter, $import_mapping);
538 }
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 3856 of file class.assQuestion.php.

3857 {
3858 global $ilDB;
3859 $result = $ilDB->queryF(
3860 "SELECT * FROM tst_active WHERE active_id = %s",
3861 array('integer'),
3862 array($active_id)
3863 );
3864 if ($result->numRows()) {
3865 $row = $ilDB->fetchAssoc($result);
3866 return array("user_id" => $row["user_fi"], "test_id" => $row["test_fi"]);
3867 } else {
3868 return array();
3869 }
3870 }

References $ilDB, $result, and $row.

◆ getAdditionalContentEditingMode()

assQuestion::getAdditionalContentEditingMode ( )

getter for additional content editing mode for this question

@access public

Returns
string

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

4490 {
4492 }

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

1891 {
1892 return "";
1893 }

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

1141 {
1142 if (is_null($pass)) {
1143 include_once "./Modules/Test/classes/class.ilObjTest.php";
1144 $pass = ilObjTest::_getPass($active_id);
1145 }
1146
1147 // determine reached points for submitted solution
1148 $reached_points = $this->calculateReachedPoints($active_id, $pass, $authorizedSolution);
1149
1150
1151
1152 // deduct points for requested hints from reached points
1153 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintTracking.php';
1154 $hintTracking = new ilAssQuestionHintTracking($this->getId(), $active_id, $pass);
1155 $requestsStatisticData = $hintTracking->getRequestStatisticDataByQuestionAndTestpass();
1156 $reached_points = $reached_points - $requestsStatisticData->getRequestsPoints();
1157
1158 // adjust reached points regarding to tests scoring options
1159 $reached_points = $this->adjustReachedPointsByScoringOptions($reached_points, $active_id, $pass);
1160
1161 return $reached_points;
1162 }

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

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

◆ getAllowedImageMaterialFileExtensions()

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

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

480 {
481 $extensions = array();
482
483 foreach (self::$allowedImageMaterialFileExtensionsByMimeType as $mimeType => $mimeExtensions) {
484 $extensions = array_merge($extensions, $mimeExtensions);
485 }
486 return array_unique($extensions);
487 }

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

1902 {
1903 return "";
1904 }

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

864 {
865 return $this->author;
866 }

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

804 {
805 return $this->comment;
806 }

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

4639 {
4640 global $ilDB;
4641
4642 if ($this->getStep() !== null) {
4643 $query = "
4644 SELECT *
4645 FROM tst_solutions
4646 WHERE active_fi = %s
4647 AND question_fi = %s
4648 AND pass = %s
4649 AND step = %s
4650 AND authorized = %s
4651 ";
4652
4653 return $ilDB->queryF(
4654 $query,
4655 array('integer', 'integer', 'integer', 'integer', 'integer'),
4656 array($active_id, $this->getId(), $pass, $this->getStep(), (int) $authorized)
4657 );
4658 } else {
4659 $query = "
4660 SELECT *
4661 FROM tst_solutions
4662 WHERE active_fi = %s
4663 AND question_fi = %s
4664 AND pass = %s
4665 AND authorized = %s
4666 ";
4667
4668 return $ilDB->queryF(
4669 $query,
4670 array('integer', 'integer', 'integer', 'integer'),
4671 array($active_id, $this->getId(), $pass, (int) $authorized)
4672 );
4673 }
4674 }

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

Referenced by assClozeTest\calculateReachedPoints(), assErrorText\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 4309 of file class.assQuestion.php.

4310 {
4311 return (int) $this->defaultnroftries;
4312 }

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

849 {
850 if (!$this->est_working_time) {
851 $this->est_working_time = array("h" => 0, "m" => 0, "s" => 0);
852 }
854 }

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

916 {
917 if (!strlen($this->external_id)) {
918 if ($this->getId() > 0) {
919 return 'il_' . IL_INST_ID . '_qst_' . $this->getId();
920 } else {
921 return uniqid('', true);
922 }
923 } else {
924 return $this->external_id;
925 }
926 }

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

3899 {
3900 return str_replace('ass', 'ilAss', $questionType) . 'Feedback';
3901 }

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

1651 {
1652 return CLIENT_WEB_DIR . "/assessment/$this->obj_id/$this->id/flash/";
1653 }

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

1706 {
1707 include_once "./Services/Utilities/classes/class.ilUtil.php";
1708 $webdir = ilUtil::removeTrailingPathSeparators(CLIENT_WEB_DIR) . "/assessment/$this->obj_id/$this->id/flash/";
1709 return str_replace(ilUtil::removeTrailingPathSeparators(ILIAS_ABSOLUTE_PATH), ilUtil::removeTrailingPathSeparators(ILIAS_HTTP_PATH), $webdir);
1710 }

References ilUtil\removeTrailingPathSeparators().

+ Here is the call graph for this function:

◆ getGuiClassNameByQuestionType()

static assQuestion::getGuiClassNameByQuestionType (   $questionType)
static

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

3889 {
3890 return $questionType . 'GUI';
3891 }

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

4601 {
4602 require_once 'Services/Html/classes/class.ilHtmlPurifierFactory.php';
4603 return ilHtmlPurifierFactory::_getInstanceByType('qpl_usersolution');
4604 }
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 4591 of file class.assQuestion.php.

4592 {
4593 require_once 'Services/Html/classes/class.ilHtmlPurifierFactory.php';
4594 return ilHtmlPurifierFactory::_getInstanceByType('qpl_usersolution');
4595 }

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

768 {
769 return $this->id;
770 }

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(), 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(), 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 1626 of file class.assQuestion.php.

1627 {
1628 if ($question_id === null) {
1629 $question_id = $this->id;
1630 }
1631
1632 if ($object_id === null) {
1633 $object_id = $this->obj_id;
1634 }
1635
1636 return $this->buildImagePath($question_id, $object_id);
1637 }
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 1688 of file class.assQuestion.php.

1689 {
1690 if (!$this->export_image_path) {
1691 include_once "./Services/Utilities/classes/class.ilUtil.php";
1692 $webdir = ilUtil::removeTrailingPathSeparators(CLIENT_WEB_DIR) . "/assessment/$this->obj_id/$this->id/images/";
1693 return str_replace(ilUtil::removeTrailingPathSeparators(ILIAS_ABSOLUTE_PATH), ilUtil::removeTrailingPathSeparators(ILIAS_HTTP_PATH), $webdir);
1694 } else {
1696 }
1697 }
$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 3796 of file class.assQuestion.php.

3797 {
3798 global $ilDB;
3799
3800 $result = $ilDB->queryF(
3801 "SELECT question_id FROM qpl_questions WHERE original_id = %s",
3802 array("integer"),
3803 array($this->getId())
3804 );
3805 $instances = array();
3806 $ids = array();
3807 while ($row = $ilDB->fetchAssoc($result)) {
3808 array_push($ids, $row["question_id"]);
3809 }
3810 foreach ($ids as $question_id) {
3811 // check non random tests
3812 $result = $ilDB->queryF(
3813 "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",
3814 array("integer"),
3815 array($question_id)
3816 );
3817 while ($row = $ilDB->fetchAssoc($result)) {
3818 $instances[$row['obj_fi']] = ilObject::_lookupTitle($row['obj_fi']);
3819 }
3820 // check random tests
3821 $result = $ilDB->queryF(
3822 "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",
3823 array("integer"),
3824 array($question_id)
3825 );
3826 while ($row = $ilDB->fetchAssoc($result)) {
3827 $instances[$row['obj_fi']] = ilObject::_lookupTitle($row['obj_fi']);
3828 }
3829 }
3830 include_once "./Modules/Test/classes/class.ilObjTest.php";
3831 foreach ($instances as $key => $value) {
3832 $instances[$key] = array("obj_id" => $key, "title" => $value, "author" => ilObjTest::_lookupAuthor($key), "refs" => ilObject::_getAllReferences($key));
3833 }
3834 return $instances;
3835 }
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 $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 1615 of file class.assQuestion.php.

1616 {
1617 return CLIENT_WEB_DIR . "/assessment/$this->obj_id/$this->id/java/";
1618 }

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

1662 {
1663 include_once "./Services/Utilities/classes/class.ilUtil.php";
1664 $webdir = ilUtil::removeTrailingPathSeparators(CLIENT_WEB_DIR) . "/assessment/$this->obj_id/$this->id/java/";
1665 return str_replace(ilUtil::removeTrailingPathSeparators(ILIAS_ABSOLUTE_PATH), ilUtil::removeTrailingPathSeparators(ILIAS_HTTP_PATH), $webdir);
1666 }

References ilUtil\removeTrailingPathSeparators().

+ Here is the call graph for this function:

◆ getKeyValuesImplosionSeparator()

static assQuestion::getKeyValuesImplosionSeparator ( )
staticprotected

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

4872 {
4874 }
const KEY_VALUES_IMPLOSION_SEPARATOR

References KEY_VALUES_IMPLOSION_SEPARATOR.

◆ getLastChange()

assQuestion::getLastChange ( )

Reimplemented in assMultipleChoice.

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

4624 {
4625 return $this->lastChange;
4626 }

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

1125 {
1126 return $this->points;
1127 }

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

4459 {
4460 global $ilDB;
4461
4462 $query = "
4463 SELECT count(active_fi) cnt
4464
4465 FROM tst_solutions
4466
4467 WHERE active_fi = %s
4468 AND question_fi = %s
4469 AND pass = %s
4470 ";
4471
4472 $res = $ilDB->queryF(
4473 $query,
4474 array('integer','integer','integer'),
4475 array($activeId, $questionId, $pass)
4476 );
4477
4478 $row = $ilDB->fetchAssoc($res);
4479
4480 return (int) $row['cnt'];
4481 }

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

3894 {
3895 return $questionType;
3896 }

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

888 {
889 return $this->obj_id;
890 }

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

816 {
817 return $this->outputType;
818 }

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

876 {
877 return $this->owner;
878 }

References $owner.

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

+ Here is the caller graph for this function:

◆ getPageOfQuestion()

assQuestion::getPageOfQuestion ( )

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

2309 {
2310 include_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php";
2311 $page = new ilAssQuestionPage($this->id);
2312 return $page->getXMLContent();
2313 }

References $page.

◆ getPoints()

◆ getPreventRteUsage()

assQuestion::getPreventRteUsage ( )

Get prevent rte usage.

Returns
boolean prevent rte usage

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

4242 {
4244 }

References $prevent_rte_usage.

◆ getProcessLocker()

◆ getQuestion()

◆ getQuestionAction()

assQuestion::getQuestionAction ( )
protected
Returns
string

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

384 {
385 if (!isset($_POST['cmd']) || !isset($_POST['cmd'][$this->questionActionCmd])) {
386 return '';
387 }
388
389 if (!is_array($_POST['cmd'][$this->questionActionCmd]) || !count($_POST['cmd'][$this->questionActionCmd])) {
390 return '';
391 }
392
393 return key($_POST['cmd'][$this->questionActionCmd]);
394 }

References $_POST.

Referenced by assFileUpload\isFileDeletionAction().

+ Here is the caller graph for this function:

◆ getQuestionChangeListeners()

assQuestion::getQuestionChangeListeners ( )
Returns
array[ilQuestionChangeListener]

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

4563 {
4565 }

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

5202 {
5203 global $ilDB;
5204
5205 $IN_questionIds = $ilDB->in('question_fi', $questionIds, false, 'integer');
5206
5207 $query = "
5208 SELECT question_fi
5209 FROM tst_test_result
5210 WHERE active_fi = %s
5211 AND pass = %s
5212 AND $IN_questionIds
5213 ";
5214
5215 $res = $ilDB->queryF(
5216 $query,
5217 array('integer', 'integer'),
5218 array($activeId, $pass)
5219 );
5220
5221 $questionsHavingResultRecord = array();
5222
5223 while ($row = $ilDB->fetchAssoc($res)) {
5224 $questionsHavingResultRecord[] = $row['question_fi'];
5225 }
5226
5227 $questionsMissingResultRecordt = array_diff(
5228 $questionIds,
5229 $questionsHavingResultRecord
5230 );
5231
5232 return $questionsMissingResultRecordt;
5233 }

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

1872 {
1873 global $ilDB;
1874
1875 $result = $ilDB->queryF(
1876 "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",
1877 array('integer'),
1878 array($question_id)
1879 );
1880 $data = $ilDB->fetchAssoc($result);
1881 return $data["type_tag"];
1882 }

References $data, $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 3700 of file class.assQuestion.php.

3701 {
3702 global $ilDB;
3703
3704 $result = $ilDB->queryF(
3705 "SELECT question_type_id FROM qpl_qst_type WHERE type_tag = %s",
3706 array('text'),
3707 array($this->getQuestionType())
3708 );
3709 if ($result->numRows() == 1) {
3710 $row = $ilDB->fetchAssoc($result);
3711 return $row["question_type_id"];
3712 }
3713 return 0;
3714 }

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

1114 {
1115 return round(self::_getReachedPoints($active_id, $this->getId(), $pass), 2);
1116 }

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

4976 {
4977 return self::$resultGateway;
4978 }

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

3758 {
3759 // must be called in parent classes. add additional RTE text in the parent
3760 // classes and call this method to add the standard RTE text
3761 $collected = $this->getQuestion();
3762 $collected .= $this->feedbackOBJ->getGenericFeedbackContent($this->getId(), false);
3763 $collected .= $this->feedbackOBJ->getGenericFeedbackContent($this->getId(), true);
3764 $collected .= $this->feedbackOBJ->getAllSpecificAnswerFeedbackContents($this->getId());
3765
3766 foreach ($this->suggested_solutions as $solution_array) {
3767 $collected .= $solution_array["value"];
3768 }
3769
3770 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintList.php';
3771 $questionHintList = ilAssQuestionHintList::getListByQuestionId($this->getId());
3772 foreach ($questionHintList as $questionHint) {
3773 /* @var $questionHint ilAssQuestionHint */
3774 $collected .= $questionHint->getText();
3775 }
3776
3777 return $collected;
3778 }
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 4289 of file class.assQuestion.php.

4290 {
4292 }

References $selfassessmenteditingmode.

Referenced by ilAssQuestionAuthoringFormGUI\addGenericAssessmentQuestionCommandButtons().

+ Here is the caller graph for this function:

◆ getSelfAssessmentFormatter()

assQuestion::getSelfAssessmentFormatter ( )
protected
Returns
\ilAssSelfAssessmentQuestionFormatter

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

4219 {
4220 require_once 'Modules/TestQuestionPool/classes/questions/class.ilAssSelfAssessmentQuestionFormatter.php';
4221 return new \ilAssSelfAssessmentQuestionFormatter();
4222 }

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

780 {
781 return $this->shuffle;
782 }

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

4701 {
4702 $ilDB = isset($GLOBALS['DIC']) ? $GLOBALS['DIC']['ilDB'] : $GLOBALS['ilDB'];
4703
4704 $res = $ilDB->queryF(
4705 "SELECT * FROM tst_solutions WHERE solution_id = %s",
4706 array('integer'),
4707 array($solutionId)
4708 );
4709
4710 while ($row = $ilDB->fetchAssoc($res)) {
4711 return $row;
4712 }
4713 }

References $GLOBALS, $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 1739 of file class.assQuestion.php.

1740 {
1741 global $ilDB;
1742
1743 if (is_null($pass)) {
1744 $pass = $this->getSolutionMaxPass($active_id);
1745 }
1746
1747 if ($this->getStep() !== null) {
1748 $query = "
1749 SELECT *
1750 FROM tst_solutions
1751 WHERE active_fi = %s
1752 AND question_fi = %s
1753 AND pass = %s
1754 AND step = %s
1755 AND authorized = %s
1756 ORDER BY solution_id";
1757
1758 $result = $ilDB->queryF(
1759 $query,
1760 array('integer', 'integer', 'integer', 'integer', 'integer'),
1761 array($active_id, $this->getId(), $pass, $this->getStep(), (int) $authorized)
1762 );
1763 } else {
1764 $query = "
1765 SELECT *
1766 FROM tst_solutions
1767 WHERE active_fi = %s
1768 AND question_fi = %s
1769 AND pass = %s
1770 AND authorized = %s
1771 ORDER BY solution_id
1772 ";
1773
1774 $result = $ilDB->queryF(
1775 $query,
1776 array('integer', 'integer', 'integer', 'integer'),
1777 array($active_id, $this->getId(), $pass, (int) $authorized)
1778 );
1779 }
1780
1781 $values = array();
1782
1783 while ($row = $ilDB->fetchAssoc($result)) {
1784 $values[] = $row;
1785 }
1786
1787 return $values;
1788 }
getSolutionMaxPass($active_id)
Returns the maximum pass a users question solution.

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

Referenced by assFormulaQuestion\calculateReachedPoints(), assOrderingQuestion\calculateReachedPoints(), deleteDummySolutionRecord(), duplicateIntermediateSolutionAuthorized(), forceExistingIntermediateSolution(), assOrderingQuestion\getOrderingElementListForSolutionOutput(), 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 2713 of file class.assQuestion.php.

2714 {
2715 if (array_key_exists($subquestion_index, $this->suggested_solutions)) {
2716 return $this->suggested_solutions[$subquestion_index];
2717 } else {
2718 return array();
2719 }
2720 }

◆ getSuggestedSolutionOutput()

assQuestion::getSuggestedSolutionOutput ( )

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

1007 {
1008 $output = array();
1009 foreach ($this->suggested_solutions as $solution) {
1010 switch ($solution["type"]) {
1011 case "lm":
1012 case "st":
1013 case "pg":
1014 case "git":
1015 array_push($output, '<a href="' . assQuestion::_getInternalLinkHref($solution["internal_link"]) . '">' . $this->lng->txt("solution_hint") . '</a>');
1016 break;
1017 case "file":
1018 $possible_texts = array_values(array_filter(array(
1019 ilUtil::prepareFormOutput($solution['value']['filename']),
1020 ilUtil::prepareFormOutput($solution['value']['name']),
1021 $this->lng->txt('tst_show_solution_suggested')
1022 )));
1023
1024 require_once 'Services/WebAccessChecker/classes/class.ilWACSignedPath.php';
1026 array_push($output, '<a href="' . ilWACSignedPath::signFile($this->getSuggestedSolutionPathWeb() . $solution["value"]["name"]) . '">' . $possible_texts[0] . '</a>');
1027 break;
1028 case "text":
1029 $solutionValue = $solution["value"];
1030 $solutionValue = $this->fixSvgToPng($solutionValue);
1031 $solutionValue = $this->fixUnavailableSkinImageSources($solutionValue);
1032 $output[] = $this->prepareTextareaOutput($solutionValue, true);
1033 break;
1034 }
1035 }
1036 return join($output, "<br />");
1037 }
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)
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\s+" &#(? foreach( $entity_files as $file) $output

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

1605 {
1606 return CLIENT_WEB_DIR . "/assessment/$this->obj_id/$this->id/solution/";
1607 }

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

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

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

1073 {
1075 }

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

2731 {
2732 if (array_key_exists($subquestion_index, $this->suggested_solutions)) {
2733 $title = $this->suggested_solutions[$subquestion_index]["internal_link"];
2734 // TO DO: resolve internal link an get link type and title
2735 } else {
2736 $title = "";
2737 }
2738 return $title;
2739 }

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

792 {
793 return $this->test_id;
794 }

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

1714 {
1715 // hey: refactored identifiers
1716 if ($this->getTestPresentationConfig()->isSolutionInitiallyPrefilled()) {
1717 // hey.
1718 return $this->getSolutionValues($activeId, $pass, true);
1719 }
1720
1721 return $this->getUserSolutionPreferingIntermediate($activeId, $pass);
1722 }
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 5324 of file class.assQuestion.php.

5325 {
5326 if ($this->testQuestionConfigInstance === null) {
5327 $this->testQuestionConfigInstance = $this->buildTestPresentationConfig();
5328 }
5329
5331 }
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 754 of file class.assQuestion.php.

755 {
756 require_once 'Services/Utilities/classes/class.ilUtil.php';
757 return ilUtil::getASCIIFilename($this->getTitle());
758 }
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 2125 of file class.assQuestion.php.

2126 {
2127 return $this->_getTotalAnswers($this->id);
2128 }
_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 1725 of file class.assQuestion.php.

1726 {
1727 $solution = $this->getSolutionValues($active_id, $pass, false);
1728
1729 if (!count($solution)) {
1730 $solution = $this->getSolutionValues($active_id, $pass, true);
1731 }
1732
1733 return $solution;
1734 }

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

4544 {
4545 return array(
4546 self::ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT,
4547 self::ADDITIONAL_CONTENT_EDITING_MODE_PAGE_OBJECT
4548 );
4549 }

Referenced by isValidAdditionalContentEditingMode(), and setAdditionalContentEditingMode().

+ Here is the caller graph for this function:

◆ implodeKeyValues()

static assQuestion::implodeKeyValues (   $keyValues)
static

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

4876 {
4877 return implode(self::getKeyValuesImplosionSeparator(), $keyValues);
4878 }

Referenced by assImagemapQuestionGUI\buildSelectionParameter().

+ Here is the caller graph for this function:

◆ includeCoreClass()

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

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

3910 {
3911 if ($withGuiClass) {
3912 $guiClassName = self::getGuiClassNameByQuestionType($questionType);
3913 require_once "Modules/TestQuestionPool/classes/class.{$guiClassName}.php";
3914
3915 // object class is included by gui classes constructor
3916 } else {
3917 $objectClassName = self::getObjectClassNameByQuestionType($questionType);
3918 require_once "Modules/TestQuestionPool/classes/class.{$objectClassName}.php";
3919 }
3920
3921 $feedbackClassName = self::getFeedbackClassNameByQuestionType($questionType);
3922 require_once "Modules/TestQuestionPool/classes/feedback/class.{$feedbackClassName}.php";
3923 }
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 3925 of file class.assQuestion.php.

3926 {
3927 global $ilPluginAdmin;
3928
3929 $classes = array(
3930 self::getObjectClassNameByQuestionType($questionType),
3931 self::getFeedbackClassNameByQuestionType($questionType)
3932 );
3933
3934 if ($withGuiClass) {
3935 $classes[] = self::getGuiClassNameByQuestionType($questionType);
3936 }
3937
3938 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_MODULE, "TestQuestionPool", "qst");
3939 foreach ($pl_names as $pl_name) {
3940 $pl = ilPlugin::getPluginObject(IL_COMP_MODULE, "TestQuestionPool", "qst", $pl_name);
3941 if (strcmp($pl->getQuestionType(), $questionType) == 0) {
3942 foreach ($classes as $class) {
3943 $pl->includeClass("class.{$class}.php");
3944 }
3945
3946 break;
3947 }
3948 }
3949 }

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

3997 {
3998 global $ilCtrl, $ilDB, $lng, $ilUser;
3999
4000 if (strcmp($a_question_id, "") != 0) {
4001 $question_type = assQuestion::_getQuestionType($a_question_id);
4002
4003 assQuestion::_includeClass($question_type, 1);
4004
4005 $question_type_gui = self::getGuiClassNameByQuestionType($question_type);
4006 $question_gui = new $question_type_gui();
4007 $question_gui->object->loadFromDb($a_question_id);
4008
4009 $feedbackObjectClassname = self::getFeedbackClassNameByQuestionType($question_type);
4010 $question_gui->object->feedbackOBJ = new $feedbackObjectClassname($question_gui->object, $ilCtrl, $ilDB, $lng);
4011
4012 $assSettings = new ilSetting('assessment');
4013 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionProcessLockerFactory.php';
4014 $processLockerFactory = new ilAssQuestionProcessLockerFactory($assSettings, $ilDB);
4015 $processLockerFactory->setQuestionId($question_gui->object->getId());
4016 $processLockerFactory->setUserId($ilUser->getId());
4017 include_once("./Modules/Test/classes/class.ilObjAssessmentFolder.php");
4018 $processLockerFactory->setAssessmentLogEnabled(ilObjAssessmentFolder::_enabledAssessmentLogging());
4019 $question_gui->object->setProcessLocker($processLockerFactory->getLocker());
4020 } else {
4021 global $ilLog;
4022 $ilLog->write('Instantiate question called without question id. (instantiateQuestionGUI@assQuestion)', $ilLog->WARNING);
4023 return null;
4024 }
4025 return $question_gui;
4026 }
ILIAS Setting Class.

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

Referenced by _instanciateQuestionGUI(), ilObjTestGUI\copyQuestionToPool(), 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 5032 of file class.assQuestion.php.

5033 {
5034 $solutionAvailability = $this->lookupForExistingSolutions($active_id, $pass);
5035 return (bool) $solutionAvailability['intermediate'];
5036 }

References $pass.

Referenced by assFileUpload\saveWorkingData().

+ Here is the caller graph for this function:

◆ isAdditionalContentEditingModePageObject()

assQuestion::isAdditionalContentEditingModePageObject ( )

isser for additional "pageobject" content editing mode

@access public

Returns
boolean

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

4517 {
4519 }
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 370 of file class.assQuestion.php.

371 {
372 return in_array(
373 strtolower($fileExtension),
374 self::getAllowedFileExtensionsForMimeType($mimeType)
375 );
376 }

Referenced by ilQtiMatImageSecurity\validateLabel().

+ Here is the caller graph for this function:

◆ isAllowedImageMimeType()

static assQuestion::isAllowedImageMimeType (   $mimeType)
static

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

343 {
344 return (bool) count(self::getAllowedFileExtensionsForMimeType($mimeType));
345 }

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

4420 {
4421 return true;
4422 }

Referenced by calculateResultsFromSolution().

+ Here is the caller graph for this function:

◆ isAutosaveable()

assQuestion::isAutosaveable ( )

Reimplemented in assFileUpload, assFlashQuestion, assImagemapQuestion, and assJavaApplet.

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

4442 {
4443 return true;
4444 }

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

1834 {
1835 global $ilDB;
1836
1837 if ($question_id < 1) {
1838 $question_id = $this->id;
1839 }
1840 $result = $ilDB->queryF(
1841 "SELECT original_id FROM qpl_questions WHERE question_id = %s",
1842 array('integer'),
1843 array($question_id)
1844 );
1845 $row = $ilDB->fetchAssoc($result);
1846 return ($row["original_id"] > 0) ? true : false;
1847 }

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

561 {
562 return false;
563 }

Referenced by saveQuestionDataToDb(), and saveToDb().

+ Here is the caller graph for this function:

◆ isCoreQuestionType()

static assQuestion::isCoreQuestionType (   $questionType)
static

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

3904 {
3905 $guiClassName = self::getGuiClassNameByQuestionType($questionType);
3906 return file_exists("Modules/TestQuestionPool/classes/class.{$guiClassName}.php");
3907 }

References getGuiClassNameByQuestionType().

+ Here is the call graph for this function:

◆ isFileAvailable()

static assQuestion::isFileAvailable (   $file)
static

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

2245 {
2246 if (!file_exists($file)) {
2247 return false;
2248 }
2249
2250 if (!is_file($file)) {
2251 return false;
2252 }
2253
2254 if (!is_readable($file)) {
2255 return false;
2256 }
2257
2258 return true;
2259 }

References $file.

Referenced by assMatchingQuestion\copyImages().

+ Here is the caller graph for this function:

◆ isForcePassResultUpdateEnabled()

static assQuestion::isForcePassResultUpdateEnabled ( )
static

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

338 {
340 }
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 3487 of file class.assQuestion.php.

3488 {
3489 return ilUtil::isHTML($a_text);
3490 }
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 1796 of file class.assQuestion.php.

1797 {
1798 global $ilDB;
1799
1800 if ($question_id < 1) {
1801 $question_id = $this->getId();
1802 }
1803 $result = $ilDB->queryF(
1804 "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",
1805 array('integer'),
1806 array($question_id)
1807 );
1808 $row = $ilDB->fetchAssoc($result);
1809 $count = $row["question_count"];
1810
1811 $result = $ilDB->queryF(
1812 "
1813 SELECT tst_active.test_fi
1814 FROM qpl_questions
1815 INNER JOIN tst_test_rnd_qst ON tst_test_rnd_qst.question_fi = qpl_questions.question_id
1816 INNER JOIN tst_active ON tst_active.active_id = tst_test_rnd_qst.active_fi
1817 WHERE qpl_questions.original_id = %s
1818 GROUP BY tst_active.test_fi",
1819 array('integer'),
1820 array($question_id)
1821 );
1822 $count += $result->numRows();
1823
1824 return $count;
1825 }

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

401 {
402 if (!isset($_POST[$postSubmissionFieldname])) {
403 return false;
404 }
405
406 if (!is_array($_POST[$postSubmissionFieldname])) {
407 return false;
408 }
409
410 if (!count($_POST[$postSubmissionFieldname])) {
411 return false;
412 }
413
414 return true;
415 }

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

4437 {
4438 return false;
4439 }

◆ isPreviewSolutionCorrect()

assQuestion::isPreviewSolutionCorrect ( ilAssQuestionPreviewSession  $previewSession)

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

3385 {
3386 $reachedPoints = $this->calculateReachedPointsFromPreviewSession($previewSession);
3387
3388 if ($reachedPoints < $this->getMaximumPoints()) {
3389 return false;
3390 }
3391
3392 return true;
3393 }
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 4528 of file class.assQuestion.php.

4529 {
4530 if (in_array($additionalContentEditingMode, $this->getValidAdditionalContentEditingModes())) {
4531 return true;
4532 }
4533
4534 return false;
4535 }
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 698 of file class.assQuestion.php.

699 {
700 if ($searchkey) {
701 foreach ($array as $key => $value) {
702 if (strcmp($key, $searchkey)==0) {
703 return true;
704 }
705 }
706 }
707 return false;
708 }

References $key.

◆ lmMigrateQuestionTypeGenericContent()

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

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

4262 {
4263 $this->setQuestion($migrator->migrateToLmContent($this->getQuestion()));
4264 }

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

4270 {
4271 // overwrite if any question type specific content except feedback needs to be migrated
4272 }

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

2438 {
2439 global $ilDB;
2440
2441 $result = $ilDB->queryF(
2442 "SELECT external_id FROM qpl_questions WHERE question_id = %s",
2443 array("integer"),
2444 array($question_id)
2445 );
2446 if ($result->numRows() == 1) {
2447 $data = $ilDB->fetchAssoc($result);
2448 $this->external_id = $data['external_id'];
2449 }
2450
2451 $result = $ilDB->queryF(
2452 "SELECT * FROM qpl_sol_sug WHERE question_fi = %s",
2453 array('integer'),
2454 array($this->getId())
2455 );
2456 $this->suggested_solutions = array();
2457 if ($result->numRows()) {
2458 include_once("./Services/RTE/classes/class.ilRTE.php");
2459 while ($row = $ilDB->fetchAssoc($result)) {
2460 $value = (is_array(unserialize($row["value"]))) ? unserialize($row["value"]) : ilRTE::_replaceMediaObjectImageSrc($row["value"], 1);
2461 $this->suggested_solutions[$row["subquestion_index"]] = array(
2462 "type" => $row["type"],
2463 "value" => $value,
2464 "internal_link" => $row["internal_link"],
2465 "import_id" => $row["import_id"]
2466 );
2467 }
2468 }
2469 }

References $data, $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 468 of file class.assQuestion.php.

469 {
471 $message = $this->lng->txtlng('assessment', $langVar, ilObjAssessmentFolder::_getLogLanguage());
472 assQuestion::logAction($message, $active_id, $this->getId());
473 }
474 }
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 1557 of file class.assQuestion.php.

1558 {
1559 $original_id = "";
1560 if (strlen($question_id)) {
1561 $original_id = self::_getOriginalId($question_id);
1562 }
1563
1564 require_once 'Modules/Test/classes/class.ilObjAssessmentFolder.php';
1565 require_once 'Modules/Test/classes/class.ilObjTest.php';
1566
1568 $GLOBALS['DIC']['ilUser']->getId(),
1570 $logtext,
1571 $question_id,
1573 );
1574 }
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.

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

437 {
438 require_once 'Modules/Test/classes/class.ilObjTest.php';
439 return ilObjTest::_getPass($active_id);
440 }

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

4344 {
4345 return self::lookupParentObjId($originalQuestionId);
4346 }
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 4321 of file class.assQuestion.php.

4322 {
4323 global $ilDB;
4324
4325 $query = "SELECT obj_fi FROM qpl_questions WHERE question_id = %s";
4326
4327 $res = $ilDB->queryF($query, array('integer'), array((int) $questionId));
4328 $row = $ilDB->fetchAssoc($res);
4329
4330 return $row['obj_fi'];
4331 }

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

5236 {
5237 global $ilDB;
5238
5239 $query = "
5240 SELECT COUNT(*) cnt
5241 FROM tst_test_result
5242 WHERE active_fi = %s
5243 AND question_fi = %s
5244 AND pass = %s
5245 ";
5246
5247 $row = $ilDB->fetchAssoc($ilDB->queryF($query, array('integer', 'integer', 'integer'), array($activeId, $questionId, $pass)));
5248
5249 return $row['cnt'] > 0;
5250 }

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

447 {
448 $ilDB = isset($GLOBALS['DIC']) ? $GLOBALS['DIC']['ilDB'] : $GLOBALS['ilDB'];
449
450 $result = $ilDB->queryF(
451 "SELECT test_fi FROM tst_active WHERE active_id = %s",
452 array('integer'),
453 array($active_id)
454 );
455
456 while ($row = $ilDB->fetchAssoc($result)) {
457 return $row["test_fi"];
458 }
459
460 return null;
461 }

References $GLOBALS, $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 4249 of file class.assQuestion.php.

4250 {
4251 $this->lmMigrateQuestionTypeGenericContent($migrator);
4252 $this->lmMigrateQuestionTypeSpecificContent($migrator);
4253 $this->saveToDb();
4254
4255 $this->feedbackOBJ->migrateContentForLearningModule($migrator, $this->getId());
4256 }
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 5178 of file class.assQuestion.php.

5179 {
5180 global $ilDB;
5181
5182 $IN_questionIds = $ilDB->in('question_fi', $questionIds, false, 'integer');
5183
5184 $query = "
5185 SELECT COUNT(*) cnt
5186 FROM tst_test_result
5187 WHERE active_fi = %s
5188 AND pass = %s
5189 AND $IN_questionIds
5190 ";
5191
5192 $row = $ilDB->fetchAssoc($ilDB->queryF(
5193 $query,
5194 array('integer', 'integer'),
5195 array($activeId, $pass)
5196 ));
5197
5198 return $row['cnt'] < count($questionIds);
5199 }

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

1584 {
1585 $mediatempdir = CLIENT_WEB_DIR . "/assessment/temp";
1586 if (!@is_dir($mediatempdir)) {
1587 ilUtil::createDirectory($mediatempdir);
1588 }
1589 $temp_name = tempnam($mediatempdir, $name . "_____");
1590 $temp_name = str_replace("\\", "/", $temp_name);
1591 @unlink($temp_name);
1592 if (!ilUtil::moveUploadedFile($file, $name, $temp_name)) {
1593 return false;
1594 } else {
1595 return $temp_name;
1596 }
1597 }
static createDirectory($a_dir, $a_mod=0755)
create directory
if($format !==null) $name
Definition: metadata.php:146

References $file, $name, and ilUtil\createDirectory().

+ Here is the call graph for this function:

◆ notifyQuestionCreated()

assQuestion::notifyQuestionCreated ( )
private

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

4568 {
4569 foreach ($this->getQuestionChangeListeners() as $listener) {
4570 $listener->notifyQuestionCreated($this);
4571 }
4572 }

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

4582 {
4583 foreach ($this->getQuestionChangeListeners() as $listener) {
4584 $listener->notifyQuestionDeleted($this);
4585 }
4586 }

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

4575 {
4576 foreach ($this->getQuestionChangeListeners() as $listener) {
4577 $listener->notifyQuestionEdited($this);
4578 }
4579 }

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

2674 {
2675 $this->copySuggestedSolutionFiles($sourceParentId, $sourceQuestionId);
2676
2677 // duplicate question feeback
2678 $this->feedbackOBJ->duplicateFeedback($sourceQuestionId, $targetQuestionId);
2679
2680 // duplicate question hints
2681 $this->duplicateQuestionHints($sourceQuestionId, $targetQuestionId);
2682
2683 // duplicate skill assignments
2684 $this->duplicateSkillAssignments($sourceParentId, $sourceQuestionId, $targetParentId, $targetQuestionId);
2685 }
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 2646 of file class.assQuestion.php.

2647 {
2648 $this->duplicateSuggestedSolutionFiles($originalParentId, $originalQuestionId);
2649
2650 // duplicate question feeback
2651 $this->feedbackOBJ->duplicateFeedback($originalQuestionId, $duplicateQuestionId);
2652
2653 // duplicate question hints
2654 $this->duplicateQuestionHints($originalQuestionId, $duplicateQuestionId);
2655
2656 // duplicate skill assignments
2657 $this->duplicateSkillAssignments($originalParentId, $originalQuestionId, $duplicateParentId, $duplicateQuestionId);
2658 }
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 3073 of file class.assQuestion.php.

3074 {
3075 global $ilDB;
3076
3077 $query = "
3078 SELECT COUNT(dupl.question_id) cnt
3079 FROM qpl_questions dupl
3080 INNER JOIN qpl_questions orig
3081 ON orig.question_id = dupl.original_id
3082 WHERE dupl.question_id = %s
3083 ";
3084
3085 $res = $ilDB->queryF($query, array('integer'), array($questionId));
3086 $row = $ilDB->fetchAssoc($res);
3087
3088 return $row['cnt'] > 0;
3089 }

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

1856 {
1857 $keys = array_keys($array);
1858 shuffle($keys);
1859 $result = array();
1860 foreach ($keys as $key) {
1861 $result[$key] = $array[$key];
1862 }
1863 return $result;
1864 }
$keys

References $key, $keys, and $result.

◆ persistPreviewState()

assQuestion::persistPreviewState ( ilAssQuestionPreviewSession  $previewSession)
final

persists the preview state for current user and question

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

1319 {
1320 $this->savePreviewData($previewSession);
1321 return $this->validateSolutionSubmit();
1322 }
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 1285 of file class.assQuestion.php.

1286 {
1287 if ($pass === null) {
1288 require_once 'Modules/Test/classes/class.ilObjTest.php';
1289 $pass = ilObjTest::_getPass($active_id);
1290 }
1291
1292 if (!$this->validateSolutionSubmit()) {
1293 return false;
1294 }
1295
1296 $saveStatus = false;
1297
1298 $this->getProcessLocker()->executePersistWorkingStateLockOperation(function () use ($active_id, $pass, $authorized, $obligationsEnabled, &$saveStatus) {
1299 $saveStatus = $this->saveWorkingData($active_id, $pass, $authorized);
1300
1301 if ($authorized) {
1302 // fau: testNav - remove an intermediate solution if the authorized solution is saved
1303 // the intermediate solution would set the displayed question status as "editing ..."
1304 $this->removeIntermediateSolution($active_id, $pass);
1305 // fau.
1306 $this->calculateResultsFromSolution($active_id, $pass, $obligationsEnabled);
1307 }
1308
1309 $this->reworkWorkingData($active_id, $pass, $obligationsEnabled, $authorized);
1310 });
1311
1312 return $saveStatus;
1313 }
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.
reworkWorkingData($active_id, $pass, $obligationsAnswered, $authorized)
Reworks the allready saved working data if neccessary.

References $pass, ilObjTest\_getPass(), calculateResultsFromSolution(), getProcessLocker(), removeIntermediateSolution(), reworkWorkingData(), 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 3498 of file class.assQuestion.php.

3499 {
3500 include_once "./Services/Utilities/classes/class.ilUtil.php";
3501 return ilUtil::prepareTextareaOutput($txt_output, $prepare_for_latex_output, $omitNl2BrWhenTextArea);
3502 }
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 3511 of file class.assQuestion.php.

3512 {
3513 $result = "";
3514 for ($i = 0; $i < $a_material->getMaterialCount(); $i++) {
3515 $material = $a_material->getMaterial($i);
3516 if (strcmp($material["type"], "mattext") == 0) {
3517 $result .= $material["material"]->getContent();
3518 }
3519 if (strcmp($material["type"], "matimage") == 0) {
3520 $matimage = $material["material"];
3521 if (preg_match("/(il_([0-9]+)_mob_([0-9]+))/", $matimage->getLabel(), $matches)) {
3522 // import an mediaobject which was inserted using tiny mce
3523 if (!is_array($_SESSION["import_mob_xhtml"])) {
3524 $_SESSION["import_mob_xhtml"] = array();
3525 }
3526 array_push($_SESSION["import_mob_xhtml"], array("mob" => $matimage->getLabel(), "uri" => $matimage->getUri()));
3527 }
3528 }
3529 }
3530 return $result;
3531 }
$_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 572 of file class.assQuestion.php.

573 {
574 global $ilDB;
575
576 $result = $ilDB->queryF(
577 "SELECT * FROM qpl_questions WHERE obj_fi = %s AND title = %s",
578 array('integer','text'),
579 array($questionpool_id, $title)
580 );
581 return ($result->numRows() > 0) ? true : false;
582 }

References $ilDB, $result, and $title.

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

4740 {
4741 global $ilDB;
4742
4743 if ($this->getStep() !== null) {
4744 $query = "
4745 DELETE FROM tst_solutions
4746 WHERE active_fi = %s
4747 AND question_fi = %s
4748 AND pass = %s
4749 AND step = %s
4750 AND authorized = %s
4751 ";
4752
4753 return $ilDB->manipulateF(
4754 $query,
4755 array('integer', 'integer', 'integer', 'integer', 'integer'),
4756 array($active_id, $this->getId(), $pass, $this->getStep(), (int) $authorized)
4757 );
4758 } else {
4759 $query = "
4760 DELETE FROM tst_solutions
4761 WHERE active_fi = %s
4762 AND question_fi = %s
4763 AND pass = %s
4764 AND authorized = %s
4765 ";
4766
4767 return $ilDB->manipulateF(
4768 $query,
4769 array('integer', 'integer', 'integer', 'integer'),
4770 array($active_id, $this->getId(), $pass, (int) $authorized)
4771 );
4772 }
4773 }

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

5119 {
5120 global $ilDB;
5121
5122 $query = "
5123 DELETE FROM tst_solutions
5124 WHERE active_fi = %s
5125 AND question_fi = %s
5126 AND pass = %s
5127 ";
5128
5129 if ($this->getStep() !== null) {
5130 $query .= " AND step = " . $ilDB->quote((int) $this->getStep(), 'integer') . " ";
5131 }
5132
5133 return $ilDB->manipulateF(
5134 $query,
5135 array('integer', 'integer', 'integer'),
5136 array($activeId, $this->getId(), $pass)
5137 );
5138 }

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

4725 {
4726 $this->getProcessLocker()->executeUserSolutionUpdateLockOperation(function () use ($active_id, $pass) {
4727 $this->removeCurrentSolution($active_id, $pass, false);
4728 });
4729 }
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 5156 of file class.assQuestion.php.

5157 {
5158 global $ilDB;
5159
5160 $query = "
5161 DELETE FROM tst_test_result
5162 WHERE active_fi = %s
5163 AND question_fi = %s
5164 AND pass = %s
5165 ";
5166
5167 if ($this->getStep() !== null) {
5168 $query .= " AND step = " . $ilDB->quote((int) $this->getStep(), 'integer') . " ";
5169 }
5170
5171 return $ilDB->manipulateF(
5172 $query,
5173 array('integer', 'integer', 'integer'),
5174 array($activeId, $this->getId(), $pass)
5175 );
5176 }

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

4683 {
4684 global $ilDB;
4685
4686 return $ilDB->manipulateF(
4687 "DELETE FROM tst_solutions WHERE solution_id = %s",
4688 array('integer'),
4689 array($solutionId)
4690 );
4691 }

References $ilDB.

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

+ Here is the caller graph for this function:

◆ requiresJsSwitch()

assQuestion::requiresJsSwitch ( )

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

837 {
838 return $this->supportsJavascriptOutput() && $this->supportsNonJsOutput();
839 }
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 2632 of file class.assQuestion.php.

2633 {
2634 $query = "UPDATE qpl_questions SET tstamp = %s, original_id = NULL WHERE question_id = %s";
2635
2636 $GLOBALS['DIC']['ilDB']->manipulateF(
2637 $query,
2638 array('integer', 'text'),
2639 array(time(), $questionId)
2640 );
2641 }

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

5141 {
5142 $this->removeExistingSolutions($activeId, $pass);
5143 $this->removeResultRecord($activeId, $pass);
5144
5145 $this->log($activeId, "log_user_solution_willingly_deleted");
5146
5147 self::_updateTestPassResults(
5148 $activeId,
5149 $pass,
5151 $this->getProcessLocker(),
5152 $this->getTestId()
5153 );
5154 }
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:

◆ reworkWorkingData()

assQuestion::reworkWorkingData (   $active_id,
  $pass,
  $obligationsAnswered,
  $authorized 
)
abstractprotected

Reworks the allready saved working data if neccessary.

Parameters
integer$active_id
integer$pass
boolean$obligationsAnswered
boolean$authorized

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

Referenced by persistWorkingState().

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

4788 {
4789 global $ilDB;
4790
4791 $next_id = $ilDB->nextId("tst_solutions");
4792
4793 $fieldData = array(
4794 "solution_id" => array("integer", $next_id),
4795 "active_fi" => array("integer", $active_id),
4796 "question_fi" => array("integer", $this->getId()),
4797 "value1" => array("clob", $value1),
4798 "value2" => array("clob", $value2),
4799 "pass" => array("integer", $pass),
4800 "tstamp" => array("integer", isset($tstamp) ? $tstamp : time()),
4801 'authorized' => array('integer', (int) $authorized)
4802 );
4803
4804 if ($this->getStep() !== null) {
4805 $fieldData['step'] = array("integer", $this->getStep());
4806 }
4807
4808 return $ilDB->insert("tst_solutions", $fieldData);
4809 }

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

2622 {
2623 $query = "UPDATE qpl_questions SET tstamp = %s, original_id = %s WHERE question_id = %s";
2624
2625 $GLOBALS['DIC']['ilDB']->manipulateF(
2626 $query,
2627 array('integer','integer', 'text'),
2628 array(time(), $originalId, $questionId)
2629 );
2630 }

References $GLOBALS, and $query.

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

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

1350 {
1351 $previewSession->setParticipantsSolution($this->getSolutionSubmit());
1352 }

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

2527 {
2528 global $ilDB;
2529
2530 $estw_time = $this->getEstimatedWorkingTime();
2531 $estw_time = sprintf("%02d:%02d:%02d", $estw_time['h'], $estw_time['m'], $estw_time['s']);
2532
2533 // cleanup RTE images which are not inserted into the question text
2534 include_once("./Services/RTE/classes/class.ilRTE.php");
2535 if ($this->getId() == -1) {
2536 // Neuen Datensatz schreiben
2537 $next_id = $ilDB->nextId('qpl_questions');
2538 $affectedRows = $ilDB->insert("qpl_questions", array(
2539 "question_id" => array("integer", $next_id),
2540 "question_type_fi" => array("integer", $this->getQuestionTypeID()),
2541 "obj_fi" => array("integer", $this->getObjId()),
2542 "title" => array("text", $this->getTitle()),
2543 "description" => array("text", $this->getComment()),
2544 "author" => array("text", $this->getAuthor()),
2545 "owner" => array("integer", $this->getOwner()),
2546 "question_text" => array("clob", ilRTE::_replaceMediaObjectImageSrc($this->getQuestion(), 0)),
2547 "points" => array("float", $this->getMaximumPoints()),
2548 "working_time" => array("text", $estw_time),
2549 "nr_of_tries" => array("integer", $this->getNrOfTries()),
2550 "created" => array("integer", time()),
2551 "original_id" => array("integer", ($original_id) ? $original_id : null),
2552 "tstamp" => array("integer", time()),
2553 "external_id" => array("text", $this->getExternalId()),
2554 'add_cont_edit_mode' => array('text', $this->getAdditionalContentEditingMode())
2555 ));
2556 $this->setId($next_id);
2557 // create page object of question
2558 $this->createPageObject();
2559 } else {
2560 // Vorhandenen Datensatz aktualisieren
2561 $affectedRows = $ilDB->update("qpl_questions", array(
2562 "obj_fi" => array("integer", $this->getObjId()),
2563 "title" => array("text", $this->getTitle()),
2564 "description" => array("text", $this->getComment()),
2565 "author" => array("text", $this->getAuthor()),
2566 "question_text" => array("clob", ilRTE::_replaceMediaObjectImageSrc($this->getQuestion(), 0)),
2567 "points" => array("float", $this->getMaximumPoints()),
2568 "nr_of_tries" => array("integer", $this->getNrOfTries()),
2569 "working_time" => array("text", $estw_time),
2570 "tstamp" => array("integer", time()),
2571 'complete' => array('integer', $this->isComplete()),
2572 "external_id" => array("text", $this->getExternalId())
2573 ), array(
2574 "question_id" => array("integer", $this->getId())
2575 ));
2576 }
2577 }
isComplete()
Returns true, if a question is complete for use.

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

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

2586 {
2587 global $ilDB;
2588
2589 $this->updateSuggestedSolutions();
2590
2591 // remove unused media objects from ILIAS
2592 $this->cleanupMediaObjectUsage();
2593
2594 $complete = "0";
2595 if ($this->isComplete()) {
2596 $complete = "1";
2597 }
2598
2599 // update the question time stamp and completion status
2600 $affectedRows = $ilDB->manipulateF(
2601 "UPDATE qpl_questions SET tstamp = %s, owner = %s, complete = %s WHERE question_id = %s",
2602 array('integer','integer', 'integer','text'),
2603 array(time(), ($this->getOwner() <= 0) ? $this->ilias->account->id : $this->getOwner(), $complete, $this->getId())
2604 );
2605
2606 // update question count of question pool
2607 include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
2609
2610 $this->notifyQuestionEdited($this);
2611 }
cleanupMediaObjectUsage()
synchronises appearances of media objects in the question with media object usage table

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

4501 {
4503 require_once 'Modules/TestQuestionPool/exceptions/class.ilTestQuestionPoolException.php';
4504 throw new ilTestQuestionPoolException('invalid additional content editing mode given: ' . $additinalContentEditingMode);
4505 }
4506
4507 $this->additinalContentEditingMode = $additinalContentEditingMode;
4508 }

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

718 {
719 if (!$author) {
720 $author = $this->ilias->account->fullname;
721 }
722 $this->author = $author;
723 }

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

4300 {
4301 $this->defaultnroftries = $a_defaultnroftries;
4302 }

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

672 {
673 $this->est_working_time = array("h" => (int) $hour, "m" => (int) $min, "s" => (int) $sec);
674 }

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

683 {
684 $this->est_working_time = array(
685 'h' => (int) substr($durationString, 0, 2),
686 'm' => (int) substr($durationString, 3, 2),
687 's' => (int) substr($durationString, 6, 2)
688 );
689 }

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

4039 {
4040 $worksheet->setFormattedExcelTitle($worksheet->getColumnCoord(0) . $startrow, $this->lng->txt($this->getQuestionType()));
4041 $worksheet->setFormattedExcelTitle($worksheet->getColumnCoord(1) . $startrow, $this->getTitle());
4042
4043 return $startrow;
4044 }
$worksheet

References $worksheet.

◆ setExportImagePath()

assQuestion::setExportImagePath (   $a_path)

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

4180 {
4181 $this->export_image_path = (string) $a_path;
4182 }

◆ setExternalId()

assQuestion::setExternalId (   $external_id)
Parameters
string$external_id

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

908 {
909 $this->external_id = $external_id;
910 }

References $external_id.

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setForcePassResultUpdateEnabled()

static assQuestion::setForcePassResultUpdateEnabled (   $forcePassResultsUpdateEnabled)
static

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

333 {
334 self::$forcePassResultsUpdateEnabled = $forcePassResultsUpdateEnabled;
335 }

References $forcePassResultsUpdateEnabled.

◆ setId()

◆ setLastChange()

assQuestion::setLastChange (   $lastChange)

Reimplemented in assMultipleChoice.

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

4619 {
4620 $this->lastChange = $lastChange;
4621 }

References $lastChange.

Referenced by assKprimChoice\loadFromDb().

+ Here is the caller graph for this function:

◆ setNewOriginalId()

assQuestion::setNewOriginalId (   $newId)
Deprecated:

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

2617 {
2618 self::saveOriginalId($this->getId(), $newId);
2619 }
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 5293 of file class.assQuestion.php.

5294 {
5295 $this->obligationsToBeConsidered = $obligationsToBeConsidered;
5296 }

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

640 {
641 $this->outputType = $outputType;
642 }

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

4232 {
4233 $this->prevent_rte_usage = $a_val;
4234 }

◆ setProcessLocker()

assQuestion::setProcessLocker (   $processLocker)
Parameters
\ilAssQuestionProcessLocker$processLocker

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

509 {
510 $this->processLocker = $processLocker;
511 }

References $processLocker.

◆ setQuestion()

◆ setResultGateway()

static assQuestion::setResultGateway (   $resultGateway)
static
Parameters
\ilObjTestGateway$resultGateway

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

4968 {
4969 self::$resultGateway = $resultGateway;
4970 }

References $resultGateway.

◆ setSelfAssessmentEditingMode()

assQuestion::setSelfAssessmentEditingMode (   $a_selfassessmenteditingmode)

Set Self-Assessment Editing Mode.

Parameters
boolean$a_selfassessmenteditingmodeSelf-Assessment Editing Mode

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

4280 {
4281 $this->selfassessmenteditingmode = $a_selfassessmenteditingmode;
4282 }

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

653 {
654 if ($shuffle) {
655 $this->shuffle = 1;
656 } else {
657 $this->shuffle = 0;
658 }
659 }

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

501 {
502 $this->shuffler = $shuffler;
503 }

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

4984 {
4985 $this->step = $step;
4986 }

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

2751 {
2752 if (strcmp($solution_id, "") != 0) {
2753 $import_id = "";
2754 if ($is_import) {
2755 $import_id = $solution_id;
2756 $solution_id = $this->_resolveInternalLink($import_id);
2757 }
2758 $this->suggested_solutions[$subquestion_index] = array(
2759 "internal_link" => $solution_id,
2760 "import_id" => $import_id
2761 );
2762 }
2763 }

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

616 {
617 $this->test_id = $id;
618 }

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

5002 {
5005 return gmdate('H:i:s', $time);
5006 }
static convertISO8601FormatH_i_s_ExtendedToSeconds($time)

References $time, and convertISO8601FormatH_i_s_ExtendedToSeconds().

Referenced by ilTestQuestionsTableGUI\fillRow(), and ilQuestionBrowserTableGUI\fillRow().

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

827 {
828 return false;
829 }

Referenced by requiresJsSwitch().

+ Here is the caller graph for this function:

◆ supportsNonJsOutput()

assQuestion::supportsNonJsOutput ( )

Reimplemented in assMatchingQuestion, assOrderingHorizontal, and assOrderingQuestion.

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

832 {
833 return true;
834 }

Referenced by requiresJsSwitch().

+ Here is the caller graph for this function:

◆ syncSkillAssignments()

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

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

4389 {
4390 global $ilDB;
4391
4392 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentList.php';
4393 $assignmentList = new ilAssQuestionSkillAssignmentList($ilDB);
4394 $assignmentList->setParentObjId($trgParentId);
4395 $assignmentList->setQuestionIdFilter($trgQuestionId);
4396 $assignmentList->loadFromDb();
4397
4398 foreach ($assignmentList->getAssignmentsByQuestionId($trgQuestionId) as $assignment) {
4399 /* @var ilAssQuestionSkillAssignment $assignment */
4400
4401 $assignment->deleteFromDb();
4402 }
4403
4404 $this->duplicateSkillAssignments($srcParentId, $srcQuestionId, $trgParentId, $trgQuestionId);
4405 }

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

2798 {
2799 global $ilLog;
2800
2801 $filepath = $this->getSuggestedSolutionPath();
2802 $filepath_original = str_replace("/$this->id/solution", "/$original_id/solution", $filepath);
2803 ilUtil::delDir($filepath_original);
2804 foreach ($this->suggested_solutions as $index => $solution) {
2805 if (strcmp($solution["type"], "file") == 0) {
2806 if (!file_exists($filepath_original)) {
2807 ilUtil::makeDirParents($filepath_original);
2808 }
2809 $filename = $solution["value"]["name"];
2810 if (strlen($filename)) {
2811 if (!@copy($filepath . $filename, $filepath_original . $filename)) {
2812 $ilLog->write("File could not be duplicated!!!!", $ilLog->ERROR);
2813 $ilLog->write("object: " . print_r($this, true), $ilLog->ERROR);
2814 }
2815 }
2816 }
2817 }
2818 }

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

3092 {
3093 global $ilDB;
3094
3095 if (!$this->getOriginalId()) {
3096 return;
3097 }
3098
3099 $originalObjId = self::lookupOriginalParentObjId($this->getOriginalId());
3100
3101 if (!$originalObjId) {
3102 return;
3103 }
3104
3105 $id = $this->getId();
3106 $objId = $this->getObjId();
3107 $original = $this->getOriginalId();
3108
3109 $this->beforeSyncWithOriginal($original, $id, $originalObjId, $objId);
3110
3111 $this->setId($original);
3112 $this->setOriginalId(null);
3113 $this->setObjId($originalObjId);
3114
3115 $this->saveToDb();
3116
3117 $this->deletePageOfQuestion($original);
3118 $this->createPageObject();
3119 $this->copyPageOfQuestion($id);
3120
3121 $this->setId($id);
3122 $this->setOriginalId($original);
3123 $this->setObjId($objId);
3124
3125 $this->updateSuggestedSolutions($original);
3127
3128 $this->afterSyncWithOriginal($original, $id, $originalObjId, $objId);
3129 $this->syncHints();
3130 }
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 $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 2270 of file class.assQuestion.php.

2271 {
2272 include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
2273 $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $this->getId());
2274 foreach ($mobs as $mob) {
2275 ilObjMediaObject::_saveUsage($mob, "qpl:html", $this->original_id);
2276 }
2277 }

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

547 {
548 include_once "./Modules/TestQuestionPool/classes/export/qti12/class." . $this->getQuestionType() . "Export.php";
549 $classname = $this->getQuestionType() . "Export";
550 $export = new $classname($this);
551 return $export->toXML($a_include_header, $a_include_binary, $a_shuffle, $test_output, $force_image_references);
552 }

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

4823 {
4824 global $ilDB;
4825
4826 $fieldData = array(
4827 "value1" => array("clob", $value1),
4828 "value2" => array("clob", $value2),
4829 "tstamp" => array("integer", time()),
4830 'authorized' => array('integer', (int) $authorized)
4831 );
4832
4833 if ($this->getStep() !== null) {
4834 $fieldData['step'] = array("integer", $this->getStep());
4835 }
4836
4837 return $ilDB->update("tst_solutions", $fieldData, array(
4838 'solution_id' => array('integer', $solutionId)
4839 ));
4840 }

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

4844 {
4845 global $ilDB;
4846
4847 $fieldData = array(
4848 'authorized' => array('integer', (int) $authorized)
4849 );
4850
4851 if (!$keepTime) {
4852 $fieldData['tstamp'] = array('integer', time());
4853 }
4854
4855 $whereData = array(
4856 'question_fi' => array('integer', $this->getId()),
4857 'active_fi' => array('integer', $activeId),
4858 'pass' => array('integer', $pass)
4859 );
4860
4861 if ($this->getStep() !== null) {
4862 $whereData['step'] = array("integer", $this->getStep());
4863 }
4864
4865 return $ilDB->update('tst_solutions', $fieldData, $whereData);
4866 }

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

5299 {
5300 global $ilDB;
5301
5302 $ilDB->manipulateF(
5303 "UPDATE qpl_questions SET tstamp = %s WHERE question_id = %s",
5304 array('integer', 'integer'),
5305 array(time(), $this->getId())
5306 );
5307 }

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

1325 {
1326 return true;
1327 }

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 2378 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(), assErrorText\addErrorData(), assMatchingQuestion\addMatchingPair(), adjustReachedPointsByScoringOptions(), assClozeTest\calculateCombinationResult(), assErrorText\calculateReachedPoints(), assFileUpload\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 5318 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 4870 of file class.assQuestion.php.

Referenced by getKeyValuesImplosionSeparator().


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