ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
assKprimChoice Class Reference
+ Inheritance diagram for assKprimChoice:
+ Collaboration diagram for assKprimChoice:

Public Member Functions

 __construct ($title='', $comment='', $author='', $owner=-1, $question='')
 assQuestion constructor More...
 
 getQuestionType ()
 Returns the question type of the question. 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...
 
 setShuffleAnswersEnabled ($shuffleAnswersEnabled)
 
 isShuffleAnswersEnabled ()
 
 setAnswerType ($answerType)
 
 getAnswerType ()
 
 setThumbSize ($thumbSize)
 
 getThumbSize ()
 
 setScorePartialSolutionEnabled ($scorePartialSolutionEnabled)
 
 isScorePartialSolutionEnabled ()
 
 setOptionLabel ($optionLabel)
 
 getOptionLabel ()
 
 setCustomTrueOptionLabel ($customTrueOptionLabel)
 
 getCustomTrueOptionLabel ()
 
 setCustomFalseOptionLabel ($customFalseOptionLabel)
 
 getCustomFalseOptionLabel ()
 
 setSpecificFeedbackSetting ($specificFeedbackSetting)
 
 getSpecificFeedbackSetting ()
 
 setAnswers ($answers)
 
 getAnswers ()
 
 getAnswer ($position)
 
 addAnswer (ilAssKprimChoiceAnswer $answer)
 
 loadFromDb ($questionId)
 Loads the question from the database. More...
 
 saveToDb ($originalId='')
 Saves the question to the database. More...
 
 saveAdditionalQuestionDataToDb ()
 Saves a record to the question types additional data table. More...
 
 saveAnswerSpecificDataToDb ()
 Saves the answer specific records into a question types answer table. More...
 
 isComplete ()
 Returns true, if a question is complete for use. More...
 
 calculateReachedPoints ($active_id, $pass=NULL, $authorizedSolution=true, $returndetails=FALSE)
 Returns the points, a learner has reached answering the question. More...
 
 getValidAnswerTypes ()
 
 isValidAnswerType ($answerType)
 
 isSingleLineAnswerType ($answerType)
 
 getAnswerTypeSelectOptions (ilLanguage $lng)
 
 getValidOptionLabels ()
 
 getValidOptionLabelsTranslated (ilLanguage $lng)
 
 isValidOptionLabel ($optionLabel)
 
 getTrueOptionLabelTranslation (ilLanguage $lng, $optionLabel)
 
 getFalseOptionLabelTranslation (ilLanguage $lng, $optionLabel)
 
 getInstructionTextTranslation (ilLanguage $lng, $optionLabel)
 
 isCustomOptionLabel ($labelValue)
 
 getThumbPrefix ()
 
 rebuildThumbnails ()
 
 handleFileUploads ($answers, $files)
 
 removeAnswerImage ($position)
 
 duplicate ($for_test=true, $title="", $author="", $owner="", $testObjId=null)
 
 createNewOriginalFromThisDuplicate ($targetParentId, $targetQuestionTitle="")
 
 copyObject ($target_questionpool_id, $title="")
 Copies an assMultipleChoice object. More...
 
 toJSON ()
 Returns a JSON representation of the question. More...
 
 getSpecificFeedbackAllCorrectOptionLabel ()
 
 isAnswered ($active_id, $pass=null)
 returns boolean wether the question is answered during test pass or not More...
 
 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
} More...
 
 moveAnswerDown ($position)
 
 moveAnswerUp ($position)
 
- Public Member Functions inherited from assQuestion
 __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...
 
 saveAdditionalQuestionDataToDb ()
 Saves a record to the question types additional data table. More...
 
 saveAnswerSpecificDataToDb ()
 Saves the answer specific records into a question types answer table. More...
 
 getSpecificFeedbackAllCorrectOptionLabel ()
 

Static Public Member Functions

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

Data Fields

const NUM_REQUIRED_ANSWERS = 4
 
const PARTIAL_SCORING_NUM_CORRECT_ANSWERS = 3
 
const ANSWER_TYPE_SINGLE_LINE = 'singleLine'
 
const ANSWER_TYPE_MULTI_LINE = 'multiLine'
 
const OPTION_LABEL_RIGHT_WRONG = 'right_wrong'
 
const OPTION_LABEL_PLUS_MINUS = 'plus_minus'
 
const OPTION_LABEL_APPLICABLE_OR_NOT = 'applicable_or_not'
 
const OPTION_LABEL_ADEQUATE_OR_NOT = 'adequate_or_not'
 
const OPTION_LABEL_CUSTOM = 'customlabel'
 
const DEFAULT_THUMB_SIZE = 150
 
const THUMB_PREFIX = 'thumb.'
 
- Data Fields inherited from assQuestion
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

 reworkWorkingData ($active_id, $pass, $obligationsAnswered, $authorized)
 {Reworks the allready saved working data if neccessary.
Parameters
integer$active_id
integer$pass
boolean$obligationsAnswered
boolean$authorized
} More...
 
 generateThumbForFile ($path, $file)
 
 getSolutionSubmit ()
 
 calculateReachedPointsForSolution ($found_values, $active_id=0)
 
 beforeSyncWithOriginal ($origQuestionId, $dupQuestionId, $origParentObjId, $dupParentObjId)
 
 afterSyncWithOriginal ($origQuestionId, $dupQuestionId, $origParentObjId, $dupParentObjId)
 
 getRTETextWithMediaObjects ()
 Collects all text in the question which could contain media objects which were created with the Rich Text Editor. More...
 
 lmMigrateQuestionTypeSpecificContent (ilAssSelfAssessmentMigrator $migrator)
 
- Protected Member Functions inherited from assQuestion
 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...
 

Private Member Functions

 loadAnswerData ($questionId)
 
 handleFileUpload (ilAssKprimChoiceAnswer $answer, $fileData)
 
 getNumAllowedFailures ()
 

Private Attributes

 $shuffleAnswersEnabled
 
 $answerType
 
 $thumbSize
 
 $scorePartialSolutionEnabled
 
 $optionLabel
 
 $customTrueOptionLabel
 
 $customFalseOptionLabel
 
 $specificFeedbackSetting
 
 $answers
 

Additional Inherited Members

- Static Protected Member Functions inherited from assQuestion
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 inherited from assQuestion
 $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 inherited from assQuestion
static $allowedFileExtensionsByMimeType
 
static $allowedCharsetsByMimeType
 
static $allowedImageMaterialFileExtensionsByMimeType
 
static $forcePassResultsUpdateEnabled = false
 
static $imageSourceFixReplaceMap
 

Detailed Description

Definition at line 15 of file class.assKprimChoice.php.

Constructor & Destructor Documentation

◆ __construct()

assKprimChoice::__construct (   $title = '',
  $comment = '',
  $author = '',
  $owner = -1,
  $question = '' 
)

assQuestion constructor

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

Reimplemented from assQuestion.

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

52 {
53 parent::__construct($title, $comment, $author, $owner, $question);
54
55 $this->shuffleAnswersEnabled = true;
56 $this->answerType = self::ANSWER_TYPE_SINGLE_LINE;
57 $this->thumbSize = self::DEFAULT_THUMB_SIZE;
58 $this->scorePartialSolutionEnabled = true;
59 $this->optionLabel = self::OPTION_LABEL_RIGHT_WRONG;
60 $this->customTrueOptionLabel = '';
61 $this->customFalseOptionLabel = '';
62
63 require_once 'Modules/TestQuestionPool/classes/feedback/class.ilAssConfigurableMultiOptionQuestionFeedback.php';
65
66 $this->answers = array();
67
68 $this->setPoints('');
69 }
setPoints($a_points)
Sets the maximum available points for the question.

References assQuestion\$author, assQuestion\$comment, assQuestion\$owner, assQuestion\$question, assQuestion\$title, ANSWER_TYPE_SINGLE_LINE, DEFAULT_THUMB_SIZE, ilAssConfigurableMultiOptionQuestionFeedback\FEEDBACK_SETTING_ALL, OPTION_LABEL_RIGHT_WRONG, and assQuestion\setPoints().

+ Here is the call graph for this function:

Member Function Documentation

◆ addAnswer()

assKprimChoice::addAnswer ( ilAssKprimChoiceAnswer  $answer)

Definition at line 189 of file class.assKprimChoice.php.

190 {
191 $this->answers[] = $answer;
192 }

◆ afterSyncWithOriginal()

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

Reimplemented from assQuestion.

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

894 {
895 parent::afterSyncWithOriginal($origQuestionId, $dupQuestionId, $origParentObjId, $dupParentObjId);
896
897 $this->cloneAnswerImages($dupQuestionId, $dupParentObjId, $origQuestionId, $origParentObjId);
898 }

◆ beforeSyncWithOriginal()

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

Reimplemented from assQuestion.

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

882 {
883 parent::beforeSyncWithOriginal($origQuestionId, $dupQuestionId, $origParentObjId, $dupParentObjId);
884
885 $question = self::_instanciateQuestion($origQuestionId);
886
887 foreach($question->getAnswers() as $answer)
888 {
889 $question->removeAnswerImage($answer->getPosition());
890 }
891 }
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.

References assQuestion\$question, and assQuestion\_instanciateQuestion().

+ Here is the call graph for this function:

◆ calculateReachedPoints()

assKprimChoice::calculateReachedPoints (   $active_id,
  $pass = NULL,
  $authorizedSolution = true,
  $returndetails = FALSE 
)

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

The points are calculated from the given answers.

@access public

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

Reimplemented from assQuestion.

Definition at line 458 of file class.assKprimChoice.php.

459 {
460 if( $returndetails )
461 {
462 throw new ilTestException('return details not implemented for '.__METHOD__);
463 }
464
465 global $ilDB;
466
467 $found_values = array();
468 if (is_null($pass))
469 {
470 $pass = $this->getSolutionMaxPass($active_id);
471 }
472
473 $result = $this->getCurrentSolutionResultSet($active_id, $pass, $authorizedSolution);
474
475 while ($data = $ilDB->fetchAssoc($result))
476 {
477 $found_values[(int)$data['value1']] = (int)$data['value2'];
478 }
479
480 $points = $this->calculateReachedPointsForSolution($found_values, $active_id);
481
482 return $points;
483 }
$result
calculateReachedPointsForSolution($found_values, $active_id=0)
getCurrentSolutionResultSet($active_id, $pass, $authorized=true)
Get a restulset for the current user solution for a this question by active_id and pass.
getSolutionMaxPass($active_id)
Returns the maximum pass a users question solution.
Base Exception for all Exceptions relating to Modules/Test.
global $ilDB

References $data, $ilDB, $pass, assQuestion\$points, $result, calculateReachedPointsForSolution(), assQuestion\getCurrentSolutionResultSet(), and assQuestion\getSolutionMaxPass().

+ Here is the call graph for this function:

◆ calculateReachedPointsForSolution()

assKprimChoice::calculateReachedPointsForSolution (   $found_values,
  $active_id = 0 
)
protected

Definition at line 712 of file class.assKprimChoice.php.

713 {
714 $numCorrect = 0;
715
716 foreach($this->getAnswers() as $key => $answer)
717 {
718 if( !isset($found_values[$answer->getPosition()]) )
719 {
720 continue;
721 }
722
723 if( $found_values[$answer->getPosition()] == $answer->getCorrectness() )
724 {
725 $numCorrect++;
726 }
727 }
728
729 if( $numCorrect >= self::NUM_REQUIRED_ANSWERS )
730 {
731 $points = $this->getPoints();
732 }
733 elseif( $this->isScorePartialSolutionEnabled() && $numCorrect >= self::PARTIAL_SCORING_NUM_CORRECT_ANSWERS )
734 {
735 $points = $this->getPoints() / 2;
736 }
737 else
738 {
739 $points = 0;
740 }
741
742 if($active_id)
743 {
744 include_once "./Modules/Test/classes/class.ilObjTest.php";
745 $mc_scoring = ilObjTest::_getMCScoring($active_id);
746 if(($mc_scoring == 0) && (count($found_values) == 0))
747 {
748 $points = 0;
749 }
750 }
751 return $points;
752 }
getPoints()
Returns the maximum available points for the question.
static _getMCScoring($active_id)
Gets the scoring type for multiple choice questions.

References assQuestion\$points, ilObjTest\_getMCScoring(), getAnswers(), assQuestion\getPoints(), and isScorePartialSolutionEnabled().

Referenced by calculateReachedPoints().

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

◆ copyObject()

assKprimChoice::copyObject (   $target_questionpool_id,
  $title = "" 
)

Copies an assMultipleChoice object.

Definition at line 850 of file class.assKprimChoice.php.

851 {
852 if ($this->id <= 0)
853 {
854 // The question has not been saved. It cannot be duplicated
855 return;
856 }
857 // duplicate the question in database
858 $clone = $this;
859 include_once ("./Modules/TestQuestionPool/classes/class.assQuestion.php");
861 $clone->id = -1;
862 $source_questionpool_id = $this->getObjId();
863 $clone->setObjId($target_questionpool_id);
864 if ($title)
865 {
866 $clone->setTitle($title);
867 }
868 $clone->saveToDb();
869 // copy question page content
870 $clone->copyPageOfQuestion($original_id);
871 // copy XHTML media objects
872 $clone->copyXHTMLMediaObjectsOfQuestion($original_id);
873 // duplicate the image
874 $clone->cloneAnswerImages($original_id, $source_questionpool_id, $clone->getId(), $clone->getObjId());
875
876 $clone->onCopy($source_questionpool_id, $original_id, $clone->getObjId(), $clone->getId());
877
878 return $clone->id;
879 }
static _getOriginalId($question_id)
Returns the original id of a question.
getObjId()
Get the object id of the container object.

References assQuestion\$original_id, assQuestion\$title, assQuestion\_getOriginalId(), and assQuestion\getObjId().

+ Here is the call graph for this function:

◆ createNewOriginalFromThisDuplicate()

assKprimChoice::createNewOriginalFromThisDuplicate (   $targetParentId,
  $targetQuestionTitle = "" 
)

Definition at line 810 of file class.assKprimChoice.php.

811 {
812 if ($this->id <= 0)
813 {
814 // The question has not been saved. It cannot be duplicated
815 return;
816 }
817
818 include_once ("./Modules/TestQuestionPool/classes/class.assQuestion.php");
819
820 $sourceQuestionId = $this->id;
821 $sourceParentId = $this->getObjId();
822
823 // duplicate the question in database
824 $clone = $this;
825 $clone->id = -1;
826
827 $clone->setObjId($targetParentId);
828
829 if ($targetQuestionTitle)
830 {
831 $clone->setTitle($targetQuestionTitle);
832 }
833
834 $clone->saveToDb();
835 // copy question page content
836 $clone->copyPageOfQuestion($sourceQuestionId);
837 // copy XHTML media objects
838 $clone->copyXHTMLMediaObjectsOfQuestion($sourceQuestionId);
839 // duplicate the image
840 $clone->cloneAnswerImages($sourceQuestionId, $sourceParentId, $clone->getId(), $clone->getObjId());
841
842 $clone->onCopy($sourceParentId, $sourceQuestionId, $targetParentId, $clone->getId());
843
844 return $clone->id;
845 }

References assQuestion\$id, and assQuestion\getObjId().

+ Here is the call graph for this function:

◆ duplicate()

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

Reimplemented from assQuestion.

Definition at line 754 of file class.assKprimChoice.php.

755 {
756 if ($this->id <= 0)
757 {
758 // The question has not been saved. It cannot be duplicated
759 return;
760 }
761 // duplicate the question in database
762 $this_id = $this->getId();
763 $thisObjId = $this->getObjId();
764
765 $clone = $this;
766 include_once ("./Modules/TestQuestionPool/classes/class.assQuestion.php");
768 $clone->id = -1;
769
770 if( (int)$testObjId > 0 )
771 {
772 $clone->setObjId($testObjId);
773 }
774
775 if ($title)
776 {
777 $clone->setTitle($title);
778 }
779
780 if ($author)
781 {
782 $clone->setAuthor($author);
783 }
784 if ($owner)
785 {
786 $clone->setOwner($owner);
787 }
788
789 if ($for_test)
790 {
791 $clone->saveToDb($original_id);
792 }
793 else
794 {
795 $clone->saveToDb();
796 }
797
798 // copy question page content
799 $clone->copyPageOfQuestion($this_id);
800 // copy XHTML media objects
801 $clone->copyXHTMLMediaObjectsOfQuestion($this_id);
802 // duplicate the images
803 $clone->cloneAnswerImages($this_id, $thisObjId, $clone->getId(), $clone->getObjId());
804
805 $clone->onDuplicate($thisObjId, $this_id, $clone->getObjId(), $clone->getId());
806
807 return $clone->id;
808 }
getId()
Gets the id of the assQuestion object.

References assQuestion\$author, assQuestion\$original_id, assQuestion\$owner, assQuestion\$title, assQuestion\_getOriginalId(), assQuestion\getId(), and assQuestion\getObjId().

+ Here is the call graph for this function:

◆ generateThumbForFile()

assKprimChoice::generateThumbForFile (   $path,
  $file 
)
protected

Definition at line 616 of file class.assKprimChoice.php.

617 {
619 if (@file_exists($filename))
620 {
621 $thumbpath = $path . $this->getThumbPrefix() . $file;
622 $path_info = @pathinfo($filename);
623 $ext = "";
624 switch (strtoupper($path_info['extension']))
625 {
626 case 'PNG':
627 $ext = 'PNG';
628 break;
629 case 'GIF':
630 $ext = 'GIF';
631 break;
632 default:
633 $ext = 'JPEG';
634 break;
635 }
636 ilUtil::convertImage($filename, $thumbpath, $ext, $this->getThumbSize());
637 }
638 }
$path
Definition: aliased.php:25
static convertImage($a_from, $a_to, $a_target_format="", $a_geometry="", $a_background_color="")
convert image
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file

References $file, $filename, $path, ilUtil\convertImage(), getThumbPrefix(), and getThumbSize().

Referenced by rebuildThumbnails().

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

◆ getAdditionalTableName()

assKprimChoice::getAdditionalTableName ( )

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

Returns
string The additional table name @access public

Reimplemented from assQuestion.

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

77 {
78 return "qpl_qst_kprim";
79 }

Referenced by saveAdditionalQuestionDataToDb().

+ Here is the caller graph for this function:

◆ getAnswer()

assKprimChoice::getAnswer (   $position)

Definition at line 176 of file class.assKprimChoice.php.

177 {
178 foreach($this->getAnswers() as $answer)
179 {
180 if($answer->getPosition() == $position)
181 {
182 return $answer;
183 }
184 }
185
186 return null;
187 }

References getAnswers().

Referenced by removeAnswerImage().

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

◆ getAnswers()

assKprimChoice::getAnswers ( )

◆ getAnswerTableName()

assKprimChoice::getAnswerTableName ( )

Returns the name of the answer table in the database.

Returns
string The answer table name @access public

Reimplemented from assQuestion.

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

82 {
83 return "qpl_a_kprim";
84 }

Referenced by saveAnswerSpecificDataToDb().

+ Here is the caller graph for this function:

◆ getAnswerType()

assKprimChoice::getAnswerType ( )

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

102 {
103 return $this->answerType;
104 }

References $answerType.

Referenced by rebuildThumbnails(), and saveAdditionalQuestionDataToDb().

+ Here is the caller graph for this function:

◆ getAnswerTypeSelectOptions()

assKprimChoice::getAnswerTypeSelectOptions ( ilLanguage  $lng)
Parameters
ilLanguage$lng
Returns
array

Definition at line 505 of file class.assKprimChoice.php.

506 {
507 return array(
508 self::ANSWER_TYPE_SINGLE_LINE => $lng->txt('answers_singleline'),
509 self::ANSWER_TYPE_MULTI_LINE => $lng->txt('answers_multiline')
510 );
511 }

References assQuestion\$lng.

◆ getCustomFalseOptionLabel()

assKprimChoice::getCustomFalseOptionLabel ( )

Definition at line 151 of file class.assKprimChoice.php.

References $customFalseOptionLabel.

Referenced by getFalseOptionLabelTranslation(), and saveAdditionalQuestionDataToDb().

+ Here is the caller graph for this function:

◆ getCustomTrueOptionLabel()

assKprimChoice::getCustomTrueOptionLabel ( )

Definition at line 141 of file class.assKprimChoice.php.

References $customTrueOptionLabel.

Referenced by getTrueOptionLabelTranslation(), and saveAdditionalQuestionDataToDb().

+ Here is the caller graph for this function:

◆ getFalseOptionLabelTranslation()

assKprimChoice::getFalseOptionLabelTranslation ( ilLanguage  $lng,
  $optionLabel 
)

Definition at line 562 of file class.assKprimChoice.php.

563 {
564 switch($optionLabel)
565 {
567 return $lng->txt('option_label_wrong');
568
570 return $lng->txt('option_label_minus');
571
573 return $lng->txt('option_label_not_applicable');
574
576 return $lng->txt('option_label_not_adequate');
577
579 return $this->getCustomFalseOptionLabel();
580 }
581 }
const OPTION_LABEL_APPLICABLE_OR_NOT

References assQuestion\$lng, $optionLabel, getCustomFalseOptionLabel(), OPTION_LABEL_ADEQUATE_OR_NOT, OPTION_LABEL_APPLICABLE_OR_NOT, OPTION_LABEL_CUSTOM, OPTION_LABEL_PLUS_MINUS, and OPTION_LABEL_RIGHT_WRONG.

Referenced by toJSON().

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

◆ getInstructionTextTranslation()

assKprimChoice::getInstructionTextTranslation ( ilLanguage  $lng,
  $optionLabel 
)

Definition at line 583 of file class.assKprimChoice.php.

584 {
585 return sprintf(
586 $lng->txt('kprim_instruction_text'),
587 $this->getTrueOptionLabelTranslation($lng, $optionLabel),
588 $this->getFalseOptionLabelTranslation($lng, $optionLabel)
589 );
590 }
sprintf('%.4f', $callTime)

References assQuestion\$lng, $optionLabel, and sprintf.

Referenced by toJSON().

+ Here is the caller graph for this function:

◆ getNumAllowedFailures()

assKprimChoice::getNumAllowedFailures ( )
private

Definition at line 1033 of file class.assKprimChoice.php.

1034 {
1035 if( $this->isScorePartialSolutionEnabled() )
1036 {
1037 return self::NUM_REQUIRED_ANSWERS - self::PARTIAL_SCORING_NUM_CORRECT_ANSWERS;
1038 }
1039
1040 return 0;
1041 }
const PARTIAL_SCORING_NUM_CORRECT_ANSWERS

References isScorePartialSolutionEnabled(), and PARTIAL_SCORING_NUM_CORRECT_ANSWERS.

Referenced by toJSON().

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

◆ getOptionLabel()

assKprimChoice::getOptionLabel ( )

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

132 {
133 return $this->optionLabel;
134 }

References $optionLabel.

Referenced by saveAdditionalQuestionDataToDb(), and toJSON().

+ Here is the caller graph for this function:

◆ getQuestionType()

assKprimChoice::getQuestionType ( )

Returns the question type of the question.

Returns
string The question type of the question

Reimplemented from assQuestion.

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

72 {
73 return 'assKprimChoice';
74 }

Referenced by toJSON().

+ Here is the caller graph for this function:

◆ getRTETextWithMediaObjects()

assKprimChoice::getRTETextWithMediaObjects ( )
protected

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

Reimplemented from assQuestion.

Definition at line 946 of file class.assKprimChoice.php.

947 {
948 $combinedText = parent::getRTETextWithMediaObjects();
949
950 foreach($this->getAnswers() as $answer)
951 {
952 $combinedText .= $answer->getAnswertext();
953 }
954
955 return $combinedText;
956 }

References getAnswers().

+ Here is the call graph for this function:

◆ getSolutionSubmit()

assKprimChoice::getSolutionSubmit ( )
protected

Definition at line 694 of file class.assKprimChoice.php.

695 {
696 $solutionSubmit = array();
697 foreach($_POST as $key => $value)
698 {
699 $matches = null;
700
701 if(preg_match("/^kprim_choice_result_(\d+)/", $key, $matches))
702 {
703 if(strlen($value))
704 {
705 $solutionSubmit[$matches[1]] = $value;
706 }
707 }
708 }
709 return $solutionSubmit;
710 }
$_POST["username"]

References $_POST.

◆ getSpecificFeedbackAllCorrectOptionLabel()

assKprimChoice::getSpecificFeedbackAllCorrectOptionLabel ( )

Implements ilAssSpecificFeedbackOptionLabelProvider.

Definition at line 1043 of file class.assKprimChoice.php.

1044 {
1045 return 'feedback_correct_kprim';
1046 }

◆ getSpecificFeedbackSetting()

assKprimChoice::getSpecificFeedbackSetting ( )

Definition at line 161 of file class.assKprimChoice.php.

References $specificFeedbackSetting.

Referenced by saveAdditionalQuestionDataToDb().

+ Here is the caller graph for this function:

◆ getThumbPrefix()

assKprimChoice::getThumbPrefix ( )

Definition at line 597 of file class.assKprimChoice.php.

598 {
599 return self::THUMB_PREFIX;
600 }

References THUMB_PREFIX.

Referenced by generateThumbForFile(), and loadAnswerData().

+ Here is the caller graph for this function:

◆ getThumbSize()

assKprimChoice::getThumbSize ( )

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

112 {
113 return $this->thumbSize;
114 }

References $thumbSize.

Referenced by generateThumbForFile(), rebuildThumbnails(), saveAdditionalQuestionDataToDb(), and toJSON().

+ Here is the caller graph for this function:

◆ getTrueOptionLabelTranslation()

assKprimChoice::getTrueOptionLabelTranslation ( ilLanguage  $lng,
  $optionLabel 
)

Definition at line 541 of file class.assKprimChoice.php.

542 {
543 switch($optionLabel)
544 {
546 return $lng->txt('option_label_right');
547
549 return $lng->txt('option_label_plus');
550
552 return $lng->txt('option_label_applicable');
553
555 return $lng->txt('option_label_adequate');
556
558 return $this->getCustomTrueOptionLabel();
559 }
560 }

References assQuestion\$lng, $optionLabel, getCustomTrueOptionLabel(), OPTION_LABEL_ADEQUATE_OR_NOT, OPTION_LABEL_APPLICABLE_OR_NOT, OPTION_LABEL_CUSTOM, OPTION_LABEL_PLUS_MINUS, and OPTION_LABEL_RIGHT_WRONG.

Referenced by toJSON().

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

◆ getValidAnswerTypes()

assKprimChoice::getValidAnswerTypes ( )

Definition at line 485 of file class.assKprimChoice.php.

486 {
487 return array(self::ANSWER_TYPE_SINGLE_LINE, self::ANSWER_TYPE_MULTI_LINE);
488 }

Referenced by isValidAnswerType().

+ Here is the caller graph for this function:

◆ getValidOptionLabels()

assKprimChoice::getValidOptionLabels ( )

Definition at line 513 of file class.assKprimChoice.php.

514 {
515 return array(
516 self::OPTION_LABEL_RIGHT_WRONG,
517 self::OPTION_LABEL_PLUS_MINUS,
518 self::OPTION_LABEL_APPLICABLE_OR_NOT,
519 self::OPTION_LABEL_ADEQUATE_OR_NOT,
520 self::OPTION_LABEL_CUSTOM
521 );
522 }

Referenced by isValidOptionLabel().

+ Here is the caller graph for this function:

◆ getValidOptionLabelsTranslated()

assKprimChoice::getValidOptionLabelsTranslated ( ilLanguage  $lng)

Definition at line 524 of file class.assKprimChoice.php.

525 {
526 return array(
527 self::OPTION_LABEL_RIGHT_WRONG => $lng->txt('option_label_right_wrong'),
528 self::OPTION_LABEL_PLUS_MINUS => $lng->txt('option_label_plus_minus'),
529 self::OPTION_LABEL_APPLICABLE_OR_NOT => $lng->txt('option_label_applicable_or_not'),
530 self::OPTION_LABEL_ADEQUATE_OR_NOT => $lng->txt('option_label_adequate_or_not'),
531 self::OPTION_LABEL_CUSTOM => $lng->txt('option_label_custom')
532 );
533 }

References assQuestion\$lng.

◆ handleFileUpload()

assKprimChoice::handleFileUpload ( ilAssKprimChoiceAnswer  $answer,
  $fileData 
)
private

Definition at line 655 of file class.assKprimChoice.php.

656 {
657 $imagePath = $this->getImagePath();
658
659 if( !file_exists($imagePath) )
660 {
661 ilUtil::makeDirParents($imagePath);
662 }
663
664 $filename = $this->buildHashedImageFilename($fileData['name'], true);
665
666 $answer->setImageFsDir($imagePath);
667 $answer->setImageFile($filename);
668
669 if( !ilUtil::moveUploadedFile($fileData['tmp_name'], $fileData['name'], $answer->getImageFsPath()) )
670 {
671 return 2;
672 }
673
674 return 0;
675 }
getImagePath($question_id=null, $object_id=null)
Returns the image path for web accessable images of a question.
buildHashedImageFilename($plain_image_filename, $unique=false)
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
static makeDirParents($a_dir)
Create a new directory and all parent directories.

References $filename, assQuestion\buildHashedImageFilename(), ilAssKprimChoiceAnswer\getImageFsPath(), assQuestion\getImagePath(), ilUtil\makeDirParents(), ilUtil\moveUploadedFile(), ilAssKprimChoiceAnswer\setImageFile(), and ilAssKprimChoiceAnswer\setImageFsDir().

Referenced by handleFileUploads().

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

◆ handleFileUploads()

assKprimChoice::handleFileUploads (   $answers,
  $files 
)

Definition at line 640 of file class.assKprimChoice.php.

641 {
642 foreach($answers as $answer)
643 {
644 /* @var ilAssKprimChoiceAnswer $answer */
645
646 if( !isset($files[$answer->getPosition()]) )
647 {
648 continue;
649 }
650
651 $this->handleFileUpload($answer, $files[$answer->getPosition()]);
652 }
653 }
$files
Definition: add-vimline.php:18
handleFileUpload(ilAssKprimChoiceAnswer $answer, $fileData)

References $answers, $files, and handleFileUpload().

+ Here is the call graph for this function:

◆ isAnswered()

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

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

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

Parameters
integer$active_id
integer$pass
Returns
boolean $answered

Reimplemented from assQuestion.

Definition at line 1053 of file class.assKprimChoice.php.

1054 {
1055 $numExistingSolutionRecords = assQuestion::getNumExistingSolutionRecords($active_id, $pass, $this->getId());
1056
1057 return $numExistingSolutionRecords >= 4;
1058 }
static getNumExistingSolutionRecords($activeId, $pass, $questionId)
returns the number of existing solution records for the given test active / pass and given question i...

References $pass, assQuestion\getId(), and assQuestion\getNumExistingSolutionRecords().

+ Here is the call graph for this function:

◆ isComplete()

assKprimChoice::isComplete ( )

Returns true, if a question is complete for use.

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

Reimplemented from assQuestion.

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

353 {
354 foreach( array($this->title, $this->author, $this->question) as $text )
355 {
356 if( !strlen($text) )
357 {
358 return false;
359 }
360 }
361
362 if( $this->getMaximumPoints() <= 0 )
363 {
364 return false;
365 }
366
367 foreach( $this->getAnswers() as $answer )
368 {
369 /* @var ilAssKprimChoiceAnswer $answer */
370
371 if( is_null($answer->getCorrectness()) )
372 {
373 return false;
374 }
375
376 if( !strlen($answer->getAnswertext()) && !strlen($answer->getImageFile()) )
377 {
378 return false;
379 }
380 }
381
382 return true;
383 }
getMaximumPoints()
Returns the maximum points, a learner can reach answering the question.
$text

References $text, getAnswers(), and assQuestion\getMaximumPoints().

+ Here is the call graph for this function:

◆ isCustomOptionLabel()

assKprimChoice::isCustomOptionLabel (   $labelValue)

Definition at line 592 of file class.assKprimChoice.php.

593 {
594 return $labelValue == self::OPTION_LABEL_CUSTOM;
595 }

References OPTION_LABEL_CUSTOM.

◆ isObligationPossible()

static assKprimChoice::isObligationPossible (   $questionId)
static

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

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

Parameters
integer$questionId
Returns
boolean $obligationPossible

Reimplemented from assQuestion.

Definition at line 1048 of file class.assKprimChoice.php.

1049 {
1050 return true;
1051 }

◆ isScorePartialSolutionEnabled()

assKprimChoice::isScorePartialSolutionEnabled ( )

Definition at line 121 of file class.assKprimChoice.php.

References $scorePartialSolutionEnabled.

Referenced by calculateReachedPointsForSolution(), getNumAllowedFailures(), and saveAdditionalQuestionDataToDb().

+ Here is the caller graph for this function:

◆ isShuffleAnswersEnabled()

assKprimChoice::isShuffleAnswersEnabled ( )

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

References $shuffleAnswersEnabled.

Referenced by saveAdditionalQuestionDataToDb(), and toJSON().

+ Here is the caller graph for this function:

◆ isSingleLineAnswerType()

assKprimChoice::isSingleLineAnswerType (   $answerType)

Definition at line 496 of file class.assKprimChoice.php.

References $answerType, and ANSWER_TYPE_SINGLE_LINE.

Referenced by rebuildThumbnails().

+ Here is the caller graph for this function:

◆ isValidAnswerType()

assKprimChoice::isValidAnswerType (   $answerType)

Definition at line 490 of file class.assKprimChoice.php.

491 {
492 $validTypes = $this->getValidAnswerTypes();
493 return in_array($answerType, $validTypes);
494 }

References $answerType, and getValidAnswerTypes().

Referenced by loadFromDb().

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

◆ isValidOptionLabel()

assKprimChoice::isValidOptionLabel (   $optionLabel)

Definition at line 535 of file class.assKprimChoice.php.

536 {
537 $validLabels = $this->getValidOptionLabels();
538 return in_array($optionLabel, $validLabels);
539 }

References $optionLabel, and getValidOptionLabels().

Referenced by loadFromDb().

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

◆ lmMigrateQuestionTypeSpecificContent()

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

Reimplemented from assQuestion.

Definition at line 961 of file class.assKprimChoice.php.

962 {
963 foreach($this->getAnswers() as $answer)
964 {
965 /* @var ilAssKprimChoiceAnswer $answer */
966 $answer->setAnswertext( $migrator->migrateToLmContent($answer->getAnswertext()) );
967 }
968 }

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

+ Here is the call graph for this function:

◆ loadAnswerData()

assKprimChoice::loadAnswerData (   $questionId)
private

Definition at line 261 of file class.assKprimChoice.php.

262 {
263 global $ilDB;
264
265 $res = $this->db->queryF(
266 "SELECT * FROM {$this->getAnswerTableName()} WHERE question_fi = %s ORDER BY position ASC",
267 array('integer'), array($questionId)
268 );
269
270 require_once 'Modules/TestQuestionPool/classes/class.ilAssKprimChoiceAnswer.php';
271 require_once 'Services/RTE/classes/class.ilRTE.php';
272
273 while($data = $ilDB->fetchAssoc($res))
274 {
275 $answer = new ilAssKprimChoiceAnswer();
276
277 $answer->setPosition($data['position']);
278
279 $answer->setAnswertext(ilRTE::_replaceMediaObjectImageSrc($data['answertext'], 1));
280
281 $answer->setImageFile($data['imagefile']);
282 $answer->setThumbPrefix($this->getThumbPrefix());
283 $answer->setImageFsDir($this->getImagePath());
284 $answer->setImageWebDir($this->getImagePathWeb());
285
286 $answer->setCorrectness($data['correctness']);
287
288 $this->answers[$answer->getPosition()] = $answer;
289 }
290
291 for( $i = count($this->answers); $i < self::NUM_REQUIRED_ANSWERS; $i++ )
292 {
293 $answer = new ilAssKprimChoiceAnswer();
294
295 $answer->setPosition($i);
296
297 $this->answers[$answer->getPosition()] = $answer;
298 }
299 }
getImagePathWeb()
Returns the web image path for web accessable images of a 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...

References $data, $ilDB, $res, ilRTE\_replaceMediaObjectImageSrc(), assQuestion\getImagePath(), assQuestion\getImagePathWeb(), getThumbPrefix(), and NUM_REQUIRED_ANSWERS.

Referenced by loadFromDb().

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

◆ loadFromDb()

assKprimChoice::loadFromDb (   $question_id)

Loads the question from the database.

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

Reimplemented from assQuestion.

Definition at line 194 of file class.assKprimChoice.php.

195 {
196 $res = $this->db->queryF($this->buildQuestionDataQuery(), array('integer'), array($questionId));
197
198 while($data = $this->db->fetchAssoc($res))
199 {
200 $this->setId($questionId);
201
202 $this->setOriginalId($data['original_id']);
203
204 $this->setObjId($data['obj_fi']);
205
206 $this->setTitle($data['title']);
207 $this->setNrOfTries($data['nr_of_tries']);
208 $this->setComment($data['description']);
209 $this->setAuthor($data['author']);
210 $this->setPoints($data['points']);
211 $this->setOwner($data['owner']);
212 $this->setEstimatedWorkingTimeFromDurationString($data['working_time']);
213 $this->setLastChange($data['tstamp']);
214 require_once 'Services/RTE/classes/class.ilRTE.php';
215 $this->setQuestion(ilRTE::_replaceMediaObjectImageSrc($data['question_text'], 1));
216
217 $this->setShuffleAnswersEnabled((bool)$data['shuffle_answers']);
218
219 if( $this->isValidAnswerType($data['answer_type']) )
220 {
221 $this->setAnswerType($data['answer_type']);
222 }
223
224 if( is_numeric($data['thumb_size']) )
225 {
226 $this->setThumbSize((int)$data['thumb_size']);
227 }
228
229 if( $this->isValidOptionLabel($data['opt_label']) )
230 {
231 $this->setOptionLabel($data['opt_label']);
232 }
233
234 $this->setCustomTrueOptionLabel($data['custom_true']);
235 $this->setCustomFalseOptionLabel($data['custom_false']);
236
237 if( $data['score_partsol'] !== null )
238 {
239 $this->setScorePartialSolutionEnabled((bool)$data['score_partsol']);
240 }
241
242 if( isset($data['feedback_setting']) )
243 {
244 $this->setSpecificFeedbackSetting((int)$data['feedback_setting']);
245 }
246
247 try
248 {
249 $this->setAdditionalContentEditingMode($data['add_cont_edit_mode']);
250 }
252 {
253 }
254 }
255
256 $this->loadAnswerData($questionId);
257
258 parent::loadFromDb($questionId);
259 }
setCustomTrueOptionLabel($customTrueOptionLabel)
setCustomFalseOptionLabel($customFalseOptionLabel)
loadAnswerData($questionId)
setSpecificFeedbackSetting($specificFeedbackSetting)
setAnswerType($answerType)
isValidOptionLabel($optionLabel)
isValidAnswerType($answerType)
setOptionLabel($optionLabel)
setShuffleAnswersEnabled($shuffleAnswersEnabled)
setScorePartialSolutionEnabled($scorePartialSolutionEnabled)
setId($id=-1)
Sets the id of the assQuestion object.
setOriginalId($original_id)
setObjId($obj_id=0)
Set the object id of the container object.
setTitle($title="")
Sets the title string of the assQuestion object.
setOwner($owner="")
Sets the creator/owner ID of the assQuestion object.
setEstimatedWorkingTimeFromDurationString($durationString)
Sets the estimated working time of a question from a given datetime string.
setAuthor($author="")
Sets the authors name of the assQuestion object.
setComment($comment="")
Sets the comment string of the assQuestion object.
setNrOfTries($a_nr_of_tries)
setAdditionalContentEditingMode($additinalContentEditingMode)
setter for additional content editing mode for this question
setQuestion($question="")
Sets the question string of the question object.
setLastChange($lastChange)

References $data, $res, ilRTE\_replaceMediaObjectImageSrc(), assQuestion\buildQuestionDataQuery(), isValidAnswerType(), isValidOptionLabel(), loadAnswerData(), assQuestion\setAdditionalContentEditingMode(), setAnswerType(), assQuestion\setAuthor(), assQuestion\setComment(), setCustomFalseOptionLabel(), setCustomTrueOptionLabel(), assQuestion\setEstimatedWorkingTimeFromDurationString(), assQuestion\setId(), assQuestion\setLastChange(), assQuestion\setNrOfTries(), assQuestion\setObjId(), setOptionLabel(), assQuestion\setOriginalId(), assQuestion\setOwner(), assQuestion\setPoints(), assQuestion\setQuestion(), setScorePartialSolutionEnabled(), setShuffleAnswersEnabled(), setSpecificFeedbackSetting(), setThumbSize(), and assQuestion\setTitle().

+ Here is the call graph for this function:

◆ moveAnswerDown()

assKprimChoice::moveAnswerDown (   $position)

Definition at line 1090 of file class.assKprimChoice.php.

1091 {
1092 if( $position < 0 || $position >= (self::NUM_REQUIRED_ANSWERS - 1) )
1093 {
1094 return false;
1095 }
1096
1097 for($i = 0, $max = count($this->answers); $i < $max; $i++)
1098 {
1099 if( $i == $position )
1100 {
1101 $movingAnswer = $this->answers[$i];
1102 $targetAnswer = $this->answers[ $i + 1 ];
1103
1104 $movingAnswer->setPosition( $position + 1 );
1105 $targetAnswer->setPosition( $position );
1106
1107 $this->answers[ $i + 1 ] = $movingAnswer;
1108 $this->answers[$i] = $targetAnswer;
1109 }
1110 }
1111 }

◆ moveAnswerUp()

assKprimChoice::moveAnswerUp (   $position)

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

1114 {
1115 if( $position <= 0 || $position > (self::NUM_REQUIRED_ANSWERS - 1) )
1116 {
1117 return false;
1118 }
1119
1120 for($i = 0, $max = count($this->answers); $i < $max; $i++)
1121 {
1122 if( $i == $position )
1123 {
1124 $movingAnswer = $this->answers[$i];
1125 $targetAnswer = $this->answers[ $i - 1 ];
1126
1127 $movingAnswer->setPosition( $position - 1 );
1128 $targetAnswer->setPosition( $position );
1129
1130 $this->answers[ $i - 1 ] = $movingAnswer;
1131 $this->answers[$i] = $targetAnswer;
1132 }
1133 }
1134
1135 return true;
1136 }

◆ rebuildThumbnails()

assKprimChoice::rebuildThumbnails ( )

Definition at line 602 of file class.assKprimChoice.php.

603 {
604 if( $this->isSingleLineAnswerType($this->getAnswerType()) && $this->getThumbSize() )
605 {
606 foreach ($this->getAnswers() as $answer)
607 {
608 if (strlen($answer->getImageFile()))
609 {
610 $this->generateThumbForFile($answer->getImageFsDir(), $answer->getImageFile());
611 }
612 }
613 }
614 }
isSingleLineAnswerType($answerType)
generateThumbForFile($path, $file)

References generateThumbForFile(), getAnswers(), getAnswerType(), getThumbSize(), and isSingleLineAnswerType().

Referenced by saveAnswerSpecificDataToDb().

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

◆ removeAnswerImage()

assKprimChoice::removeAnswerImage (   $position)

Definition at line 677 of file class.assKprimChoice.php.

678 {
679 $answer = $this->getAnswer($position);
680
681 if( file_exists($answer->getImageFsPath()) )
682 {
683 ilUtil::delDir($answer->getImageFsPath());
684 }
685
686 if( file_exists($answer->getThumbFsPath()) )
687 {
688 ilUtil::delDir($answer->getThumbFsPath());
689 }
690
691 $answer->setImageFile(null);
692 }
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively

References ilUtil\delDir(), and getAnswer().

+ Here is the call graph for this function:

◆ reworkWorkingData()

assKprimChoice::reworkWorkingData (   $active_id,
  $pass,
  $obligationsAnswered,
  $authorized 
)
protected

{Reworks the allready saved working data if neccessary.

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

Reimplemented from assQuestion.

Definition at line 443 of file class.assKprimChoice.php.

444 {
445 // nothing to rework!
446 }

◆ saveAdditionalQuestionDataToDb()

assKprimChoice::saveAdditionalQuestionDataToDb ( )

Saves a record to the question types additional data table.

Returns
mixed

Implements ilObjQuestionScoringAdjustable.

Definition at line 311 of file class.assKprimChoice.php.

312 {
313 $this->db->replace(
314 $this->getAdditionalTableName(),
315 array(
316 'question_fi' => array('integer', $this->getId())
317 ),
318 array(
319 'shuffle_answers' => array('integer', (int)$this->isShuffleAnswersEnabled()),
320 'answer_type' => array('text', $this->getAnswerType()),
321 'thumb_size' => array('integer', (int)$this->getThumbSize()),
322 'opt_label' => array('text', $this->getOptionLabel()),
323 'custom_true' => array('text', $this->getCustomTrueOptionLabel()),
324 'custom_false' => array('text', $this->getCustomFalseOptionLabel()),
325 'score_partsol' => array('integer', (int)$this->isScorePartialSolutionEnabled()),
326 'feedback_setting' => array('integer', (int)$this->getSpecificFeedbackSetting())
327 )
328 );
329 }
getAdditionalTableName()
Returns the name of the additional question data table in the database.

References getAdditionalTableName(), getAnswerType(), getCustomFalseOptionLabel(), getCustomTrueOptionLabel(), assQuestion\getId(), getOptionLabel(), getSpecificFeedbackSetting(), getThumbSize(), isScorePartialSolutionEnabled(), and isShuffleAnswersEnabled().

Referenced by saveToDb().

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

◆ saveAnswerSpecificDataToDb()

assKprimChoice::saveAnswerSpecificDataToDb ( )

Saves the answer specific records into a question types answer table.

Returns
mixed

Implements ilObjAnswerScoringAdjustable.

Definition at line 331 of file class.assKprimChoice.php.

332 {
333 foreach($this->getAnswers() as $answer)
334 {
335 $this->db->replace(
336 $this->getAnswerTableName(),
337 array(
338 'question_fi' => array('integer', (int)$this->getId()),
339 'position' => array('integer', (int)$answer->getPosition())
340 ),
341 array(
342 'answertext' => array('text', $answer->getAnswertext()),
343 'imagefile' => array('text', $answer->getImageFile()),
344 'correctness' => array('integer', (int)$answer->getCorrectness())
345 )
346 );
347 }
348
349 $this->rebuildThumbnails();
350 }
getAnswerTableName()
Returns the name of the answer table in the database.

References getAnswers(), getAnswerTableName(), assQuestion\getId(), and rebuildThumbnails().

Referenced by saveToDb().

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

◆ saveToDb()

assKprimChoice::saveToDb (   $original_id = '')

Saves the question to the database.

Parameters
integer$original_id@access public

Reimplemented from assQuestion.

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

302 {
303 $this->saveQuestionDataToDb($originalId);
304
307
308 parent::saveToDb($originalId);
309 }
saveAnswerSpecificDataToDb()
Saves the answer specific records into a question types answer table.
saveAdditionalQuestionDataToDb()
Saves a record to the question types additional data table.
saveQuestionDataToDb($original_id="")

References saveAdditionalQuestionDataToDb(), saveAnswerSpecificDataToDb(), and assQuestion\saveQuestionDataToDb().

+ Here is the call graph for this function:

◆ setAnswers()

assKprimChoice::setAnswers (   $answers)

Definition at line 166 of file class.assKprimChoice.php.

167 {
168 $this->answers = $answers;
169 }

References $answers.

◆ setAnswerType()

assKprimChoice::setAnswerType (   $answerType)

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

97 {
98 $this->answerType = $answerType;
99 }

References $answerType.

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setCustomFalseOptionLabel()

assKprimChoice::setCustomFalseOptionLabel (   $customFalseOptionLabel)

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

147 {
148 $this->customFalseOptionLabel = $customFalseOptionLabel;
149 }

References $customFalseOptionLabel.

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setCustomTrueOptionLabel()

assKprimChoice::setCustomTrueOptionLabel (   $customTrueOptionLabel)

Definition at line 136 of file class.assKprimChoice.php.

137 {
138 $this->customTrueOptionLabel = $customTrueOptionLabel;
139 }

References $customTrueOptionLabel.

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setExportDetailsXLS()

assKprimChoice::setExportDetailsXLS (   $worksheet,
  $startrow,
  $active_id,
  $pass 
)

{Creates an Excel worksheet for the detailed cumulated results of this question.

Parameters
object$worksheetReference to the parent excel worksheet
object$startrowStartrow of the output in the excel worksheet
object$active_idActive id of the participant
object$passTest pass
Returns
object
}

Reimplemented from assQuestion.

Definition at line 1063 of file class.assKprimChoice.php.

1064 {
1065 parent::setExportDetailsXLS($worksheet, $startrow, $active_id, $pass);
1066
1067 $solution = $this->getSolutionValues($active_id, $pass);
1068
1069 $i = 1;
1070 foreach($this->getAnswers() as $id => $answer)
1071 {
1072 $worksheet->setCell($startrow + $i, 0, $answer->getAnswertext());
1073 $worksheet->setBold($worksheet->getColumnCoord(0) . ($startrow + $i));
1074 $correctness = FALSE;
1075 foreach($solution as $solutionvalue)
1076 {
1077 if($id == $solutionvalue['value1'])
1078 {
1079 $correctness = $solutionvalue['value2'];
1080 break;
1081 }
1082 }
1083 $worksheet->setCell($startrow + $i, 1, $correctness);
1084 $i++;
1085 }
1086
1087 return $startrow + $i + 1;
1088 }
$worksheet
getSolutionValues($active_id, $pass=NULL, $authorized=true)
Loads solutions of a given user from the database an returns it.

References assQuestion\$id, $pass, $worksheet, getAnswers(), and assQuestion\getSolutionValues().

+ Here is the call graph for this function:

◆ setOptionLabel()

assKprimChoice::setOptionLabel (   $optionLabel)

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

127 {
128 $this->optionLabel = $optionLabel;
129 }

References $optionLabel.

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setScorePartialSolutionEnabled()

assKprimChoice::setScorePartialSolutionEnabled (   $scorePartialSolutionEnabled)

Definition at line 116 of file class.assKprimChoice.php.

117 {
118 $this->scorePartialSolutionEnabled = $scorePartialSolutionEnabled;
119 }

References $scorePartialSolutionEnabled.

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setShuffleAnswersEnabled()

assKprimChoice::setShuffleAnswersEnabled (   $shuffleAnswersEnabled)

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

87 {
88 $this->shuffleAnswersEnabled = $shuffleAnswersEnabled;
89 }

References $shuffleAnswersEnabled.

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setSpecificFeedbackSetting()

assKprimChoice::setSpecificFeedbackSetting (   $specificFeedbackSetting)

Definition at line 156 of file class.assKprimChoice.php.

157 {
158 $this->specificFeedbackSetting = $specificFeedbackSetting;
159 }

References $specificFeedbackSetting.

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setThumbSize()

assKprimChoice::setThumbSize (   $thumbSize)

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

107 {
108 $this->thumbSize = $thumbSize;
109 }

References $thumbSize.

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ toJSON()

assKprimChoice::toJSON ( )

Returns a JSON representation of the question.

Reimplemented from assQuestion.

Definition at line 973 of file class.assKprimChoice.php.

974 {
975 $this->lng->loadLanguageModule('assessment');
976
977 require_once './Services/RTE/classes/class.ilRTE.php';
978 $result = array();
979 $result['id'] = (int) $this->getId();
980 $result['type'] = (string) $this->getQuestionType();
981 $result['title'] = (string) $this->getTitle();
982 $result['question'] = $this->formatSAQuestion($this->getQuestion());
983 $result['instruction'] = $this->getInstructionTextTranslation(
984 $this->lng, $this->getOptionLabel()
985 );
986 $result['nr_of_tries'] = (int) $this->getNrOfTries();
987 $result['shuffle'] = (bool) $this->isShuffleAnswersEnabled();
988 $result['feedback'] = array(
989 'onenotcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), false)),
990 'allcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), true))
991 );
992
993 $result['trueOptionLabel'] = $this->getTrueOptionLabelTranslation($this->lng, $this->getOptionLabel());
994 $result['falseOptionLabel'] = $this->getFalseOptionLabelTranslation($this->lng, $this->getOptionLabel());
995
996 $result['num_allowed_failures'] = $this->getNumAllowedFailures();
997
998 $answers = array();
999 $has_image = false;
1000
1001 foreach( $this->getAnswers() as $key => $answer )
1002 {
1003 if( strlen((string)$answer->getImageFile()) )
1004 {
1005 $has_image = true;
1006 }
1007
1008 $answers[] = array(
1009 'answertext' => (string) $this->formatSAQuestion($answer->getAnswertext()),
1010 'correctness' => (bool) $answer->getCorrectness(),
1011 'order' => (int)$answer->getPosition(),
1012 'image' => (string)$answer->getImageFile(),
1013 'feedback' => $this->formatSAQuestion(
1014 $this->feedbackOBJ->getSpecificAnswerFeedbackExportPresentation($this->getId(), $key)
1015 )
1016 );
1017 }
1018
1019 $result['answers'] = $answers;
1020
1021 if($has_image)
1022 {
1023 $result['path'] = $this->getImagePathWeb();
1024 $result['thumb'] = $this->getThumbSize();
1025 }
1026
1027 $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $this->getId());
1028 $result['mobs'] = $mobs;
1029
1030 return json_encode($result);
1031 }
getQuestionType()
Returns the question type of the question.
getTrueOptionLabelTranslation(ilLanguage $lng, $optionLabel)
getFalseOptionLabelTranslation(ilLanguage $lng, $optionLabel)
getInstructionTextTranslation(ilLanguage $lng, $optionLabel)
formatSAQuestion($a_q)
Format self assessment question.
getTitle()
Gets the title string of the assQuestion object.
getQuestion()
Gets the question string of the question object.
static _getMobsOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
get mobs of object
$mobs

References $answers, $mobs, $result, ilObjMediaObject\_getMobsOfObject(), assQuestion\formatSAQuestion(), getAnswers(), getFalseOptionLabelTranslation(), assQuestion\getId(), assQuestion\getImagePathWeb(), getInstructionTextTranslation(), assQuestion\getNrOfTries(), getNumAllowedFailures(), getOptionLabel(), assQuestion\getQuestion(), getQuestionType(), getThumbSize(), assQuestion\getTitle(), getTrueOptionLabelTranslation(), and isShuffleAnswersEnabled().

+ Here is the call graph for this function:

Field Documentation

◆ $answers

assKprimChoice::$answers
private

Definition at line 49 of file class.assKprimChoice.php.

Referenced by getAnswers(), handleFileUploads(), setAnswers(), and toJSON().

◆ $answerType

assKprimChoice::$answerType
private

◆ $customFalseOptionLabel

assKprimChoice::$customFalseOptionLabel
private

◆ $customTrueOptionLabel

assKprimChoice::$customTrueOptionLabel
private

Definition at line 43 of file class.assKprimChoice.php.

Referenced by getCustomTrueOptionLabel(), and setCustomTrueOptionLabel().

◆ $optionLabel

◆ $scorePartialSolutionEnabled

assKprimChoice::$scorePartialSolutionEnabled
private

◆ $shuffleAnswersEnabled

assKprimChoice::$shuffleAnswersEnabled
private

Definition at line 33 of file class.assKprimChoice.php.

Referenced by isShuffleAnswersEnabled(), and setShuffleAnswersEnabled().

◆ $specificFeedbackSetting

assKprimChoice::$specificFeedbackSetting
private

◆ $thumbSize

assKprimChoice::$thumbSize
private

Definition at line 37 of file class.assKprimChoice.php.

Referenced by getThumbSize(), and setThumbSize().

◆ ANSWER_TYPE_MULTI_LINE

const assKprimChoice::ANSWER_TYPE_MULTI_LINE = 'multiLine'

◆ ANSWER_TYPE_SINGLE_LINE

const assKprimChoice::ANSWER_TYPE_SINGLE_LINE = 'singleLine'

Definition at line 21 of file class.assKprimChoice.php.

Referenced by __construct(), and isSingleLineAnswerType().

◆ DEFAULT_THUMB_SIZE

const assKprimChoice::DEFAULT_THUMB_SIZE = 150

Definition at line 30 of file class.assKprimChoice.php.

Referenced by __construct().

◆ NUM_REQUIRED_ANSWERS

const assKprimChoice::NUM_REQUIRED_ANSWERS = 4

Definition at line 17 of file class.assKprimChoice.php.

Referenced by loadAnswerData().

◆ OPTION_LABEL_ADEQUATE_OR_NOT

const assKprimChoice::OPTION_LABEL_ADEQUATE_OR_NOT = 'adequate_or_not'

◆ OPTION_LABEL_APPLICABLE_OR_NOT

const assKprimChoice::OPTION_LABEL_APPLICABLE_OR_NOT = 'applicable_or_not'

◆ OPTION_LABEL_CUSTOM

const assKprimChoice::OPTION_LABEL_CUSTOM = 'customlabel'

◆ OPTION_LABEL_PLUS_MINUS

const assKprimChoice::OPTION_LABEL_PLUS_MINUS = 'plus_minus'

◆ OPTION_LABEL_RIGHT_WRONG

const assKprimChoice::OPTION_LABEL_RIGHT_WRONG = 'right_wrong'

◆ PARTIAL_SCORING_NUM_CORRECT_ANSWERS

const assKprimChoice::PARTIAL_SCORING_NUM_CORRECT_ANSWERS = 3

Definition at line 19 of file class.assKprimChoice.php.

Referenced by getNumAllowedFailures().

◆ THUMB_PREFIX

const assKprimChoice::THUMB_PREFIX = 'thumb.'

Definition at line 31 of file class.assKprimChoice.php.

Referenced by getThumbPrefix().


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