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='')
 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, &$format_title, &$format_bold)
 {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
object$format_titleExcel title format
object$format_boldExcel bold format
array$eval_dataCumulated evaluation data @access public
} 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)
 @TODO 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 ()
 
 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 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)
 @global 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 ()
 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
 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 = '' 
)

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 898 of file class.assKprimChoice.php.

899 {
900 parent::afterSyncWithOriginal($origQuestionId, $dupQuestionId, $origParentObjId, $dupParentObjId);
901
902 $this->cloneAnswerImages($dupQuestionId, $dupParentObjId, $origQuestionId, $origParentObjId);
903 }

◆ beforeSyncWithOriginal()

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

Reimplemented from assQuestion.

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

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 }
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 463 of file class.assKprimChoice.php.

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
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.
$data
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 717 of file class.assKprimChoice.php.

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.

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 855 of file class.assKprimChoice.php.

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.

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

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 }

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 759 of file class.assKprimChoice.php.

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.

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 621 of file class.assKprimChoice.php.

622 {
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

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 510 of file class.assKprimChoice.php.

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 }

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 567 of file class.assKprimChoice.php.

568 {
569 switch($optionLabel)
570 {
572 return $lng->txt('option_label_wrong');
573
575 return $lng->txt('option_label_minus');
576
578 return $lng->txt('option_label_not_applicable');
579
581 return $lng->txt('option_label_not_adequate');
582
584 return $this->getCustomFalseOptionLabel();
585 }
586 }
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 588 of file class.assKprimChoice.php.

589 {
590 return sprintf(
591 $lng->txt('kprim_instruction_text'),
592 $this->getTrueOptionLabelTranslation($lng, $optionLabel),
593 $this->getFalseOptionLabelTranslation($lng, $optionLabel)
594 );
595 }

References assQuestion\$lng, and $optionLabel.

Referenced by toJSON().

+ Here is the caller graph for this function:

◆ getNumAllowedFailures()

assKprimChoice::getNumAllowedFailures ( )
private

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

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

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

References getAnswers().

+ Here is the call graph for this function:

◆ getSolutionSubmit()

assKprimChoice::getSolutionSubmit ( )
protected

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

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

References $_POST.

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

+ Here is the caller graph for this function:

◆ getThumbPrefix()

assKprimChoice::getThumbPrefix ( )

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

603 {
604 return self::THUMB_PREFIX;
605 }

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

547 {
548 switch($optionLabel)
549 {
551 return $lng->txt('option_label_right');
552
554 return $lng->txt('option_label_plus');
555
557 return $lng->txt('option_label_applicable');
558
560 return $lng->txt('option_label_adequate');
561
563 return $this->getCustomTrueOptionLabel();
564 }
565 }

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 490 of file class.assKprimChoice.php.

491 {
492 return array(self::ANSWER_TYPE_SINGLE_LINE, self::ANSWER_TYPE_MULTI_LINE);
493 }

Referenced by isValidAnswerType().

+ Here is the caller graph for this function:

◆ getValidOptionLabels()

assKprimChoice::getValidOptionLabels ( )

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

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 }

Referenced by isValidOptionLabel().

+ Here is the caller graph for this function:

◆ getValidOptionLabelsTranslated()

assKprimChoice::getValidOptionLabelsTranslated ( ilLanguage  $lng)

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

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 }

References assQuestion\$lng.

◆ handleFileUpload()

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

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

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 }
createNewImageFileName($image_filename, $unique=false)
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
static makeDirParents($a_dir)
Create a new directory and all parent directories.

References $filename, assQuestion\createNewImageFileName(), 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 645 of file class.assKprimChoice.php.

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)

References $answers, 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 1055 of file class.assKprimChoice.php.

1056 {
1057 $numExistingSolutionRecords = assQuestion::getNumExistingSolutionRecords($active_id, $pass, $this->getId());
1058
1059 return $numExistingSolutionRecords >= 4;
1060 }
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 597 of file class.assKprimChoice.php.

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

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

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

496 {
497 $validTypes = $this->getValidAnswerTypes();
498 return in_array($answerType, $validTypes);
499 }

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 540 of file class.assKprimChoice.php.

541 {
542 $validLabels = $this->getValidOptionLabels();
543 return in_array($optionLabel, $validLabels);
544 }

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 963 of file class.assKprimChoice.php.

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

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

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)

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

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

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

+ Here is the call graph for this function:

◆ reworkWorkingData()

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

Reworks the allready saved working data if neccessary.

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

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,
$format_title,
$format_bold 
)

{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
object$format_titleExcel title format
object$format_boldExcel bold format
array$eval_dataCumulated evaluation data @access public
}

Reimplemented from assQuestion.

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

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 }
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.
_convert_text($a_text, $a_target="has been removed")

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

+ 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 975 of file class.assKprimChoice.php.

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 }
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.
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
$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: