ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
assImagemapQuestion Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. 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 (bool $for_test=true, string $title="", string $author="", string $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 (ilAssExcelFormatHelper $worksheet, int $startrow, int $active_id, int $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 (string $title="", string $comment="", string $author="", int $owner=-1, string $question="")
 assQuestion constructor More...
 
 getShuffler ()
 
 setShuffler (Transformation $shuffler)
 
 setProcessLocker (ilAssQuestionProcessLocker $processLocker)
 
 getProcessLocker ()
 
 fromXML ($item, int $questionpool_id, ?int $tst_id, &$tst_object, int &$question_counter, array $import_mapping, array &$solutionhints=[])
 Receives parameters from a QTI parser and creates a valid ILIAS question object. More...
 
 toXML (bool $a_include_header=true, bool $a_include_binary=true, bool $a_shuffle=false, bool $test_output=false, bool $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 (int $questionpool_id, string $title)
 Returns TRUE if the question title exists in a question pool in the database. More...
 
 setTitle (string $title="")
 
 setId (int $id=-1)
 
 setTestId (int $id=-1)
 
 setComment (string $comment="")
 
 setOutputType (int $outputType=OUTPUT_HTML)
 
 setShuffle (?bool $shuffle=true)
 
 setAuthor (string $author="")
 
 setOwner (int $owner=-1)
 
 getTitle ()
 
 getTitleForHTMLOutput ()
 
 getTitleFilenameCompliant ()
 
 getId ()
 
 getShuffle ()
 
 getTestId ()
 
 getComment ()
 
 getDescriptionForHTMLOutput ()
 
 getThumbSize ()
 
 setThumbSize (int $a_size)
 
 getMinimumThumbSize ()
 
 getMaximumThumbSize ()
 
 getOutputType ()
 
 supportsJavascriptOutput ()
 
 supportsNonJsOutput ()
 
 requiresJsSwitch ()
 
 getAuthor ()
 
 getAuthorForHTMLOutput ()
 
 getOwner ()
 
 getObjId ()
 
 setObjId (int $obj_id=0)
 
 getLifecycle ()
 
 setLifecycle (ilAssQuestionLifecycle $lifecycle)
 
 setExternalId (?string $external_id)
 
 getExternalId ()
 
 getSuggestedSolutionOutput ()
 
 _getSuggestedSolution (int $question_id, int $subquestion_index=0)
 
 loadSuggestedSolution (int $question_id, int $subquestion_index=0)
 Returns a suggested solution for a given subquestion index. More...
 
 getSuggestedSolutions ()
 
 getReachedPoints (int $active_id, int $pass)
 
 getMaximumPoints ()
 
 getAdjustedReachedPoints (int $active_id, int $pass, bool $authorizedSolution=true)
 returns the reached points ... More...
 
 calculateResultsFromSolution (int $active_id, int $pass, bool $obligationsEnabled=false)
 Calculates the question results from a previously saved question solution. More...
 
 persistWorkingState (int $active_id, $pass, bool $obligationsEnabled=false, bool $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 (int $active_id, int $pass, bool $authorized=true)
 Saves the learners input of the question to the database. More...
 
 moveUploadedMediaFile (string $file, string $name)
 Move an uploaded media file to an public accessible temp dir to present it. More...
 
 getSuggestedSolutionPath ()
 
 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...
 
 getSuggestedSolutionPathWeb ()
 
 getImagePathWeb ()
 Returns the web image path for web accessable images of a question. More...
 
 getTestOutputSolutions (int $activeId, int $pass)
 
 getUserSolutionPreferingIntermediate (int $active_id, $pass=null)
 
 getSolutionValues ($active_id, $pass=null, bool $authorized=true)
 Loads solutions of a given user from the database an returns it. More...
 
 isInUse (int $question_id=0)
 Checks whether the question is in use or not in pools or tests. More...
 
 usageNumber (int $question_id=0)
 Returns the number of place the question is in use in pools or tests. More...
 
 isClone (int $question_id=0)
 Checks whether the question is a clone of another question or not. More...
 
 getAdditionalTableName ()
 
 getAnswerTableName ()
 
 deleteAnswers (int $question_id)
 
 deleteAdditionalTableData (int $question_id)
 
 delete (int $question_id)
 
 getTotalAnswers ()
 
 copyXHTMLMediaObjectsOfQuestion (int $a_q_id)
 
 syncXHTMLMediaObjectsOfQuestion ()
 
 createPageObject ()
 
 copyPageOfQuestion (int $a_q_id)
 
 getPageOfQuestion ()
 
 setOriginalId (?int $original_id)
 
 getOriginalId ()
 
 fixSvgToPng (string $imageFilenameContainingString)
 
 fixUnavailableSkinImageSources (string $html)
 
 loadFromDb (int $question_id)
 
 createNewQuestion (bool $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 (int $original_id=-1)
 
 saveToDb ()
 
 setNewOriginalId (int $newId)
 
 deleteSuggestedSolutions ()
 
 getSuggestedSolution (int $subquestion_index=0)
 Returns a suggested solution for a given subquestion index. More...
 
 getSuggestedSolutionTitle (int $subquestion_index=0)
 Returns the title of a suggested solution at a given subquestion_index. More...
 
 setSuggestedSolution (string $solution_id="", int $subquestion_index=0, bool $is_import=false)
 Sets a suggested solution for the question. More...
 
 updateSuggestedSolutions (int $original_id=-1, int $original_obj_id=-1)
 
 _resolveInternalLink (string $internal_link)
 
 _resolveIntLinks (int $question_id)
 
 syncWithOriginal ()
 
 _questionExists ($question_id)
 Returns true if the question already exists in the database. More...
 
 _questionExistsInPool (int $question_id)
 
 getPoints ()
 
 setPoints (float $points)
 
 getSolutionMaxPass (int $active_id)
 
 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 (string $txt_output, bool $prepare_for_latex_output=false, bool $omitNl2BrWhenTextArea=false)
 
 QTIMaterialToString (ilQTIMaterial $a_material)
 Reads an QTI material tag and creates a text or XHTML string. More...
 
 addQTIMaterial (ilXmlWriter $a_xml_writer, string $a_material, bool $close_material_tag=true, bool $add_mobs=true)
 
 buildHashedImageFilename (string $plain_image_filename, bool $unique=false)
 
 getQuestion ()
 
 getQuestionForHTMLOutput ()
 
 setQuestion (string $question="")
 
 getQuestionType ()
 Returns the question type of the question. More...
 
 getQuestionTypeID ()
 
 syncHints ()
 
 cleanupMediaObjectUsage ()
 
 getInstances ()
 
 getActiveUserData (int $active_id)
 Returns the user id and the test id for a given active id. More...
 
 hasSpecificFeedback ()
 
 setExportDetailsXLS (ilAssExcelFormatHelper $worksheet, int $startrow, int $active_id, int $pass)
 
 __get ($value)
 Object getter. More...
 
 __set ($key, $value)
 Object setter. More...
 
 __isset ($key)
 Object issetter. More...
 
 getNrOfTries ()
 
 setNrOfTries (int $a_nr_of_tries)
 
 setExportImagePath (string $path)
 
 formatSAQuestion ($a_q)
 
 setPreventRteUsage (bool $prevent_rte_usage)
 
 getPreventRteUsage ()
 
 migrateContentForLearningModule (ilAssSelfAssessmentMigrator $migrator)
 
 setSelfAssessmentEditingMode (bool $selfassessmenteditingmode)
 
 getSelfAssessmentEditingMode ()
 
 setDefaultNrOfTries (int $defaultnroftries)
 
 getDefaultNrOfTries ()
 
 syncSkillAssignments (int $srcParentId, int $srcQuestionId, int $trgParentId, int $trgQuestionId)
 
 ensureHintPageObjectExists ($pageObjectId)
 
 isAnswered (int $active_id, int $pass)
 
 isAutosaveable ()
 
 getAdditionalContentEditingMode ()
 
 setAdditionalContentEditingMode (?string $additionalContentEditingMode)
 
 isAdditionalContentEditingModePageObject ()
 
 isValidAdditionalContentEditingMode (string $additionalContentEditingMode)
 
 getValidAdditionalContentEditingModes ()
 
 getHtmlUserSolutionPurifier ()
 
 getHtmlQuestionContentPurifier ()
 
 setLastChange ($lastChange)
 
 getLastChange ()
 
 removeIntermediateSolution (int $active_id, int $pass)
 
 removeCurrentSolution (int $active_id, int $pass, bool $authorized=true)
 
 saveCurrentSolution (int $active_id, int $pass, $value1, $value2, bool $authorized=true, $tstamp=0)
 
 updateCurrentSolution (int $solutionId, $value1, $value2, bool $authorized=true)
 
 updateCurrentSolutionsAuthorization (int $activeId, int $pass, bool $authorized, bool $keepTime=false)
 
 setStep ($step)
 
 getStep ()
 
 toJSON ()
 
 duplicate (bool $for_test=true, string $title="", string $author="", string $owner="", $testObjId=null)
 
 intermediateSolutionExists (int $active_id, int $pass)
 
 authorizedSolutionExists (int $active_id, ?int $pass)
 
 authorizedOrIntermediateSolutionExists (int $active_id, int $pass)
 
 lookupForExistingSolutions (int $activeId, int $pass)
 Lookup if an authorized or intermediate solution exists. More...
 
 isAddableAnswerOptionValue (int $qIndex, string $answerOptionValue)
 
 addAnswerOptionValue (int $qIndex, string $answerOptionValue, float $points)
 
 removeAllExistingSolutions ()
 
 removeExistingSolutions (int $activeId, int $pass)
 
 resetUsersAnswer (int $activeId, int $pass)
 
 removeResultRecord (int $activeId, int $pass)
 
 fetchValuePairsFromIndexedValues (array $indexedValues)
 
 fetchIndexedValuesFromValuePairs (array $valuePairs)
 
 areObligationsToBeConsidered ()
 
 setObligationsToBeConsidered (bool $obligationsToBeConsidered)
 
 updateTimestamp ()
 
 getTestPresentationConfig ()
 
 savePartial ()
 
 isInActiveTest ()
 
- 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
 
const AVAILABLE_SHAPES
 
 $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 TRIM_PATTERN = '/^[\p{C}\p{Z}]+|[\p{C}\p{Z}]+$/u'
 
const ADDITIONAL_CONTENT_EDITING_MODE_RTE = 'default'
 
const ADDITIONAL_CONTENT_EDITING_MODE_IPE = 'pageobject'
 
ilAssQuestionFeedback $feedbackOBJ
 
bool $prevent_rte_usage = false
 
bool $selfassessmenteditingmode = false
 
int $defaultnroftries = 0
 
string $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 (string $postSubmissionFieldname)
 
 ensureCurrentTestPass (int $active_id, int $pass)
 
 lookupCurrentTestPass (int $active_id, int $pass)
 
 lookupTestId (int $active_id)
 Move to ilObjTest or similar More...
 
 log (int $active_id, string $langVar)
 
 savePreviewData (ilAssQuestionPreviewSession $previewSession)
 
 deletePageOfQuestion (int $question_id)
 
 onDuplicate (int $originalParentId, int $originalQuestionId, int $duplicateParentId, int $duplicateQuestionId)
 
 beforeSyncWithOriginal (int $origQuestionId, int $dupQuestionId, int $origParentObjId, int $dupParentObjId)
 
 afterSyncWithOriginal (int $origQuestionId, int $dupQuestionId, int $origParentObjId, int $dupParentObjId)
 
 onCopy (int $sourceParentId, int $sourceQuestionId, int $targetParentId, int $targetQuestionId)
 
 duplicateSuggestedSolutionFiles (int $parent_id, int $question_id)
 Duplicates the files of a suggested solution if the question is duplicated. More...
 
 syncSuggestedSolutionFiles (int $target_question_id, int $target_obj_id)
 
 copySuggestedSolutionFiles (int $source_questionpool_id, int $source_question_id)
 
 ensureNonNegativePoints ($points)
 
 purifyAndPrepareTextAreaOutput (string $content)
 
 getRTETextWithMediaObjects ()
 
 getSelfAssessmentFormatter ()
 
 lmMigrateQuestionTypeGenericContent (ilAssSelfAssessmentMigrator $migrator)
 
 lmMigrateQuestionTypeSpecificContent (ilAssSelfAssessmentMigrator $migrator)
 
 duplicateQuestionHints (int $originalQuestionId, int $duplicateQuestionId)
 
 duplicateSkillAssignments (int $srcParentId, int $srcQuestionId, int $trgParentId, int $trgQuestionId)
 
 buildQuestionDataQuery ()
 
 getCurrentSolutionResultSet (int $active_id, int $pass, bool $authorized=true)
 
 removeSolutionRecordById (int $solutionId)
 
 getSolutionRecordById (int $solutionId)
 
 deleteDummySolutionRecord (int $activeId, int $passIndex)
 
 isDummySolutionRecord (array $solutionRecord)
 
 deleteSolutionRecordByValues (int $activeId, int $passIndex, bool $authorized, array $matchValues)
 
 duplicateIntermediateSolutionAuthorized (int $activeId, int $passIndex)
 
 forceExistingIntermediateSolution (int $activeId, int $passIndex, bool $considerDummyRecordCreation)
 
 lookupMaxStep (int $active_id, int $pass)
 
 buildTestPresentationConfig ()
 build basic test question configuration instance More...
 

Protected Attributes

 $is_multiple_choice = false
 
- Protected Attributes inherited from assQuestion
const HAS_SPECIFIC_FEEDBACK = true
 
ILIAS HTTP Services $http
 
ILIAS Refinery Factory $refinery
 
ILIAS DI LoggingServices $ilLog
 
int $id
 
string $title
 
string $comment
 
string $owner
 
string $author
 
int $thumb_size
 
string $question
 The question text. More...
 
float $points
 The maximum available points for the question. More...
 
bool $shuffle
 Indicates whether the answers will be shuffled or not. More...
 
int $test_id
 The database id of a test in which the question is contained. More...
 
int $obj_id = 0
 Object id of the container object. More...
 
 $ilias
 
ilGlobalPageTemplate $tpl
 
ilLanguage $lng
 
ilDBInterface $db
 
Container $dic
 
int $outputType = OUTPUT_JAVASCRIPT
 Contains the output type of a question. More...
 
array $suggested_solutions
 
int $original_id = null
 
 $page
 
string $external_id = null
 
ilAssQuestionProcessLocker $processLocker
 
 $step
 
 $lastChange
 
Transformation $shuffler
 
ilTestQuestionConfig $testQuestionConfig
 
ilAssQuestionLifecycle $lifecycle
 
ilObjUser $current_user
 

Private Attributes

ILIAS TestQuestionPool InternalRequestService $request
 

Additional Inherited Members

- Static Public Member Functions inherited from assQuestion
static setForcePassResultUpdateEnabled (bool $forcePassResultsUpdateEnabled)
 
static isForcePassResultUpdateEnabled ()
 
static isAllowedImageMimeType ($mimeType)
 
static fetchMimeTypeIdentifier (string $contentType)
 
static getAllowedFileExtensionsForMimeType (string $mimeType)
 
static isAllowedImageFileExtension (string $mimeType, string $fileExtension)
 
static getAllowedImageMaterialFileExtensions ()
 
static _getMaximumPoints (int $question_id)
 Returns the maximum points, a learner can reach answering the question. More...
 
static _getQuestionInfo (int $question_id)
 
static _getSuggestedSolutionCount (int $question_id)
 
static _getSuggestedSolutionOutput (int $question_id)
 
static _getReachedPoints (int $active_id, int $question_id, int $pass)
 
static _updateTestResultCache (int $active_id, ilAssQuestionProcessLocker $processLocker=null)
 Move this to a proper place. More...
 
static logAction (string $logtext, int $active_id, int $question_id)
 
static getQuestionTypeFromDb (int $question_id)
 
static _getTotalRightAnswers (int $a_q_id)
 
static _getTitle (int $a_q_id)
 
static _getQuestionText (int $a_q_id)
 
static isFileAvailable (string $file)
 
static _getQuestionType (int $question_id)
 
static _getQuestionTitle (int $question_id)
 
static saveOriginalId (int $questionId, int $originalId)
 
static resetOriginalId (int $questionId)
 
static _getInternalLinkHref (string $target="")
 
static _getOriginalId (int $question_id)
 
static originalQuestionExists (int $questionId)
 
static _instanciateQuestion (int $question_id)
 
static _instantiateQuestion (int $question_id)
 
static instantiateQuestion (int $question_id)
 
static _getSolutionMaxPass (int $question_id, int $active_id)
 Returns the maximum pass a users question solution. More...
 
static _isWriteable (int $question_id, int $user_id)
 
static _isUsedInRandomTest (int $question_id)
 
static _isWorkedThrough (int $active_id, int $question_id, int $pass)
 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 (int $a_user_id, array $a_question_ids)
 Checks if an array of question ids is answered by a user or not. More...
 
static _setReachedPoints (int $active_id, int $question_id, float $points, float $maxpoints, int $pass, bool $manualscoring, bool $obligationsEnabled)
 Sets the points, a learner has reached answering the question Additionally objective results are updated. More...
 
static _needsManualScoring (int $question_id)
 
static _includeClass (string $question_type, int $gui=0)
 
static getFeedbackClassNameByQuestionType (string $questionType)
 
static isCoreQuestionType (string $questionType)
 
static includeCoreClass ($questionType, $withGuiClass)
 
static _getQuestionTypeName ($type_tag)
 
static _instanciateQuestionGUI (int $question_id)
 
static instantiateQuestionGUI (int $a_question_id)
 
static _questionExistsInTest (int $question_id, int $test_id)
 
static lookupParentObjId (int $questionId)
 
static lookupOriginalParentObjId (int $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 (int $questionId)
 
static implodeKeyValues (array $keyValues)
 
static explodeKeyValues (string $keyValues)
 
static convertISO8601FormatH_i_s_ExtendedToSeconds (string $time)
 
static missingResultRecordExists (int $activeId, int $pass, array $questionIds)
 
static getQuestionsMissingResultRecord (int $activeId, int $pass, array $questionIds)
 
static lookupResultRecordExist (int $activeId, int $questionId, int $pass)
 
static extendedTrim (string $value)
 Trim non-printable characters from the beginning and end of a string. More...
 
- Static Protected Member Functions inherited from assQuestion
static getNumExistingSolutionRecords (int $activeId, int $pass, int $questionId)
 
- Static Protected Attributes inherited from assQuestion
static $allowedFileExtensionsByMimeType
 
static $allowedCharsetsByMimeType
 
static $allowedImageMaterialFileExtensionsByMimeType
 
static $forcePassResultsUpdateEnabled = false
 
static $imageSourceFixReplaceMap
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning 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 34 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

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

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

85  {
87  $this->image_filename = $image_filename;
88  $this->answers = array();
89  $this->coords = array();
90 
91  global $DIC;
92  $this->request = $DIC->testQuestionPool()->internal()->request();
93  }
global $DIC
Definition: feed.php:28
string $question
The question text.
__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 522 of file class.assImagemapQuestion.php.

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

Referenced by uploadImagemap().

529  : void {
530  include_once "./Modules/TestQuestionPool/classes/class.assAnswerImagemap.php";
531  if (array_key_exists($order, $this->answers)) {
532  // Insert answer
533  $answer = new ASS_AnswerImagemap($answertext, $points, $order, 0, -1);
534  $answer->setCoords($coords);
535  $answer->setArea($area);
536  $answer->setPointsUnchecked($points_unchecked);
537  for ($i = count($this->answers) - 1; $i >= $order; $i--) {
538  $this->answers[$i + 1] = $this->answers[$i];
539  $this->answers[$i + 1]->setOrder($i + 1);
540  }
541  $this->answers[$order] = $answer;
542  } else {
543  // Append answer
544  $answer = new ASS_AnswerImagemap($answertext, $points, count($this->answers), 0, -1);
545  $answer->setCoords($coords);
546  $answer->setArea($area);
547  $answer->setPointsUnchecked($points_unchecked);
548  array_push($this->answers, $answer);
549  }
550  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
float $points
The maximum available points for the question.
$i
Definition: metadata.php:41
+ 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 685 of file class.assImagemapQuestion.php.

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

Referenced by getExpressionTypes().

686  {
687  if ($returndetails) {
688  throw new ilTestException('return details not implemented for ' . __METHOD__);
689  }
690 
691  global $DIC;
692  $ilDB = $DIC['ilDB'];
693 
694  $found_values = array();
695  if (is_null($pass)) {
696  $pass = $this->getSolutionMaxPass($active_id);
697  }
698  $result = $this->getCurrentSolutionResultSet($active_id, $pass, $authorizedSolution);
699  while ($data = $ilDB->fetchAssoc($result)) {
700  if (strcmp($data["value1"], "") != 0) {
701  array_push($found_values, $data["value1"]);
702  }
703  }
704 
705  $points = $this->calculateReachedPointsForSolution($found_values);
706 
707  return $points;
708  }
calculateReachedPointsForSolution($found_values)
float $points
The maximum available points for the question.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
getSolutionMaxPass(int $active_id)
getCurrentSolutionResultSet(int $active_id, int $pass, bool $authorized=true)
+ 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
float

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

References ILIAS\LTI\ToolProvider\$key, assQuestion\$points, and getIsMultipleChoice().

Referenced by calculateReachedPoints(), and calculateReachedPointsFromPreviewSession().

983  : float
984  {
985  if ($found_values == null) {
986  $found_values = [];
987  }
988  $points = 0;
989  if (count($found_values) > 0) {
990  foreach ($this->answers as $key => $answer) {
991  if (in_array($key, $found_values)) {
992  $points += $answer->getPoints();
993  } elseif ($this->getIsMultipleChoice()) {
994  $points += $answer->getPointsUnchecked();
995  }
996  }
997  return $points;
998  }
999  return $points;
1000  }
float $points
The maximum available points for the question.
getIsMultipleChoice()
Returns true, if the imagemap question is a multiplechoice question.
string $key
Consumer key/client ID value.
Definition: System.php:193
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calculateReachedPointsFromPreviewSession()

assImagemapQuestion::calculateReachedPointsFromPreviewSession ( ilAssQuestionPreviewSession  $previewSession)

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

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

711  {
712  $solutionData = $previewSession->getParticipantsSolution();
713 
714  $reachedPoints = $this->calculateReachedPointsForSolution(is_array($solutionData) ? array_values($solutionData) : array());
715  $reachedPoints = $this->deductHintPointsFromReachedPoints($previewSession, $reachedPoints);
716 
717  return $this->ensureNonNegativePoints($reachedPoints);
718  }
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 355 of file class.assImagemapQuestion.php.

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

355  : void
356  {
357  $imagepath = $this->getImagePath();
358  $imagepath_original = str_replace("/$this->id/images", "/$question_id/images", $imagepath);
359  $imagepath_original = str_replace("/$this->obj_id/", "/$source_questionpool/", $imagepath_original);
360  if (!file_exists($imagepath)) {
361  ilFileUtils::makeDirParents($imagepath);
362  }
363  $filename = $this->getImageFilename();
364  if (!copy($imagepath_original . $filename, $imagepath . $filename)) {
365  print "image could not be copied!!!! ";
366  }
367  }
static makeDirParents(string $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:78
+ 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 263 of file class.assImagemapQuestion.php.

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

263  : int
264  {
265  if ($this->getId() <= 0) {
266  throw new RuntimeException('The question has not been saved. It cannot be duplicated');
267  }
268  // duplicate the question in database
269  $clone = $this;
270  include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
272  $clone->id = -1;
273  $source_questionpool_id = $this->getObjId();
274  $clone->setObjId($target_questionpool_id);
275  if ($title) {
276  $clone->setTitle($title);
277  }
278  $clone->saveToDb();
279 
280  // copy question page content
281  $clone->copyPageOfQuestion($original_id);
282  // copy XHTML media objects
283  $clone->copyXHTMLMediaObjectsOfQuestion($original_id);
284  // duplicate the image
285  $clone->copyImage($original_id, $source_questionpool_id);
286 
287  $clone->onCopy($source_questionpool_id, $original_id, $clone->getObjId(), $clone->getId());
288 
289  return $clone->id;
290  }
static _getOriginalId(int $question_id)
+ Here is the call graph for this function:

◆ createNewOriginalFromThisDuplicate()

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

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

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

292  : int
293  {
294  if ($this->getId() <= 0) {
295  throw new RuntimeException('The question has not been saved. It cannot be duplicated');
296  }
297 
298  include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
299 
300  $sourceQuestionId = $this->id;
301  $sourceParentId = $this->getObjId();
302 
303  // duplicate the question in database
304  $clone = $this;
305  $clone->id = -1;
306 
307  $clone->setObjId($targetParentId);
308 
309  if ($targetQuestionTitle) {
310  $clone->setTitle($targetQuestionTitle);
311  }
312 
313  $clone->saveToDb();
314  // copy question page content
315  $clone->copyPageOfQuestion($sourceQuestionId);
316  // copy XHTML media objects
317  $clone->copyXHTMLMediaObjectsOfQuestion($sourceQuestionId);
318  // duplicate the image
319  $clone->copyImage($sourceQuestionId, $sourceParentId);
320 
321  $clone->onCopy($sourceParentId, $sourceQuestionId, $clone->getObjId(), $clone->getId());
322 
323  return $clone->id;
324  }
+ 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 615 of file class.assImagemapQuestion.php.

References $i, and $index.

615  : void
616  {
617  if ($index < 0) {
618  return;
619  }
620  if (count($this->answers) < 1) {
621  return;
622  }
623  if ($index >= count($this->answers)) {
624  return;
625  }
626  unset($this->answers[$index]);
627  $this->answers = array_values($this->answers);
628  for ($i = 0; $i < count($this->answers); $i++) {
629  if ($this->answers[$i]->getOrder() > $index) {
630  $this->answers[$i]->setOrder($i);
631  }
632  }
633  }
$index
Definition: metadata.php:145
$i
Definition: metadata.php:41

◆ deleteImage()

assImagemapQuestion::deleteImage ( )

Deletes the image file.

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

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

926  : void
927  {
928  $file = $this->getImagePath() . $this->getImageFilename();
929  @unlink($file);
930  $this->flushAnswers();
931  $this->image_filename = "";
932  }
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 ( bool  $for_test = true,
string  $title = "",
string  $author = "",
string  $owner = "",
  $testObjId = null 
)

Duplicates an assImagemapQuestion.

public

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

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

210  : int
211  {
212  if ($this->id <= 0) {
213  // The question has not been saved. It cannot be duplicated
214  return -1;
215  }
216  // duplicate the question in database
217  $this_id = $this->getId();
218  $thisObjId = $this->getObjId();
219 
220  $clone = $this;
221  include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
223  $clone->id = -1;
224 
225  if ((int) $testObjId > 0) {
226  $clone->setObjId($testObjId);
227  }
228 
229  if ($title) {
230  $clone->setTitle($title);
231  }
232  if ($author) {
233  $clone->setAuthor($author);
234  }
235  if ($owner) {
236  $clone->setOwner($owner);
237  }
238  if ($for_test) {
239  $clone->saveToDb($original_id);
240  } else {
241  $clone->saveToDb();
242  }
243 
244  // copy question page content
245  $clone->copyPageOfQuestion($this_id);
246  // copy XHTML media objects
247  $clone->copyXHTMLMediaObjectsOfQuestion($this_id);
248  // duplicate the image
249  $clone->duplicateImage($this_id, $thisObjId);
250 
251  $clone->onDuplicate($thisObjId, $this_id, $clone->getObjId(), $clone->getId());
252 
253  return $clone->id;
254  }
static _getOriginalId(int $question_id)
+ Here is the call graph for this function:

◆ duplicateImage()

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

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

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

326  : void
327  {
328  global $DIC;
329  $ilLog = $DIC['ilLog'];
330 
331  $imagepath = $this->getImagePath();
332  $imagepath_original = str_replace("/$this->id/images", "/$question_id/images", $imagepath);
333 
334  if ((int) $objectId > 0) {
335  $imagepath_original = str_replace("/$this->obj_id/", "/$objectId/", $imagepath_original);
336  }
337 
338  if (!file_exists($imagepath)) {
339  ilFileUtils::makeDirParents($imagepath);
340  }
341  $filename = $this->getImageFilename();
342 
343  // #18755
344  if (!file_exists($imagepath_original . $filename)) {
345  $ilLog->write("Could not find an image map file when trying to duplicate image: " . $imagepath_original . $filename);
346  $imagepath_original = str_replace("/$this->obj_id/", "/$objectId/", $imagepath_original);
347  $ilLog->write("Using fallback source directory:" . $imagepath_original);
348  }
349 
350  if (!file_exists($imagepath_original . $filename) || !copy($imagepath_original . $filename, $imagepath . $filename)) {
351  $ilLog->write("Could not duplicate image for image map question: " . $imagepath_original . $filename);
352  }
353  }
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
global $DIC
Definition: feed.php:28
getImagePath($question_id=null, $object_id=null)
Returns the image path for web accessable images of a question.
$filename
Definition: buildRTE.php:78
ILIAS DI LoggingServices $ilLog
+ Here is the call graph for this function:

◆ flushAnswers()

assImagemapQuestion::flushAnswers ( )

Deletes all answers.

Deletes all answers

public

See also
$answers

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

Referenced by deleteImage().

643  : void
644  {
645  $this->answers = array();
646  }
+ 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 495 of file class.assImagemapQuestion.php.

References $i, and $imagemap_contents.

495  : string
496  {
497  $imagemap_contents = "<map name=\"" . $this->title . "\"> ";
498  for ($i = 0; $i < count($this->answers); $i++) {
499  $imagemap_contents .= "<area alt=\"" . $this->answers[$i]->getAnswertext() . "\" ";
500  $imagemap_contents .= "shape=\"" . $this->answers[$i]->getArea() . "\" ";
501  $imagemap_contents .= "coords=\"" . $this->answers[$i]->getCoords() . "\" ";
502  $imagemap_contents .= "href=\"$href&selimage=" . $this->answers[$i]->getOrder() . "\" /> ";
503  }
504  $imagemap_contents .= "</map>";
505  return $imagemap_contents;
506  }
$i
Definition: metadata.php:41

◆ 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 862 of file class.assImagemapQuestion.php.

Referenced by loadFromDb(), and saveAdditionalQuestionDataToDb().

862  : string
863  {
864  return "qpl_qst_imagemap";
865  }
+ Here is the caller graph for this function:

◆ getAddSolutionSelectionParameter()

assImagemapQuestion::getAddSolutionSelectionParameter ( )
protected

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

References isAddSolutionSelectionRequest().

Referenced by saveWorkingData().

1101  {
1102  if (!$this->isAddSolutionSelectionRequest()) {
1103  return null;
1104  }
1105 
1106  return $this->request->raw('selImage');
1107  }
+ 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 577 of file class.assImagemapQuestion.php.

References $index.

Referenced by getAvailableAnswerOptions().

577  : ?object
578  {
579  if ($index < 0) {
580  return null;
581  }
582  if (count($this->answers) < 1) {
583  return null;
584  }
585  if ($index >= count($this->answers)) {
586  return null;
587  }
588  return $this->answers[$index];
589  }
$index
Definition: metadata.php:145
+ 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 561 of file class.assImagemapQuestion.php.

561  : int
562  {
563  return count($this->answers);
564  }

◆ getAnswers()

& assImagemapQuestion::getAnswers ( )

Returns the answer array.

Returns the answer array

Returns
array The answer array public
See also
$answers

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

References $answers.

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

600  : array
601  {
602  return $this->answers;
603  }
+ 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 875 of file class.assImagemapQuestion.php.

875  : string
876  {
877  return "qpl_a_imagemap";
878  }

◆ 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

Implements iQuestionCondition.

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

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

1080  {
1081  if ($index !== null) {
1082  return $this->getAnswer($index);
1083  } else {
1084  return $this->getAnswers();
1085  }
1086  }
$index
Definition: metadata.php:145
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 454 of file class.assImagemapQuestion.php.

References $image_filename.

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

454  : string
455  {
456  return $this->image_filename;
457  }
+ 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 110 of file class.assImagemapQuestion.php.

References $is_multiple_choice.

Referenced by calculateReachedPointsForSolution(), and toJSON().

110  : bool
111  {
113  }
+ 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 656 of file class.assImagemapQuestion.php.

References ILIAS\LTI\ToolProvider\$key, and assQuestion\$points.

Referenced by getExpressionTypes(), and isComplete().

656  : float
657  {
658  $points = 0;
659  foreach ($this->answers as $key => $value) {
660  if ($this->is_multiple_choice) {
661  if ($value->getPoints() > $value->getPointsUnchecked()) {
662  $points += $value->getPoints();
663  } else {
664  $points += $value->getPointsUnchecked();
665  }
666  } else {
667  if ($value->getPoints() > $points) {
668  $points = $value->getPoints();
669  }
670  }
671  }
672  return $points;
673  }
float $points
The maximum available points for the question.
string $key
Consumer key/client ID value.
Definition: System.php:193
+ 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 1010 of file class.assImagemapQuestion.php.

References ilOperatorsExpressionMapping\getOperatorsByExpression().

1010  : array
1011  {
1013  }
+ 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 849 of file class.assImagemapQuestion.php.

Referenced by toJSON().

849  : string
850  {
851  return "assImagemapQuestion";
852  }
+ Here is the caller graph for this function:

◆ getRemoveSolutionSelectionParameter()

assImagemapQuestion::getRemoveSolutionSelectionParameter ( )
protected

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

References isRemoveSolutionSelectionRequest().

Referenced by saveWorkingData().

1121  {
1122  if (!$this->isRemoveSolutionSelectionRequest()) {
1123  return null;
1124  }
1125 
1126  return $this->request->raw('remImage');
1127  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getReuseSolutionSelectionParameter()

assImagemapQuestion::getReuseSolutionSelectionParameter ( )
protected

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

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

Referenced by saveWorkingData().

1144  : ?array
1145  {
1146  if (!$this->isReuseSolutionSelectionRequest()) {
1147  return null;
1148  }
1149 
1150  return assQuestion::explodeKeyValues($this->request->raw("reuseSelection"));
1151  }
static explodeKeyValues(string $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 884 of file class.assImagemapQuestion.php.

References $index, and assQuestion\getId().

884  : string
885  {
886  $text = parent::getRTETextWithMediaObjects();
887  foreach ($this->answers as $index => $answer) {
888  $text .= $this->feedbackOBJ->getSpecificAnswerFeedbackContent($this->getId(), 0, $index);
889  }
890  return $text;
891  }
$index
Definition: metadata.php:145
+ Here is the call graph for this function:

◆ getTestOutputSolutions()

assImagemapQuestion::getTestOutputSolutions (   $activeId,
  $pass 
)

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

1089  : array
1090  {
1091  $solution = parent::getTestOutputSolutions($activeId, $pass);
1092 
1093  $this->currentSolution = array();
1094  foreach ($solution as $record) {
1095  $this->currentSolution[] = $record['value1'];
1096  }
1097 
1098  return $solution;
1099  }

◆ isAddSolutionSelectionRequest()

assImagemapQuestion::isAddSolutionSelectionRequest ( )
protected

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

Referenced by getAddSolutionSelectionParameter(), and saveWorkingData().

1108  : bool
1109  {
1110  if (!$this->request->isset("selImage")) {
1111  return false;
1112  }
1113 
1114  if (!strlen($this->request->raw('selImage'))) {
1115  return false;
1116  }
1117 
1118  return true;
1119  }
+ Here is the caller graph for this function:

◆ isAutosaveable()

assImagemapQuestion::isAutosaveable ( )

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

720  : bool
721  {
722  return false; // #15217
723  }

◆ 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 121 of file class.assImagemapQuestion.php.

References getMaximumPoints().

121  : bool
122  {
123  if (strlen($this->title)
124  && ($this->author)
125  && ($this->question)
126  && ($this->image_filename)
127  && (count($this->answers))
128  && ($this->getMaximumPoints() > 0)
129  ) {
130  return true;
131  }
132  return false;
133  }
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 1128 of file class.assImagemapQuestion.php.

Referenced by getRemoveSolutionSelectionParameter(), and saveWorkingData().

1128  : bool
1129  {
1130  if (!$this->is_multiple_choice) {
1131  return false;
1132  }
1133 
1134  if (!$this->request->isset("remImage")) {
1135  return false;
1136  }
1137 
1138  if (!strlen($this->request->raw('remImage'))) {
1139  return false;
1140  }
1141 
1142  return true;
1143  }
+ Here is the caller graph for this function:

◆ isReuseSolutionSelectionRequest()

assImagemapQuestion::isReuseSolutionSelectionRequest ( )
protected

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

References assQuestion\getTestPresentationConfig().

Referenced by getReuseSolutionSelectionParameter(), and saveWorkingData().

1152  : bool
1153  {
1154  if (!$this->getTestPresentationConfig()->isPreviousPassSolutionReuseAllowed()) {
1155  return false;
1156  }
1157 
1158  if (!$this->request->isset("reuseSelection")) {
1159  return false;
1160  }
1161 
1162  if (!strlen($this->request->raw("reuseSelection"))) {
1163  return false;
1164  }
1165 
1166  if (!preg_match('/\d(,\d)*/', $this->request->raw("reuseSelection"))) {
1167  return false;
1168  }
1169 
1170  return true;
1171  }
+ 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 378 of file class.assImagemapQuestion.php.

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

378  : void
379  {
380  global $DIC;
381  $ilDB = $DIC['ilDB'];
382 
383  $result = $ilDB->queryF(
384  "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",
385  array("integer"),
386  array($question_id)
387  );
388  if ($result->numRows() == 1) {
389  $data = $ilDB->fetchAssoc($result);
390  $this->setId($question_id);
391  $this->setObjId($data["obj_fi"]);
392  $this->setTitle((string) $data["title"]);
393  $this->setComment((string) $data["description"]);
394  $this->setOriginalId($data["original_id"]);
395  $this->setNrOfTries($data['nr_of_tries']);
396  $this->setAuthor($data["author"]);
397  $this->setPoints($data["points"]);
398  $this->setOwner($data["owner"]);
399  $this->setIsMultipleChoice($data["is_multiple_choice"] == self::MODE_MULTIPLE_CHOICE);
400  include_once("./Services/RTE/classes/class.ilRTE.php");
401  $this->setQuestion(ilRTE::_replaceMediaObjectImageSrc((string) $data["question_text"], 1));
402  $this->setImageFilename($data["image_file"]);
403 
404  try {
408  }
409 
410  try {
411  $this->setAdditionalContentEditingMode($data['add_cont_edit_mode']);
412  } catch (ilTestQuestionPoolException $e) {
413  }
414 
415  $result = $ilDB->queryF(
416  "SELECT * FROM qpl_a_imagemap WHERE question_fi = %s ORDER BY aorder ASC",
417  array("integer"),
418  array($question_id)
419  );
420  include_once "./Modules/TestQuestionPool/classes/class.assAnswerImagemap.php";
421  if ($result->numRows() > 0) {
422  while ($data = $ilDB->fetchAssoc($result)) {
423  $image_map_question = new ASS_AnswerImagemap($data["answertext"] ?? '', $data["points"], $data["aorder"]);
424  $image_map_question->setCoords($data["coords"]);
425  $image_map_question->setArea($data["area"]);
426  $image_map_question->setPointsUnchecked($data['points_unchecked']);
427  array_push($this->answers, $image_map_question);
428  }
429  }
430  }
431  parent::loadFromDb($question_id);
432  }
static _replaceMediaObjectImageSrc(string $a_text, int $a_direction=0, string $nic='')
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
setNrOfTries(int $a_nr_of_tries)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setOwner(int $owner=-1)
setComment(string $comment="")
global $DIC
Definition: feed.php:28
setPoints(float $points)
setObjId(int $obj_id=0)
setIsMultipleChoice($is_multiple_choice)
Set true if the Imagemapquestion is a multiplechoice Question.
setId(int $id=-1)
setOriginalId(?int $original_id)
setImageFilename($image_filename, $image_tempfilename="")
Sets the image file name.
setTitle(string $title="")
setLifecycle(ilAssQuestionLifecycle $lifecycle)
setAuthor(string $author="")
setAdditionalContentEditingMode(?string $additionalContentEditingMode)
getAdditionalTableName()
Returns the name of the additional question data table in the database.
setQuestion(string $question="")
+ 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 182 of file class.assImagemapQuestion.php.

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

Referenced by saveToDb().

183  {
184  global $DIC;
185  $ilDB = $DIC['ilDB'];
186 
187  $ilDB->manipulateF(
188  "DELETE FROM " . $this->getAdditionalTableName() . " WHERE question_fi = %s",
189  array( "integer" ),
190  array( $this->getId() )
191  );
192 
193  $ilDB->manipulateF(
194  "INSERT INTO " . $this->getAdditionalTableName(
195  ) . " (question_fi, image_file, is_multiple_choice) VALUES (%s, %s, %s)",
196  array( "integer", "text", 'integer' ),
197  array(
198  $this->getId(),
199  $this->image_filename,
200  (int) $this->is_multiple_choice
201  )
202  );
203  }
global $DIC
Definition: feed.php:28
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 156 of file class.assImagemapQuestion.php.

References $DIC, $ilDB, ILIAS\LTI\ToolProvider\$key, and assQuestion\getId().

Referenced by saveToDb().

157  {
158  global $DIC;
159  $ilDB = $DIC['ilDB'];
160  $ilDB->manipulateF(
161  "DELETE FROM qpl_a_imagemap WHERE question_fi = %s",
162  array( "integer" ),
163  array( $this->getId() )
164  );
165 
166  // Anworten wegschreiben
167  foreach ($this->answers as $key => $value) {
168  $answer_obj = $this->answers[$key];
169  $answer_obj->setOrder($key);
170  $next_id = $ilDB->nextId('qpl_a_imagemap');
171  $ilDB->manipulateF(
172  "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)",
173  array( "integer", "integer", "text", "float", "integer", "text", "text", "float" ),
174  array( $next_id, $this->id, $answer_obj->getAnswertext(
175  ), $answer_obj->getPoints(), $answer_obj->getOrder(
176  ), $answer_obj->getCoords(), $answer_obj->getArea(
177  ), $answer_obj->getPointsUnchecked() )
178  );
179  }
180  }
global $DIC
Definition: feed.php:28
string $key
Consumer key/client ID value.
Definition: System.php:193
+ 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 815 of file class.assImagemapQuestion.php.

References ilAssQuestionPreviewSession\getParticipantsSolution(), ILIAS\Repository\int(), and ilAssQuestionPreviewSession\setParticipantsSolution().

815  : void
816  {
817  $solution = $previewSession->getParticipantsSolution();
818 
819  if ($this->is_multiple_choice && strlen($this->request->raw('remImage'))) {
820  unset($solution[(int) $this->request->raw('remImage')]);
821  }
822 
823  if (strlen($this->request->raw('selImage'))) {
824  if (!$this->is_multiple_choice) {
825  $solution = array();
826  }
827 
828  $solution[(int) $this->request->raw('selImage')] = (int) $this->request->raw('selImage');
829  }
830 
831  $previewSession->setParticipantsSolution($solution);
832  }
+ 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 144 of file class.assImagemapQuestion.php.

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

144  : void
145  {
146  if ($original_id == '') {
147  $this->saveQuestionDataToDb();
148  } else {
150  }
153  parent::saveToDb($original_id);
154  }
saveQuestionDataToDb(int $original_id=-1)
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 733 of file class.assImagemapQuestion.php.

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

733  : bool
734  {
735  global $DIC;
736  $ilDB = $DIC['ilDB'];
737 
738  if (is_null($pass)) {
739  include_once "./Modules/Test/classes/class.ilObjTest.php";
740  $pass = ilObjTest::_getPass($active_id);
741  }
742 
743  $solutionSelectionChanged = false;
744 
745  $this->getProcessLocker()->executeUserSolutionUpdateLockOperation(function () use (&$solutionSelectionChanged, $ilDB, $active_id, $pass, $authorized) {
746  if ($authorized) {
747  // remove the dummy record of the intermediate solution
748  $this->deleteDummySolutionRecord($active_id, $pass);
749 
750  // delete the authorized solution and make the intermediate solution authorized (keeping timestamps)
751  $this->removeCurrentSolution($active_id, $pass, true);
752  $this->updateCurrentSolutionsAuthorization($active_id, $pass, true, true);
753 
754  $solutionSelectionChanged = true;
755  } else {
757  $active_id,
758  $pass,
759  $this->is_multiple_choice
760  );
761 
762  if ($this->isReuseSolutionSelectionRequest()) {
763  $selection = $this->getReuseSolutionSelectionParameter();
764 
765  foreach ($selection as $selectedIndex) {
766  $this->saveCurrentSolution($active_id, $pass, (int) $selectedIndex, null, $authorized);
767  $solutionSelectionChanged = true;
768  }
769  } elseif ($this->isRemoveSolutionSelectionRequest()) {
770  $selection = $this->getRemoveSolutionSelectionParameter();
771 
772  $this->deleteSolutionRecordByValues($active_id, $pass, $authorized, array(
773  'value1' => (int) $selection
774  ));
775 
776  $solutionSelectionChanged = true;
777  } elseif ($this->isAddSolutionSelectionRequest()) {
778  $selection = $this->getAddSolutionSelectionParameter();
779 
780  if ($this->is_multiple_choice) {
781  $this->deleteSolutionRecordByValues($active_id, $pass, $authorized, array(
782  'value1' => (int) $this->request->raw('selImage')
783  ));
784  } else {
785  $this->removeCurrentSolution($active_id, $pass, $authorized);
786  }
787 
788  $this->saveCurrentSolution($active_id, $pass, $this->request->raw('selImage'), null, $authorized);
789 
790  $solutionSelectionChanged = true;
791  }
792  }
793  });
794 
795  require_once 'Modules/Test/classes/class.ilObjAssessmentFolder.php';
797  if ($solutionSelectionChanged) {
798  assQuestion::logAction($this->lng->txtlng(
799  "assessment",
800  "log_user_entered_values",
802  ), $active_id, $this->getId());
803  } else {
804  assQuestion::logAction($this->lng->txtlng(
805  "assessment",
806  "log_user_not_entered_values",
808  ), $active_id, $this->getId());
809  }
810  }
811 
812  return true;
813  }
static _getPass($active_id)
Retrieves the actual pass of a given user for a given test.
updateCurrentSolutionsAuthorization(int $activeId, int $pass, bool $authorized, bool $keepTime=false)
deleteDummySolutionRecord(int $activeId, int $passIndex)
global $DIC
Definition: feed.php:28
saveCurrentSolution(int $active_id, int $pass, $value1, $value2, bool $authorized=true, $tstamp=0)
static logAction(string $logtext, int $active_id, int $question_id)
removeCurrentSolution(int $active_id, int $pass, bool $authorized=true)
deleteSolutionRecordByValues(int $activeId, int $passIndex, bool $authorized, array $matchValues)
forceExistingIntermediateSolution(int $activeId, int $passIndex, bool $considerDummyRecordCreation)
+ Here is the call graph for this function:

◆ setExportDetailsXLS()

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

{}

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

References $i, assQuestion\$id, getAnswers(), ilExcel\getColumnCoord(), assQuestion\getSolutionValues(), ilExcel\setBold(), and ilAssExcelFormatHelper\setCell().

896  : int
897  {
898  parent::setExportDetailsXLS($worksheet, $startrow, $active_id, $pass);
899 
900  $solution = $this->getSolutionValues($active_id, $pass);
901 
902  $i = 1;
903  foreach ($this->getAnswers() as $id => $answer) {
904  $worksheet->setCell($startrow + $i, 0, $answer->getArea() . ": " . $answer->getCoords());
905  $worksheet->setBold($worksheet->getColumnCoord(0) . ($startrow + $i));
906 
907  $cellValue = 0;
908  foreach ($solution as $solIndex => $sol) {
909  if ($sol['value1'] == $id) {
910  $cellValue = 1;
911  break;
912  }
913  }
914 
915  $worksheet->setCell($startrow + $i, 2, $cellValue);
916 
917  $i++;
918  }
919 
920  return $startrow + $i + 1;
921  }
getSolutionValues($active_id, $pass=null, bool $authorized=true)
Loads solutions of a given user from the database an returns it.
getColumnCoord(int $a_col)
Get column "name" from number.
setCell($a_row, $a_col, $a_value, $datatype=null)
setBold(string $a_coords)
Set cell(s) to bold.
& getAnswers()
Returns the answer array.
$i
Definition: metadata.php:41
+ 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 466 of file class.assImagemapQuestion.php.

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

Referenced by loadFromDb().

466  : void
467  {
468  if (!empty($image_filename)) {
469  $image_filename = str_replace(" ", "_", $image_filename);
470  $this->image_filename = $image_filename;
471  }
472  if (!empty($image_tempfilename)) {
473  $imagepath = $this->getImagePath();
474  if (!file_exists($imagepath)) {
475  ilFileUtils::makeDirParents($imagepath);
476  }
477  if (!ilFileUtils::moveUploadedFile($image_tempfilename, $image_filename, $imagepath . $image_filename)) {
478  $this->ilias->raiseError("The image could not be uploaded!", $this->ilias->error_obj->MESSAGE);
479  }
480  global $DIC;
481  $ilLog = $DIC['ilLog'];
482  $ilLog->write("gespeichert: " . $imagepath . $image_filename);
483  }
484  }
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
global $DIC
Definition: feed.php:28
getImagePath($question_id=null, $object_id=null)
Returns the image path for web accessable images of a question.
header include for all ilias files.
static moveUploadedFile(string $a_file, string $a_name, string $a_target, bool $a_raise_errors=true, string $a_mode="move_uploaded")
move uploaded file
ILIAS DI LoggingServices $ilLog
+ 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 100 of file class.assImagemapQuestion.php.

References $is_multiple_choice.

Referenced by loadFromDb().

100  : void
101  {
102  $this->is_multiple_choice = $is_multiple_choice;
103  }
+ Here is the caller graph for this function:

◆ syncWithOriginal()

assImagemapQuestion::syncWithOriginal ( )

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

References assQuestion\getOriginalId().

834  : void
835  {
836  if ($this->getOriginalId()) {
837  parent::syncWithOriginal();
838  }
839  }
+ Here is the call graph for this function:

◆ toJSON()

assImagemapQuestion::toJSON ( )

Returns a JSON representation of the question.

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

References $answers, ILIAS\LTI\ToolProvider\$key, $mobs, ilObjMediaObject\_getMobsOfObject(), assQuestion\formatSAQuestion(), getAnswers(), assQuestion\getId(), getImageFilename(), assQuestion\getImagePathWeb(), getIsMultipleChoice(), assQuestion\getNrOfTries(), assQuestion\getQuestion(), getQuestionType(), assQuestion\getShuffle(), and assQuestion\getTitleForHTMLOutput().

937  : string
938  {
939  include_once("./Services/RTE/classes/class.ilRTE.php");
940  $result = array();
941  $result['id'] = $this->getId();
942  $result['type'] = (string) $this->getQuestionType();
943  $result['title'] = $this->getTitleForHTMLOutput();
944  $result['question'] = $this->formatSAQuestion($this->getQuestion());
945  $result['nr_of_tries'] = $this->getNrOfTries();
946  $result['shuffle'] = $this->getShuffle();
947  $result['is_multiple'] = $this->getIsMultipleChoice();
948  $result['feedback'] = array(
949  'onenotcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), false)),
950  'allcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), true))
951  );
952  $result['image'] = $this->getImagePathWeb() . $this->getImageFilename();
953 
954  $answers = array();
955  $order = 0;
956  foreach ($this->getAnswers() as $key => $answer_obj) {
957  array_push($answers, array(
958  "answertext" => (string) $answer_obj->getAnswertext(),
959  "points" => (float) $answer_obj->getPoints(),
960  "points_unchecked" => (float) $answer_obj->getPointsUnchecked(),
961  "order" => $order,
962  "coords" => $answer_obj->getCoords(),
963  "state" => $answer_obj->getState(),
964  "area" => $answer_obj->getArea(),
965  "feedback" => $this->formatSAQuestion(
966  $this->feedbackOBJ->getSpecificAnswerFeedbackExportPresentation($this->getId(), 0, $key)
967  )
968  ));
969  $order++;
970  }
971  $result['answers'] = $answers;
972 
973  $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $this->getId());
974  $result['mobs'] = $mobs;
975 
976  return json_encode($result);
977  }
$mobs
Definition: imgupload.php:70
getImagePathWeb()
Returns the web image path for web accessable images of a question.
getIsMultipleChoice()
Returns true, if the imagemap question is a multiplechoice question.
string $key
Consumer key/client ID value.
Definition: System.php:193
static _getMobsOfObject(string $a_type, int $a_id, int $a_usage_hist_nr=0, string $a_lang="-")
& getAnswers()
Returns the answer array.
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 440 of file class.assImagemapQuestion.php.

References addAnswer().

440  : int
441  {
442  $added = 0;
443 
444  if (count($shapes) > 0) {
445  foreach ($shapes as $shape) {
446  $this->addAnswer($shape->getAnswertext(), 0.0, count($this->answers), $shape->getCoords(), $shape->getArea());
447  $added++;
448  }
449  }
450 
451  return $added;
452  }
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 51 of file class.assImagemapQuestion.php.

Referenced by getAnswers(), and toJSON().

◆ $coords

assImagemapQuestion::$coords

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

Referenced by addAnswer().

◆ $currentSolution

assImagemapQuestion::$currentSolution = array()

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

◆ $image_filename

assImagemapQuestion::$image_filename

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

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

◆ $imagemap_contents

assImagemapQuestion::$imagemap_contents

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

Referenced by get_imagemap_contents().

◆ $is_multiple_choice

assImagemapQuestion::$is_multiple_choice = false
protected

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

Referenced by getIsMultipleChoice(), and setIsMultipleChoice().

◆ $request

ILIAS TestQuestionPool InternalRequestService assImagemapQuestion::$request
private

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

◆ AVAILABLE_SHAPES

const assImagemapQuestion::AVAILABLE_SHAPES
Initial value:
= [
'RECT' => 'rect'

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

Referenced by assImagemapQuestionGUI\saveShape(), and ilHtmlImageMapFileInputGUI\verifyArea().

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