ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 ($imagemap_filename="")
 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, &$format_title, &$format_bold)
 Creates an Excel worksheet for the detailed cumulated results of this question. 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...
 
- Public Member Functions inherited from assQuestion
 __construct ( $title="", $comment="", $author="", $owner=-1, $question="")
 assQuestion constructor More...
 
 getShuffler ()
 
 setShuffler (ilArrayElementShuffler $shuffler)
 
 setProcessLocker ($processLocker)
 
 getProcessLocker ()
 
 fromXML (&$item, &$questionpool_id, &$tst_id, &$tst_object, &$question_counter, &$import_mapping)
 Receives parameters from a QTI parser and creates a valid ILIAS question object. More...
 
 toXML ($a_include_header=true, $a_include_binary=true, $a_shuffle=false, $test_output=false, $force_image_references=false)
 Returns a QTI xml representation of the question. More...
 
 isComplete ()
 Returns true, if a question is complete for use. More...
 
 questionTitleExists ($questionpool_id, $title)
 Returns TRUE if the question title exists in the database. More...
 
 setTitle ($title="")
 Sets the title string of the assQuestion object. More...
 
 setId ($id=-1)
 Sets the id of the assQuestion object. More...
 
 setTestId ($id=-1)
 Sets the test id of the assQuestion object. More...
 
 setComment ($comment="")
 Sets the comment string of the assQuestion object. More...
 
 setOutputType ($outputType=OUTPUT_HTML)
 Sets the output type. More...
 
 setShuffle ($shuffle=true)
 Sets the shuffle flag. More...
 
 setEstimatedWorkingTime ($hour=0, $min=0, $sec=0)
 Sets the estimated working time of a question from given hour, minute and second. More...
 
 setEstimatedWorkingTimeFromDurationString ($durationString)
 Sets the estimated working time of a question from a given datetime string. More...
 
 keyInArray ($searchkey, $array)
 returns TRUE if the key occurs in an array More...
 
 setAuthor ($author="")
 Sets the authors name of the assQuestion object. More...
 
 setOwner ($owner="")
 Sets the creator/owner ID of the assQuestion object. More...
 
 getTitle ()
 Gets the title string of the assQuestion object. More...
 
 getId ()
 Gets the id of the assQuestion object. More...
 
 getShuffle ()
 Gets the shuffle flag. More...
 
 getTestId ()
 Gets the test id of the assQuestion object. More...
 
 getComment ()
 Gets the comment string of the assQuestion object. More...
 
 getOutputType ()
 Gets the output type. More...
 
 supportsJavascriptOutput ()
 Returns true if the question type supports JavaScript output. More...
 
 supportsNonJsOutput ()
 
 requiresJsSwitch ()
 
 getEstimatedWorkingTime ()
 Gets the estimated working time of a question. More...
 
 getAuthor ()
 Gets the authors name of the assQuestion object. More...
 
 getOwner ()
 Gets the creator/owner ID of the assQuestion object. More...
 
 getObjId ()
 Get the object id of the container object. More...
 
 setObjId ($obj_id=0)
 Set the object id of the container object. More...
 
 setExternalId ($external_id)
 
 getExternalId ()
 
 _getMaximumPoints ($question_id)
 Returns the maximum points, a learner can reach answering the question. More...
 
_getQuestionInfo ($question_id)
 Returns question information from the database. More...
 
 getSuggestedSolutionOutput ()
 
_getSuggestedSolution ($question_id, $subquestion_index=0)
 Returns a suggested solution for a given subquestion index. More...
 
 getSuggestedSolutions ()
 Return the suggested solutions. More...
 
 _getReachedPoints ($active_id, $question_id, $pass=NULL)
 Returns the points, a learner has reached answering the question. More...
 
 getReachedPoints ($active_id, $pass=NULL)
 Returns the points, a learner has reached answering the question This is the fast way to get the points directly from the database. More...
 
 getMaximumPoints ()
 Returns the maximum points, a learner can reach answering the question. More...
 
 getAdjustedReachedPoints ($active_id, $pass=NULL, $authorizedSolution=true)
 returns the reached points ... More...
 
 calculateResultsFromSolution ($active_id, $pass=NULL, $obligationsEnabled=false)
 Calculates the question results from a previously saved question solution. More...
 
 persistWorkingState ($active_id, $pass=NULL, $obligationsEnabled=false, $authorized=true)
 persists the working state for current testactive and testpass More...
 
 persistPreviewState (ilAssQuestionPreviewSession $previewSession)
 persists the preview state for current user and question More...
 
 saveWorkingData ($active_id, $pass=NULL, $authorized=true)
 Saves the learners input of the question to the database. More...
 
 _updateTestResultCache ($active_id, ilAssQuestionProcessLocker $processLocker=null)
 @TODO Move this to a proper place. More...
 
 logAction ($logtext="", $active_id="", $question_id="")
 Logs an action into the Test&Assessment log. More...
 
 _logAction ($logtext="", $active_id="", $question_id="")
 Logs an action into the Test&Assessment log. More...
 
 moveUploadedMediaFile ($file, $name)
 Move an uploaded media file to an public accessible temp dir to present it. More...
 
 getSuggestedSolutionPath ()
 Returns the path for a suggested solution. More...
 
 getJavaPath ()
 Returns the image path for web accessable images of a question. More...
 
 getImagePath ($question_id=null, $object_id=null)
 Returns the image path for web accessable images of a question. More...
 
 buildImagePath ($questionId, $parentObjectId)
 
 getFlashPath ()
 Returns the image path for web accessable flash files of a question. More...
 
 getJavaPathWeb ()
 Returns the web image path for web accessable java applets of a question. More...
 
 getSuggestedSolutionPathWeb ()
 Returns the web path for a suggested solution. More...
 
 getImagePathWeb ()
 Returns the web image path for web accessable images of a question. More...
 
 getFlashPathWeb ()
 Returns the web image path for web accessable flash applications of a question. More...
 
 getUserSolutionPreferingIntermediate ($active_id, $pass=NULL)
 
 getSolutionValues ($active_id, $pass=NULL, $authorized=true)
 Loads solutions of a given user from the database an returns it. More...
 
 isInUse ($question_id="")
 Checks whether the question is in use or not. More...
 
 isClone ($question_id="")
 Checks whether the question is a clone of another question or not. More...
 
 pcArrayShuffle ($array)
 Shuffles the values of a given array. More...
 
 getQuestionTypeFromDb ($question_id)
 get question type for question id More...
 
 getAdditionalTableName ()
 Returns the name of the additional question data table in the database. More...
 
 getAnswerTableName ()
 Returns the name of the answer table in the database. More...
 
 deleteAnswers ($question_id)
 Deletes datasets from answers tables. More...
 
 deleteAdditionalTableData ($question_id)
 Deletes datasets from the additional question table in the database. More...
 
 delete ($question_id)
 Deletes a question and all materials from the database. More...
 
 getTotalAnswers ()
 get total number of answers More...
 
 _getTotalAnswers ($a_q_id)
 get number of answers for question id (static) note: do not use $this inside this method More...
 
 _getTitle ($a_q_id)
 Returns the title of a question. More...
 
 _getQuestionText ($a_q_id)
 Returns question text. More...
 
 copyXHTMLMediaObjectsOfQuestion ($a_q_id)
 
 syncXHTMLMediaObjectsOfQuestion ()
 
 createPageObject ()
 create page object of question More...
 
 copyPageOfQuestion ($a_q_id)
 
 getPageOfQuestion ()
 
 _getQuestionType ($question_id)
 Returns the question type of a question with a given id. More...
 
 _getQuestionTitle ($question_id)
 Returns the question title of a question with a given id. More...
 
 setOriginalId ($original_id)
 
 getOriginalId ()
 
 fixSvgToPng ($imageFilenameContainingString)
 
 fixUnavailableSkinImageSources ($html)
 
 loadFromDb ($question_id)
 Loads the question from the database. More...
 
 createNewQuestion ($a_create_page=true)
 Creates a new question without an owner when a new question is created This assures that an ID is given to the question if a file upload or something else occurs. More...
 
 saveQuestionDataToDb ($original_id="")
 
 saveToDb ($original_id="")
 Saves the question to the database. More...
 
 setNewOriginalId ($newId)
 
 deleteSuggestedSolutions ()
 Deletes all suggestes solutions in the database. More...
 
 getSuggestedSolution ($subquestion_index=0)
 Returns a suggested solution for a given subquestion index. More...
 
 getSuggestedSolutionTitle ($subquestion_index=0)
 Returns the title of a suggested solution at a given subquestion_index. More...
 
 setSuggestedSolution ($solution_id="", $subquestion_index=0, $is_import=false)
 Sets a suggested solution for the question. More...
 
 _resolveInternalLink ($internal_link)
 
 _resolveIntLinks ($question_id)
 
 _getInternalLinkHref ($target="")
 
 syncWithOriginal ()
 
 createRandomSolution ($test_id, $user_id)
 
 _questionExists ($question_id)
 Returns true if the question already exists in the database. More...
 
 _questionExistsInPool ($question_id)
 Returns true if the question already exists in the database and is assigned to a question pool. More...
 
 getPoints ()
 Returns the maximum available points for the question. More...
 
 setPoints ($a_points)
 Sets the maximum available points for the question. More...
 
 getSolutionMaxPass ($active_id)
 Returns the maximum pass a users question solution. More...
 
 _getSolutionMaxPass ($question_id, $active_id)
 Returns the maximum pass a users question solution. More...
 
 _isWriteable ($question_id, $user_id)
 Returns true if the question is writeable by a certain user. More...
 
 _isUsedInRandomTest ($question_id="")
 Checks whether the question is used in a random test or not. More...
 
 calculateReachedPoints ($active_id, $pass=NULL, $authorizedSolution=true, $returndetails=FALSE)
 Returns the points, a learner has reached answering the question. More...
 
 calculateReachedPointsFromPreviewSession (ilAssQuestionPreviewSession $previewSession)
 
 isPreviewSolutionCorrect (ilAssQuestionPreviewSession $previewSession)
 
 adjustReachedPointsByScoringOptions ($points, $active_id, $pass=NULL)
 Adjust the given reached points by checks for all special scoring options in the test container. More...
 
 isHTML ($a_text)
 Checks if a given string contains HTML or not. More...
 
 prepareTextareaOutput ($txt_output, $prepare_for_latex_output=FALSE, $omitNl2BrWhenTextArea=false)
 Prepares a string for a text area output in tests. More...
 
 QTIMaterialToString ($a_material)
 Reads an QTI material tag an creates a text string. More...
 
 addQTIMaterial (&$a_xml_writer, $a_material, $close_material_tag=TRUE, $add_mobs=TRUE)
 Creates a QTI material tag from a plain text or xhtml text. More...
 
 createNewImageFileName ($image_filename, $unique=false)
 
 _setReachedPoints ($active_id, $question_id, $points, $maxpoints, $pass, $manualscoring, $obligationsEnabled)
 Sets the points, a learner has reached answering the question Additionally objective results are updated. More...
 
 getQuestion ()
 Gets the question string of the question object. More...
 
 setQuestion ($question="")
 Sets the question string of the question object. More...
 
 getQuestionType ()
 Returns the question type of the question. More...
 
 getQuestionTypeID ()
 Returns the question type of the question. More...
 
 cleanupMediaObjectUsage ()
 synchronises appearances of media objects in the question with media object usage table More...
 
getInstances ()
 Gets all instances of the question. More...
 
 _needsManualScoring ($question_id)
 
 getActiveUserData ($active_id)
 Returns the user id and the test id for a given active id. More...
 
 setExportDetailsXLS (&$worksheet, $startrow, $active_id, $pass, &$format_title, &$format_bold)
 Creates an Excel worksheet for the detailed cumulated results of this question. More...
 
 __get ($value)
 Object getter. More...
 
 __set ($key, $value)
 Object setter. More...
 
 getNrOfTries ()
 
 setNrOfTries ($a_nr_of_tries)
 
 setExportImagePath ($a_path)
 
 _questionExistsInTest ($question_id, $test_id)
 
 formatSAQuestion ($a_q)
 Format self assessment question. More...
 
 setPreventRteUsage ($a_val)
 Set prevent rte usage. More...
 
 getPreventRteUsage ()
 Get prevent rte usage. More...
 
 migrateContentForLearningModule (ilAssSelfAssessmentMigrator $migrator)
 
 setSelfAssessmentEditingMode ($a_selfassessmenteditingmode)
 Set Self-Assessment Editing Mode. More...
 
 getSelfAssessmentEditingMode ()
 Get Self-Assessment Editing Mode. More...
 
 setDefaultNrOfTries ($a_defaultnroftries)
 Set Default Nr of Tries. More...
 
 getDefaultNrOfTries ()
 Get Default Nr of Tries. More...
 
 syncSkillAssignments ($srcParentId, $srcQuestionId, $trgParentId, $trgQuestionId)
 
 isAnswered ($active_id, $pass=null)
 returns boolean wether the question is answered during test pass or not More...
 
 isAutosaveable ()
 
 getAdditionalContentEditingMode ()
 getter for additional content editing mode for this question More...
 
 setAdditionalContentEditingMode ($additinalContentEditingMode)
 setter for additional content editing mode for this question More...
 
 isAdditionalContentEditingModePageObject ()
 isser for additional "pageobject" content editing mode More...
 
 isValidAdditionalContentEditingMode ($additionalContentEditingMode)
 returns the fact wether the passed additional content mode is valid or not More...
 
 getValidAdditionalContentEditingModes ()
 getter for valid additional content editing modes More...
 
 addQuestionChangeListener (ilQuestionChangeListener $listener)
 
 getQuestionChangeListeners ()
 
 getHtmlUserSolutionPurifier ()
 
 getHtmlQuestionContentPurifier ()
 
 setLastChange ($lastChange)
 
 getLastChange ()
 
 removeIntermediateSolution ($active_id, $pass)
 
 removeCurrentSolution ($active_id, $pass, $authorized=true, $ignoredSolutionIds=array())
 
 saveCurrentSolution ($active_id, $pass, $value1, $value2, $authorized=true)
 
 updateCurrentSolution ($solutionId, $value1, $value2, $authorized=true)
 
 updateCurrentSolutionsAuthorization ($activeId, $pass, $authorized)
 
 setStep ($step)
 
 getStep ()
 
 toJSON ()
 
 duplicate ($for_test=true, $title="", $author="", $owner="", $testObjId=null)
 
 authorizedSolutionExists ($active_id, $pass)
 
 authorizedOrIntermediateSolutionExists ($active_id, $pass)
 
 lookupForExistingSolutions ($activeId, $pass)
 Lookup if an authorized or intermediate solution exists. More...
 
 removeExistingSolutions ($activeId, $pass)
 
 resetUsersAnswer ($activeId, $pass)
 
 removeResultRecord ($activeId, $pass)
 
 areObligationsToBeConsidered ()
 
 setObligationsToBeConsidered ($obligationsToBeConsidered)
 
 validateSolutionSubmit ()
 
 updateTimestamp ()
 
 saveAdditionalQuestionDataToDb ()
 Saves a record to the question types additional data table. More...
 
 saveAnswerSpecificDataToDb ()
 Saves the answer specific records into a question types answer table. More...
 
- Public Member Functions inherited from iQuestionCondition
 getOperators ($expression)
 Get all available operations for a specific question. More...
 
 getExpressionTypes ()
 Get all available expression types for a specific question. More...
 
 getUserQuestionResult ($active_id, $pass)
 Get the user solution for a question by active_id and the test pass. 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...
 

Data Fields

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'
 
- 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)
 Reworks the allready saved working data if neccessary. More...
 
 reworkWorkingData ($active_id, $pass, $obligationsAnswered)
 Reworks the allready saved working data if neccessary. More...
 
 calculateReachedPointsForSolution ($found_values)
 
- Protected Member Functions inherited from assQuestion
 savePreviewData (ilAssQuestionPreviewSession $previewSession)
 Reworks the allready saved working data if neccessary. More...
 
 deletePageOfQuestion ($question_id)
 Deletes the page object of a question with a given ID. More...
 
 onDuplicate ($originalParentId, $originalQuestionId, $duplicateParentId, $duplicateQuestionId)
 Will be called when a question is duplicated (inside a question pool or for insertion in a test) More...
 
 beforeSyncWithOriginal ($origQuestionId, $dupQuestionId, $origParentObjId, $dupParentObjId)
 
 afterSyncWithOriginal ($origQuestionId, $dupQuestionId, $origParentObjId, $dupParentObjId)
 
 onCopy ($sourceParentId, $sourceQuestionId, $targetParentId, $targetQuestionId)
 Will be called when a question is copied (into another question pool) More...
 
 duplicateSuggestedSolutionFiles ($parent_id, $question_id)
 Duplicates the files of a suggested solution if the question is duplicated. More...
 
 syncSuggestedSolutionFiles ($original_id)
 Syncs the files of a suggested solution if the question is synced. More...
 
 copySuggestedSolutionFiles ($source_questionpool_id, $source_question_id)
 
 getRTETextWithMediaObjects ()
 Collects all text in the question which could contain media objects which were created with the Rich Text Editor. More...
 
 lmMigrateQuestionTypeGenericContent (ilAssSelfAssessmentMigrator $migrator)
 
 lmMigrateQuestionTypeSpecificContent (ilAssSelfAssessmentMigrator $migrator)
 
 duplicateQuestionHints ($originalQuestionId, $duplicateQuestionId)
 
 duplicateSkillAssignments ($srcParentId, $srcQuestionId, $trgParentId, $trgQuestionId)
 
 buildQuestionDataQuery ()
 
 getCurrentSolutionResultSet ($active_id, $pass, $authorized=true)
 Get a restulset for the current user solution for a this question by active_id and pass. More...
 
 removeSolutionRecordById ($solutionId)
 
 getSelfAssessmentFormatter ()
 

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
 
 $suggested_solutions
 
 $original_id
 
 $page
 
 $external_id = ''
 
 $questionChangeListeners = array()
 
 $processLocker
 
 $step = null
 
 $lastChange
 
 $shuffler
 

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 getAllowedImageFileExtensions ()
 
static _getSuggestedSolutionCount ($question_id)
 Returns the number of suggested solutions associated with a question. More...
 
static _getSuggestedSolutionOutput ($question_id)
 Returns the output of the suggested solution. More...
 
static _getTotalRightAnswers ($a_q_id)
 get number of answers for question id (static) note: do not use $this inside this method More...
 
static isFileAvailable ($file)
 
static _getOriginalId ($question_id)
 Returns the original id of a question. More...
 
static originalQuestionExists ($questionId)
 
static _instanciateQuestion ($question_id)
 Creates an instance of a question with a given question id. More...
 
static _instantiateQuestion ($question_id)
 
static _isWorkedThrough ($active_id, $question_id, $pass=NULL)
 Returns true if the question was worked through in the given pass Worked through means that the user entered at least one value. More...
 
static _areAnswered ($a_user_id, $a_question_ids)
 Checks if an array of question ids is answered by an user or not. More...
 
static _includeClass ($question_type, $gui=0)
 Include the php class file for a given question type. More...
 
static getGuiClassNameByQuestionType ($questionType)
 
static getObjectClassNameByQuestionType ($questionType)
 
static getFeedbackClassNameByQuestionType ($questionType)
 
static isCoreQuestionType ($questionType)
 
static includeCoreClass ($questionType, $withGuiClass)
 
static includePluginClass ($questionType, $withGuiClass)
 
static _getQuestionTypeName ($type_tag)
 Return the translation for a given question type tag. More...
 
static & _instanciateQuestionGUI ($question_id)
 Creates an instance of a question gui with a given question id. More...
 
static instantiateQuestionGUI ($a_question_id)
 Creates an instance of a question gui with a given question id. More...
 
static lookupParentObjId ($questionId)
 @global ilDB $ilDB More...
 
static lookupOriginalParentObjId ($originalQuestionId)
 returns the parent object id for given original question id (should be a qpl id, but theoretically it can be a tst id, too) More...
 
static isObligationPossible ($questionId)
 returns boolean wether it is possible to set this question type as obligatory or not considering the current question configuration More...
 
static setResultGateway ($resultGateway)
 
static getResultGateway ()
 
static sumTimesInISO8601FormatH_i_s_Extended ($time1, $time2)
 
static convertISO8601FormatH_i_s_ExtendedToSeconds ($time)
 
static missingResultRecordExists ($activeId, $pass, $questionIds)
 
static lookupResultRecordExist ($activeId, $questionId, $pass)
 
- 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 Protected Attributes inherited from assQuestion
static $allowedFileExtensionsByMimeType
 
static $allowedCharsetsByMimeType
 
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
\assImagemapQuestion

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

66 {
67 parent::__construct($title, $comment, $author, $owner, $question);
68 $this->image_filename = $image_filename;
69 $this->answers = array();
70 $this->coords = array();
71 }

References assQuestion\$author, assQuestion\$comment, $image_filename, assQuestion\$owner, assQuestion\$question, and assQuestion\$title.

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 @access public
See also
$answers
ASS_AnswerImagemap

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

522 {
523 include_once "./Modules/TestQuestionPool/classes/class.assAnswerImagemap.php";
524 if (array_key_exists($order, $this->answers))
525 {
526 // Insert answer
527 $answer = new ASS_AnswerImagemap($answertext, $points, $order, $coords, $area, -1, $points_unchecked);
528 for ($i = count($this->answers) - 1; $i >= $order; $i--)
529 {
530 $this->answers[$i+1] = $this->answers[$i];
531 $this->answers[$i+1]->setOrder($i+1);
532 }
533 $this->answers[$order] = $answer;
534 }
535 else
536 {
537 // Append answer
538 $answer = new ASS_AnswerImagemap($answertext, $points, count($this->answers), $coords, $area, -1, $points_unchecked);
539 array_push($this->answers, $answer);
540 }
541 }
Class for true/false or yes/no answers.

References $coords, and assQuestion\$points.

Referenced by uploadImagemap().

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

@access public

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

Reimplemented from assQuestion.

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

668 {
669 if( $returndetails )
670 {
671 throw new ilTestException('return details not implemented for '.__METHOD__);
672 }
673
674 global $ilDB;
675
676 $found_values = array();
677 if (is_null($pass))
678 {
679 $pass = $this->getSolutionMaxPass($active_id);
680 }
681 $result = $this->getCurrentSolutionResultSet($active_id, $pass, $authorizedSolution);
682 while ($data = $ilDB->fetchAssoc($result))
683 {
684 if (strcmp($data["value1"], "") != 0)
685 {
686 array_push($found_values, $data["value1"]);
687 }
688 }
689
690 $points = $this->calculateReachedPointsForSolution($found_values);
691
692 return $points;
693 }
$result
calculateReachedPointsForSolution($found_values)
getCurrentSolutionResultSet($active_id, $pass, $authorized=true)
Get a restulset for the current user solution for a this question by active_id and pass.
getSolutionMaxPass($active_id)
Returns the maximum pass a users question solution.
Base Exception for all Exceptions relating to Modules/Test.
$data
global $ilDB

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

+ Here is the call graph for this function:

◆ calculateReachedPointsForSolution()

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

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

1005 {
1006 $points = 0;
1007 if(count($found_values) > 0)
1008 {
1009 foreach($this->answers as $key => $answer)
1010 {
1011 if(in_array($key, $found_values))
1012 {
1013 $points += $answer->getPoints();
1014 } elseif($this->getIsMultipleChoice())
1015 {
1016 $points += $answer->getPointsUnchecked();
1017 }
1018 }
1019 return $points;
1020 }
1021 return $points;
1022 }
getIsMultipleChoice()
Returns true, if the imagemap question is a multiplechoice question.

References assQuestion\$points, and getIsMultipleChoice().

Referenced by calculateReachedPoints(), and calculateReachedPointsFromPreviewSession().

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

◆ calculateReachedPointsFromPreviewSession()

assImagemapQuestion::calculateReachedPointsFromPreviewSession ( ilAssQuestionPreviewSession  $previewSession)

Reimplemented from assQuestion.

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

696 {
697 $solutionData = $previewSession->getParticipantsSolution();
698 return $this->calculateReachedPointsForSolution(is_array($solutionData) ? array_values($solutionData) : array());
699 }

References calculateReachedPointsForSolution(), and ilAssQuestionPreviewSession\getParticipantsSolution().

+ Here is the call graph for this function:

◆ copyImage()

assImagemapQuestion::copyImage (   $question_id,
  $source_questionpool 
)

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

342 {
343 $imagepath = $this->getImagePath();
344 $imagepath_original = str_replace("/$this->id/images", "/$question_id/images", $imagepath);
345 $imagepath_original = str_replace("/$this->obj_id/", "/$source_questionpool/", $imagepath_original);
346 if (!file_exists($imagepath))
347 {
348 ilUtil::makeDirParents($imagepath);
349 }
350 $filename = $this->getImageFilename();
351 if (!copy($imagepath_original . $filename, $imagepath . $filename))
352 {
353 print "image could not be copied!!!! ";
354 }
355 }
$filename
Definition: buildRTE.php:89
getImagePath($question_id=null, $object_id=null)
Returns the image path for web accessable images of a question.
static makeDirParents($a_dir)
Create a new directory and all parent directories.
if(! $in) print

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

+ Here is the call graph for this function:

◆ copyObject()

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

Copies an assImagemapQuestion object.

Copies an assImagemapQuestion object

@access public

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

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

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

+ Here is the call graph for this function:

◆ createNewOriginalFromThisDuplicate()

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

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

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

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

+ 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 @access public
See also
$answers

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

599 {
600 if ($index < 0) return;
601 if (count($this->answers) < 1) return;
602 if ($index >= count($this->answers)) return;
603 unset($this->answers[$index]);
604 $this->answers = array_values($this->answers);
605 for ($i = 0; $i < count($this->answers); $i++) {
606 if ($this->answers[$i]->getOrder() > $index) {
607 $this->answers[$i]->setOrder($i);
608 }
609 }
610 }

◆ deleteImage()

assImagemapQuestion::deleteImage ( )

Deletes the image file.

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

947 {
948 $file = $this->getImagePath() . $this->getImageFilename();
949 @unlink($file);
950 $this->flushAnswers();
951 $this->image_filename = "";
952 }
print $file
flushAnswers()
Deletes all answers.

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

+ Here is the call graph for this function:

◆ duplicate()

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

Duplicates an assImagemapQuestion.

@access public

Reimplemented from assQuestion.

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

180 {
181 if ($this->id <= 0)
182 {
183 // The question has not been saved. It cannot be duplicated
184 return;
185 }
186 // duplicate the question in database
187 $this_id = $this->getId();
188 $thisObjId = $this->getObjId();
189
190 $clone = $this;
191 include_once ("./Modules/TestQuestionPool/classes/class.assQuestion.php");
193 $clone->id = -1;
194
195 if( (int)$testObjId > 0 )
196 {
197 $clone->setObjId($testObjId);
198 }
199
200 if ($title)
201 {
202 $clone->setTitle($title);
203 }
204 if ($author)
205 {
206 $clone->setAuthor($author);
207 }
208 if ($owner)
209 {
210 $clone->setOwner($owner);
211 }
212 if ($for_test)
213 {
214 $clone->saveToDb($original_id);
215 }
216 else
217 {
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.

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

+ Here is the call graph for this function:

◆ duplicateImage()

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

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

310 {
311 global $ilLog;
312
313 $imagepath = $this->getImagePath();
314 $imagepath_original = str_replace("/$this->id/images", "/$question_id/images", $imagepath);
315
316 if( (int)$objectId > 0 )
317 {
318 $imagepath_original = str_replace("/$this->obj_id/", "/$objectId/", $imagepath_original);
319 }
320
321 if(!file_exists($imagepath))
322 {
323 ilUtil::makeDirParents($imagepath);
324 }
325 $filename = $this->getImageFilename();
326
327 // #18755
328 if(!file_exists($imagepath_original . $filename))
329 {
330 $ilLog->write("Could not find an image map file when trying to duplicate image: " . $imagepath_original . $filename);
331 $imagepath_original = str_replace("/$this->obj_id/", "/$objectId/", $imagepath_original);
332 $ilLog->write("Using fallback source directory:" . $imagepath_original);
333 }
334
335 if(!file_exists($imagepath_original . $filename) || !copy($imagepath_original . $filename, $imagepath . $filename))
336 {
337 $ilLog->write("Could not duplicate image for image map question: " . $imagepath_original . $filename);
338 }
339 }

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

+ Here is the call graph for this function:

◆ flushAnswers()

assImagemapQuestion::flushAnswers ( )

Deletes all answers.

Deletes all answers

@access public

See also
$answers

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

620 {
621 $this->answers = array();
622 }

Referenced by deleteImage().

+ 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 @access public
See also
$imagemap_contents

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

488 {
489 $imagemap_contents = "<map name=\"".$this->title."\"> ";
490 for ($i = 0; $i < count($this->answers); $i++) {
491 $imagemap_contents .= "<area alt=\"".$this->answers[$i]->getAnswertext()."\" ";
492 $imagemap_contents .= "shape=\"".$this->answers[$i]->getArea()."\" ";
493 $imagemap_contents .= "coords=\"".$this->answers[$i]->getCoords()."\" ";
494 $imagemap_contents .= "href=\"$href&selimage=" . $this->answers[$i]->getOrder() . "\" /> ";
495 }
496 $imagemap_contents .= "</map>";
497 return $imagemap_contents;
498 }

References $imagemap_contents.

◆ 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 @access public

Reimplemented from assQuestion.

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

877 {
878 return "qpl_qst_imagemap";
879 }

Referenced by loadFromDb(), and saveAdditionalQuestionDataToDb().

+ 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 @access public
See also
$answers

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

567 {
568 if ($index < 0) return NULL;
569 if (count($this->answers) < 1) return NULL;
570 if ($index >= count($this->answers)) return NULL;
571 return $this->answers[$index];
572 }

Referenced by getAvailableAnswerOptions().

+ 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 @access public
See also
$answers

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

552 {
553 return count($this->answers);
554 }

◆ getAnswers()

& assImagemapQuestion::getAnswers ( )

Returns the answer array.

Returns the answer array

Returns
array The answer array @access public
See also
$answers

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

References $answers.

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

+ 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 @access public

Reimplemented from assQuestion.

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

890 {
891 return "qpl_a_imagemap";
892 }

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

1105 {
1106 if($index !== null)
1107 {
1108 return $this->getAnswer($index);
1109 }
1110 else
1111 {
1112 return $this->getAnswers();
1113 }
1114 }
getAnswer($index=0)
Returns an answer.
& getAnswers()
Returns the answer array.

References getAnswer(), and getAnswers().

+ Here is the call graph for this function:

◆ getExpressionTypes()

◆ getImageFilename()

assImagemapQuestion::getImageFilename ( )

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

446 {
448 }

References $image_filename.

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

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

@access public

See also
$points

Reimplemented from assQuestion.

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

632 {
633 $points = 0;
634 foreach ($this->answers as $key => $value) {
635 if($this->is_multiple_choice)
636 {
637 if($value->getPoints() > $value->getPointsUnchecked())
638 {
639 $points += $value->getPoints();
640 }
641 else
642 {
643 $points += $value->getPointsUnchecked();
644 }
645 }
646 else
647 {
648 if($value->getPoints() > $points)
649 {
650 $points = $value->getPoints();
651 }
652 }
653 }
654 return $points;
655 }

References assQuestion\$points.

Referenced by isComplete().

+ 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 1032 of file class.assImagemapQuestion.php.

1033 {
1034 require_once "./Modules/TestQuestionPool/classes/class.ilOperatorsExpressionMapping.php";
1036 }

References ilOperatorsExpressionMapping\getOperatorsByExpression().

+ 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 @access public

Reimplemented from assQuestion.

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

864 {
865 return "assImagemapQuestion";
866 }

Referenced by toJSON().

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

Reimplemented from assQuestion.

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

899 {
900 $text = parent::getRTETextWithMediaObjects();
901 foreach ($this->answers as $index => $answer)
902 {
903 $text .= $this->feedbackOBJ->getSpecificAnswerFeedbackContent($this->getId(), $index);
904 }
905 return $text;
906 }
$text

References $text, and assQuestion\getId().

+ Here is the call graph for this function:

◆ isAutosaveable()

assImagemapQuestion::isAutosaveable ( )

Reimplemented from assQuestion.

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

702 {
703 return false; // #15217
704 }

◆ 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 @access public

Reimplemented from assQuestion.

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

100 {
101 if (strlen($this->title)
102 && ($this->author)
103 && ($this->question)
104 && ($this->image_filename)
105 && (count($this->answers))
106 && ($this->getMaximumPoints() > 0)
107 )
108 {
109 return true;
110 }
111 return false;
112 }
getMaximumPoints()
Returns the maximum points, a learner can reach answering the question.

References getMaximumPoints().

+ Here is the call 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 @access public

Reimplemented from assQuestion.

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

367 {
368 global $ilDB;
369
370 $result = $ilDB->queryF("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",
371 array("integer"),
372 array($question_id)
373 );
374 if ($result->numRows() == 1)
375 {
376 $data = $ilDB->fetchAssoc($result);
377 $this->setId($question_id);
378 $this->setObjId($data["obj_fi"]);
379 $this->setTitle($data["title"]);
380 $this->setComment($data["description"]);
381 $this->setOriginalId($data["original_id"]);
382 $this->setNrOfTries($data['nr_of_tries']);
383 $this->setAuthor($data["author"]);
384 $this->setPoints($data["points"]);
385 $this->setOwner($data["owner"]);
386 $this->setIsMultipleChoice($data["is_multiple_choice"] == self::MODE_MULTIPLE_CHOICE);
387 include_once("./Services/RTE/classes/class.ilRTE.php");
388 $this->setQuestion(ilRTE::_replaceMediaObjectImageSrc($data["question_text"], 1));
389 $this->setImageFilename($data["image_file"]);
390 $this->setEstimatedWorkingTime(substr($data["working_time"], 0, 2), substr($data["working_time"], 3, 2), substr($data["working_time"], 6, 2));
391
392 try
393 {
394 $this->setAdditionalContentEditingMode($data['add_cont_edit_mode']);
395 }
397 {
398 }
399
400 $result = $ilDB->queryF("SELECT * FROM qpl_a_imagemap WHERE question_fi = %s ORDER BY aorder ASC",
401 array("integer"),
402 array($question_id)
403 );
404 include_once "./Modules/TestQuestionPool/classes/class.assAnswerImagemap.php";
405 if ($result->numRows() > 0)
406 {
407 while ($data = $ilDB->fetchAssoc($result))
408 {
409 array_push($this->answers, new ASS_AnswerImagemap($data["answertext"], $data["points"], $data["aorder"], $data["coords"], $data["area"], $data['question_fi'], $data['points_unchecked']));
410 }
411 }
412 }
413 parent::loadFromDb($question_id);
414 }
setIsMultipleChoice($is_multiple_choice)
Set true if the Imagemapquestion is a multiplechoice Question.
setImageFilename($image_filename, $image_tempfilename="")
Sets the image file name.
getAdditionalTableName()
Returns the name of the additional question data table in the database.
setId($id=-1)
Sets the id of the assQuestion object.
setOriginalId($original_id)
setObjId($obj_id=0)
Set the object id of the container object.
setTitle($title="")
Sets the title string of the assQuestion object.
setOwner($owner="")
Sets the creator/owner ID of the assQuestion object.
setEstimatedWorkingTime($hour=0, $min=0, $sec=0)
Sets the estimated working time of a question from given hour, minute and second.
setAuthor($author="")
Sets the authors name of the assQuestion object.
setPoints($a_points)
Sets the maximum available points for the question.
setComment($comment="")
Sets the comment string of the assQuestion object.
setNrOfTries($a_nr_of_tries)
setAdditionalContentEditingMode($additinalContentEditingMode)
setter for additional content editing mode for this question
setQuestion($question="")
Sets the question string of the question object.
static _replaceMediaObjectImageSrc($a_text, $a_direction=0, $nic=IL_INST_ID)
replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...

References $data, $ilDB, $result, ilRTE\_replaceMediaObjectImageSrc(), getAdditionalTableName(), assQuestion\setAdditionalContentEditingMode(), assQuestion\setAuthor(), assQuestion\setComment(), assQuestion\setEstimatedWorkingTime(), assQuestion\setId(), setImageFilename(), setIsMultipleChoice(), assQuestion\setNrOfTries(), assQuestion\setObjId(), assQuestion\setOriginalId(), assQuestion\setOwner(), assQuestion\setPoints(), assQuestion\setQuestion(), and assQuestion\setTitle().

+ Here is the call graph for this function:

◆ reworkWorkingData()

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

Reworks the allready saved working data if neccessary.

@access protected

Parameters
integer$active_id
integer$pass
boolean$obligationsAnswered

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

843 {
844 // nothing to rework!
845 }

◆ saveAdditionalQuestionDataToDb()

assImagemapQuestion::saveAdditionalQuestionDataToDb ( )

Saves a record to the question types additional data table.

Returns
mixed

Implements ilObjQuestionScoringAdjustable.

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

155 {
156 global $ilDB;
157
158 $ilDB->manipulateF( "DELETE FROM " . $this->getAdditionalTableName() . " WHERE question_fi = %s",
159 array( "integer" ),
160 array( $this->getId() )
161 );
162
163 $ilDB->manipulateF( "INSERT INTO " . $this->getAdditionalTableName(
164 ) . " (question_fi, image_file, is_multiple_choice) VALUES (%s, %s, %s)",
165 array( "integer", "text", 'integer' ),
166 array(
167 $this->getId(),
168 $this->image_filename,
169 (int)$this->is_multiple_choice
170 )
171 );
172 }

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

Referenced by saveToDb().

+ 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 131 of file class.assImagemapQuestion.php.

132 {
133 global $ilDB;
134 $ilDB->manipulateF( "DELETE FROM qpl_a_imagemap WHERE question_fi = %s",
135 array( "integer" ),
136 array( $this->getId() )
137 );
138
139 // Anworten wegschreiben
140 foreach ($this->answers as $key => $value)
141 {
142 $answer_obj = $this->answers[$key];
143 $next_id = $ilDB->nextId( 'qpl_a_imagemap' );
144 $ilDB->manipulateF( "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)",
145 array( "integer", "integer", "text", "float", "integer", "text", "text", "float" ),
146 array( $next_id, $this->id, $answer_obj->getAnswertext(
147 ), $answer_obj->getPoints(), $answer_obj->getOrder(
148 ), $answer_obj->getCoords(), $answer_obj->getArea(
149 ), $answer_obj->getPointsUnchecked() )
150 );
151 }
152 }

References $ilDB, and assQuestion\getId().

Referenced by saveToDb().

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

◆ savePreviewData()

assImagemapQuestion::savePreviewData ( ilAssQuestionPreviewSession  $previewSession)
protected

Reworks the allready saved working data if neccessary.

@abstract @access protected

Parameters
integer$active_id
integer$pass
boolean$obligationsAnswered

Reimplemented from assQuestion.

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

813 {
814 $solution = $previewSession->getParticipantsSolution();
815
816 if( $this->is_multiple_choice && strlen($_GET['remImage']) )
817 {
818 unset($solution[(int)$_GET['remImage']]);
819 }
820
821 if( strlen($_GET['selImage']) )
822 {
823 if( !$this->is_multiple_choice )
824 {
825 $solution = array();
826 }
827
828 $solution[(int)$_GET['selImage']] = (int)$_GET['selImage'];
829 }
830
831 $previewSession->setParticipantsSolution($solution);
832 }
$_GET["client_id"]

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

+ 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

Reimplemented from assQuestion.

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

124 {
128 parent::saveToDb($original_id);
129 }
saveAdditionalQuestionDataToDb()
Saves a record to the question types additional data table.
saveAnswerSpecificDataToDb()
Saves the answer specific records into a question types answer table.
saveQuestionDataToDb($original_id="")

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

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

@access public

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

Reimplemented from assQuestion.

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

715 {
716 global $ilDB;
717
718 if (is_null($pass))
719 {
720 include_once "./Modules/Test/classes/class.ilObjTest.php";
721 $pass = ilObjTest::_getPass($active_id);
722 }
723
724 $this->getProcessLocker()->requestUserSolutionUpdateLock();
725
726 if(!$authorized)
727 {
728
729 $solutions = $this->getSolutionValues($active_id, $pass, false);
730 if(0 == count($solutions))
731 {
732 $solutions = $this->getSolutionValues($active_id, $pass, true);
733 $this->removeCurrentSolution($active_id, $pass, true);
734 $this->removeCurrentSolution($active_id, $pass, false);
735 foreach($solutions as $solution)
736 {
737 $this->saveCurrentSolution($active_id, $pass, $solution['value1'], null, false);
738 }
739 }
740
741 if($this->is_multiple_choice && strlen($_GET['remImage']))
742 {
743 $query = "DELETE FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s AND value1 = %s AND authorized = %s";
744 $types = array("integer", "integer", "integer", "integer", 'integer');
745 $values = array($active_id, $this->getId(), $pass, $_GET['remImage'], (int)$authorized);
746
747 if($this->getStep() !== NULL)
748 {
749 $query .= " AND step = %s ";
750 $types[] = 'integer';
751 $values[] = $this->getStep();
752 }
753 $ilDB->manipulateF($query, $types, $values);
754 }
755 elseif(!$this->is_multiple_choice)
756 {
757 $this->removeCurrentSolution($active_id, $pass, $authorized);
758 }
759
760 if(!$authorized && strlen($_GET["selImage"]))
761 {
762 $imageWasSelected = true;
763
764 $types = array('integer', 'integer', 'integer', 'integer', 'integer');
765 $values = array($active_id, $this->getId(), $pass, (int)$_GET['selImage'], (int)$authorized);
766 $query = 'DELETE FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s AND value1 = %s AND authorized = %s';
767 if($this->getStep() != null)
768 {
769 $types[] = 'integer';
770 $values[] = $this->getStep();
771 $query .= ' AND step = %s';
772 }
773
774 $ilDB->manipulateF($query, $types, $values);
775
776 $this->saveCurrentSolution($active_id, $pass, $_GET['selImage'], null, $authorized);
777 }
778 else
779 {
780 $imageWasSelected = false;
781 }
782 }
783 else
784 {
785 $solutions = $this->getUserSolutionPreferingIntermediate($active_id, $pass);
786 $this->removeCurrentSolution($active_id, $pass, true);
787 $this->removeCurrentSolution($active_id, $pass, false);
788 foreach($solutions as $solution)
789 {
790 $this->saveCurrentSolution($active_id, $pass, $solution['value1'], null, true);
791 }
792 }
793
794 $this->getProcessLocker()->releaseUserSolutionUpdateLock();
795
796 require_once 'Modules/Test/classes/class.ilObjAssessmentFolder.php';
798 {
799 if( $imageWasSelected )
800 {
801 $this->logAction($this->lng->txtlng("assessment", "log_user_entered_values", ilObjAssessmentFolder::_getLogLanguage()), $active_id, $this->getId());
802 }
803 else
804 {
805 $this->logAction($this->lng->txtlng("assessment", "log_user_not_entered_values", ilObjAssessmentFolder::_getLogLanguage()), $active_id, $this->getId());
806 }
807 }
808
809 return true;
810 }
getUserSolutionPreferingIntermediate($active_id, $pass=NULL)
getSolutionValues($active_id, $pass=NULL, $authorized=true)
Loads solutions of a given user from the database an returns it.
logAction($logtext="", $active_id="", $question_id="")
Logs an action into the Test&Assessment log.
removeCurrentSolution($active_id, $pass, $authorized=true, $ignoredSolutionIds=array())
saveCurrentSolution($active_id, $pass, $value1, $value2, $authorized=true)
_getLogLanguage()
retrieve the log language for assessment logging
_enabledAssessmentLogging()
check wether assessment logging is enabled or not
_getPass($active_id)
Retrieves the actual pass of a given user for a given test.

References $_GET, $ilDB, $pass, $query, ilObjAssessmentFolder\_enabledAssessmentLogging(), ilObjAssessmentFolder\_getLogLanguage(), ilObjTest\_getPass(), assQuestion\getId(), assQuestion\getProcessLocker(), assQuestion\getSolutionValues(), assQuestion\getStep(), assQuestion\getUserSolutionPreferingIntermediate(), assQuestion\logAction(), assQuestion\removeCurrentSolution(), and assQuestion\saveCurrentSolution().

+ Here is the call graph for this function:

◆ setExportDetailsXLS()

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

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

Parameters
object$worksheetReference to the parent excel worksheet
object$startrowStartrow of the output in the excel worksheet
object$active_idActive id of the participant
object$passTest pass
object$format_titleExcel title format
object$format_boldExcel bold format
array$eval_dataCumulated evaluation data @access public

Reimplemented from assQuestion.

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

921 {
922 include_once ("./Services/Excel/classes/class.ilExcelUtils.php");
923 $solution = $this->getSolutionValues($active_id, $pass);
924 $worksheet->writeString($startrow, 0, ilExcelUtils::_convert_text($this->lng->txt($this->getQuestionType())), $format_title);
925 $worksheet->writeString($startrow, 1, ilExcelUtils::_convert_text($this->getTitle()), $format_title);
926 $i = 1;
927 foreach ($this->getAnswers() as $id => $answer)
928 {
929 $worksheet->writeString($startrow + $i, 0, ilExcelUtils::_convert_text($answer->getArea() . ": " . $answer->getCoords()), $format_bold);
930 if ($id == $solution[0]["value1"])
931 {
932 $worksheet->write($startrow + $i, 1, 1);
933 }
934 else
935 {
936 $worksheet->write($startrow + $i, 1, 0);
937 }
938 $i++;
939 }
940 return $startrow + $i + 1;
941 }
getTitle()
Gets the title string of the assQuestion object.
_convert_text($a_text, $a_target="has been removed")

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

+ Here is the call graph for this function:

◆ setImageFilename()

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

Sets the image file name.

Parameters
string$image_filename. @access public
See also
$image_filename

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

458 {
459 if (!empty($image_filename))
460 {
461 $image_filename = str_replace(" ", "_", $image_filename);
462 $this->image_filename = $image_filename;
463 }
464 if (!empty($image_tempfilename))
465 {
466 $imagepath = $this->getImagePath();
467 if (!file_exists($imagepath))
468 {
469 ilUtil::makeDirParents($imagepath);
470 }
471 if (!ilUtil::moveUploadedFile($image_tempfilename, $image_filename, $imagepath.$image_filename))
472 {
473 $this->ilias->raiseError("The image could not be uploaded!", $this->ilias->error_obj->MESSAGE);
474 }
475 global $ilLog; $ilLog->write("gespeichert: " . $imagepath.$image_filename);
476 }
477 }
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)

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

Referenced by loadFromDb().

+ 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 78 of file class.assImagemapQuestion.php.

79 {
80 $this->is_multiple_choice = $is_multiple_choice;
81 }

References $is_multiple_choice.

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ syncWithOriginal()

assImagemapQuestion::syncWithOriginal ( )

Reimplemented from assQuestion.

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

848 {
849 if ($this->getOriginalId())
850 {
851 parent::syncWithOriginal();
852 }
853 }

References assQuestion\getOriginalId().

+ Here is the call graph for this function:

◆ toJSON()

assImagemapQuestion::toJSON ( )

Returns a JSON representation of the question.

Reimplemented from assQuestion.

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

958 {
959 include_once("./Services/RTE/classes/class.ilRTE.php");
960 $result = array();
961 $result['id'] = (int) $this->getId();
962 $result['type'] = (string) $this->getQuestionType();
963 $result['title'] = (string) $this->getTitle();
964 $result['question'] = $this->formatSAQuestion($this->getQuestion());
965 $result['nr_of_tries'] = (int) $this->getNrOfTries();
966 $result['shuffle'] = (bool) $this->getShuffle();
967 $result['is_multiple'] = (bool) $this->getIsMultipleChoice();
968 $result['feedback'] = array(
969 'onenotcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), false)),
970 'allcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), true))
971 );
972 $result['image'] = (string) $this->getImagePathWeb() . $this->getImageFilename();
973
974 $answers = array();
975 $order = 0;
976 foreach ($this->getAnswers() as $key => $answer_obj)
977 {
978 array_push($answers, array(
979 "answertext" => (string)$answer_obj->getAnswertext(),
980 "points" => (float)$answer_obj->getPoints(),
981 "points_unchecked" => (float)$answer_obj->getPointsUnchecked(),
982 "order" => (int)$order,
983 "coords" => $answer_obj->getCoords(),
984 "state" => $answer_obj->getState(),
985 "area" => $answer_obj->getArea(),
986 "feedback" => $this->formatSAQuestion(
987 $this->feedbackOBJ->getSpecificAnswerFeedbackExportPresentation($this->getId(), $key)
988 )
989 ));
990 $order++;
991 }
992 $result['answers'] = $answers;
993
994 $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $this->getId());
995 $result['mobs'] = $mobs;
996
997 return json_encode($result);
998 }
getQuestionType()
Returns the question type of the question.
formatSAQuestion($a_q)
Format self assessment question.
getShuffle()
Gets the shuffle flag.
getQuestion()
Gets the question string of the question object.
getImagePathWeb()
Returns the web image path for web accessable images of a question.
_getMobsOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
get mobs of object
$mobs

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

+ Here is the call graph for this function:

◆ uploadImagemap()

assImagemapQuestion::uploadImagemap (   $imagemap_filename = "")

Uploads an image map and takes over the areas.

Parameters
string$imagemap_filenameImagemap filename
Returns
integer number of areas added

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

423 {
424 $added = 0;
425 if (!empty($imagemap_filename))
426 {
427 $fp = fopen($imagemap_filename, "r");
428 $contents = fread($fp, filesize($imagemap_filename));
429 fclose($fp);
430 if (preg_match_all("/<area(.+)>/siU", $contents, $matches))
431 {
432 for ($i=0; $i< count($matches[1]); $i++)
433 {
434 preg_match("/alt\s*=\s*\"(.+)\"\s*/siU", $matches[1][$i], $alt);
435 preg_match("/coords\s*=\s*\"(.+)\"\s*/siU", $matches[1][$i], $coords);
436 preg_match("/shape\s*=\s*\"(.+)\"\s*/siU", $matches[1][$i], $shape);
437 $this->addAnswer($alt[1], 0.0, count($this->answers), $coords[1], $shape[1]);
438 $added++;
439 }
440 }
441 }
442 return $added;
443 }
addAnswer( $answertext="", $points=0.0, $order=0, $coords="", $area="", $points_unchecked=0.0)
Adds a possible answer for a imagemap question.

References $coords, and addAnswer().

+ Here is the call graph for this function:

Field Documentation

◆ $answers

assImagemapQuestion::$answers

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

Referenced by getAnswers(), and toJSON().

◆ $coords

assImagemapQuestion::$coords

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

Referenced by addAnswer(), and uploadImagemap().

◆ $image_filename

assImagemapQuestion::$image_filename

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

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

◆ $imagemap_contents

assImagemapQuestion::$imagemap_contents

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

Referenced by get_imagemap_contents().

◆ $is_multiple_choice

assImagemapQuestion::$is_multiple_choice = false
protected

Definition at line 42 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: