ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
assImagemapQuestion Class Reference

Class for image map questions. More...

+ Inheritance diagram for assImagemapQuestion:
+ Collaboration diagram for assImagemapQuestion:

Public Member Functions

 __construct ( $title="", $comment="", $author="", $owner=-1, $question="", $image_filename="")
 assImagemapQuestion constructor More...
 
 setIsMultipleChoice ($is_multiple_choice)
 Set true if the Imagemapquestion is a multiplechoice Question. More...
 
 getIsMultipleChoice ()
 Returns true, if the imagemap question is a multiplechoice question. More...
 
 isComplete ()
 Returns true, if a imagemap question is complete for use. More...
 
 saveToDb ($original_id="")
 Saves an assImagemapQuestion object to a database. More...
 
 saveAnswerSpecificDataToDb ()
 Saves the answer specific records into a question types answer table. More...
 
 saveAdditionalQuestionDataToDb ()
 Saves a record to the question types additional data table. More...
 
 duplicate ($for_test=true, $title="", $author="", $owner="", $testObjId=null)
 Duplicates an assImagemapQuestion. More...
 
 copyObject ($target_questionpool_id, $title="")
 Copies an assImagemapQuestion object. More...
 
 createNewOriginalFromThisDuplicate ($targetParentId, $targetQuestionTitle="")
 
 duplicateImage ($question_id, $objectId=null)
 
 copyImage ($question_id, $source_questionpool)
 
 loadFromDb ($question_id)
 Loads a assImagemapQuestion object from a database. More...
 
 uploadImagemap (array $shapes)
 Uploads an image map and takes over the areas. More...
 
 getImageFilename ()
 
 setImageFilename ($image_filename, $image_tempfilename="")
 Sets the image file name. More...
 
 get_imagemap_contents ($href="#")
 Gets the imagemap file contents. More...
 
 addAnswer ( $answertext="", $points=0.0, $order=0, $coords="", $area="", $points_unchecked=0.0)
 Adds a possible answer for a imagemap question. More...
 
 getAnswerCount ()
 Returns the number of answers. More...
 
 getAnswer ($index=0)
 Returns an answer. More...
 
getAnswers ()
 Returns the answer array. More...
 
 deleteArea ($index=0)
 Deletes an answer. More...
 
 flushAnswers ()
 Deletes all answers. More...
 
 getMaximumPoints ()
 Returns the maximum points, a learner can reach answering the question. More...
 
 calculateReachedPoints ($active_id, $pass=null, $authorizedSolution=true, $returndetails=false)
 Returns the points, a learner has reached answering the question. More...
 
 calculateReachedPointsFromPreviewSession (ilAssQuestionPreviewSession $previewSession)
 
 isAutosaveable ()
 
 saveWorkingData ($active_id, $pass=null, $authorized=true)
 Saves the learners input of the question to the database. More...
 
 syncWithOriginal ()
 
 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...
 
 getRTETextWithMediaObjects ()
 Collects all text in the question which could contain media objects which were created with the Rich Text Editor. More...
 
 setExportDetailsXLS ($worksheet, $startrow, $active_id, $pass)
 {} More...
 
 deleteImage ()
 Deletes the image file. More...
 
 toJSON ()
 Returns a JSON representation of the question. More...
 
 getOperators ($expression)
 Get all available operations for a specific question. More...
 
 getExpressionTypes ()
 Get all available expression types for a specific question. More...
 
 getAvailableAnswerOptions ($index=null)
 If index is null, the function returns an array with all anwser options Else it returns the specific answer option. More...
 
 getTestOutputSolutions ($activeId, $pass)
 
- Public Member Functions inherited from assQuestion
 __construct ( $title="", $comment="", $author="", $owner=-1, $question="")
 assQuestion constructor More...
 
 getShuffler ()
 
 setShuffler (ilArrayElementShuffler $shuffler)
 
 setProcessLocker ($processLocker)
 
 getProcessLocker ()
 
 fromXML (&$item, &$questionpool_id, &$tst_id, &$tst_object, &$question_counter, &$import_mapping)
 Receives parameters from a QTI parser and creates a valid ILIAS question object. More...
 
 toXML ($a_include_header=true, $a_include_binary=true, $a_shuffle=false, $test_output=false, $force_image_references=false)
 Returns a QTI xml representation of the question. More...
 
 isComplete ()
 Returns true, if a question is complete for use. More...
 
 questionTitleExists ($questionpool_id, $title)
 Returns TRUE if the question title exists in the database. More...
 
 setTitle ($title="")
 Sets the title string of the assQuestion object. More...
 
 setId ($id=-1)
 Sets the id of the assQuestion object. More...
 
 setTestId ($id=-1)
 Sets the test id of the assQuestion object. More...
 
 setComment ($comment="")
 Sets the comment string of the assQuestion object. More...
 
 setOutputType ($outputType=OUTPUT_HTML)
 Sets the output type. More...
 
 setShuffle ($shuffle=true)
 Sets the shuffle flag. More...
 
 setEstimatedWorkingTime ($hour=0, $min=0, $sec=0)
 Sets the estimated working time of a question from given hour, minute and second. More...
 
 setEstimatedWorkingTimeFromDurationString ($durationString)
 Sets the estimated working time of a question from a given datetime string. More...
 
 keyInArray ($searchkey, $array)
 returns TRUE if the key occurs in an array More...
 
 setAuthor ($author="")
 Sets the authors name of the assQuestion object. More...
 
 setOwner ($owner="")
 Sets the creator/owner ID of the assQuestion object. More...
 
 getTitle ()
 Gets the title string of the assQuestion object. More...
 
 getTitleFilenameCompliant ()
 returns the object title prepared to be used as a filename More...
 
 getId ()
 Gets the id of the assQuestion object. More...
 
 getShuffle ()
 Gets the shuffle flag. More...
 
 getTestId ()
 Gets the test id of the assQuestion object. More...
 
 getComment ()
 Gets the comment string of the assQuestion object. More...
 
 getOutputType ()
 Gets the output type. More...
 
 supportsJavascriptOutput ()
 Returns true if the question type supports JavaScript output. More...
 
 supportsNonJsOutput ()
 
 requiresJsSwitch ()
 
 getEstimatedWorkingTime ()
 Gets the estimated working time of a question. More...
 
 getAuthor ()
 Gets the authors name of the assQuestion object. More...
 
 getOwner ()
 Gets the creator/owner ID of the assQuestion object. More...
 
 getObjId ()
 Get the object id of the container object. More...
 
 setObjId ($obj_id=0)
 Set the object id of the container object. More...
 
 getLifecycle ()
 
 setLifecycle (ilAssQuestionLifecycle $lifecycle)
 
 setExternalId ($external_id)
 
 getExternalId ()
 
 getSuggestedSolutionOutput ()
 
_getSuggestedSolution ($question_id, $subquestion_index=0)
 Returns a suggested solution for a given subquestion index. More...
 
 getSuggestedSolutions ()
 Return the suggested solutions. More...
 
 getReachedPoints ($active_id, $pass=null)
 Returns the points, a learner has reached answering the question This is the fast way to get the points directly from the database. More...
 
 getMaximumPoints ()
 Returns the maximum points, a learner can reach answering the question. More...
 
 getAdjustedReachedPoints ($active_id, $pass=null, $authorizedSolution=true)
 returns the reached points ... More...
 
 calculateResultsFromSolution ($active_id, $pass=null, $obligationsEnabled=false)
 Calculates the question results from a previously saved question solution. More...
 
 persistWorkingState ($active_id, $pass=null, $obligationsEnabled=false, $authorized=true)
 persists the working state for current testactive and testpass More...
 
 persistPreviewState (ilAssQuestionPreviewSession $previewSession)
 persists the preview state for current user and question More...
 
 validateSolutionSubmit ()
 
 saveWorkingData ($active_id, $pass=null, $authorized=true)
 Saves the learners input of the question to the database. More...
 
 moveUploadedMediaFile ($file, $name)
 Move an uploaded media file to an public accessible temp dir to present it. More...
 
 getSuggestedSolutionPath ()
 Returns the path for a suggested solution. More...
 
 getJavaPath ()
 Returns the image path for web accessable images of a question. More...
 
 getImagePath ($question_id=null, $object_id=null)
 Returns the image path for web accessable images of a question. More...
 
 buildImagePath ($questionId, $parentObjectId)
 
 getFlashPath ()
 Returns the image path for web accessable flash files of a question. More...
 
 getJavaPathWeb ()
 Returns the web image path for web accessable java applets of a question. More...
 
 getSuggestedSolutionPathWeb ()
 Returns the web path for a suggested solution. More...
 
 getImagePathWeb ()
 Returns the web image path for web accessable images of a question. More...
 
 getFlashPathWeb ()
 Returns the web image path for web accessable flash applications of a question. More...
 
 getTestOutputSolutions ($activeId, $pass)
 
 getUserSolutionPreferingIntermediate ($active_id, $pass=null)
 
 getSolutionValues ($active_id, $pass=null, $authorized=true)
 Loads solutions of a given user from the database an returns it. More...
 
 isInUse ($question_id="")
 Checks whether the question is in use or not. More...
 
 isClone ($question_id="")
 Checks whether the question is a clone of another question or not. More...
 
 pcArrayShuffle ($array)
 Shuffles the values of a given array. More...
 
 getAdditionalTableName ()
 Returns the name of the additional question data table in the database. More...
 
 getAnswerTableName ()
 Returns the name of the answer table in the database. More...
 
 deleteAnswers ($question_id)
 Deletes datasets from answers tables. More...
 
 deleteAdditionalTableData ($question_id)
 Deletes datasets from the additional question table in the database. More...
 
 delete ($question_id)
 Deletes a question and all materials from the database. More...
 
 getTotalAnswers ()
 get total number of answers More...
 
 _getTotalAnswers ($a_q_id)
 get number of answers for question id (static) note: do not use $this inside this method More...
 
 copyXHTMLMediaObjectsOfQuestion ($a_q_id)
 
 syncXHTMLMediaObjectsOfQuestion ()
 
 createPageObject ()
 create page object of question More...
 
 copyPageOfQuestion ($a_q_id)
 
 getPageOfQuestion ()
 
 setOriginalId ($original_id)
 
 getOriginalId ()
 
 fixSvgToPng ($imageFilenameContainingString)
 
 fixUnavailableSkinImageSources ($html)
 
 loadFromDb ($question_id)
 Loads the question from the database. More...
 
 createNewQuestion ($a_create_page=true)
 Creates a new question without an owner when a new question is created This assures that an ID is given to the question if a file upload or something else occurs. More...
 
 saveQuestionDataToDb ($original_id="")
 
 saveToDb ($original_id="")
 Saves the question to the database. More...
 
 setNewOriginalId ($newId)
 
 deleteSuggestedSolutions ()
 Deletes all suggestes solutions in the database. More...
 
 getSuggestedSolution ($subquestion_index=0)
 Returns a suggested solution for a given subquestion index. More...
 
 getSuggestedSolutionTitle ($subquestion_index=0)
 Returns the title of a suggested solution at a given subquestion_index. More...
 
 setSuggestedSolution ($solution_id="", $subquestion_index=0, $is_import=false)
 Sets a suggested solution for the question. More...
 
 _resolveInternalLink ($internal_link)
 
 _resolveIntLinks ($question_id)
 
 syncWithOriginal ()
 
 _questionExists ($question_id)
 Returns true if the question already exists in the database. More...
 
 _questionExistsInPool ($question_id)
 Returns true if the question already exists in the database and is assigned to a question pool. More...
 
 getPoints ()
 Returns the maximum available points for the question. More...
 
 setPoints ($a_points)
 Sets the maximum available points for the question. More...
 
 getSolutionMaxPass ($active_id)
 Returns the maximum pass a users question solution. More...
 
 calculateReachedPoints ($active_id, $pass=null, $authorizedSolution=true, $returndetails=false)
 Returns the points, a learner has reached answering the question. More...
 
 deductHintPointsFromReachedPoints (ilAssQuestionPreviewSession $previewSession, $reachedPoints)
 
 calculateReachedPointsFromPreviewSession (ilAssQuestionPreviewSession $previewSession)
 
 isPreviewSolutionCorrect (ilAssQuestionPreviewSession $previewSession)
 
 adjustReachedPointsByScoringOptions ($points, $active_id, $pass=null)
 Adjust the given reached points by checks for all special scoring options in the test container. More...
 
 isHTML ($a_text)
 Checks if a given string contains HTML or not. More...
 
 prepareTextareaOutput ($txt_output, $prepare_for_latex_output=false, $omitNl2BrWhenTextArea=false)
 Prepares a string for a text area output in tests. More...
 
 QTIMaterialToString ($a_material)
 Reads an QTI material tag an creates a text string. More...
 
 addQTIMaterial (&$a_xml_writer, $a_material, $close_material_tag=true, $add_mobs=true)
 Creates a QTI material tag from a plain text or xhtml text. More...
 
 buildHashedImageFilename ($plain_image_filename, $unique=false)
 
 getQuestion ()
 Gets the question string of the question object. More...
 
 setQuestion ($question="")
 Sets the question string of the question object. More...
 
 getQuestionType ()
 Returns the question type of the question. More...
 
 getQuestionTypeID ()
 Returns the question type of the question. More...
 
 cleanupMediaObjectUsage ()
 synchronises appearances of media objects in the question with media object usage table More...
 
getInstances ()
 Gets all instances of the question. More...
 
 getActiveUserData ($active_id)
 Returns the user id and the test id for a given active id. More...
 
 setExportDetailsXLS ($worksheet, $startrow, $active_id, $pass)
 Creates an Excel worksheet for the detailed cumulated results of this question. More...
 
 __get ($value)
 Object getter. More...
 
 __set ($key, $value)
 Object setter. More...
 
 getNrOfTries ()
 
 setNrOfTries ($a_nr_of_tries)
 
 setExportImagePath ($a_path)
 
 formatSAQuestion ($a_q)
 Format self assessment question. More...
 
 setPreventRteUsage ($a_val)
 Set prevent rte usage. More...
 
 getPreventRteUsage ()
 Get prevent rte usage. More...
 
 migrateContentForLearningModule (ilAssSelfAssessmentMigrator $migrator)
 
 setSelfAssessmentEditingMode ($a_selfassessmenteditingmode)
 Set Self-Assessment Editing Mode. More...
 
 getSelfAssessmentEditingMode ()
 Get Self-Assessment Editing Mode. More...
 
 setDefaultNrOfTries ($a_defaultnroftries)
 Set Default Nr of Tries. More...
 
 getDefaultNrOfTries ()
 Get Default Nr of Tries. More...
 
 syncSkillAssignments ($srcParentId, $srcQuestionId, $trgParentId, $trgQuestionId)
 
 isAnswered ($active_id, $pass=null)
 returns boolean wether the question is answered during test pass or not More...
 
 isAutosaveable ()
 
 getAdditionalContentEditingMode ()
 getter for additional content editing mode for this question More...
 
 setAdditionalContentEditingMode ($additinalContentEditingMode)
 setter for additional content editing mode for this question More...
 
 isAdditionalContentEditingModePageObject ()
 isser for additional "pageobject" content editing mode More...
 
 isValidAdditionalContentEditingMode ($additionalContentEditingMode)
 returns the fact wether the passed additional content mode is valid or not More...
 
 getValidAdditionalContentEditingModes ()
 getter for valid additional content editing modes More...
 
 addQuestionChangeListener (ilQuestionChangeListener $listener)
 
 getQuestionChangeListeners ()
 
 getHtmlUserSolutionPurifier ()
 
 getHtmlQuestionContentPurifier ()
 
 setLastChange ($lastChange)
 
 getLastChange ()
 
 removeIntermediateSolution ($active_id, $pass)
 
 removeCurrentSolution ($active_id, $pass, $authorized=true)
 
 saveCurrentSolution ($active_id, $pass, $value1, $value2, $authorized=true, $tstamp=null)
 
 updateCurrentSolution ($solutionId, $value1, $value2, $authorized=true)
 
 updateCurrentSolutionsAuthorization ($activeId, $pass, $authorized, $keepTime=false)
 
 setStep ($step)
 
 getStep ()
 
 toJSON ()
 
 duplicate ($for_test=true, $title="", $author="", $owner="", $testObjId=null)
 
 intermediateSolutionExists ($active_id, $pass)
 
 authorizedSolutionExists ($active_id, $pass)
 
 authorizedOrIntermediateSolutionExists ($active_id, $pass)
 
 isAddableAnswerOptionValue ($qIndex, $answerOptionValue)
 
 addAnswerOptionValue ($qIndex, $answerOptionValue, $points)
 
 removeAllExistingSolutions ()
 
 removeExistingSolutions ($activeId, $pass)
 
 resetUsersAnswer ($activeId, $pass)
 
 removeResultRecord ($activeId, $pass)
 
 fetchValuePairsFromIndexedValues (array $indexedValues)
 
 fetchIndexedValuesFromValuePairs (array $valuePairs)
 
 areObligationsToBeConsidered ()
 
 setObligationsToBeConsidered ($obligationsToBeConsidered)
 
 updateTimestamp ()
 
 getTestPresentationConfig ()
 Get the test question configuration (initialised once) More...
 
 savePartial ()
 
- Public Member Functions inherited from iQuestionCondition
 getUserQuestionResult ($active_id, $pass)
 Get the user solution for a question by active_id and the test pass. More...
 

Data Fields

 $currentSolution = array()
 
const MODE_SINGLE_CHOICE = 0
 
const MODE_MULTIPLE_CHOICE = 1
 
 $answers
 
 $image_filename
 
 $imagemap_contents
 
 $coords
 
- Data Fields inherited from assQuestion
const IMG_MIME_TYPE_JPG = 'image/jpeg'
 
const IMG_MIME_TYPE_PNG = 'image/png'
 
const IMG_MIME_TYPE_GIF = 'image/gif'
 
const ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT = 'default'
 constant for additional content editing mode "default" More...
 
const ADDITIONAL_CONTENT_EDITING_MODE_PAGE_OBJECT = 'pageobject'
 constant for additional content editing mode "pageobject" More...
 
 $feedbackOBJ = null
 
 $prevent_rte_usage = false
 
 $selfassessmenteditingmode = false
 
 $defaultnroftries = 0
 
 $questionActionCmd = 'handleQuestionAction'
 
const KEY_VALUES_IMPLOSION_SEPARATOR = ':'
 
- Data Fields inherited from iQuestionCondition
const StringResultExpression = '~TEXT~'
 
const PercentageResultExpression = '%n%'
 
const NumericResultExpression = '#n#'
 
const MatchingResultExpression = ';n:m;'
 
const OrderingResultExpression = '$n,m,o,p$'
 
const NumberOfResultExpression = '+n+'
 
const ExclusiveResultExpression = '*n,m,o,p*'
 
const EmptyAnswerExpression = "?"
 

Protected Member Functions

 savePreviewData (ilAssQuestionPreviewSession $previewSession)
 
 calculateReachedPointsForSolution ($found_values)
 
 getAddSolutionSelectionParameter ()
 
 isAddSolutionSelectionRequest ()
 
 getRemoveSolutionSelectionParameter ()
 
 isRemoveSolutionSelectionRequest ()
 
 getReuseSolutionSelectionParameter ()
 
 isReuseSolutionSelectionRequest ()
 
- Protected Member Functions inherited from assQuestion
 getQuestionAction ()
 
 isNonEmptyItemListPostSubmission ($postSubmissionFieldname)
 
 ensureCurrentTestPass ($active_id, $pass)
 
 lookupCurrentTestPass ($active_id, $pass)
 
 lookupTestId ($active_id)
 
 log ($active_id, $langVar)
 
 savePreviewData (ilAssQuestionPreviewSession $previewSession)
 
 deletePageOfQuestion ($question_id)
 Deletes the page object of a question with a given ID. More...
 
 onDuplicate ($originalParentId, $originalQuestionId, $duplicateParentId, $duplicateQuestionId)
 Will be called when a question is duplicated (inside a question pool or for insertion in a test) More...
 
 beforeSyncWithOriginal ($origQuestionId, $dupQuestionId, $origParentObjId, $dupParentObjId)
 
 afterSyncWithOriginal ($origQuestionId, $dupQuestionId, $origParentObjId, $dupParentObjId)
 
 onCopy ($sourceParentId, $sourceQuestionId, $targetParentId, $targetQuestionId)
 Will be called when a question is copied (into another question pool) More...
 
 duplicateSuggestedSolutionFiles ($parent_id, $question_id)
 Duplicates the files of a suggested solution if the question is duplicated. More...
 
 syncSuggestedSolutionFiles ($original_id)
 Syncs the files of a suggested solution if the question is synced. More...
 
 copySuggestedSolutionFiles ($source_questionpool_id, $source_question_id)
 
 ensureNonNegativePoints ($points)
 
 getRTETextWithMediaObjects ()
 Collects all text in the question which could contain media objects which were created with the Rich Text Editor. More...
 
 getSelfAssessmentFormatter ()
 
 lmMigrateQuestionTypeGenericContent (ilAssSelfAssessmentMigrator $migrator)
 
 lmMigrateQuestionTypeSpecificContent (ilAssSelfAssessmentMigrator $migrator)
 
 duplicateQuestionHints ($originalQuestionId, $duplicateQuestionId)
 
 duplicateSkillAssignments ($srcParentId, $srcQuestionId, $trgParentId, $trgQuestionId)
 
 buildQuestionDataQuery ()
 
 getCurrentSolutionResultSet ($active_id, $pass, $authorized=true)
 Get a restulset for the current user solution for a this question by active_id and pass. More...
 
 removeSolutionRecordById ($solutionId)
 
 getSolutionRecordById ($solutionId)
 
 deleteDummySolutionRecord ($activeId, $passIndex)
 
 isDummySolutionRecord ($solutionRecord)
 
 deleteSolutionRecordByValues ($activeId, $passIndex, $authorized, $matchValues)
 
 duplicateIntermediateSolutionAuthorized ($activeId, $passIndex)
 
 forceExistingIntermediateSolution ($activeId, $passIndex, $considerDummyRecordCreation)
 
 buildTestPresentationConfig ()
 build basic test question configuration instance More...
 

Protected Attributes

 $is_multiple_choice = false
 
- Protected Attributes inherited from assQuestion
 $id
 
 $title
 
 $comment
 
 $owner
 
 $author
 
 $question
 
 $points
 
 $est_working_time
 
 $shuffle
 
 $test_id
 
 $obj_id
 
 $ilias
 
 $tpl
 
 $lng
 
 $db
 
 $outputType = OUTPUT_JAVASCRIPT
 
 $suggested_solutions
 
 $original_id
 
 $page
 
 $external_id = ''
 
 $questionChangeListeners = array()
 
 $processLocker
 
 $step = null
 
 $lastChange
 
 $shuffler
 
 $testQuestionConfig
 
 $lifecycle
 

Additional Inherited Members

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

Detailed Description

Class for image map questions.

assImagemapQuestion is a class for imagemap question.

Author
Helmut Schottmüller helmu.nosp@m.t.sc.nosp@m.hottm.nosp@m.uell.nosp@m.er@ma.nosp@m.c.co.nosp@m.m
Björn Heyser bheys.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
Maximilian Becker mbeck.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

assImagemapQuestion::__construct (   $title = "",
  $comment = "",
  $author = "",
  $owner = -1,
  $question = "",
  $image_filename = "" 
)

assImagemapQuestion constructor

The constructor takes possible arguments an creates an instance of the assImagemapQuestion object.

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$questionThe question string of the imagemap question.
string$image_filename
Returns

Definition at line 62 of file class.assImagemapQuestion.php.

References assQuestion\$author, assQuestion\$comment, $image_filename, assQuestion\$owner, assQuestion\$question, assQuestion\$title, and ILIAS\GlobalScreen\Provider\__construct().

69  {
71  $this->image_filename = $image_filename;
72  $this->answers = array();
73  $this->coords = array();
74  }
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ addAnswer()

assImagemapQuestion::addAnswer (   $answertext = "",
  $points = 0.0,
  $order = 0,
  $coords = "",
  $area = "",
  $points_unchecked = 0.0 
)

Adds a possible answer for a imagemap question.

Adds a possible answer for a imagemap question. A ASS_AnswerImagemap object will be created and assigned to the array $this->answers.

Parameters
string$answertextThe answer text
double$pointsThe points for selecting the answer (even negative points can be used)
integer$statusThe state of the answer (set = 1 or unset = 0)
integer$orderA possible display order of the answer public
See also
$answers
ASS_AnswerImagemap

Definition at line 498 of file class.assImagemapQuestion.php.

References $coords, $i, and assQuestion\$points.

Referenced by uploadImagemap().

505  {
506  include_once "./Modules/TestQuestionPool/classes/class.assAnswerImagemap.php";
507  if (array_key_exists($order, $this->answers)) {
508  // Insert answer
509  $answer = new ASS_AnswerImagemap($answertext, $points, $order, $coords, $area, -1, $points_unchecked);
510  for ($i = count($this->answers) - 1; $i >= $order; $i--) {
511  $this->answers[$i + 1] = $this->answers[$i];
512  $this->answers[$i + 1]->setOrder($i + 1);
513  }
514  $this->answers[$order] = $answer;
515  } else {
516  // Append answer
517  $answer = new ASS_AnswerImagemap($answertext, $points, count($this->answers), $coords, $area, -1, $points_unchecked);
518  array_push($this->answers, $answer);
519  }
520  }
Class for true/false or yes/no answers.
$i
Definition: metadata.php:24
+ Here is the caller graph for this function:

◆ calculateReachedPoints()

assImagemapQuestion::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 655 of file class.assImagemapQuestion.php.

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

Referenced by getExpressionTypes().

656  {
657  if ($returndetails) {
658  throw new ilTestException('return details not implemented for ' . __METHOD__);
659  }
660 
661  global $DIC;
662  $ilDB = $DIC['ilDB'];
663 
664  $found_values = array();
665  if (is_null($pass)) {
666  $pass = $this->getSolutionMaxPass($active_id);
667  }
668  $result = $this->getCurrentSolutionResultSet($active_id, $pass, $authorizedSolution);
669  while ($data = $ilDB->fetchAssoc($result)) {
670  if (strcmp($data["value1"], "") != 0) {
671  array_push($found_values, $data["value1"]);
672  }
673  }
674 
675  $points = $this->calculateReachedPointsForSolution($found_values);
676 
677  return $points;
678  }
calculateReachedPointsForSolution($found_values)
$data
Definition: storeScorm.php:23
$result
getSolutionMaxPass($active_id)
Returns the maximum pass a users question solution.
Base Exception for all Exceptions relating to Modules/Test.
global $ilDB
$DIC
Definition: xapitoken.php:46
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:
+ Here is the caller graph for this function:

◆ calculateReachedPointsForSolution()

assImagemapQuestion::calculateReachedPointsForSolution (   $found_values)
protected
Parameters
$found_values
Returns
int

Definition at line 945 of file class.assImagemapQuestion.php.

References assQuestion\$points, and getIsMultipleChoice().

Referenced by calculateReachedPoints(), and calculateReachedPointsFromPreviewSession().

946  {
947  $points = 0;
948  if (count($found_values) > 0) {
949  foreach ($this->answers as $key => $answer) {
950  if (in_array($key, $found_values)) {
951  $points += $answer->getPoints();
952  } elseif ($this->getIsMultipleChoice()) {
953  $points += $answer->getPointsUnchecked();
954  }
955  }
956  return $points;
957  }
958  return $points;
959  }
getIsMultipleChoice()
Returns true, if the imagemap question is a multiplechoice question.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calculateReachedPointsFromPreviewSession()

assImagemapQuestion::calculateReachedPointsFromPreviewSession ( ilAssQuestionPreviewSession  $previewSession)

Definition at line 680 of file class.assImagemapQuestion.php.

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

681  {
682  $solutionData = $previewSession->getParticipantsSolution();
683 
684  $reachedPoints = $this->calculateReachedPointsForSolution(is_array($solutionData) ? array_values($solutionData) : array());
685  $reachedPoints = $this->deductHintPointsFromReachedPoints($previewSession, $reachedPoints);
686 
687  return $this->ensureNonNegativePoints($reachedPoints);
688  }
calculateReachedPointsForSolution($found_values)
ensureNonNegativePoints($points)
deductHintPointsFromReachedPoints(ilAssQuestionPreviewSession $previewSession, $reachedPoints)
+ Here is the call graph for this function:

◆ copyImage()

assImagemapQuestion::copyImage (   $question_id,
  $source_questionpool 
)

Definition at line 334 of file class.assImagemapQuestion.php.

References $filename, getImageFilename(), assQuestion\getImagePath(), and ilUtil\makeDirParents().

335  {
336  $imagepath = $this->getImagePath();
337  $imagepath_original = str_replace("/$this->id/images", "/$question_id/images", $imagepath);
338  $imagepath_original = str_replace("/$this->obj_id/", "/$source_questionpool/", $imagepath_original);
339  if (!file_exists($imagepath)) {
340  ilUtil::makeDirParents($imagepath);
341  }
342  $filename = $this->getImageFilename();
343  if (!copy($imagepath_original . $filename, $imagepath . $filename)) {
344  print "image could not be copied!!!! ";
345  }
346  }
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.
$filename
Definition: buildRTE.php:89
+ Here is the call graph for this function:

◆ copyObject()

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

Copies an assImagemapQuestion object.

Copies an assImagemapQuestion object

public

Definition at line 240 of file class.assImagemapQuestion.php.

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

241  {
242  if ($this->id <= 0) {
243  // The question has not been saved. It cannot be duplicated
244  return;
245  }
246  // duplicate the question in database
247  $clone = $this;
248  include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
250  $clone->id = -1;
251  $source_questionpool_id = $this->getObjId();
252  $clone->setObjId($target_questionpool_id);
253  if ($title) {
254  $clone->setTitle($title);
255  }
256  $clone->saveToDb();
257 
258  // copy question page content
259  $clone->copyPageOfQuestion($original_id);
260  // copy XHTML media objects
261  $clone->copyXHTMLMediaObjectsOfQuestion($original_id);
262  // duplicate the image
263  $clone->copyImage($original_id, $source_questionpool_id);
264 
265  $clone->onCopy($source_questionpool_id, $original_id, $clone->getObjId(), $clone->getId());
266 
267  return $clone->id;
268  }
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()

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

Definition at line 270 of file class.assImagemapQuestion.php.

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

271  {
272  if ($this->id <= 0) {
273  // The question has not been saved. It cannot be duplicated
274  return;
275  }
276 
277  include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
278 
279  $sourceQuestionId = $this->id;
280  $sourceParentId = $this->getObjId();
281 
282  // duplicate the question in database
283  $clone = $this;
284  $clone->id = -1;
285 
286  $clone->setObjId($targetParentId);
287 
288  if ($targetQuestionTitle) {
289  $clone->setTitle($targetQuestionTitle);
290  }
291 
292  $clone->saveToDb();
293  // copy question page content
294  $clone->copyPageOfQuestion($sourceQuestionId);
295  // copy XHTML media objects
296  $clone->copyXHTMLMediaObjectsOfQuestion($sourceQuestionId);
297  // duplicate the image
298  $clone->copyImage($sourceQuestionId, $sourceParentId);
299 
300  $clone->onCopy($sourceParentId, $sourceQuestionId, $clone->getObjId(), $clone->getId());
301 
302  return $clone->id;
303  }
getObjId()
Get the object id of the container object.
+ Here is the call graph for this function:

◆ deleteArea()

assImagemapQuestion::deleteArea (   $index = 0)

Deletes an answer.

Deletes an area with a given index. The index of the first area is 0, the index of the second area is 1 and so on.

Parameters
integer$indexA nonnegative index of the n-th answer public
See also
$answers

Definition at line 585 of file class.assImagemapQuestion.php.

References $i, and $index.

586  {
587  if ($index < 0) {
588  return;
589  }
590  if (count($this->answers) < 1) {
591  return;
592  }
593  if ($index >= count($this->answers)) {
594  return;
595  }
596  unset($this->answers[$index]);
597  $this->answers = array_values($this->answers);
598  for ($i = 0; $i < count($this->answers); $i++) {
599  if ($this->answers[$i]->getOrder() > $index) {
600  $this->answers[$i]->setOrder($i);
601  }
602  }
603  }
$index
Definition: metadata.php:128
$i
Definition: metadata.php:24

◆ deleteImage()

assImagemapQuestion::deleteImage ( )

Deletes the image file.

Definition at line 888 of file class.assImagemapQuestion.php.

References flushAnswers(), getImageFilename(), and assQuestion\getImagePath().

889  {
890  $file = $this->getImagePath() . $this->getImageFilename();
891  @unlink($file);
892  $this->flushAnswers();
893  $this->image_filename = "";
894  }
getImagePath($question_id=null, $object_id=null)
Returns the image path for web accessable images of a question.
flushAnswers()
Deletes all answers.
+ Here is the call graph for this function:

◆ duplicate()

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

Duplicates an assImagemapQuestion.

public

Definition at line 187 of file class.assImagemapQuestion.php.

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

188  {
189  if ($this->id <= 0) {
190  // The question has not been saved. It cannot be duplicated
191  return;
192  }
193  // duplicate the question in database
194  $this_id = $this->getId();
195  $thisObjId = $this->getObjId();
196 
197  $clone = $this;
198  include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
200  $clone->id = -1;
201 
202  if ((int) $testObjId > 0) {
203  $clone->setObjId($testObjId);
204  }
205 
206  if ($title) {
207  $clone->setTitle($title);
208  }
209  if ($author) {
210  $clone->setAuthor($author);
211  }
212  if ($owner) {
213  $clone->setOwner($owner);
214  }
215  if ($for_test) {
216  $clone->saveToDb($original_id);
217  } else {
218  $clone->saveToDb();
219  }
220 
221  // copy question page content
222  $clone->copyPageOfQuestion($this_id);
223  // copy XHTML media objects
224  $clone->copyXHTMLMediaObjectsOfQuestion($this_id);
225  // duplicate the image
226  $clone->duplicateImage($this_id, $thisObjId);
227 
228  $clone->onDuplicate($thisObjId, $this_id, $clone->getObjId(), $clone->getId());
229 
230  return $clone->id;
231  }
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:

◆ duplicateImage()

assImagemapQuestion::duplicateImage (   $question_id,
  $objectId = null 
)

Definition at line 305 of file class.assImagemapQuestion.php.

References $DIC, $filename, $ilLog, getImageFilename(), assQuestion\getImagePath(), and ilUtil\makeDirParents().

306  {
307  global $DIC;
308  $ilLog = $DIC['ilLog'];
309 
310  $imagepath = $this->getImagePath();
311  $imagepath_original = str_replace("/$this->id/images", "/$question_id/images", $imagepath);
312 
313  if ((int) $objectId > 0) {
314  $imagepath_original = str_replace("/$this->obj_id/", "/$objectId/", $imagepath_original);
315  }
316 
317  if (!file_exists($imagepath)) {
318  ilUtil::makeDirParents($imagepath);
319  }
320  $filename = $this->getImageFilename();
321 
322  // #18755
323  if (!file_exists($imagepath_original . $filename)) {
324  $ilLog->write("Could not find an image map file when trying to duplicate image: " . $imagepath_original . $filename);
325  $imagepath_original = str_replace("/$this->obj_id/", "/$objectId/", $imagepath_original);
326  $ilLog->write("Using fallback source directory:" . $imagepath_original);
327  }
328 
329  if (!file_exists($imagepath_original . $filename) || !copy($imagepath_original . $filename, $imagepath . $filename)) {
330  $ilLog->write("Could not duplicate image for image map question: " . $imagepath_original . $filename);
331  }
332  }
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.
$filename
Definition: buildRTE.php:89
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

◆ flushAnswers()

assImagemapQuestion::flushAnswers ( )

Deletes all answers.

Deletes all answers

public

See also
$answers

Definition at line 613 of file class.assImagemapQuestion.php.

Referenced by deleteImage().

614  {
615  $this->answers = array();
616  }
+ Here is the caller graph for this function:

◆ get_imagemap_contents()

assImagemapQuestion::get_imagemap_contents (   $href = "#")

Gets the imagemap file contents.

Gets the imagemap file contents

Returns
string The imagemap file contents of the assImagemapQuestion object public
See also
$imagemap_contents

Definition at line 471 of file class.assImagemapQuestion.php.

References $i, and $imagemap_contents.

472  {
473  $imagemap_contents = "<map name=\"" . $this->title . "\"> ";
474  for ($i = 0; $i < count($this->answers); $i++) {
475  $imagemap_contents .= "<area alt=\"" . $this->answers[$i]->getAnswertext() . "\" ";
476  $imagemap_contents .= "shape=\"" . $this->answers[$i]->getArea() . "\" ";
477  $imagemap_contents .= "coords=\"" . $this->answers[$i]->getCoords() . "\" ";
478  $imagemap_contents .= "href=\"$href&selimage=" . $this->answers[$i]->getOrder() . "\" /> ";
479  }
480  $imagemap_contents .= "</map>";
481  return $imagemap_contents;
482  }
$i
Definition: metadata.php:24

◆ getAdditionalTableName()

assImagemapQuestion::getAdditionalTableName ( )

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

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

Returns
string The additional table name public

Definition at line 824 of file class.assImagemapQuestion.php.

Referenced by loadFromDb(), and saveAdditionalQuestionDataToDb().

825  {
826  return "qpl_qst_imagemap";
827  }
+ Here is the caller graph for this function:

◆ getAddSolutionSelectionParameter()

assImagemapQuestion::getAddSolutionSelectionParameter ( )
protected

Definition at line 1061 of file class.assImagemapQuestion.php.

References $_GET, and isAddSolutionSelectionRequest().

Referenced by saveWorkingData().

1062  {
1063  if (!$this->isAddSolutionSelectionRequest()) {
1064  return null;
1065  }
1066 
1067  return $_GET["selImage"];
1068  }
$_GET["client_id"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAnswer()

assImagemapQuestion::getAnswer (   $index = 0)

Returns an answer.

Returns an answer with a given index. The index of the first answer is 0, the index of the second answer is 1 and so on.

Parameters
integer$indexA nonnegative index of the n-th answer
Returns
object ASS_AnswerImagemap-Object containing the answer public
See also
$answers

Definition at line 547 of file class.assImagemapQuestion.php.

References $index.

Referenced by getAvailableAnswerOptions().

548  {
549  if ($index < 0) {
550  return null;
551  }
552  if (count($this->answers) < 1) {
553  return null;
554  }
555  if ($index >= count($this->answers)) {
556  return null;
557  }
558  return $this->answers[$index];
559  }
$index
Definition: metadata.php:128
+ Here is the caller graph for this function:

◆ getAnswerCount()

assImagemapQuestion::getAnswerCount ( )

Returns the number of answers.

Returns the number of answers

Returns
integer The number of answers of the multiple choice question public
See also
$answers

Definition at line 531 of file class.assImagemapQuestion.php.

532  {
533  return count($this->answers);
534  }

◆ getAnswers()

& assImagemapQuestion::getAnswers ( )

Returns the answer array.

Returns the answer array

Returns
array The answer array public
See also
$answers

Definition at line 570 of file class.assImagemapQuestion.php.

References $answers.

Referenced by getAvailableAnswerOptions(), setExportDetailsXLS(), and toJSON().

571  {
572  return $this->answers;
573  }
+ Here is the caller graph for this function:

◆ getAnswerTableName()

assImagemapQuestion::getAnswerTableName ( )

Returns the name of the answer table in the database.

Returns the name of the answer table in the database

Returns
string The answer table name public

Definition at line 837 of file class.assImagemapQuestion.php.

838  {
839  return "qpl_a_imagemap";
840  }

◆ getAvailableAnswerOptions()

assImagemapQuestion::getAvailableAnswerOptions (   $index = null)

If index is null, the function returns an array with all anwser options Else it returns the specific answer option.

Parameters
null | int$index
Returns
array|ASS_AnswerSimple

Implements iQuestionCondition.

Definition at line 1040 of file class.assImagemapQuestion.php.

References $index, getAnswer(), and getAnswers().

1041  {
1042  if ($index !== null) {
1043  return $this->getAnswer($index);
1044  } else {
1045  return $this->getAnswers();
1046  }
1047  }
$index
Definition: metadata.php:128
getAnswer($index=0)
Returns an answer.
& getAnswers()
Returns the answer array.
+ Here is the call graph for this function:

◆ getExpressionTypes()

◆ getImageFilename()

assImagemapQuestion::getImageFilename ( )

Definition at line 430 of file class.assImagemapQuestion.php.

References $image_filename.

Referenced by copyImage(), deleteImage(), duplicateImage(), and toJSON().

431  {
432  return $this->image_filename;
433  }
+ Here is the caller graph for this function:

◆ getIsMultipleChoice()

assImagemapQuestion::getIsMultipleChoice ( )

Returns true, if the imagemap question is a multiplechoice question.

Returns
bool

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

References $is_multiple_choice.

Referenced by calculateReachedPointsForSolution(), and toJSON().

+ Here is the caller graph for this function:

◆ getMaximumPoints()

assImagemapQuestion::getMaximumPoints ( )

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

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

public

See also
$points

Definition at line 626 of file class.assImagemapQuestion.php.

References assQuestion\$points.

Referenced by getExpressionTypes(), and isComplete().

627  {
628  $points = 0;
629  foreach ($this->answers as $key => $value) {
630  if ($this->is_multiple_choice) {
631  if ($value->getPoints() > $value->getPointsUnchecked()) {
632  $points += $value->getPoints();
633  } else {
634  $points += $value->getPointsUnchecked();
635  }
636  } else {
637  if ($value->getPoints() > $points) {
638  $points = $value->getPoints();
639  }
640  }
641  }
642  return $points;
643  }
+ Here is the caller graph for this function:

◆ getOperators()

assImagemapQuestion::getOperators (   $expression)

Get all available operations for a specific question.

Parameters
$expression

Implements iQuestionCondition.

Definition at line 969 of file class.assImagemapQuestion.php.

References ilOperatorsExpressionMapping\getOperatorsByExpression().

970  {
971  require_once "./Modules/TestQuestionPool/classes/class.ilOperatorsExpressionMapping.php";
973  }
+ Here is the call graph for this function:

◆ getQuestionType()

assImagemapQuestion::getQuestionType ( )

Returns the question type of the question.

Returns the question type of the question

Returns
integer The question type of the question public

Definition at line 811 of file class.assImagemapQuestion.php.

Referenced by toJSON().

812  {
813  return "assImagemapQuestion";
814  }
+ Here is the caller graph for this function:

◆ getRemoveSolutionSelectionParameter()

assImagemapQuestion::getRemoveSolutionSelectionParameter ( )
protected

Definition at line 1081 of file class.assImagemapQuestion.php.

References $_GET, and isRemoveSolutionSelectionRequest().

Referenced by saveWorkingData().

1082  {
1083  if (!$this->isRemoveSolutionSelectionRequest()) {
1084  return null;
1085  }
1086 
1087  return $_GET["remImage"];
1088  }
$_GET["client_id"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getReuseSolutionSelectionParameter()

assImagemapQuestion::getReuseSolutionSelectionParameter ( )
protected

Definition at line 1105 of file class.assImagemapQuestion.php.

References $_GET, assQuestion\explodeKeyValues(), and isReuseSolutionSelectionRequest().

Referenced by saveWorkingData().

1106  {
1107  if (!$this->isReuseSolutionSelectionRequest()) {
1108  return null;
1109  }
1110 
1111  return assQuestion::explodeKeyValues($_GET["reuseSelection"]);
1112  }
$_GET["client_id"]
static explodeKeyValues($keyValues)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRTETextWithMediaObjects()

assImagemapQuestion::getRTETextWithMediaObjects ( )

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

Definition at line 846 of file class.assImagemapQuestion.php.

References $index, and assQuestion\getId().

847  {
848  $text = parent::getRTETextWithMediaObjects();
849  foreach ($this->answers as $index => $answer) {
850  $text .= $this->feedbackOBJ->getSpecificAnswerFeedbackContent($this->getId(), 0, $index);
851  }
852  return $text;
853  }
getId()
Gets the id of the assQuestion object.
$index
Definition: metadata.php:128
+ Here is the call graph for this function:

◆ getTestOutputSolutions()

assImagemapQuestion::getTestOutputSolutions (   $activeId,
  $pass 
)

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

References $pass.

1051  {
1052  $solution = parent::getTestOutputSolutions($activeId, $pass);
1053 
1054  $this->currentSolution = array();
1055  foreach ($solution as $record) {
1056  $this->currentSolution[] = $record['value1'];
1057  }
1058 
1059  return $solution;
1060  }

◆ isAddSolutionSelectionRequest()

assImagemapQuestion::isAddSolutionSelectionRequest ( )
protected

Definition at line 1069 of file class.assImagemapQuestion.php.

References $_GET.

Referenced by getAddSolutionSelectionParameter(), and saveWorkingData().

1070  {
1071  if (!isset($_GET["selImage"])) {
1072  return false;
1073  }
1074 
1075  if (!strlen($_GET["selImage"])) {
1076  return false;
1077  }
1078 
1079  return true;
1080  }
$_GET["client_id"]
+ Here is the caller graph for this function:

◆ isAutosaveable()

assImagemapQuestion::isAutosaveable ( )

Definition at line 690 of file class.assImagemapQuestion.php.

691  {
692  return false; // #15217
693  }

◆ isComplete()

assImagemapQuestion::isComplete ( )

Returns true, if a imagemap question is complete for use.

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

Definition at line 102 of file class.assImagemapQuestion.php.

References getMaximumPoints().

103  {
104  if (strlen($this->title)
105  && ($this->author)
106  && ($this->question)
107  && ($this->image_filename)
108  && (count($this->answers))
109  && ($this->getMaximumPoints() > 0)
110  ) {
111  return true;
112  }
113  return false;
114  }
getMaximumPoints()
Returns the maximum points, a learner can reach answering the question.
+ Here is the call graph for this function:

◆ isRemoveSolutionSelectionRequest()

assImagemapQuestion::isRemoveSolutionSelectionRequest ( )
protected

Definition at line 1089 of file class.assImagemapQuestion.php.

References $_GET.

Referenced by getRemoveSolutionSelectionParameter(), and saveWorkingData().

1090  {
1091  if (!$this->is_multiple_choice) {
1092  return false;
1093  }
1094 
1095  if (!isset($_GET["remImage"])) {
1096  return false;
1097  }
1098 
1099  if (!strlen($_GET["remImage"])) {
1100  return false;
1101  }
1102 
1103  return true;
1104  }
$_GET["client_id"]
+ Here is the caller graph for this function:

◆ isReuseSolutionSelectionRequest()

assImagemapQuestion::isReuseSolutionSelectionRequest ( )
protected

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

References $_GET, and assQuestion\getTestPresentationConfig().

Referenced by getReuseSolutionSelectionParameter(), and saveWorkingData().

1114  {
1115  if (!$this->getTestPresentationConfig()->isPreviousPassSolutionReuseAllowed()) {
1116  return false;
1117  }
1118 
1119  if (!isset($_GET["reuseSelection"])) {
1120  return false;
1121  }
1122 
1123  if (!strlen($_GET["reuseSelection"])) {
1124  return false;
1125  }
1126 
1127  if (!preg_match('/\d(,\d)*/', $_GET["reuseSelection"])) {
1128  return false;
1129  }
1130 
1131  return true;
1132  }
$_GET["client_id"]
getTestPresentationConfig()
Get the test question configuration (initialised once)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadFromDb()

assImagemapQuestion::loadFromDb (   $question_id)

Loads a assImagemapQuestion object from a database.

Loads a assImagemapQuestion object from a database (experimental)

Parameters
object$dbA pear DB object
integer$question_idA unique key which defines the multiple choice test in the database public

Definition at line 357 of file class.assImagemapQuestion.php.

References $data, $DIC, Vendor\Package\$e, $ilDB, $result, ilRTE\_replaceMediaObjectImageSrc(), getAdditionalTableName(), ilAssQuestionLifecycle\getDraftInstance(), ilAssQuestionLifecycle\getInstance(), assQuestion\setAdditionalContentEditingMode(), assQuestion\setAuthor(), assQuestion\setComment(), assQuestion\setEstimatedWorkingTime(), assQuestion\setId(), setImageFilename(), setIsMultipleChoice(), assQuestion\setLifecycle(), assQuestion\setNrOfTries(), assQuestion\setObjId(), assQuestion\setOriginalId(), assQuestion\setOwner(), assQuestion\setPoints(), assQuestion\setQuestion(), and assQuestion\setTitle().

358  {
359  global $DIC;
360  $ilDB = $DIC['ilDB'];
361 
362  $result = $ilDB->queryF(
363  "SELECT qpl_questions.*, " . $this->getAdditionalTableName() . ".* FROM qpl_questions LEFT JOIN " . $this->getAdditionalTableName() . " ON " . $this->getAdditionalTableName() . ".question_fi = qpl_questions.question_id WHERE qpl_questions.question_id = %s",
364  array("integer"),
365  array($question_id)
366  );
367  if ($result->numRows() == 1) {
368  $data = $ilDB->fetchAssoc($result);
369  $this->setId($question_id);
370  $this->setObjId($data["obj_fi"]);
371  $this->setTitle($data["title"]);
372  $this->setComment($data["description"]);
373  $this->setOriginalId($data["original_id"]);
374  $this->setNrOfTries($data['nr_of_tries']);
375  $this->setAuthor($data["author"]);
376  $this->setPoints($data["points"]);
377  $this->setOwner($data["owner"]);
378  $this->setIsMultipleChoice($data["is_multiple_choice"] == self::MODE_MULTIPLE_CHOICE);
379  include_once("./Services/RTE/classes/class.ilRTE.php");
380  $this->setQuestion(ilRTE::_replaceMediaObjectImageSrc($data["question_text"], 1));
381  $this->setImageFilename($data["image_file"]);
382  $this->setEstimatedWorkingTime(substr($data["working_time"], 0, 2), substr($data["working_time"], 3, 2), substr($data["working_time"], 6, 2));
383 
384  try {
388  }
389 
390  try {
391  $this->setAdditionalContentEditingMode($data['add_cont_edit_mode']);
392  } catch (ilTestQuestionPoolException $e) {
393  }
394 
395  $result = $ilDB->queryF(
396  "SELECT * FROM qpl_a_imagemap WHERE question_fi = %s ORDER BY aorder ASC",
397  array("integer"),
398  array($question_id)
399  );
400  include_once "./Modules/TestQuestionPool/classes/class.assAnswerImagemap.php";
401  if ($result->numRows() > 0) {
402  while ($data = $ilDB->fetchAssoc($result)) {
403  array_push($this->answers, new ASS_AnswerImagemap($data["answertext"], $data["points"], $data["aorder"], $data["coords"], $data["area"], $data['question_fi'], $data['points_unchecked']));
404  }
405  }
406  }
407  parent::loadFromDb($question_id);
408  }
$data
Definition: storeScorm.php:23
$result
Class for true/false or yes/no answers.
setId($id=-1)
Sets the id of the assQuestion object.
setEstimatedWorkingTime($hour=0, $min=0, $sec=0)
Sets the estimated working time of a question from given hour, minute and second. ...
setNrOfTries($a_nr_of_tries)
setAdditionalContentEditingMode($additinalContentEditingMode)
setter for additional content editing mode for this 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...
setAuthor($author="")
Sets the authors name of the assQuestion object.
setIsMultipleChoice($is_multiple_choice)
Set true if the Imagemapquestion is a multiplechoice Question.
setPoints($a_points)
Sets the maximum available points for the question.
setQuestion($question="")
Sets the question string of the question object.
setImageFilename($image_filename, $image_tempfilename="")
Sets the image file name.
global $ilDB
setOriginalId($original_id)
$DIC
Definition: xapitoken.php:46
setLifecycle(ilAssQuestionLifecycle $lifecycle)
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.
getAdditionalTableName()
Returns the name of the additional question data table in the database.
setOwner($owner="")
Sets the creator/owner ID of the assQuestion object.
+ Here is the call graph for this function:

◆ saveAdditionalQuestionDataToDb()

assImagemapQuestion::saveAdditionalQuestionDataToDb ( )

Saves a record to the question types additional data table.

Returns
mixed

Implements ilObjQuestionScoringAdjustable.

Definition at line 159 of file class.assImagemapQuestion.php.

References $DIC, $ilDB, getAdditionalTableName(), and assQuestion\getId().

Referenced by saveToDb().

160  {
161  global $DIC;
162  $ilDB = $DIC['ilDB'];
163 
164  $ilDB->manipulateF(
165  "DELETE FROM " . $this->getAdditionalTableName() . " WHERE question_fi = %s",
166  array( "integer" ),
167  array( $this->getId() )
168  );
169 
170  $ilDB->manipulateF(
171  "INSERT INTO " . $this->getAdditionalTableName(
172  ) . " (question_fi, image_file, is_multiple_choice) VALUES (%s, %s, %s)",
173  array( "integer", "text", 'integer' ),
174  array(
175  $this->getId(),
176  $this->image_filename,
177  (int) $this->is_multiple_choice
178  )
179  );
180  }
getId()
Gets the id of the assQuestion object.
global $ilDB
$DIC
Definition: xapitoken.php:46
getAdditionalTableName()
Returns the name of the additional question data table in the database.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveAnswerSpecificDataToDb()

assImagemapQuestion::saveAnswerSpecificDataToDb ( )

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

Returns
mixed

Implements ilObjAnswerScoringAdjustable.

Definition at line 133 of file class.assImagemapQuestion.php.

References $DIC, $ilDB, and assQuestion\getId().

Referenced by saveToDb().

134  {
135  global $DIC;
136  $ilDB = $DIC['ilDB'];
137  $ilDB->manipulateF(
138  "DELETE FROM qpl_a_imagemap WHERE question_fi = %s",
139  array( "integer" ),
140  array( $this->getId() )
141  );
142 
143  // Anworten wegschreiben
144  foreach ($this->answers as $key => $value) {
145  $answer_obj = $this->answers[$key];
146  $answer_obj->setOrder($key);
147  $next_id = $ilDB->nextId('qpl_a_imagemap');
148  $ilDB->manipulateF(
149  "INSERT INTO qpl_a_imagemap (answer_id, question_fi, answertext, points, aorder, coords, area, points_unchecked) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)",
150  array( "integer", "integer", "text", "float", "integer", "text", "text", "float" ),
151  array( $next_id, $this->id, $answer_obj->getAnswertext(
152  ), $answer_obj->getPoints(), $answer_obj->getOrder(
153  ), $answer_obj->getCoords(), $answer_obj->getArea(
154  ), $answer_obj->getPointsUnchecked() )
155  );
156  }
157  }
getId()
Gets the id of the assQuestion object.
global $ilDB
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ savePreviewData()

assImagemapQuestion::savePreviewData ( ilAssQuestionPreviewSession  $previewSession)
protected

Definition at line 777 of file class.assImagemapQuestion.php.

References $_GET, ilAssQuestionPreviewSession\getParticipantsSolution(), and ilAssQuestionPreviewSession\setParticipantsSolution().

778  {
779  $solution = $previewSession->getParticipantsSolution();
780 
781  if ($this->is_multiple_choice && strlen($_GET['remImage'])) {
782  unset($solution[(int) $_GET['remImage']]);
783  }
784 
785  if (strlen($_GET['selImage'])) {
786  if (!$this->is_multiple_choice) {
787  $solution = array();
788  }
789 
790  $solution[(int) $_GET['selImage']] = (int) $_GET['selImage'];
791  }
792 
793  $previewSession->setParticipantsSolution($solution);
794  }
$_GET["client_id"]
+ Here is the call graph for this function:

◆ saveToDb()

assImagemapQuestion::saveToDb (   $original_id = "")

Saves an assImagemapQuestion object to a database.

Saves an assImagemapQuestion object to a database

Parameters
string$original_id
Returns
mixed|void

Definition at line 125 of file class.assImagemapQuestion.php.

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

126  {
130  parent::saveToDb($original_id);
131  }
saveQuestionDataToDb($original_id="")
saveAdditionalQuestionDataToDb()
Saves a record to the question types additional data table.
saveAnswerSpecificDataToDb()
Saves the answer specific records into a question types answer table.
+ Here is the call graph for this function:

◆ saveWorkingData()

assImagemapQuestion::saveWorkingData (   $active_id,
  $pass = null,
  $authorized = true 
)

Saves the learners input of the question to the database.

public

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

Definition at line 703 of file class.assImagemapQuestion.php.

References $_GET, $DIC, $ilDB, $pass, ilObjAssessmentFolder\_enabledAssessmentLogging(), ilObjAssessmentFolder\_getLogLanguage(), ilObjTest\_getPass(), assQuestion\deleteDummySolutionRecord(), assQuestion\deleteSolutionRecordByValues(), assQuestion\forceExistingIntermediateSolution(), getAddSolutionSelectionParameter(), assQuestion\getId(), assQuestion\getProcessLocker(), getRemoveSolutionSelectionParameter(), getReuseSolutionSelectionParameter(), isAddSolutionSelectionRequest(), isRemoveSolutionSelectionRequest(), isReuseSolutionSelectionRequest(), assQuestion\logAction(), assQuestion\removeCurrentSolution(), assQuestion\saveCurrentSolution(), and assQuestion\updateCurrentSolutionsAuthorization().

704  {
705  global $DIC;
706  $ilDB = $DIC['ilDB'];
707 
708  if (is_null($pass)) {
709  include_once "./Modules/Test/classes/class.ilObjTest.php";
710  $pass = ilObjTest::_getPass($active_id);
711  }
712 
713  $solutionSelectionChanged = false;
714 
715  $this->getProcessLocker()->executeUserSolutionUpdateLockOperation(function () use (&$solutionSelectionChanged, $ilDB, $active_id, $pass, $authorized) {
716  if ($authorized) {
717  // remove the dummy record of the intermediate solution
718  $this->deleteDummySolutionRecord($active_id, $pass);
719 
720  // delete the authorized solution and make the intermediate solution authorized (keeping timestamps)
721  $this->removeCurrentSolution($active_id, $pass, true);
722  $this->updateCurrentSolutionsAuthorization($active_id, $pass, true, true);
723 
724  $solutionSelectionChanged = true;
725  } else {
727  $active_id,
728  $pass,
729  $this->is_multiple_choice
730  );
731 
732  if ($this->isReuseSolutionSelectionRequest()) {
733  $selection = $this->getReuseSolutionSelectionParameter();
734 
735  foreach ($selection as $selectedIndex) {
736  $this->saveCurrentSolution($active_id, $pass, (int) $selectedIndex, null, $authorized);
737  $solutionSelectionChanged = true;
738  }
739  } elseif ($this->isRemoveSolutionSelectionRequest()) {
740  $selection = $this->getRemoveSolutionSelectionParameter();
741 
742  $this->deleteSolutionRecordByValues($active_id, $pass, $authorized, array(
743  'value1' => (int) $selection
744  ));
745 
746  $solutionSelectionChanged = true;
747  } elseif ($this->isAddSolutionSelectionRequest()) {
748  $selection = $this->getAddSolutionSelectionParameter();
749 
750  if ($this->is_multiple_choice) {
751  $this->deleteSolutionRecordByValues($active_id, $pass, $authorized, array(
752  'value1' => (int) $_GET['selImage']
753  ));
754  } else {
755  $this->removeCurrentSolution($active_id, $pass, $authorized);
756  }
757 
758  $this->saveCurrentSolution($active_id, $pass, $_GET['selImage'], null, $authorized);
759 
760  $solutionSelectionChanged = true;
761  }
762  }
763  });
764 
765  require_once 'Modules/Test/classes/class.ilObjAssessmentFolder.php';
767  if ($solutionSelectionChanged) {
768  assQuestion::logAction($this->lng->txtlng("assessment", "log_user_entered_values", ilObjAssessmentFolder::_getLogLanguage()), $active_id, $this->getId());
769  } else {
770  assQuestion::logAction($this->lng->txtlng("assessment", "log_user_not_entered_values", ilObjAssessmentFolder::_getLogLanguage()), $active_id, $this->getId());
771  }
772  }
773 
774  return true;
775  }
static logAction($logtext="", $active_id="", $question_id="")
Logs an action into the Test&Assessment log.
getId()
Gets the id of the assQuestion object.
forceExistingIntermediateSolution($activeId, $passIndex, $considerDummyRecordCreation)
static _getPass($active_id)
Retrieves the actual pass of a given user for a given test.
$_GET["client_id"]
deleteDummySolutionRecord($activeId, $passIndex)
static _getLogLanguage()
retrieve the log language for assessment logging
static _enabledAssessmentLogging()
check wether assessment logging is enabled or not
updateCurrentSolutionsAuthorization($activeId, $pass, $authorized, $keepTime=false)
saveCurrentSolution($active_id, $pass, $value1, $value2, $authorized=true, $tstamp=null)
removeCurrentSolution($active_id, $pass, $authorized=true)
deleteSolutionRecordByValues($activeId, $passIndex, $authorized, $matchValues)
global $ilDB
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:

◆ setExportDetailsXLS()

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

{}

Definition at line 858 of file class.assImagemapQuestion.php.

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

859  {
860  parent::setExportDetailsXLS($worksheet, $startrow, $active_id, $pass);
861 
862  $solution = $this->getSolutionValues($active_id, $pass);
863 
864  $i = 1;
865  foreach ($this->getAnswers() as $id => $answer) {
866  $worksheet->setCell($startrow + $i, 0, $answer->getArea() . ": " . $answer->getCoords());
867  $worksheet->setBold($worksheet->getColumnCoord(0) . ($startrow + $i));
868 
869  $cellValue = 0;
870  foreach ($solution as $solIndex => $sol) {
871  if ($sol['value1'] == $id) {
872  $cellValue = 1;
873  break;
874  }
875  }
876 
877  $worksheet->setCell($startrow + $i, 1, $cellValue);
878 
879  $i++;
880  }
881 
882  return $startrow + $i + 1;
883  }
getSolutionValues($active_id, $pass=null, $authorized=true)
Loads solutions of a given user from the database an returns it.
& getAnswers()
Returns the answer array.
$i
Definition: metadata.php:24
+ Here is the call graph for this function:

◆ setImageFilename()

assImagemapQuestion::setImageFilename (   $image_filename,
  $image_tempfilename = "" 
)

Sets the image file name.

Parameters
string$image_filename. public
See also
$image_filename

Definition at line 442 of file class.assImagemapQuestion.php.

References $DIC, $ilLog, $image_filename, assQuestion\getImagePath(), ilUtil\makeDirParents(), and ilUtil\moveUploadedFile().

Referenced by loadFromDb().

443  {
444  if (!empty($image_filename)) {
445  $image_filename = str_replace(" ", "_", $image_filename);
446  $this->image_filename = $image_filename;
447  }
448  if (!empty($image_tempfilename)) {
449  $imagepath = $this->getImagePath();
450  if (!file_exists($imagepath)) {
451  ilUtil::makeDirParents($imagepath);
452  }
453  if (!ilUtil::moveUploadedFile($image_tempfilename, $image_filename, $imagepath . $image_filename)) {
454  $this->ilias->raiseError("The image could not be uploaded!", $this->ilias->error_obj->MESSAGE);
455  }
456  global $DIC;
457  $ilLog = $DIC['ilLog'];
458  $ilLog->write("gespeichert: " . $imagepath . $image_filename);
459  }
460  }
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
redirection script todo: (a better solution should control the processing via a xml file) ...
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setIsMultipleChoice()

assImagemapQuestion::setIsMultipleChoice (   $is_multiple_choice)

Set true if the Imagemapquestion is a multiplechoice Question.

Parameters
bool$is_multiple_choice

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

References $is_multiple_choice.

Referenced by loadFromDb().

82  {
83  $this->is_multiple_choice = $is_multiple_choice;
84  }
+ Here is the caller graph for this function:

◆ syncWithOriginal()

assImagemapQuestion::syncWithOriginal ( )

Definition at line 796 of file class.assImagemapQuestion.php.

References assQuestion\getOriginalId().

797  {
798  if ($this->getOriginalId()) {
799  parent::syncWithOriginal();
800  }
801  }
+ Here is the call graph for this function:

◆ toJSON()

assImagemapQuestion::toJSON ( )

Returns a JSON representation of the question.

Definition at line 899 of file class.assImagemapQuestion.php.

References $answers, $mobs, $result, ilObjMediaObject\_getMobsOfObject(), assQuestion\formatSAQuestion(), getAnswers(), assQuestion\getId(), getImageFilename(), assQuestion\getImagePathWeb(), getIsMultipleChoice(), assQuestion\getNrOfTries(), assQuestion\getQuestion(), getQuestionType(), assQuestion\getShuffle(), and assQuestion\getTitle().

900  {
901  include_once("./Services/RTE/classes/class.ilRTE.php");
902  $result = array();
903  $result['id'] = (int) $this->getId();
904  $result['type'] = (string) $this->getQuestionType();
905  $result['title'] = (string) $this->getTitle();
906  $result['question'] = $this->formatSAQuestion($this->getQuestion());
907  $result['nr_of_tries'] = (int) $this->getNrOfTries();
908  $result['shuffle'] = (bool) $this->getShuffle();
909  $result['is_multiple'] = (bool) $this->getIsMultipleChoice();
910  $result['feedback'] = array(
911  'onenotcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), false)),
912  'allcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), true))
913  );
914  $result['image'] = (string) $this->getImagePathWeb() . $this->getImageFilename();
915 
916  $answers = array();
917  $order = 0;
918  foreach ($this->getAnswers() as $key => $answer_obj) {
919  array_push($answers, array(
920  "answertext" => (string) $answer_obj->getAnswertext(),
921  "points" => (float) $answer_obj->getPoints(),
922  "points_unchecked" => (float) $answer_obj->getPointsUnchecked(),
923  "order" => (int) $order,
924  "coords" => $answer_obj->getCoords(),
925  "state" => $answer_obj->getState(),
926  "area" => $answer_obj->getArea(),
927  "feedback" => $this->formatSAQuestion(
928  $this->feedbackOBJ->getSpecificAnswerFeedbackExportPresentation($this->getId(), 0, $key)
929  )
930  ));
931  $order++;
932  }
933  $result['answers'] = $answers;
934 
935  $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $this->getId());
936  $result['mobs'] = $mobs;
937 
938  return json_encode($result);
939  }
getId()
Gets the id of the assQuestion object.
static _getMobsOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
get mobs of object
formatSAQuestion($a_q)
Format self assessment question.
$result
getImagePathWeb()
Returns the web image path for web accessable images of a question.
getShuffle()
Gets the shuffle flag.
getIsMultipleChoice()
Returns true, if the imagemap question is a multiplechoice question.
$mobs
getQuestion()
Gets the question string of the question object.
& getAnswers()
Returns the answer array.
getTitle()
Gets the title string of the assQuestion object.
getQuestionType()
Returns the question type of the question.
+ Here is the call graph for this function:

◆ uploadImagemap()

assImagemapQuestion::uploadImagemap ( array  $shapes)

Uploads an image map and takes over the areas.

Parameters
ASS_AnswerImagemap[]$shapes
Returns
integer number of areas added

Definition at line 416 of file class.assImagemapQuestion.php.

References addAnswer().

417  {
418  $added = 0;
419 
420  if (count($shapes) > 0) {
421  foreach ($shapes as $shape) {
422  $this->addAnswer($shape->getAnswertext(), 0.0, count($this->answers), $shape->getCoords(), $shape->getArea());
423  $added++;
424  }
425  }
426 
427  return $added;
428  }
addAnswer( $answertext="", $points=0.0, $order=0, $coords="", $area="", $points_unchecked=0.0)
Adds a possible answer for a imagemap question.
+ Here is the call graph for this function:

Field Documentation

◆ $answers

assImagemapQuestion::$answers

Definition at line 34 of file class.assImagemapQuestion.php.

Referenced by getAnswers(), and toJSON().

◆ $coords

assImagemapQuestion::$coords

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

Referenced by addAnswer().

◆ $currentSolution

assImagemapQuestion::$currentSolution = array()

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

◆ $image_filename

assImagemapQuestion::$image_filename

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

Referenced by __construct(), getImageFilename(), and setImageFilename().

◆ $imagemap_contents

assImagemapQuestion::$imagemap_contents

Definition at line 40 of file class.assImagemapQuestion.php.

Referenced by get_imagemap_contents().

◆ $is_multiple_choice

assImagemapQuestion::$is_multiple_choice = false
protected

Definition at line 46 of file class.assImagemapQuestion.php.

Referenced by getIsMultipleChoice(), and setIsMultipleChoice().

◆ MODE_MULTIPLE_CHOICE

const assImagemapQuestion::MODE_MULTIPLE_CHOICE = 1

◆ MODE_SINGLE_CHOICE

const assImagemapQuestion::MODE_SINGLE_CHOICE = 0

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