ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
assKprimChoice Class Reference
+ Inheritance diagram for assKprimChoice:
+ Collaboration diagram for assKprimChoice:

Public Member Functions

 __construct ($title='', $comment='', $author='', $owner=-1, $question='')
 
 getQuestionType ()
 
 getAdditionalTableName ()
 
 getAnswerTableName ()
 
 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)
 
 saveToDb ($originalId='')
 
 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 ()
 
 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)
 
 setExportDetailsXLS (&$worksheet, $startrow, $active_id, $pass, &$format_title, &$format_bold)
 {} 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...
 
 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 ()
 
 _getMaximumPoints ($question_id)
 Returns the maximum points, a learner can reach answering the question. More...
 
_getQuestionInfo ($question_id)
 Returns question information from the database. More...
 
 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, $question_id, $pass=NULL)
 Returns the points, a learner has reached answering the question. 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...
 
 saveWorkingData ($active_id, $pass=NULL, $authorized=true)
 Saves the learners input of the question to the database. More...
 
 _updateTestResultCache ($active_id, ilAssQuestionProcessLocker $processLocker=null)
 Move this to a proper place. More...
 
 logAction ($logtext="", $active_id="", $question_id="")
 Logs an action into the Test&Assessment log. More...
 
 _logAction ($logtext="", $active_id="", $question_id="")
 Logs an action into the Test&Assessment log. 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...
 
 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...
 
 getQuestionTypeFromDb ($question_id)
 get question type for question id 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...
 
 _getTitle ($a_q_id)
 Returns the title of a question. More...
 
 _getQuestionText ($a_q_id)
 Returns question text. More...
 
 copyXHTMLMediaObjectsOfQuestion ($a_q_id)
 
 syncXHTMLMediaObjectsOfQuestion ()
 
 createPageObject ()
 create page object of question More...
 
 copyPageOfQuestion ($a_q_id)
 
 getPageOfQuestion ()
 
 _getQuestionType ($question_id)
 Returns the question type of a question with a given id. More...
 
 _getQuestionTitle ($question_id)
 Returns the question title of a question with a given id. More...
 
 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)
 
 _getInternalLinkHref ($target="")
 
 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...
 
 _getSolutionMaxPass ($question_id, $active_id)
 Returns the maximum pass a users question solution. More...
 
 _isWriteable ($question_id, $user_id)
 Returns true if the question is writeable by a certain user. More...
 
 _isUsedInRandomTest ($question_id="")
 Checks whether the question is used in a random test or not. More...
 
 calculateReachedPoints ($active_id, $pass=NULL, $authorizedSolution=true, $returndetails=FALSE)
 Returns the points, a learner has reached answering the question. More...
 
 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...
 
 createNewImageFileName ($image_filename, $unique=false)
 
 _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...
 
 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...
 
 _needsManualScoring ($question_id)
 
 getActiveUserData ($active_id)
 Returns the user id and the test id for a given active id. More...
 
 setExportDetailsXLS (&$worksheet, $startrow, $active_id, $pass, &$format_title, &$format_bold)
 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)
 
 _questionExistsInTest ($question_id, $test_id)
 
 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, $ignoredSolutionIds=array())
 
 saveCurrentSolution ($active_id, $pass, $value1, $value2, $authorized=true)
 
 updateCurrentSolution ($solutionId, $value1, $value2, $authorized=true)
 
 updateCurrentSolutionsAuthorization ($activeId, $pass, $authorized)
 
 setStep ($step)
 
 getStep ()
 
 toJSON ()
 
 duplicate ($for_test=true, $title="", $author="", $owner="", $testObjId=null)
 
 authorizedSolutionExists ($active_id, $pass)
 
 authorizedOrIntermediateSolutionExists ($active_id, $pass)
 
 lookupForExistingSolutions ($activeId, $pass)
 Lookup if an authorized or intermediate solution exists. More...
 
 removeExistingSolutions ($activeId, $pass)
 
 resetUsersAnswer ($activeId, $pass)
 
 removeResultRecord ($activeId, $pass)
 
 areObligationsToBeConsidered ()
 
 setObligationsToBeConsidered ($obligationsToBeConsidered)
 
 validateSolutionSubmit ()
 
 updateTimestamp ()
 

Static Public Member Functions

static isObligationPossible ($questionId)
 
- 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 getAllowedImageFileExtensions ()
 
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 _getTotalRightAnswers ($a_q_id)
 get number of answers for question id (static) note: do not use $this inside this method More...
 
static isFileAvailable ($file)
 
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 _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 _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 lookupParentObjId ($questionId)
 ilDB $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 setResultGateway ($resultGateway)
 
static getResultGateway ()
 
static sumTimesInISO8601FormatH_i_s_Extended ($time1, $time2)
 
static convertISO8601FormatH_i_s_ExtendedToSeconds ($time)
 
static missingResultRecordExists ($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'
 

Protected Member Functions

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

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...
 
- 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
 
 $suggested_solutions
 
 $original_id
 
 $page
 
 $external_id = ''
 
 $questionChangeListeners = array()
 
 $processLocker
 
 $step = null
 
 $lastChange
 
 $shuffler
 
- Static Protected Attributes inherited from assQuestion
static $allowedFileExtensionsByMimeType
 
static $allowedCharsetsByMimeType
 
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 = '' 
)

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

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

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

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

References $filename, $ilLog, assQuestion\buildImagePath(), getAnswers(), getThumbPrefix(), and ilUtil\makeDirParents().

899  {
900  parent::afterSyncWithOriginal($origQuestionId, $dupQuestionId, $origParentObjId, $dupParentObjId);
901 
902  $this->cloneAnswerImages($dupQuestionId, $dupParentObjId, $origQuestionId, $origParentObjId);
903  }
+ Here is the call graph for this function:

◆ beforeSyncWithOriginal()

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

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

References assQuestion\$question.

887  {
888  parent::beforeSyncWithOriginal($origQuestionId, $dupQuestionId, $origParentObjId, $dupParentObjId);
889 
890  $question = self::_instanciateQuestion($origQuestionId);
891 
892  foreach($question->getAnswers() as $answer)
893  {
894  $question->removeAnswerImage($answer->getPosition());
895  }
896  }

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

public

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

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

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

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

◆ calculateReachedPointsForSolution()

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

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

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

Referenced by calculateReachedPoints().

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

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

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

◆ createNewOriginalFromThisDuplicate()

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

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

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

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

◆ duplicate()

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

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

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

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

◆ generateThumbForFile()

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

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

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

Referenced by rebuildThumbnails().

622  {
623  $filename = $path . $file;
624  if (@file_exists($filename))
625  {
626  $thumbpath = $path . $this->getThumbPrefix() . $file;
627  $path_info = @pathinfo($filename);
628  $ext = "";
629  switch (strtoupper($path_info['extension']))
630  {
631  case 'PNG':
632  $ext = 'PNG';
633  break;
634  case 'GIF':
635  $ext = 'GIF';
636  break;
637  default:
638  $ext = 'JPEG';
639  break;
640  }
641  ilUtil::convertImage($filename, $thumbpath, $ext, $this->getThumbSize());
642  }
643  }
print $file
$filename
Definition: buildRTE.php:89
static convertImage($a_from, $a_to, $a_target_format="", $a_geometry="", $a_background_color="")
convert image
$path
Definition: index.php:22
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAdditionalTableName()

assKprimChoice::getAdditionalTableName ( )

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

Referenced by saveAdditionalQuestionDataToDb().

77  {
78  return "qpl_qst_kprim";
79  }
+ Here is the caller graph for this function:

◆ getAnswer()

assKprimChoice::getAnswer (   $position)

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

References getAnswers().

Referenced by removeAnswerImage().

177  {
178  foreach($this->getAnswers() as $answer)
179  {
180  if($answer->getPosition() == $position)
181  {
182  return $answer;
183  }
184  }
185 
186  return null;
187  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAnswers()

◆ getAnswerTableName()

assKprimChoice::getAnswerTableName ( )

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

Referenced by saveAnswerSpecificDataToDb().

82  {
83  return "qpl_a_kprim";
84  }
+ Here is the caller graph for this function:

◆ getAnswerType()

assKprimChoice::getAnswerType ( )

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

References $answerType.

Referenced by rebuildThumbnails(), and saveAdditionalQuestionDataToDb().

102  {
103  return $this->answerType;
104  }
+ Here is the caller graph for this function:

◆ getAnswerTypeSelectOptions()

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

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

References ilLanguage\txt().

511  {
512  return array(
513  self::ANSWER_TYPE_SINGLE_LINE => $lng->txt('answers_singleline'),
514  self::ANSWER_TYPE_MULTI_LINE => $lng->txt('answers_multiline')
515  );
516  }
txt($a_topic, $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
+ Here is the call graph for this function:

◆ getCustomFalseOptionLabel()

assKprimChoice::getCustomFalseOptionLabel ( )

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

References $customFalseOptionLabel.

Referenced by getFalseOptionLabelTranslation(), and saveAdditionalQuestionDataToDb().

152  {
154  }
+ 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().

142  {
144  }
+ Here is the caller graph for this function:

◆ getFalseOptionLabelTranslation()

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

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

References $optionLabel, getCustomFalseOptionLabel(), and ilLanguage\txt().

Referenced by getInstructionTextTranslation(), and toJSON().

568  {
569  switch($optionLabel)
570  {
571  case self::OPTION_LABEL_RIGHT_WRONG:
572  return $lng->txt('option_label_wrong');
573 
574  case self::OPTION_LABEL_PLUS_MINUS:
575  return $lng->txt('option_label_minus');
576 
577  case self::OPTION_LABEL_APPLICABLE_OR_NOT:
578  return $lng->txt('option_label_not_applicable');
579 
580  case self::OPTION_LABEL_ADEQUATE_OR_NOT:
581  return $lng->txt('option_label_not_adequate');
582 
583  case self::OPTION_LABEL_CUSTOM:
584  return $this->getCustomFalseOptionLabel();
585  }
586  }
txt($a_topic, $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
+ 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 588 of file class.assKprimChoice.php.

References $optionLabel, getFalseOptionLabelTranslation(), getTrueOptionLabelTranslation(), and ilLanguage\txt().

Referenced by toJSON().

589  {
590  return sprintf(
591  $lng->txt('kprim_instruction_text'),
594  );
595  }
getTrueOptionLabelTranslation(ilLanguage $lng, $optionLabel)
getFalseOptionLabelTranslation(ilLanguage $lng, $optionLabel)
txt($a_topic, $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNumAllowedFailures()

assKprimChoice::getNumAllowedFailures ( )
private

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

References isScorePartialSolutionEnabled().

Referenced by toJSON().

1036  {
1037  if( $this->isScorePartialSolutionEnabled() )
1038  {
1039  return self::NUM_REQUIRED_ANSWERS - self::PARTIAL_SCORING_NUM_CORRECT_ANSWERS;
1040  }
1041 
1042  return 0;
1043  }
+ 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.

References $optionLabel.

Referenced by saveAdditionalQuestionDataToDb(), and toJSON().

132  {
133  return $this->optionLabel;
134  }
+ Here is the caller graph for this function:

◆ getQuestionType()

assKprimChoice::getQuestionType ( )

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

Referenced by toJSON().

72  {
73  return 'assKprimChoice';
74  }
+ Here is the caller graph for this function:

◆ getRTETextWithMediaObjects()

assKprimChoice::getRTETextWithMediaObjects ( )
protected

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

References getAnswers().

949  {
950  $combinedText = parent::getRTETextWithMediaObjects();
951 
952  foreach($this->getAnswers() as $answer)
953  {
954  $combinedText .= $answer->getAnswertext();
955  }
956 
957  return $combinedText;
958  }
+ Here is the call graph for this function:

◆ getSolutionSubmit()

assKprimChoice::getSolutionSubmit ( )
protected

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

References $_POST.

Referenced by isComplete().

700  {
701  $solutionSubmit = array();
702  foreach($_POST as $key => $value)
703  {
704  $matches = null;
705 
706  if(preg_match("/^kprim_choice_result_(\d+)/", $key, $matches))
707  {
708  if(strlen($value))
709  {
710  $solutionSubmit[$matches[1]] = $value;
711  }
712  }
713  }
714  return $solutionSubmit;
715  }
$_POST['username']
Definition: cron.php:12
+ Here is the caller graph for this function:

◆ getSpecificFeedbackAllCorrectOptionLabel()

assKprimChoice::getSpecificFeedbackAllCorrectOptionLabel ( )

Implements ilAssSpecificFeedbackOptionLabelProvider.

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

1046  {
1047  return 'feedback_correct_kprim';
1048  }

◆ getSpecificFeedbackSetting()

assKprimChoice::getSpecificFeedbackSetting ( )

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

References $specificFeedbackSetting.

Referenced by saveAdditionalQuestionDataToDb().

162  {
164  }
+ Here is the caller graph for this function:

◆ getThumbPrefix()

assKprimChoice::getThumbPrefix ( )

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

Referenced by afterSyncWithOriginal(), generateThumbForFile(), and loadAnswerData().

603  {
604  return self::THUMB_PREFIX;
605  }
+ Here is the caller graph for this function:

◆ getThumbSize()

assKprimChoice::getThumbSize ( )

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

References $thumbSize.

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

112  {
113  return $this->thumbSize;
114  }
+ Here is the caller graph for this function:

◆ getTrueOptionLabelTranslation()

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

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

References $optionLabel, getCustomTrueOptionLabel(), and ilLanguage\txt().

Referenced by getInstructionTextTranslation(), and toJSON().

547  {
548  switch($optionLabel)
549  {
550  case self::OPTION_LABEL_RIGHT_WRONG:
551  return $lng->txt('option_label_right');
552 
553  case self::OPTION_LABEL_PLUS_MINUS:
554  return $lng->txt('option_label_plus');
555 
556  case self::OPTION_LABEL_APPLICABLE_OR_NOT:
557  return $lng->txt('option_label_applicable');
558 
559  case self::OPTION_LABEL_ADEQUATE_OR_NOT:
560  return $lng->txt('option_label_adequate');
561 
562  case self::OPTION_LABEL_CUSTOM:
563  return $this->getCustomTrueOptionLabel();
564  }
565  }
txt($a_topic, $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getValidAnswerTypes()

assKprimChoice::getValidAnswerTypes ( )

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

Referenced by isValidAnswerType().

491  {
492  return array(self::ANSWER_TYPE_SINGLE_LINE, self::ANSWER_TYPE_MULTI_LINE);
493  }
+ Here is the caller graph for this function:

◆ getValidOptionLabels()

assKprimChoice::getValidOptionLabels ( )

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

Referenced by isValidOptionLabel().

519  {
520  return array(
521  self::OPTION_LABEL_RIGHT_WRONG,
522  self::OPTION_LABEL_PLUS_MINUS,
523  self::OPTION_LABEL_APPLICABLE_OR_NOT,
524  self::OPTION_LABEL_ADEQUATE_OR_NOT,
525  self::OPTION_LABEL_CUSTOM
526  );
527  }
+ Here is the caller graph for this function:

◆ getValidOptionLabelsTranslated()

assKprimChoice::getValidOptionLabelsTranslated ( ilLanguage  $lng)

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

References ilLanguage\txt().

530  {
531  return array(
532  self::OPTION_LABEL_RIGHT_WRONG => $lng->txt('option_label_right_wrong'),
533  self::OPTION_LABEL_PLUS_MINUS => $lng->txt('option_label_plus_minus'),
534  self::OPTION_LABEL_APPLICABLE_OR_NOT => $lng->txt('option_label_applicable_or_not'),
535  self::OPTION_LABEL_ADEQUATE_OR_NOT => $lng->txt('option_label_adequate_or_not'),
536  self::OPTION_LABEL_CUSTOM => $lng->txt('option_label_custom')
537  );
538  }
txt($a_topic, $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
+ Here is the call graph for this function:

◆ handleFileUpload()

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

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

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

Referenced by handleFileUploads().

661  {
662  $imagePath = $this->getImagePath();
663 
664  if( !file_exists($imagePath) )
665  {
666  ilUtil::makeDirParents($imagePath);
667  }
668 
669  $filename = $this->createNewImageFileName($fileData['name'], true);
670 
671  $answer->setImageFsDir($imagePath);
672  $answer->setImageFile($filename);
673 
674  if( !ilUtil::moveUploadedFile($fileData['tmp_name'], $fileData['name'], $answer->getImageFsPath()) )
675  {
676  return 2;
677  }
678 
679  return 0;
680  }
static makeDirParents($a_dir)
Create a new directory and all parent directories.
getImagePath($question_id=null, $object_id=null)
Returns the image path for web accessable images of a question.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
$filename
Definition: buildRTE.php:89
createNewImageFileName($image_filename, $unique=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleFileUploads()

assKprimChoice::handleFileUploads (   $answers,
  $files 
)

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

References $answers, and handleFileUpload().

646  {
647  foreach($answers as $answer)
648  {
649  /* @var ilAssKprimChoiceAnswer $answer */
650 
651  if( !isset($files[$answer->getPosition()]) )
652  {
653  continue;
654  }
655 
656  $this->handleFileUpload($answer, $files[$answer->getPosition()]);
657  }
658  }
handleFileUpload(ilAssKprimChoiceAnswer $answer, $fileData)
+ Here is the call graph for this function:

◆ isAnswered()

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

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

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

1056  {
1057  $numExistingSolutionRecords = assQuestion::getNumExistingSolutionRecords($active_id, $pass, $this->getId());
1058 
1059  return $numExistingSolutionRecords >= 4;
1060  }
getId()
Gets the id of the assQuestion object.
static getNumExistingSolutionRecords($activeId, $pass, $questionId)
returns the number of existing solution records for the given test active / pass and given question i...
+ Here is the call graph for this function:

◆ isComplete()

assKprimChoice::isComplete ( )

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

References $ilDB, $pass, $text, ilObjAssessmentFolder\_enabledAssessmentLogging(), ilObjAssessmentFolder\_getLogLanguage(), ilObjTest\_getPass(), getAnswers(), assQuestion\getId(), assQuestion\getMaximumPoints(), assQuestion\getProcessLocker(), getSolutionSubmit(), assQuestion\logAction(), assQuestion\removeCurrentSolution(), assQuestion\saveCurrentSolution(), and assQuestion\saveWorkingData().

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

◆ isCustomOptionLabel()

assKprimChoice::isCustomOptionLabel (   $labelValue)

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

598  {
599  return $labelValue == self::OPTION_LABEL_CUSTOM;
600  }

◆ isObligationPossible()

static assKprimChoice::isObligationPossible (   $questionId)
static

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

1051  {
1052  return true;
1053  }

◆ isScorePartialSolutionEnabled()

assKprimChoice::isScorePartialSolutionEnabled ( )

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

References $scorePartialSolutionEnabled.

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

122  {
124  }
+ 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().

92  {
94  }
+ Here is the caller graph for this function:

◆ isSingleLineAnswerType()

assKprimChoice::isSingleLineAnswerType (   $answerType)

Definition at line 501 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 495 of file class.assKprimChoice.php.

References $answerType, and getValidAnswerTypes().

Referenced by loadFromDb().

496  {
497  $validTypes = $this->getValidAnswerTypes();
498  return in_array($answerType, $validTypes);
499  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isValidOptionLabel()

assKprimChoice::isValidOptionLabel (   $optionLabel)

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

References $optionLabel, and getValidOptionLabels().

Referenced by loadFromDb().

541  {
542  $validLabels = $this->getValidOptionLabels();
543  return in_array($optionLabel, $validLabels);
544  }
+ 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

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

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

964  {
965  foreach($this->getAnswers() as $answer)
966  {
967  /* @var ilAssKprimChoiceAnswer $answer */
968  $answer->setAnswertext( $migrator->migrateToLmContent($answer->getAnswertext()) );
969  }
970  }
+ Here is the call graph for this function:

◆ loadAnswerData()

assKprimChoice::loadAnswerData (   $questionId)
private

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

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

Referenced by loadFromDb().

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...
getImagePath($question_id=null, $object_id=null)
Returns the image path for web accessable images of a question.
$data
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadFromDb()

assKprimChoice::loadFromDb (   $questionId)

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

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

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  }
isValidAnswerType($answerType)
setScorePartialSolutionEnabled($scorePartialSolutionEnabled)
setId($id=-1)
Sets the id of the assQuestion object.
setEstimatedWorkingTimeFromDurationString($durationString)
Sets the estimated working time of a question from a given datetime string.
setNrOfTries($a_nr_of_tries)
setAdditionalContentEditingMode($additinalContentEditingMode)
setter for additional content editing mode for this question
setCustomTrueOptionLabel($customTrueOptionLabel)
isValidOptionLabel($optionLabel)
loadAnswerData($questionId)
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...
setOptionLabel($optionLabel)
setAuthor($author="")
Sets the authors name of the assQuestion object.
$data
setShuffleAnswersEnabled($shuffleAnswersEnabled)
setPoints($a_points)
Sets the maximum available points for the question.
setCustomFalseOptionLabel($customFalseOptionLabel)
setQuestion($question="")
Sets the question string of the question object.
setSpecificFeedbackSetting($specificFeedbackSetting)
setOriginalId($original_id)
setLastChange($lastChange)
setTitle($title="")
Sets the title string of the assQuestion object.
setObjId($obj_id=0)
Set the object id of the container object.
setComment($comment="")
Sets the comment string of the assQuestion object.
setAnswerType($answerType)
setOwner($owner="")
Sets the creator/owner ID of the assQuestion object.
+ Here is the call graph for this function:

◆ moveAnswerDown()

assKprimChoice::moveAnswerDown (   $position)

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

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

◆ moveAnswerUp()

assKprimChoice::moveAnswerUp (   $position)

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

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

◆ rebuildThumbnails()

assKprimChoice::rebuildThumbnails ( )

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

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

Referenced by saveAnswerSpecificDataToDb().

608  {
609  if( $this->isSingleLineAnswerType($this->getAnswerType()) && $this->getThumbSize() )
610  {
611  foreach ($this->getAnswers() as $answer)
612  {
613  if (strlen($answer->getImageFile()))
614  {
615  $this->generateThumbForFile($answer->getImageFsDir(), $answer->getImageFile());
616  }
617  }
618  }
619  }
isSingleLineAnswerType($answerType)
generateThumbForFile($path, $file)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeAnswerImage()

assKprimChoice::removeAnswerImage (   $position)

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

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

683  {
684  $answer = $this->getAnswer($position);
685 
686  if( file_exists($answer->getImageFsPath()) )
687  {
688  ilUtil::delDir($answer->getImageFsPath());
689  }
690 
691  if( file_exists($answer->getThumbFsPath()) )
692  {
693  ilUtil::delDir($answer->getThumbFsPath());
694  }
695 
696  $answer->setImageFile(null);
697  }
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:

◆ reworkWorkingData()

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

Reworks the allready saved working data if neccessary.

protected

Parameters
integer$active_id
integer$pass
boolean$obligationsAnswered

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

449  {
450  // nothing to do
451  }

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

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

Referenced by saveToDb().

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

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

Referenced by saveToDb().

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

◆ saveToDb()

assKprimChoice::saveToDb (   $originalId = '')

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

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

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

◆ setAnswers()

assKprimChoice::setAnswers (   $answers)

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

References $answers.

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

◆ setAnswerType()

assKprimChoice::setAnswerType (   $answerType)

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

References $answerType.

Referenced by loadFromDb().

97  {
98  $this->answerType = $answerType;
99  }
+ Here is the caller graph for this function:

◆ setCustomFalseOptionLabel()

assKprimChoice::setCustomFalseOptionLabel (   $customFalseOptionLabel)

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

References $customFalseOptionLabel.

Referenced by loadFromDb().

147  {
148  $this->customFalseOptionLabel = $customFalseOptionLabel;
149  }
+ Here is the caller graph for this function:

◆ setCustomTrueOptionLabel()

assKprimChoice::setCustomTrueOptionLabel (   $customTrueOptionLabel)

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

References $customTrueOptionLabel.

Referenced by loadFromDb().

137  {
138  $this->customTrueOptionLabel = $customTrueOptionLabel;
139  }
+ Here is the caller graph for this function:

◆ setExportDetailsXLS()

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

{}

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

References assQuestion\$id, $pass, ilExcelUtils\_convert_text(), getAnswers(), assQuestion\getSolutionValues(), and assQuestion\getTitle().

1066  {
1067  require_once 'Services/Excel/classes/class.ilExcelUtils.php';
1068 
1069  $solution = $this->getSolutionValues($active_id, $pass);
1070 
1071  $worksheet->writeString($startrow, 0, ilExcelUtils::_convert_text($this->lng->txt($this->getQuestionType())), $format_title);
1072  $worksheet->writeString($startrow, 1, ilExcelUtils::_convert_text($this->getTitle()), $format_title);
1073  $i = 1;
1074  foreach($this->getAnswers() as $id => $answer)
1075  {
1076  $worksheet->writeString($startrow + $i, 0, ilExcelUtils::_convert_text($answer->getAnswertext()), $format_bold);
1077  $correctness = FALSE;
1078  foreach($solution as $solutionvalue)
1079  {
1080  if($id == $solutionvalue['value1'])
1081  {
1082  $correctness = $solutionvalue['value2'];
1083  break;
1084  }
1085  }
1086  $worksheet->write($startrow + $i, 1, $correctness);
1087  $i++;
1088  }
1089  return $startrow + $i + 1;
1090  }
_convert_text($a_text, $a_target="has been removed")
getSolutionValues($active_id, $pass=NULL, $authorized=true)
Loads solutions of a given user from the database an returns it.
getTitle()
Gets the title string of the assQuestion object.
+ Here is the call graph for this function:

◆ setOptionLabel()

assKprimChoice::setOptionLabel (   $optionLabel)

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

References $optionLabel.

Referenced by loadFromDb().

127  {
128  $this->optionLabel = $optionLabel;
129  }
+ Here is the caller graph for this function:

◆ setScorePartialSolutionEnabled()

assKprimChoice::setScorePartialSolutionEnabled (   $scorePartialSolutionEnabled)

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

References $scorePartialSolutionEnabled.

Referenced by loadFromDb().

117  {
118  $this->scorePartialSolutionEnabled = $scorePartialSolutionEnabled;
119  }
+ Here is the caller graph for this function:

◆ setShuffleAnswersEnabled()

assKprimChoice::setShuffleAnswersEnabled (   $shuffleAnswersEnabled)

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

References $shuffleAnswersEnabled.

Referenced by loadFromDb().

87  {
88  $this->shuffleAnswersEnabled = $shuffleAnswersEnabled;
89  }
+ Here is the caller graph for this function:

◆ setSpecificFeedbackSetting()

assKprimChoice::setSpecificFeedbackSetting (   $specificFeedbackSetting)

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

References $specificFeedbackSetting.

Referenced by loadFromDb().

157  {
158  $this->specificFeedbackSetting = $specificFeedbackSetting;
159  }
+ Here is the caller graph for this function:

◆ setThumbSize()

assKprimChoice::setThumbSize (   $thumbSize)

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

References $thumbSize.

Referenced by loadFromDb().

107  {
108  $this->thumbSize = $thumbSize;
109  }
+ Here is the caller graph for this function:

◆ toJSON()

assKprimChoice::toJSON ( )

Returns a JSON representation of the question.

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

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

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

◆ DEFAULT_THUMB_SIZE

const assKprimChoice::DEFAULT_THUMB_SIZE = 150

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

◆ NUM_REQUIRED_ANSWERS

const assKprimChoice::NUM_REQUIRED_ANSWERS = 4

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

◆ OPTION_LABEL_ADEQUATE_OR_NOT

const assKprimChoice::OPTION_LABEL_ADEQUATE_OR_NOT = 'adequate_or_not'

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

◆ OPTION_LABEL_APPLICABLE_OR_NOT

const assKprimChoice::OPTION_LABEL_APPLICABLE_OR_NOT = 'applicable_or_not'

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

◆ OPTION_LABEL_CUSTOM

const assKprimChoice::OPTION_LABEL_CUSTOM = 'customlabel'

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

◆ OPTION_LABEL_PLUS_MINUS

const assKprimChoice::OPTION_LABEL_PLUS_MINUS = 'plus_minus'

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

◆ OPTION_LABEL_RIGHT_WRONG

const assKprimChoice::OPTION_LABEL_RIGHT_WRONG = 'right_wrong'

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

◆ PARTIAL_SCORING_NUM_CORRECT_ANSWERS

const assKprimChoice::PARTIAL_SCORING_NUM_CORRECT_ANSWERS = 3

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

◆ THUMB_PREFIX

const assKprimChoice::THUMB_PREFIX = 'thumb.'

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


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