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

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 public

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

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

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. ...
comment()
Definition: comment.php:2
redirection script todo: (a better solution should control the processing via a xml file) ...
Create styles array
The data for the language used.
setExternalId($external_id)
setQuestion($question="")
Sets the question string of the question object.
global $ilDB
+ Here is the call graph for this function:

Member Function Documentation

◆ __get()

assQuestion::__get (   $value)

Object getter.

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

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

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.
getPoints()
Returns the maximum available points for the question.
getObjId()
Get the object id of the container object.
getShuffle()
Gets the shuffle flag.
getTestId()
Gets the test id of the assQuestion object.
getAuthor()
Gets the authors name of the assQuestion object.
getQuestion()
Gets the question string of the question object.
getComment()
Gets the comment string of the assQuestion object.
getOwner()
Gets the creator/owner ID of the assQuestion object.
getEstimatedWorkingTime()
Gets the estimated working time of a question.
getTitle()
Gets the title string of the assQuestion object.
getOutputType()
Gets the output type.
getSuggestedSolutions()
Return the suggested solutions.
+ Here is the call graph for this function:

◆ __set()

assQuestion::__set (   $key,
  $value 
)

Object setter.

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

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

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  }
setId($id=-1)
Sets the id of the assQuestion object.
setEstimatedWorkingTime($hour=0, $min=0, $sec=0)
Sets the estimated working time of a question from given hour, minute and second. ...
setShuffle($shuffle=true)
Sets the shuffle flag.
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.
setQuestion($question="")
Sets the question string of the question object.
setTestId($id=-1)
Sets the test id of the assQuestion object.
setOriginalId($original_id)
setTitle($title="")
Sets the title string of the assQuestion object.
setObjId($obj_id=0)
Set the object id of the container object.
$key
Definition: croninfo.php:18
setComment($comment="")
Sets the comment string of the assQuestion object.
setOwner($owner="")
Sets the creator/owner ID of the assQuestion object.
+ 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.

References $ilDB, $res, and array.

Referenced by ilCourseObjectiveResult\getStatus().

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
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ _getInternalLinkHref()

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

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

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

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

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  }
$type
$_GET["client_id"]
$target_id
Definition: goto.php:49
Create styles array
The data for the language used.
global $ilDB
+ 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.

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

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

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
Create styles array
The data for the language used.
global $ilDB
+ 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 public

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

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

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

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  }
$result
Create styles array
The data for the language used.
global $ilDB
+ 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.

References $ilDB, $result, and array.

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

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  }
$result
Create styles array
The data for the language used.
global $ilDB
+ 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.

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

Referenced by ilLMQuestionListTableGUI\fillRow().

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  }
$result
Create styles array
The data for the language used.
global $ilDB
+ 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 private

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

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

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

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  }
$result
Create styles array
The data for the language used.
global $ilDB
+ 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.

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

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

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  }
$result
Create styles array
The data for the language used.
global $ilDB
+ 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 public

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

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

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

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  }
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get plugin object.
const IL_COMP_MODULE
+ 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.

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

Referenced by ilTestScoringByQuestionsGUI\__construct(), ilTestScoringGUI\buildManScoringParticipantForm(), ilTestServiceGUI\getPassListOfAnswersWithScoring(), and ilTestPlayerDynamicQuestionSetGUI\isQuestionAnsweredCorrect().

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.
$result
Create styles array
The data for the language used.
global $ilDB
+ 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 public

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

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

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

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  }
$result
Create styles array
The data for the language used.
global $ilDB
+ 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 public

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

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

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  }
$result
Create styles array
The data for the language used.
global $ilDB

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

References $ilDB, $result, and array.

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  }
$result
Create styles array
The data for the language used.
global $ilDB

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

References $question, and _instanciateQuestion().

Referenced by ilObjTest\getTestResult().

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

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

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

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  }
$result
Create styles array
The data for the language used.
global $ilDB
+ 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.

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

Referenced by getTotalAnswers().

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  }
$result
Create styles array
The data for the language used.
global $ilDB
+ 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.

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

Referenced by ilQuestionCumulatedStatisticsTableGUI\initData().

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  }
$result
static _getMaximumPoints($question_id)
Returns the maximum points, a learner can reach answering the question.
Create styles array
The data for the language used.
global $ilDB
$key
Definition: croninfo.php:18
+ 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 public

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

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

3880  {
3881  if (self::isCoreQuestionType($question_type)) {
3882  self::includeCoreClass($question_type, $gui);
3883  } else {
3884  self::includePluginClass($question_type, $gui);
3885  }
3886  }
+ 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
The question gui instance
Deprecated:
Use instantiateQuestionGUI (without legacy underscore & typos) instead. public

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

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

3985  {
3986  return self::instantiateQuestionGUI($question_id);
3987  }
+ 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.

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

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

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 _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
global $ilDB
+ 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 public

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

References $ilDB, $pass, $result, array, and calculateReachedPoints().

Referenced by ilObjQuestionPool\getDeleteableQuestionDetails().

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  }
$result
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:
+ 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.

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

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

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 _getSolutionMaxPass($question_id, $active_id)
Returns the maximum pass a users question solution.
$result
Create styles array
The data for the language used.
global $ilDB
+ 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 public

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

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

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

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.
$result
Create styles array
The data for the language used.
global $ilDB
+ 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.

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

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

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.
static _getQuestionType($question_id)
Returns the question type of a question with a given id.
+ 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 public

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

References $ilDB, $result, and array.

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  }
$result
Create styles array
The data for the language used.
global $ilDB

◆ _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 public

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

References $ilDB, $result, and array.

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  }
$result
Create styles array
The data for the language used.
global $ilDB

◆ _questionExistsInTest()

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

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

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

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

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  }
$result
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ _resolveInternalLink()

assQuestion::_resolveInternalLink (   $internal_link)

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

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

Referenced by _resolveIntLinks(), and setSuggestedSolution().

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

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

Referenced by ilContObjParser\processPagesToParse().

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  }
$result
Create styles array
The data for the language used.
global $ilDB
_resolveInternalLink($internal_link)
+ 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 public

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

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

Referenced by ilTestScoringByQuestionsGUI\__construct(), assFileUpload\handleSubmission(), ilTestScoring\recalculatePass(), and ilTestScoringGUI\saveManScoringParticipantScreen().

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  }
static _getUserIdFromActiveId($active_id)
static logAction($logtext="", $active_id="", $question_id="")
Logs an action into the Test&Assessment log.
static _getParticipantData($active_id)
Retrieves a participant name from active id.
static _getSolutionMaxPass($question_id, $active_id)
Returns the maximum pass a users question solution.
$result
static _getLogLanguage()
retrieve the log language for assessment logging
static _enabledAssessmentLogging()
check wether assessment logging is enabled or not
$ilUser
Definition: imgupload.php:18
static _updateObjectiveResult($a_user_id, $a_active_id, $a_question_id)
Create styles array
The data for the language used.
global $ilDB
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ 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

Move this to a proper place.

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

References $data, $ilDB, $pass, $processLocker, $query, $result, $row, $time, ilObjTest\_getQuestionCountAndPointsForPassOfParticipant(), ilObjTest\_getResultPass(), ilObjTest\_getWorkingTimeOfParticipantForPass(), array, ilObjTest\buildExamId(), and time.

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

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  }
$result
executeUserTestResultUpdateLockOperation(callable $operation)
static _getResultPass($active_id)
Retrieves the pass number that should be counted for a given user.
$query
Create styles array
The data for the language used.
global $ilDB
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ 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 public

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

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

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  }
getId()
Gets the id of the assQuestion object.
static _getMobsOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
get mobs of object
isHTML($a_text)
Checks if a given string contains HTML 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
Class ilObjMediaObject.
Create styles array
The data for the language used.
static _exists($a_id, $a_reference=false, $a_type=null)
checks wether a lm content object with specified id exists or not
+ 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.

Referenced by ilObjQuestionPool\addQuestionChangeListeners().

4555  {
4556  $this->questionChangeListeners[] = $listener;
4557  }
+ 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.

public

Parameters
integer$points
integer$active_id
integer$pass

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

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

Referenced by calculateResultsFromSolution(), and getAdjustedReachedPoints().

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 _getScoreCutting($active_id)
Determines if the score of a question should be cut at 0 points or the score of the whole test...
static _getCountSystem($active_id)
Gets the count system for the calculation of points.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ afterSyncWithOriginal()

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

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

Referenced by syncWithOriginal().

2665  {
2666  // sync question feeback
2667  $this->feedbackOBJ->syncFeedback($origQuestionId, $dupQuestionId);
2668  }
+ Here is the caller graph for this function:

◆ areObligationsToBeConsidered()

assQuestion::areObligationsToBeConsidered ( )
Returns
boolean

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

References $obligationsToBeConsidered.

Referenced by resetUsersAnswer().

5286  {
5288  }
+ Here is the caller graph for this function:

◆ authorizedOrIntermediateSolutionExists()

assQuestion::authorizedOrIntermediateSolutionExists (   $active_id,
  $pass 
)

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

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

5043  {
5044  $solutionAvailability = $this->lookupForExistingSolutions($active_id, $pass);
5045  return (bool) $solutionAvailability['authorized'] || (bool) $solutionAvailability['intermediate'];
5046  }
+ Here is the call graph for this function:

◆ authorizedSolutionExists()

assQuestion::authorizedSolutionExists (   $active_id,
  $pass 
)

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

References $pass.

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

◆ beforeSyncWithOriginal()

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

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

Referenced by syncWithOriginal().

2661  {
2662  }
+ 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.

Referenced by assKprimChoice\handleFileUpload().

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

◆ buildImagePath()

assQuestion::buildImagePath (   $questionId,
  $parentObjectId 
)

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

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

1640  {
1641  return CLIENT_WEB_DIR . "/assessment/{$parentObjectId}/{$questionId}/images/";
1642  }
+ Here is the caller graph for this function:

◆ buildQuestionDataQuery()

assQuestion::buildQuestionDataQuery ( )
protected

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

Referenced by assKprimChoice\loadFromDb().

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

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

Referenced by getTestPresentationConfig().

5342  {
5343  include_once('Modules/TestQuestionPool/classes/class.ilTestQuestionConfig.php');
5344  return new ilTestQuestionConfig();
5345  }
Test Question configuration.
+ Here is the caller graph for this function:

◆ calculateReachedPoints()

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

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

The points are calculated from the given answers.

public

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

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

+ Here is the caller graph for this function:

◆ calculateReachedPointsFromPreviewSession()

assQuestion::calculateReachedPointsFromPreviewSession ( ilAssQuestionPreviewSession  $previewSession)

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

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

Referenced by isPreviewSolutionCorrect().

3372  {
3373  $reachedPoints = $this->calculateReachedPointsForSolution($previewSession->getParticipantsSolution());
3374  $reachedPoints = $this->deductHintPointsFromReachedPoints($previewSession, $reachedPoints);
3375 
3376  return $this->ensureNonNegativePoints($reachedPoints);
3377  }
ensureNonNegativePoints($points)
deductHintPointsFromReachedPoints(ilAssQuestionPreviewSession $previewSession, $reachedPoints)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calculateResultsFromSolution()

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

Calculates the question results from a previously saved question solution.

ilDBInterface $ilDB ilObjUser $ilUser

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

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

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

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

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  }
static logAction($logtext="", $active_id="", $question_id="")
Logs an action into the Test&Assessment log.
getId()
Gets the id of the assQuestion object.
static _getPass($active_id)
Retrieves the actual pass of a given user for a given test.
adjustReachedPointsByScoringOptions($points, $active_id, $pass=null)
Adjust the given reached points by checks for all special scoring options in the test container...
isAnswered($active_id, $pass=null)
returns boolean wether the question is answered during test pass or not
calculateReachedPoints($active_id, $pass=null, $authorizedSolution=true, $returndetails=false)
Returns the points, a learner has reached answering the question.
static isQuestionObligatory($question_id)
checks wether the question with given id is marked as obligatory or not
static _getLogLanguage()
retrieve the log language for assessment logging
static _enabledAssessmentLogging()
check wether assessment logging is enabled or not
$ilUser
Definition: imgupload.php:18
$query
static _updateObjectiveResult($a_user_id, $a_active_id, $a_question_id)
Create styles array
The data for the language used.
global $ilDB
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ 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.

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

Referenced by copySuggestedSolutionFiles(), and saveToDb().

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

References $time.

Referenced by sumTimesInISO8601FormatH_i_s_Extended().

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

◆ copyPageOfQuestion()

assQuestion::copyPageOfQuestion (   $a_q_id)

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

References $page, and $xml.

Referenced by syncWithOriginal().

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

References $filename, $id, $ilDB, $ilLog, $index, $original_id, $type, ilInternalLink\_deleteAllLinksOfSource(), ilRTE\_replaceMediaObjectImageSrc(), ilInternalLink\_saveLink(), array, cleanupMediaObjectUsage(), getId(), getSuggestedSolutionPath(), ilUtil\makeDirParents(), syncSuggestedSolutionFiles(), and time.

Referenced by onCopy().

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  }
static makeDirParents($a_dir)
Create a new directory and all parent directories.
getSuggestedSolutionPath()
Returns the path for a suggested solution.
$index
Definition: metadata.php:60
+ 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.

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

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  }
getId()
Gets the id of the assQuestion object.
static _getMobsOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
get mobs of object
$mobs
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.
+ 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.

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

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  }
getId()
Gets the id of the assQuestion object.
$_GET["client_id"]
createPageObject()
create page object of question
setId($id=-1)
Sets the id of the assQuestion object.
getAdditionalContentEditingMode()
getter for additional content editing mode for this question
getObjId()
Get the object id of the container object.
getAuthor()
Gets the authors name of the assQuestion object.
getQuestionTypeID()
Returns the question type of the question.
static _lookupObjId($a_id)
$ilUser
Definition: imgupload.php:18
getDefaultNrOfTries()
Get Default Nr of Tries.
Create styles array
The data for the language used.
getEstimatedWorkingTime()
Gets the estimated working time of a question.
global $ilDB
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
$_POST["username"]
+ 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.

References getId(), and getObjId().

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

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  }
getId()
Gets the id of the assQuestion object.
Question page object.
getObjId()
Get the object id of the container object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createRandomSolution()

assQuestion::createRandomSolution (   $test_id,
  $user_id 
)

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 private

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

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

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 
2094  $this->deleteTaxonomyAssignments();
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.
static _getMobsOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
get mobs of object
$result
deleteAnswers($question_id)
Deletes datasets from answers tables.
deleteAdditionalTableData($question_id)
Deletes datasets from the additional question table in the database.
static _removeUsage($a_mob_id, $a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
Remove usage of mob in another container.
getObjId()
Get the object id of the container object.
static deleteHintsByQuestionIds($questionIds)
Deletes all question hints relating to questions included in given question ids.
static _updateQuestionCount($object_id)
Updates the number of available questions for a question pool in the database.
$mobs
Class ilObjMediaObject.
Create styles array
The data for the language used.
isAdditionalContentEditingModePageObject()
isser for additional "pageobject" content editing mode
global $ilDB
static _exists($a_id, $a_reference=false, $a_type=null)
checks wether a lm content object with specified id exists or not
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
+ 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 public

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

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

Referenced by delete().

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.
Create styles array
The data for the language used.
global $ilDB
if(empty($password)) $table
Definition: pwgen.php:24
+ 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 public

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

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

Referenced by delete().

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  }
Create styles array
The data for the language used.
global $ilDB
getAnswerTableName()
Returns the name of the answer table in the database.
if(empty($password)) $table
Definition: pwgen.php:24
+ 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.

References getSolutionValues(), and removeSolutionRecordById().

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

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)
+ 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 protected

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

References $page.

Referenced by delete(), and syncWithOriginal().

1966  {
1967  include_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php";
1968  $page = new ilAssQuestionPage($question_id);
1969  $page->delete();
1970  return true;
1971  }
Question page object.
+ 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.

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

Referenced by assImagemapQuestion\saveWorkingData().

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  }
getId()
Gets the id of the assQuestion object.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
$query
Create styles array
The data for the language used.
global $ilDB
+ 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.

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

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  }
getId()
Gets the id of the assQuestion object.
getSuggestedSolutionPath()
Returns the path for a suggested solution.
Create styles array
The data for the language used.
global $ilDB
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
+ Here is the call graph for this function:

◆ deleteTaxonomyAssignments()

assQuestion::deleteTaxonomyAssignments ( )
private

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

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

Referenced by delete().

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  }
getId()
Gets the id of the assQuestion object.
Taxonomy node <-> item assignment.
static getUsageOfObject($a_obj_id, $a_include_titles=false)
Get usage of object.
getObjId()
Get the object id of the container object.
+ 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

Referenced by toJSON().

+ Here is the caller graph for this function:

◆ duplicateIntermediateSolutionAuthorized()

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

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

References getSolutionValues(), and saveCurrentSolution().

Referenced by forceExistingIntermediateSolution().

4937  {
4938  foreach ($this->getSolutionValues($activeId, $passIndex, false) as $rec) {
4939  $this->saveCurrentSolution($activeId, $passIndex, $rec['value1'], $rec['value2'], true, $rec['tstamp']);
4940  }
4941  }
getSolutionValues($active_id, $pass=null, $authorized=true)
Loads solutions of a given user from the database an returns it.
saveCurrentSolution($active_id, $pass, $value1, $value2, $authorized=true, $tstamp=null)
+ 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.

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

Referenced by onCopy(), and onDuplicate().

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  }
getId()
Gets the id of the assQuestion object.
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 ...
isAdditionalContentEditingModePageObject()
isser for additional "pageobject" content editing mode
+ 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.

References $ilDB.

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

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  }
global $ilDB
+ 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.

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

Referenced by onDuplicate().

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  }
static makeDirParents($a_dir)
Create a new directory and all parent directories.
getSuggestedSolutionPath()
Returns the path for a suggested solution.
$index
Definition: metadata.php:60
+ 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.

References $pass, and lookupCurrentTestPass().

Referenced by assFileUpload\saveWorkingData().

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

Referenced by assImagemapQuestion\getReuseSolutionSelectionParameter().

4880  {
4881  return explode(self::getKeyValuesImplosionSeparator(), $keyValues);
4882  }
+ Here is the caller graph for this function:

◆ fetchIndexedValuesFromValuePairs()

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

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

References array.

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

5272  {
5273  $indexedValues = array();
5274 
5275  foreach ($valuePairs as $valuePair) {
5276  $indexedValues[ $valuePair['value1'] ] = $valuePair['value2'];
5277  }
5278 
5279  return $indexedValues;
5280  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ fetchMimeTypeIdentifier()

static assQuestion::fetchMimeTypeIdentifier (   $contentTypeString)
static

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

Referenced by ilQtiMatImageSecurity\validateContent().

348  {
349  return current(explode(';', $contentTypeString));
350  }
+ 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.

References array.

5257  {
5258  $valuePairs = array();
5259 
5260  foreach ($indexedValues as $value1 => $value2) {
5261  $valuePairs[] = array('value1' => $value1, 'value2' => $value2);
5262  }
5263 
5264  return $valuePairs;
5265  }
Create styles array
The data for the language used.

◆ fixSvgToPng()

assQuestion::fixSvgToPng (   $imageFilenameContainingString)

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

Referenced by getSuggestedSolutionOutput().

2387  {
2388  $needles = array_keys(self::$imageSourceFixReplaceMap);
2389  $replacements = array_values(self::$imageSourceFixReplaceMap);
2390  return str_replace($needles, $replacements, $imageFilenameContainingString);
2391  }
+ Here is the caller graph for this function:

◆ fixUnavailableSkinImageSources()

assQuestion::fixUnavailableSkinImageSources (   $html)

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

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

Referenced by getSuggestedSolutionOutput().

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)
Create styles array
The data for the language used.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
$html
Definition: example_001.php:87
+ 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.

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

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

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)
getSolutionValues($active_id, $pass=null, $authorized=true)
Loads solutions of a given user from the database an returns it.
updateCurrentSolutionsAuthorization($activeId, $pass, $authorized, $keepTime=false)
saveCurrentSolution($active_id, $pass, $value1, $value2, $authorized=true, $tstamp=null)
+ 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

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

References getSelfAssessmentFormatter().

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

4211  {
4212  return $this->getSelfAssessmentFormatter()->format($a_q);
4213  }
+ 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 public

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

References getQuestionType().

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

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

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

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  }
$result
Create styles array
The data for the language used.
global $ilDB

◆ getAdditionalContentEditingMode()

assQuestion::getAdditionalContentEditingMode ( )

getter for additional content editing mode for this question

public

Returns
string

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

References $additinalContentEditingMode.

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

4490  {
4492  }
+ 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 public

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

Referenced by deleteAdditionalTableData().

1891  {
1892  return "";
1893  }
+ 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.

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

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  }
getId()
Gets the id of the assQuestion object.
static _getPass($active_id)
Retrieves the actual pass of a given user for a given test.
adjustReachedPointsByScoringOptions($points, $active_id, $pass=null)
Adjust the given reached points by checks for all special scoring options in the test container...
calculateReachedPoints($active_id, $pass=null, $authorizedSolution=true, $returndetails=false)
Returns the points, a learner has reached answering the question.
+ Here is the call graph for this function:

◆ getAllowedFileExtensionsForMimeType()

static assQuestion::getAllowedFileExtensionsForMimeType (   $mimeType)
static

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

References array.

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  }
Create styles array
The data for the language used.

◆ getAllowedImageMaterialFileExtensions()

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

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

References array.

Referenced by ilImageWizardInputGUI\__construct().

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  }
Create styles array
The data for the language used.
+ 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 public

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

Referenced by deleteAnswers().

1902  {
1903  return "";
1904  }
+ 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 public
See also
$author

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

References $author.

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

864  {
865  return $this->author;
866  }
+ 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 public
See also
$comment

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

References $comment.

Referenced by __get(), and saveQuestionDataToDb().

804  {
805  return $this->comment;
806  }
+ 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$authorizedilDBInterface $ilDB
Returns
object

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

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

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

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  }
getId()
Gets the id of the assQuestion object.
$query
Create styles array
The data for the language used.
global $ilDB
+ 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.

References $defaultnroftries.

Referenced by createNewQuestion().

4310  {
4311  return (int) $this->defaultnroftries;
4312  }
+ 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 public
See also
$est_working_time

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

References $est_working_time, and array.

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

849  {
850  if (!$this->est_working_time) {
851  $this->est_working_time = array("h" => 0, "m" => 0, "s" => 0);
852  }
854  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ getExternalId()

assQuestion::getExternalId ( )
Returns
string

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

References $external_id, and getId().

Referenced by createNewQuestion(), and saveQuestionDataToDb().

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  }
getId()
Gets the id of the assQuestion object.
+ 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.

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

3899  {
3900  return str_replace('ass', 'ilAss', $questionType) . 'Feedback';
3901  }
+ 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

public

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

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

1651  {
1652  return CLIENT_WEB_DIR . "/assessment/$this->obj_id/$this->id/flash/";
1653  }
+ 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

public

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

References ilUtil\removeTrailingPathSeparators().

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  }
static removeTrailingPathSeparators($path)
+ Here is the call graph for this function:

◆ getGuiClassNameByQuestionType()

static assQuestion::getGuiClassNameByQuestionType (   $questionType)
static

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

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

3889  {
3890  return $questionType . 'GUI';
3891  }
+ Here is the caller graph for this function:

◆ getHtmlQuestionContentPurifier()

assQuestion::getHtmlQuestionContentPurifier ( )
Returns
ilAssHtmlUserSolutionPurifier

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

References ilHtmlPurifierFactory\_getInstanceByType().

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

◆ getHtmlUserSolutionPurifier()

assQuestion::getHtmlUserSolutionPurifier ( )
Returns
ilAssHtmlUserSolutionPurifier

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

References ilHtmlPurifierFactory\_getInstanceByType().

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

4592  {
4593  require_once 'Services/Html/classes/class.ilHtmlPurifierFactory.php';
4594  return ilHtmlPurifierFactory::_getInstanceByType('qpl_usersolution');
4595  }
static _getInstanceByType($a_type)
Factory method for creating purifier instances.
+ 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 public
See also
$id

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

References $id.

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

768  {
769  return $this->id;
770  }
+ 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

public

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

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

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

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

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.

References $export_image_path, and ilUtil\removeTrailingPathSeparators().

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

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 {
1695  return $this->export_image_path;
1696  }
1697  }
$export_image_path
(Web) Path to images
static removeTrailingPathSeparators($path)
+ 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.

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

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  }
getId()
Gets the id of the assQuestion object.
$result
static _lookupTitle($a_id)
lookup object title
static _getAllReferences($a_id)
get all reference ids of object
static _lookupAuthor($obj_id)
Gets the authors name of the ilObjTest object.
Create styles array
The data for the language used.
global $ilDB
$key
Definition: croninfo.php:18
+ 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

public

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

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

1616  {
1617  return CLIENT_WEB_DIR . "/assessment/$this->obj_id/$this->id/java/";
1618  }
+ 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

public

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

References ilUtil\removeTrailingPathSeparators().

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  }
static removeTrailingPathSeparators($path)
+ Here is the call graph for this function:

◆ getKeyValuesImplosionSeparator()

static assQuestion::getKeyValuesImplosionSeparator ( )
staticprotected

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

4872  {
4873  return self::KEY_VALUES_IMPLOSION_SEPARATOR;
4874  }

◆ getLastChange()

assQuestion::getLastChange ( )

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

References $lastChange.

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

◆ getMaximumPoints()

assQuestion::getMaximumPoints ( )

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

public

See also
$points

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

References $points.

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

1125  {
1126  return $this->points;
1127  }
+ 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

protected ilDBInterface $ilDB

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

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

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

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

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  }
foreach($_POST as $key=> $value) $res
$query
Create styles array
The data for the language used.
global $ilDB
+ 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  }

◆ getObjId()

assQuestion::getObjId ( )

Get the object id of the container object.

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

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

References $obj_id.

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

888  {
889  return $this->obj_id;
890  }
+ Here is the caller graph for this function:

◆ getOriginalId()

assQuestion::getOriginalId ( )

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

References $original_id.

Referenced by __get(), assSingleChoice\syncImages(), assMultipleChoice\syncImages(), assMultipleChoice\syncWithOriginal(), assImagemapQuestion\syncWithOriginal(), and syncWithOriginal().

2374  {
2375  return $this->original_id;
2376  }
+ Here is the caller graph for this function:

◆ getOutputType()

assQuestion::getOutputType ( )

Gets the output type.

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

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

References $outputType.

Referenced by __get().

816  {
817  return $this->outputType;
818  }
+ 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 public
See also
$owner

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

References $owner.

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

876  {
877  return $this->owner;
878  }
+ Here is the caller graph for this function:

◆ getPageOfQuestion()

assQuestion::getPageOfQuestion ( )

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

References $page.

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

◆ getPoints()

◆ getPreventRteUsage()

assQuestion::getPreventRteUsage ( )

Get prevent rte usage.

Returns
boolean prevent rte usage

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

References $prevent_rte_usage.

4242  {
4243  return $this->prevent_rte_usage;
4244  }

◆ getProcessLocker()

◆ getQuestion()

◆ getQuestionAction()

assQuestion::getQuestionAction ( )
protected
Returns
string

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

References $_POST.

Referenced by assFileUpload\isFileDeletionAction().

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  }
$_POST["username"]
+ Here is the caller graph for this function:

◆ getQuestionChangeListeners()

assQuestion::getQuestionChangeListeners ( )
Returns
array[ilQuestionChangeListener]

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

References $questionChangeListeners.

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

4563  {
4565  }
+ 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.

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

Referenced by ilTestOutputGUI\handlePrimaryButton().

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  }
foreach($_POST as $key=> $value) $res
$query
Create styles array
The data for the language used.
global $ilDB
+ 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

Referenced by fromXML(), getQuestionTypeID(), setExportDetailsXLS(), setQuestion(), 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.

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

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

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  }
$result
Create styles array
The data for the language used.
global $ilDB
+ 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 public

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

References $ilDB, $result, $row, array, getId(), and getQuestionType().

Referenced by createNewQuestion(), and saveQuestionDataToDb().

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  }
$result
getQuestionType()
Returns the question type of the question.
Create styles array
The data for the language used.
global $ilDB
+ 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 public

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

References $pass, and getId().

Referenced by ilLOTestQuestionAdapter\updateQuestionResult().

1114  {
1115  return round(self::_getReachedPoints($active_id, $this->getId(), $pass), 2);
1116  }
getId()
Gets the id of the assQuestion object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getResultGateway()

static assQuestion::getResultGateway ( )
static
Returns

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

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

◆ getRTETextWithMediaObjects()

assQuestion::getRTETextWithMediaObjects ( )
protected

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

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

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

Referenced by cleanupMediaObjectUsage().

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  }
getId()
Gets the id of the assQuestion object.
static getListByQuestionId($questionId)
instantiates a question hint list for the passed question id
getQuestion()
Gets the question string of the question object.
+ 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.

References $selfassessmenteditingmode.

Referenced by ilAssQuestionAuthoringFormGUI\addGenericAssessmentQuestionCommandButtons().

4290  {
4292  }
+ Here is the caller graph for this function:

◆ getSelfAssessmentFormatter()

assQuestion::getSelfAssessmentFormatter ( )
protected
Returns

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

Referenced by formatSAQuestion().

4219  {
4220  require_once 'Modules/TestQuestionPool/classes/questions/class.ilAssSelfAssessmentQuestionFormatter.php';
4221  return new \ilAssSelfAssessmentQuestionFormatter();
4222  }
+ Here is the caller graph for this function:

◆ getShuffle()

assQuestion::getShuffle ( )

Gets the shuffle flag.

Returns
boolean The shuffle flag public
See also
$shuffle

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

References $shuffle.

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

780  {
781  return $this->shuffle;
782  }
+ Here is the caller graph for this function:

◆ getShuffler()

assQuestion::getShuffler ( )

◆ getSolutionMaxPass()

◆ getSolutionRecordById()

assQuestion::getSolutionRecordById (   $solutionId)
protected
Parameters
$solutionIdilDBInterface $ilDB
Returns
int

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

References $GLOBALS, $ilDB, $res, $row, and array.

Referenced by assFileUpload\saveWorkingData().

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  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
foreach($_POST as $key=> $value) $res
Create styles array
The data for the language used.
global $ilDB
+ 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.

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

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

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

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  }
getId()
Gets the id of the assQuestion object.
$result
getSolutionMaxPass($active_id)
Returns the maximum pass a users question solution.
$query
Create styles array
The data for the language used.
global $ilDB
+ 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 public

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

References array.

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  }
Create styles array
The data for the language used.

◆ getSuggestedSolutionOutput()

assQuestion::getSuggestedSolutionOutput ( )

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

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

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  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
static _getInternalLinkHref($target="")
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\+" &#(? foreach( $entity_files as $file) $output
getSuggestedSolutionPathWeb()
Returns the web path for a suggested solution.
static signFile($path_to_file)
Create styles array
The data for the language used.
fixSvgToPng($imageFilenameContainingString)
prepareTextareaOutput($txt_output, $prepare_for_latex_output=false, $omitNl2BrWhenTextArea=false)
Prepares a string for a text area output in tests.
static setTokenMaxLifetimeInSeconds($token_max_lifetime_in_seconds)
fixUnavailableSkinImageSources($html)
+ Here is the call graph for this function:

◆ getSuggestedSolutionPath()

assQuestion::getSuggestedSolutionPath ( )

Returns the path for a suggested solution.

public

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

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

1605  {
1606  return CLIENT_WEB_DIR . "/assessment/$this->obj_id/$this->id/solution/";
1607  }
+ Here is the caller graph for this function:

◆ getSuggestedSolutionPathWeb()

assQuestion::getSuggestedSolutionPathWeb ( )

Returns the web path for a suggested solution.

public

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

References ilUtil\removeTrailingPathSeparators().

Referenced by getSuggestedSolutionOutput().

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  }
static removeTrailingPathSeparators($path)
+ 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.

References $suggested_solutions.

Referenced by __get().

1073  {
1075  }
+ 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 public

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

References $title.

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  }

◆ getTestId()

assQuestion::getTestId ( )

Gets the test id of the assQuestion object.

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

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

References $test_id.

Referenced by __get(), and resetUsersAnswer().

792  {
793  return $this->test_id;
794  }
+ Here is the caller graph for this function:

◆ getTestOutputSolutions()

assQuestion::getTestOutputSolutions (   $activeId,
  $pass 
)

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

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

Referenced by assOrderingQuestion\getSolutionOrderingElementListForTestOutput().

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  }
getSolutionValues($active_id, $pass=null, $authorized=true)
Loads solutions of a given user from the database an returns it.
getUserSolutionPreferingIntermediate($active_id, $pass=null)
getTestPresentationConfig()
Get the test question configuration (initialised once)
+ 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.

References $testQuestionConfigInstance, and buildTestPresentationConfig().

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

5325  {
5326  if ($this->testQuestionConfigInstance === null) {
5327  $this->testQuestionConfigInstance = $this->buildTestPresentationConfig();
5328  }
5329 
5331  }
buildTestPresentationConfig()
build basic test question configuration instance
+ 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.

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

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
getTitle()
Gets the title string of the assQuestion object.
+ 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.

References _getTotalAnswers().

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

◆ getUserSolutionPreferingIntermediate()

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

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

References $pass, and getSolutionValues().

Referenced by getTestOutputSolutions().

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  }
getSolutionValues($active_id, $pass=null, $authorized=true)
Loads solutions of a given user from the database an returns it.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getValidAdditionalContentEditingModes()

assQuestion::getValidAdditionalContentEditingModes ( )

getter for valid additional content editing modes

public

Returns
array

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

References array.

Referenced by isValidAdditionalContentEditingMode(), and setAdditionalContentEditingMode().

4544  {
4545  return array(
4546  self::ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT,
4547  self::ADDITIONAL_CONTENT_EDITING_MODE_PAGE_OBJECT
4548  );
4549  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ implodeKeyValues()

static assQuestion::implodeKeyValues (   $keyValues)
static

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

Referenced by assImagemapQuestionGUI\buildSelectionParameter().

4876  {
4877  return implode(self::getKeyValuesImplosionSeparator(), $keyValues);
4878  }
+ 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  }

◆ includePluginClass()

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

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

References array, ilPlugin\getPluginObject(), and IL_COMP_MODULE.

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  }
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get plugin object.
const IL_COMP_MODULE
Create styles array
The data for the language used.
+ Here is the call 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
The question gui instance

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

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

Referenced by ilObjTestGUI\copyQuestionToPool(), ilScoringAdjustmentGUI\dispatchCommand(), ilAssQuestionPreviewGUI\initQuestion(), and ilScoringAdjustmentGUI\outputAdjustQuestionForm().

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  }
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
static _enabledAssessmentLogging()
check wether assessment logging is enabled or not
$ilUser
Definition: imgupload.php:18
global $ilDB
+ 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.

References $pass.

Referenced by assFileUpload\saveWorkingData().

5033  {
5034  $solutionAvailability = $this->lookupForExistingSolutions($active_id, $pass);
5035  return (bool) $solutionAvailability['intermediate'];
5036  }
+ Here is the caller graph for this function:

◆ isAdditionalContentEditingModePageObject()

assQuestion::isAdditionalContentEditingModePageObject ( )

isser for additional "pageobject" content editing mode

public

Returns
boolean

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

References ADDITIONAL_CONTENT_EDITING_MODE_PAGE_OBJECT, and getAdditionalContentEditingMode().

Referenced by delete(), and duplicateQuestionHints().

4517  {
4519  }
const ADDITIONAL_CONTENT_EDITING_MODE_PAGE_OBJECT
constant for additional content editing mode "pageobject"
getAdditionalContentEditingMode()
getter for additional content editing mode for this question
+ 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.

Referenced by ilQtiMatImageSecurity\validateLabel().

371  {
372  return in_array(
373  strtolower($fileExtension),
374  self::getAllowedFileExtensionsForMimeType($mimeType)
375  );
376  }
+ Here is the caller graph for this function:

◆ isAllowedImageMimeType()

static assQuestion::isAllowedImageMimeType (   $mimeType)
static

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

Referenced by ilQtiMatImageSecurity\validateContent().

343  {
344  return (bool) count(self::getAllowedFileExtensionsForMimeType($mimeType));
345  }
+ 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

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

Referenced by calculateResultsFromSolution().

4420  {
4421  return true;
4422  }
+ Here is the caller graph for this function:

◆ isAutosaveable()

assQuestion::isAutosaveable ( )

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 public

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

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

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  }
$result
Create styles array
The data for the language used.
global $ilDB

◆ isComplete()

assQuestion::isComplete ( )

Returns true, if a question is complete for use.

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

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

Referenced by saveQuestionDataToDb(), and saveToDb().

561  {
562  return false;
563  }
+ 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  }

◆ isFileAvailable()

static assQuestion::isFileAvailable (   $file)
static

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

References $file.

Referenced by assMatchingQuestion\copyImages().

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  }
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
+ Here is the caller graph for this function:

◆ isForcePassResultUpdateEnabled()

static assQuestion::isForcePassResultUpdateEnabled ( )
static

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

338  {
339  return self::$forcePassResultsUpdateEnabled;
340  }

◆ isHTML()

assQuestion::isHTML (   $a_text)

Checks if a given string contains HTML or not.

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

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

References ilUtil\isHTML().

Referenced by addQTIMaterial().

3488  {
3489  return ilUtil::isHTML($a_text);
3490  }
static isHTML($a_text)
Checks if a given string contains HTML or not.
+ 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. public

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

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

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  }
getId()
Gets the id of the assQuestion object.
$result
Create styles array
The data for the language used.
global $ilDB
+ 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.

References $_POST.

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

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  }
$_POST["username"]
+ 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

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

Referenced by assMultipleChoice\isAnswered().

4437  {
4438  return false;
4439  }
+ Here is the caller graph for this function:

◆ isPreviewSolutionCorrect()

assQuestion::isPreviewSolutionCorrect ( ilAssQuestionPreviewSession  $previewSession)

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

References calculateReachedPointsFromPreviewSession(), and getMaximumPoints().

3385  {
3386  $reachedPoints = $this->calculateReachedPointsFromPreviewSession($previewSession);
3387 
3388  if ($reachedPoints < $this->getMaximumPoints()) {
3389  return false;
3390  }
3391 
3392  return true;
3393  }
getMaximumPoints()
Returns the maximum points, a learner can reach answering the question.
calculateReachedPointsFromPreviewSession(ilAssQuestionPreviewSession $previewSession)
+ 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

public

Parameters
string$additionalContentEditingMode
Returns
boolean $isValidAdditionalContentEditingMode

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

References getValidAdditionalContentEditingModes().

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

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

References $key.

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  }
$key
Definition: croninfo.php:18

◆ lmMigrateQuestionTypeGenericContent()

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

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

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

Referenced by migrateContentForLearningModule().

4262  {
4263  $this->setQuestion($migrator->migrateToLmContent($this->getQuestion()));
4264  }
setQuestion($question="")
Sets the question string of the question object.
+ 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

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

Referenced by migrateContentForLearningModule().

4270  {
4271  // overwrite if any question type specific content except feedback needs to be migrated
4272  }
+ 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 public

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

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

Referenced by assNumeric\saveToDb().

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  }
getId()
Gets the id of the assQuestion object.
$result
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...
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller 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.

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

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

469  {
471  $message = $this->lng->txtlng('assessment', $langVar, ilObjAssessmentFolder::_getLogLanguage());
472  assQuestion::logAction($message, $active_id, $this->getId());
473  }
474  }
static logAction($logtext="", $active_id="", $question_id="")
Logs an action into the Test&Assessment log.
getId()
Gets the id of the assQuestion object.
static _getLogLanguage()
retrieve the log language for assessment logging
catch(Exception $e) $message
static _enabledAssessmentLogging()
check wether assessment logging is enabled or not
+ 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.

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

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

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,
1572  $original_id
1573  );
1574  }
getId()
Gets the id of the assQuestion object.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
static _getObjectIDFromActiveID($active_id)
Returns the ILIAS test object id for a given active id.
static _addLog($user_id, $object_id, $logtext, $question_id="", $original_id="", $test_only=false, $test_ref_id=null)
Add an assessment log entry.
+ 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.

References ilObjTest\_getPass().

Referenced by ensureCurrentTestPass().

437  {
438  require_once 'Modules/Test/classes/class.ilObjTest.php';
439  return ilObjTest::_getPass($active_id);
440  }
static _getPass($active_id)
Retrieves the actual pass of a given user for a given test.
+ 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)

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  }

◆ lookupParentObjId()

static assQuestion::lookupParentObjId (   $questionId)
static

ilDBInterface $ilDB

Parameters
integer$questionId
Returns
integer $parentObjectId

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

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

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

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  }
foreach($_POST as $key=> $value) $res
$query
Create styles array
The data for the language used.
global $ilDB
+ 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.

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

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  }
$query
Create styles array
The data for the language used.
global $ilDB

◆ lookupTestId()

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

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

References $GLOBALS, $ilDB, $result, $row, and array.

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

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  }
$result
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
Create styles array
The data for the language used.
global $ilDB
+ 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.

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

Referenced by ilAssSelfAssessmentQuestionFormatter\prepareQuestionForLearningModule().

4250  {
4251  $this->lmMigrateQuestionTypeGenericContent($migrator);
4252  $this->lmMigrateQuestionTypeSpecificContent($migrator);
4253  $this->saveToDb();
4254 
4255  $this->feedbackOBJ->migrateContentForLearningModule($migrator, $this->getId());
4256  }
getId()
Gets the id of the assQuestion object.
saveToDb($original_id="")
Saves the question to the database.
lmMigrateQuestionTypeSpecificContent(ilAssSelfAssessmentMigrator $migrator)
lmMigrateQuestionTypeGenericContent(ilAssSelfAssessmentMigrator $migrator)
+ 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.

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

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  }
$query
Create styles array
The data for the language used.
global $ilDB

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

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

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

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  }
if($format !==null) $name
Definition: metadata.php:146
static createDirectory($a_dir, $a_mod=0755)
create directory
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
+ Here is the call graph for this function:

◆ notifyQuestionCreated()

assQuestion::notifyQuestionCreated ( )
private

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

References getQuestionChangeListeners().

Referenced by createNewQuestion().

4568  {
4569  foreach ($this->getQuestionChangeListeners() as $listener) {
4570  $listener->notifyQuestionCreated($this);
4571  }
4572  }
+ 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.

References getQuestionChangeListeners().

Referenced by delete().

4582  {
4583  foreach ($this->getQuestionChangeListeners() as $listener) {
4584  $listener->notifyQuestionDeleted($this);
4585  }
4586  }
+ 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.

References getQuestionChangeListeners().

Referenced by saveToDb().

4575  {
4576  foreach ($this->getQuestionChangeListeners() as $listener) {
4577  $listener->notifyQuestionEdited($this);
4578  }
4579  }
+ 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.

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

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

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

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  }
duplicateSkillAssignments($srcParentId, $srcQuestionId, $trgParentId, $trgQuestionId)
duplicateQuestionHints($originalQuestionId, $duplicateQuestionId)
duplicateSuggestedSolutionFiles($parent_id, $question_id)
Duplicates the files of a suggested solution if the question is duplicated.
+ Here is the call graph for this function:

◆ originalQuestionExists()

static assQuestion::originalQuestionExists (   $questionId)
static

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

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

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

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  }
foreach($_POST as $key=> $value) $res
$query
Create styles array
The data for the language used.
global $ilDB
+ 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 public

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

References $key, $keys, $result, and array.

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  }
$result
$keys
Create styles array
The data for the language used.
$key
Definition: croninfo.php:18

◆ persistPreviewState()

assQuestion::persistPreviewState ( ilAssQuestionPreviewSession  $previewSession)
final

persists the preview state for current user and question

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

References savePreviewData(), and validateSolutionSubmit().

1319  {
1320  $this->savePreviewData($previewSession);
1321  return $this->validateSolutionSubmit();
1322  }
savePreviewData(ilAssQuestionPreviewSession $previewSession)
+ 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

public

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

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

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

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  }
static _getPass($active_id)
Retrieves the actual pass of a given user for a given test.
calculateResultsFromSolution($active_id, $pass=null, $obligationsEnabled=false)
Calculates the question results from a previously saved question solution.
reworkWorkingData($active_id, $pass, $obligationsAnswered, $authorized)
Reworks the allready saved working data if neccessary.
saveWorkingData($active_id, $pass=null, $authorized=true)
Saves the learners input of the question to the database.
removeIntermediateSolution($active_id, $pass)
+ 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 public

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

References ilUtil\prepareTextareaOutput().

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

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

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

References $_SESSION, $i, $result, and array.

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"]
$result
Create styles array
The data for the language used.
$i
Definition: disco.tpl.php:19

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

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

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

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  }
$result
Create styles array
The data for the language used.
global $ilDB

◆ removeCurrentSolution()

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

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

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

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

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  }
getId()
Gets the id of the assQuestion object.
$query
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeExistingSolutions()

assQuestion::removeExistingSolutions (   $activeId,
  $pass 
)

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

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

Referenced by resetUsersAnswer().

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  }
getId()
Gets the id of the assQuestion object.
$query
Create styles array
The data for the language used.
global $ilDB
+ 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$authorizedilDBInterface $ilDB
Returns
int

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

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

Referenced by persistWorkingState().

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

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

Referenced by resetUsersAnswer().

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  }
getId()
Gets the id of the assQuestion object.
$query
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeSolutionRecordById()

assQuestion::removeSolutionRecordById (   $solutionId)
protected
Parameters
$solutionIdilDBInterface $ilDB
Returns
int

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

References $ilDB, and array.

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

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  }
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ requiresJsSwitch()

assQuestion::requiresJsSwitch ( )

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

References supportsJavascriptOutput(), and supportsNonJsOutput().

837  {
838  return $this->supportsJavascriptOutput() && $this->supportsNonJsOutput();
839  }
supportsJavascriptOutput()
Returns true if the question type supports JavaScript output.
+ Here is the call graph for this function:

◆ resetOriginalId()

static assQuestion::resetOriginalId (   $questionId)
static

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

References $GLOBALS, $query, array, and time.

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

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  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
$query
Create styles array
The data for the language used.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ Here is the caller graph for this function:

◆ resetUsersAnswer()

assQuestion::resetUsersAnswer (   $activeId,
  $pass 
)

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

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

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)
getTestId()
Gets the test id of the assQuestion object.
log($active_id, $langVar)
removeExistingSolutions($activeId, $pass)
+ 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

Referenced by persistWorkingState(), and validateSolutionSubmit().

+ 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$tstampilDBInterface $ilDB
Returns
int

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

References $ilDB, $pass, array, getId(), getStep(), and time.

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

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  }
getId()
Gets the id of the assQuestion object.
Create styles array
The data for the language used.
global $ilDB
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ 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.

References $GLOBALS, $query, array, and time.

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

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  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
$query
Create styles array
The data for the language used.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ Here is the caller graph for this function:

◆ savePreviewData()

assQuestion::savePreviewData ( ilAssQuestionPreviewSession  $previewSession)
protected

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

References ilAssQuestionPreviewSession\setParticipantsSolution().

Referenced by persistPreviewState().

1350  {
1351  $previewSession->setParticipantsSolution($this->getSolutionSubmit());
1352  }
+ 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.

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

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

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  }
getId()
Gets the id of the assQuestion object.
createPageObject()
create page object of question
setId($id=-1)
Sets the id of the assQuestion object.
getAdditionalContentEditingMode()
getter for additional content editing mode for this question
getMaximumPoints()
Returns the maximum points, a learner can reach answering the question.
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...
getObjId()
Get the object id of the container object.
getAuthor()
Gets the authors name of the assQuestion object.
getQuestionTypeID()
Returns the question type of the question.
isComplete()
Returns true, if a question is complete for use.
getQuestion()
Gets the question string of the question object.
getComment()
Gets the comment string of the assQuestion object.
Create styles array
The data for the language used.
getOwner()
Gets the creator/owner ID of the assQuestion object.
getEstimatedWorkingTime()
Gets the estimated working time of a question.
global $ilDB
getTitle()
Gets the title string of the assQuestion object.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ 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_idpublic

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

References $ilDB, ilObjQuestionPool\_updateQuestionCount(), array, cleanupMediaObjectUsage(), getId(), getOwner(), isComplete(), notifyQuestionEdited(), and time.

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

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  }
getId()
Gets the id of the assQuestion object.
static _updateQuestionCount($object_id)
Updates the number of available questions for a question pool in the database.
isComplete()
Returns true, if a question is complete for use.
redirection script todo: (a better solution should control the processing via a xml file) ...
cleanupMediaObjectUsage()
synchronises appearances of media objects in the question with media object usage table ...
Create styles array
The data for the language used.
getOwner()
Gets the creator/owner ID of the assQuestion object.
global $ilDB
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ 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.

public

Parameters
integer$active_idActive id of the user
integer$passTest pass
Returns
boolean $status

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

+ Here is the caller graph for this function:

◆ setAdditionalContentEditingMode()

assQuestion::setAdditionalContentEditingMode (   $additinalContentEditingMode)

setter for additional content editing mode for this question

public

Returns
string

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

References $additinalContentEditingMode, and getValidAdditionalContentEditingModes().

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

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  }
getValidAdditionalContentEditingModes()
getter for valid additional content editing modes
+ 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 public
See also
$author

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

References $author.

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

718  {
719  if (!$author) {
720  $author = $this->ilias->account->fullname;
721  }
722  $this->author = $author;
723  }
redirection script todo: (a better solution should control the processing via a xml file) ...
+ 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 public
See also
$comment

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

References array.

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

672  {
673  $this->est_working_time = array("h" => (int) $hour, "m" => (int) $min, "s" => (int) $sec);
674  }
Create styles array
The data for the language used.
+ 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.

References array.

Referenced by assKprimChoice\loadFromDb().

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  }
Create styles array
The data for the language used.
+ 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

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

References $worksheet, getQuestionType(), and getTitle().

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
getQuestionType()
Returns the question type of the question.
getTitle()
Gets the title string of the assQuestion object.
+ Here is the call graph for this function:

◆ setExportImagePath()

assQuestion::setExportImagePath (   $a_path)

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

References string.

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

◆ setExternalId()

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

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

References $external_id.

Referenced by __construct().

908  {
909  $this->external_id = $external_id;
910  }
+ Here is the caller graph for this function:

◆ setForcePassResultUpdateEnabled()

static assQuestion::setForcePassResultUpdateEnabled (   $forcePassResultsUpdateEnabled)
static

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

References $forcePassResultsUpdateEnabled.

Referenced by ilTestScoring\recalculatePass().

333  {
334  self::$forcePassResultsUpdateEnabled = $forcePassResultsUpdateEnabled;
335  }
static $forcePassResultsUpdateEnabled
+ Here is the caller graph for this function:

◆ setId()

◆ setLastChange()

assQuestion::setLastChange (   $lastChange)

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

References $lastChange.

Referenced by assKprimChoice\loadFromDb().

4619  {
4620  $this->lastChange = $lastChange;
4621  }
+ Here is the caller graph for this function:

◆ setNewOriginalId()

assQuestion::setNewOriginalId (   $newId)
Deprecated:

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

References getId().

2617  {
2618  self::saveOriginalId($this->getId(), $newId);
2619  }
getId()
Gets the id of the assQuestion object.
+ 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.

References $obligationsToBeConsidered.

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

◆ setOriginalId()

◆ setOutputType()

assQuestion::setOutputType (   $outputType = OUTPUT_HTML)

Sets the output type.

Parameters
integer$outputTypeThe output type of the question public
See also
$outputType

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

References $outputType.

Referenced by __set().

640  {
641  $this->outputType = $outputType;
642  }
+ Here is the caller graph for this function:

◆ setOwner()

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

References $processLocker.

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

◆ setQuestion()

◆ setResultGateway()

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

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

References $resultGateway.

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

◆ 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 public
See also
$shuffle

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

References $shuffle.

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

653  {
654  if ($shuffle) {
655  $this->shuffle = 1;
656  } else {
657  $this->shuffle = 0;
658  }
659  }
+ 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.

References $shuffler.

Referenced by assMatchingQuestion\toJSON().

501  {
502  $this->shuffler = $shuffler;
503  }
+ 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.

References $step.

Referenced by assFileUpload\deleteUploadedFiles().

4984  {
4985  $this->step = $step;
4986  }
+ Here is the caller graph for this function:

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

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

References _resolveInternalLink(), and array.

Referenced by assFileUpload\loadFromDb(), assFlashQuestion\loadFromDb(), and assFormulaQuestion\loadFromDb().

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  }
Create styles array
The data for the language used.
_resolveInternalLink($internal_link)
+ 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 public
See also
$test_id

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

References $id.

Referenced by __set().

616  {
617  $this->test_id = $id;
618  }
+ 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.

References $time, and convertISO8601FormatH_i_s_ExtendedToSeconds().

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

5002  {
5005  return gmdate('H:i:s', $time);
5006  }
static convertISO8601FormatH_i_s_ExtendedToSeconds($time)
$time
Definition: cron.php:21
+ 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 public

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

Referenced by requiresJsSwitch().

827  {
828  return false;
829  }
+ Here is the caller graph for this function:

◆ supportsNonJsOutput()

assQuestion::supportsNonJsOutput ( )

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

Referenced by requiresJsSwitch().

832  {
833  return true;
834  }
+ Here is the caller graph for this function:

◆ syncSkillAssignments()

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

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

References $ilDB, and duplicateSkillAssignments().

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  }
duplicateSkillAssignments($srcParentId, $srcQuestionId, $trgParentId, $trgQuestionId)
global $ilDB
+ 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.

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

Referenced by copySuggestedSolutionFiles().

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  }
static makeDirParents($a_dir)
Create a new directory and all parent directories.
getSuggestedSolutionPath()
Returns the path for a suggested solution.
$index
Definition: metadata.php:60
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ syncWithOriginal()

assQuestion::syncWithOriginal ( )

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

References $id, $ilDB, afterSyncWithOriginal(), beforeSyncWithOriginal(), copyPageOfQuestion(), createPageObject(), deletePageOfQuestion(), getId(), getObjId(), getOriginalId(), saveToDb(), setId(), setObjId(), setOriginalId(), and syncXHTMLMediaObjectsOfQuestion().

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  }
deletePageOfQuestion($question_id)
Deletes the page object of a question with a given ID.
afterSyncWithOriginal($origQuestionId, $dupQuestionId, $origParentObjId, $dupParentObjId)
getId()
Gets the id of the assQuestion object.
saveToDb($original_id="")
Saves the question to the database.
copyPageOfQuestion($a_q_id)
createPageObject()
create page object of question
setId($id=-1)
Sets the id of the assQuestion object.
beforeSyncWithOriginal($origQuestionId, $dupQuestionId, $origParentObjId, $dupParentObjId)
getObjId()
Get the object id of the container object.
global $ilDB
setOriginalId($original_id)
setObjId($obj_id=0)
Set the object id of the container object.
+ Here is the call graph for this function:

◆ syncXHTMLMediaObjectsOfQuestion()

assQuestion::syncXHTMLMediaObjectsOfQuestion ( )

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

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

Referenced by syncWithOriginal().

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  }
getId()
Gets the id of the assQuestion object.
static _getMobsOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
get mobs of object
$mobs
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.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toJSON()

assQuestion::toJSON ( )

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

References $author, $owner, $title, array, and duplicate().

5025  {
5026  return json_encode(array());
5027  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:

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

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

References getQuestionType().

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  }
getQuestionType()
Returns the question type of the question.
+ 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$authorizedilDBInterface $ilDB
Returns
int

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

References $ilDB, array, getStep(), and time.

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

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  }
Create styles array
The data for the language used.
global $ilDB
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ 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.

References $ilDB, $pass, array, getId(), getStep(), and time.

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

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  }
getId()
Gets the id of the assQuestion object.
Create styles array
The data for the language used.
global $ilDB
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ 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.

References $ilDB, array, getId(), and time.

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  }
getId()
Gets the id of the assQuestion object.
Create styles array
The data for the language used.
global $ilDB
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ Here is the call graph for this function:

◆ validateSolutionSubmit()

assQuestion::validateSolutionSubmit ( )

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

References $pass, reworkWorkingData(), and saveWorkingData().

Referenced by persistPreviewState(), and persistWorkingState().

1325  {
1326  return true;
1327  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $additinalContentEditingMode

assQuestion::$additinalContentEditingMode = null
private

◆ $allowedCharsetsByMimeType

assQuestion::$allowedCharsetsByMimeType
staticprotected
Initial value:
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:
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:
'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

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

Referenced by setForcePassResultUpdateEnabled().

◆ $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:
'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 assOrderingHorizontal\copyObject(), assFileUpload\copyObject(), assNumeric\copyObject(), assTextQuestion\copyObject(), assImagemapQuestion\copyObject(), assErrorText\copyObject(), assOrderingQuestion\copyObject(), assFlashQuestion\copyObject(), assTextSubset\copyObject(), assSingleChoice\copyObject(), assMultipleChoice\copyObject(), assJavaApplet\copyObject(), assMatchingQuestion\copyObject(), assLongMenu\copyObject(), assFormulaQuestion\copyObject(), assKprimChoice\copyObject(), assClozeTest\copyObject(), copySuggestedSolutionFiles(), assLongMenu\delete(), assOrderingHorizontal\duplicate(), assFileUpload\duplicate(), assNumeric\duplicate(), assTextQuestion\duplicate(), assImagemapQuestion\duplicate(), assOrderingQuestion\duplicate(), assErrorText\duplicate(), assFlashQuestion\duplicate(), assTextSubset\duplicate(), assSingleChoice\duplicate(), assMultipleChoice\duplicate(), assJavaApplet\duplicate(), assMatchingQuestion\duplicate(), assLongMenu\duplicate(), assKprimChoice\duplicate(), assFormulaQuestion\duplicate(), assClozeTest\duplicate(), assTextQuestion\duplicateAnswers(), getOriginalId(), assSingleChoice\isComplete(), logAction(), saveQuestionDataToDb(), assOrderingHorizontal\saveToDb(), assErrorText\saveToDb(), assFlashQuestion\saveToDb(), assFileUpload\saveToDb(), assNumeric\saveToDb(), assTextSubset\saveToDb(), assTextQuestion\saveToDb(), assMatchingQuestion\saveToDb(), assImagemapQuestion\saveToDb(), assOrderingQuestion\saveToDb(), assMultipleChoice\saveToDb(), assLongMenu\saveToDb(), assJavaApplet\saveToDb(), assClozeTest\saveToDb(), assFormulaQuestion\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(), assTextSubset\addAnswer(), assSingleChoice\addAnswer(), assMultipleChoice\addAnswer(), assImagemapQuestion\addAnswer(), assTextQuestion\addAnswer(), assErrorText\addErrorData(), assMatchingQuestion\addMatchingPair(), adjustReachedPointsByScoringOptions(), assClozeTest\calculateCombinationResult(), assOrderingHorizontal\calculateReachedPoints(), assFileUpload\calculateReachedPoints(), assErrorText\calculateReachedPoints(), assFlashQuestion\calculateReachedPoints(), assKprimChoice\calculateReachedPoints(), assTextSubset\calculateReachedPoints(), assTextQuestion\calculateReachedPoints(), assSingleChoice\calculateReachedPoints(), assMultipleChoice\calculateReachedPoints(), assLongMenu\calculateReachedPoints(), assJavaApplet\calculateReachedPoints(), assImagemapQuestion\calculateReachedPoints(), assMatchingQuestion\calculateReachedPoints(), assFormulaQuestion\calculateReachedPoints(), assTextQuestion\calculateReachedPointsForSolution(), assLongMenu\calculateReachedPointsForSolution(), assKprimChoice\calculateReachedPointsForSolution(), assOrderingHorizontal\calculateReachedPointsForSolution(), assTextSubset\calculateReachedPointsForSolution(), assImagemapQuestion\calculateReachedPointsForSolution(), assMultipleChoice\calculateReachedPointsForSolution(), assMatchingQuestion\calculateReachedPointsForSolution(), assClozeTest\calculateReachedPointsForSolution(), assNumeric\calculateReachedPointsFromPreviewSession(), assFlashQuestion\calculateReachedPointsFromPreviewSession(), assSingleChoice\calculateReachedPointsFromPreviewSession(), assJavaApplet\calculateReachedPointsFromPreviewSession(), assFormulaQuestion\calculateReachedPointsFromPreviewSession(), assLongMenu\checkQuestionCustomPart(), ensureNonNegativePoints(), assErrorText\getBestSelection(), assNumeric\getExpressionTypes(), assOrderingHorizontal\getExpressionTypes(), assTextSubset\getExpressionTypes(), assImagemapQuestion\getExpressionTypes(), assSingleChoice\getExpressionTypes(), assErrorText\getExpressionTypes(), assMultipleChoice\getExpressionTypes(), assFormulaQuestion\getExpressionTypes(), assOrderingQuestion\getExpressionTypes(), assMatchingQuestion\getExpressionTypes(), assClozeTest\getExpressionTypes(), assClozeTest\getMaximumGapPoints(), assLongMenu\getMaximumPoints(), assTextQuestion\getMaximumPoints(), assFlashQuestion\getMaximumPoints(), assTextSubset\getMaximumPoints(), assSingleChoice\getMaximumPoints(), assMultipleChoice\getMaximumPoints(), assImagemapQuestion\getMaximumPoints(), assClozeTest\getMaximumPoints(), assFormulaQuestion\getMaximumPoints(), assMatchingQuestion\getMaximumPoints(), getMaximumPoints(), assTextQuestion\getMinimumPoints(), getPoints(), assLongMenu\getPointsForGap(), assErrorText\getPointsForSelectedPositions(), assLongMenu\getUserQuestionResult(), assJavaApplet\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 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 assFileUpload\deleteUploadedFiles(), 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 assLongMenu\__construct(), assOrderingHorizontal\__construct(), assFlashQuestion\__construct(), assErrorText\__construct(), assFormulaQuestion\__construct(), assNumeric\__construct(), assFileUpload\__construct(), assKprimChoice\__construct(), assImagemapQuestion\__construct(), assTextSubset\__construct(), assTextQuestion\__construct(), assSingleChoice\__construct(), assOrderingQuestion\__construct(), assMatchingQuestion\__construct(), assJavaApplet\__construct(), assMultipleChoice\__construct(), assClozeTest\__construct(), __construct(), assOrderingHorizontal\copyObject(), assFileUpload\copyObject(), assNumeric\copyObject(), assTextQuestion\copyObject(), assImagemapQuestion\copyObject(), assErrorText\copyObject(), assOrderingQuestion\copyObject(), assFlashQuestion\copyObject(), assTextSubset\copyObject(), assSingleChoice\copyObject(), assMultipleChoice\copyObject(), assJavaApplet\copyObject(), assMatchingQuestion\copyObject(), assLongMenu\copyObject(), assFormulaQuestion\copyObject(), assKprimChoice\copyObject(), assClozeTest\copyObject(), assOrderingHorizontal\duplicate(), assFileUpload\duplicate(), assNumeric\duplicate(), assTextQuestion\duplicate(), assImagemapQuestion\duplicate(), assOrderingQuestion\duplicate(), assErrorText\duplicate(), assFlashQuestion\duplicate(), assTextSubset\duplicate(), assSingleChoice\duplicate(), assMultipleChoice\duplicate(), assJavaApplet\duplicate(), assMatchingQuestion\duplicate(), assLongMenu\duplicate(), assKprimChoice\duplicate(), assFormulaQuestion\duplicate(), assClozeTest\duplicate(), getSuggestedSolutionTitle(), getTitle(), questionTitleExists(), setTitle(), and toJSON().

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


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