ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
assOrderingQuestion Class Reference

Class for ordering questions. More...

+ Inheritance diagram for assOrderingQuestion:
+ Collaboration diagram for assOrderingQuestion:

Public Member Functions

 __construct ( $title="", $comment="", $author="", $owner=-1, $question="", $ordering_type=OQ_TERMS)
 assOrderingQuestion constructor More...
 
 isComplete ()
 Returns true, if a ordering question is complete for use. More...
 
 saveToDb ($original_id="")
 Saves a assOrderingQuestion object to a database. More...
 
 loadFromDb ($question_id)
 Loads a assOrderingQuestion object from a database. More...
 
 duplicate ($for_test=true, $title="", $author="", $owner="", $testObjId=null)
 Duplicates an assOrderingQuestion. More...
 
 copyObject ($target_questionpool_id, $title="")
 Copies an assOrderingQuestion object. More...
 
 createNewOriginalFromThisDuplicate ($targetParentId, $targetQuestionTitle="")
 
 duplicateImages ($src_question_id, $src_object_id, $dest_question_id, $dest_object_id)
 
 copyImages ($question_id, $source_questionpool)
 
 setOrderingType ($ordering_type=OQ_TERMS)
 Sets the ordering question type. More...
 
 getOrderingType ()
 Returns the ordering question type. More...
 
 isOrderingTypeNested ()
 
 isImageOrderingType ()
 
 hasOrderingTypeUploadSupport ()
 
 getOrderingElementListForSolutionOutput ($forceCorrectSolution, $activeId, $passIndex, $getUseIntermediateSolution=false)
 
 getSolutionOrderingElementListForTestOutput (ilAssNestedOrderingElementsInputGUI $inputGUI, $lastPost, $activeId, $pass)
 
 getSolutionOrderingElementList ($indexedSolutionValues)
 
 getShuffledOrderingElementList ()
 
 getOrderingElementList ()
 
 setOrderingElementList ($orderingElementList)
 
 moveAnswerUp ($position)
 
 moveAnswerDown ($position)
 
 getAnswer ($index=0)
 Returns the ordering element from the given position. More...
 
 deleteAnswer ($randomIdentifier)
 Deletes an answer with a given index. More...
 
 getAnswerCount ()
 Returns the number of answers. More...
 
 calculateReachedPoints ($active_id, $pass=null, $authorizedSolution=true, $returndetails=false)
 Returns the points, a learner has reached answering the question. More...
 
 calculateReachedPointsFromPreviewSession (ilAssQuestionPreviewSession $previewSession)
 
 getMaximumPoints ()
 Returns the maximum points, a learner can reach answering the question. More...
 
 getEncryptedFilename ($filename)
 
 dropImageFile ($imageFilename)
 
 isImageFileStored ($imageFilename)
 
 isImageReplaced (ilAssOrderingElement $newElement, ilAssOrderingElement $oldElement)
 
 storeImageFile ($uploadFile, $targetFile)
 Sets the image file and uploads the image to the object's image directory. More...
 
 handleThumbnailCreation (ilAssOrderingElementList $elementList)
 
 createImageThumbnail (ilAssOrderingElement $element)
 
 validateSolutionSubmit ()
 Checks the data to be saved for consistency. More...
 
 saveWorkingData ($active_id, $pass=null, $authorized=true)
 Saves the learners input of the question to the database. More...
 
 saveAnswerSpecificDataToDb ()
 Saves the answer specific records into a question types answer table. More...
 
 getQuestionType ()
 Returns the question type of the question. More...
 
 getAdditionalTableName ()
 Returns the name of the additional question data table in the database. More...
 
 getAnswerTableName ()
 Returns the name of the answer table in the database. More...
 
 getRTETextWithMediaObjects ()
 Collects all text in the question which could contain media objects which were created with the Rich Text Editor. More...
 
 getOrderElements ()
 Returns the answers array. More...
 
 supportsJavascriptOutput ()
 Returns true if the question type supports JavaScript output. More...
 
 supportsNonJsOutput ()
 
 setExportDetailsXLS ($worksheet, $startrow, $active_id, $pass)
 {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
Returns
object
} More...
 
 getThumbGeometry ()
 
 getThumbSize ()
 
 setThumbGeometry ($a_geometry)
 
 getElementHeight ()
 
 setElementHeight ($a_height)
 
 rebuildThumbnails ()
 
 getThumbPrefix ()
 
 toJSON ()
 Returns a JSON representation of the question. More...
 
 buildOrderingElementInputGui ()
 
 initOrderingElementAuthoringProperties (ilFormPropertyGUI $formField)
 
 initOrderingElementFormFieldLabels (ilFormPropertyGUI $formField)
 
 buildOrderingTextsInputGui ()
 
 buildOrderingImagesInputGui ()
 
 buildNestedOrderingElementInputGui ()
 
 fetchSolutionListFromSubmittedForm (ilPropertyFormGUI $form)
 
 fetchSolutionListFromFormSubmissionData ($userSolutionPost)
 
 getSolutionListFromPostSubmit ()
 
 getSolutionPostSubmit ()
 
 getLeveledOrdering ()
 
 getOldLeveledOrdering ()
 
 lookupSolutionOrderByRandomid ($a_random_id)
 
 updateLeveledOrdering ($a_index, $a_answer_text, $a_depth)
 
 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...
 
 buildTestPresentationConfig ()
 Get the test question configuration. More...
 
 fetchSolutionSubmit ($formSubmissionDataStructure)
 
- Public Member Functions inherited from assQuestion
 __construct ( $title="", $comment="", $author="", $owner=-1, $question="")
 assQuestion constructor More...
 
 getShuffler ()
 
 setShuffler (ilArrayElementShuffler $shuffler)
 
 setProcessLocker ($processLocker)
 
 getProcessLocker ()
 
 fromXML (&$item, &$questionpool_id, &$tst_id, &$tst_object, &$question_counter, &$import_mapping)
 Receives parameters from a QTI parser and creates a valid ILIAS question object. More...
 
 toXML ($a_include_header=true, $a_include_binary=true, $a_shuffle=false, $test_output=false, $force_image_references=false)
 Returns a QTI xml representation of the question. More...
 
 isComplete ()
 Returns true, if a question is complete for use. More...
 
 questionTitleExists ($questionpool_id, $title)
 Returns TRUE if the question title exists in the database. More...
 
 setTitle ($title="")
 Sets the title string of the assQuestion object. More...
 
 setId ($id=-1)
 Sets the id of the assQuestion object. More...
 
 setTestId ($id=-1)
 Sets the test id of the assQuestion object. More...
 
 setComment ($comment="")
 Sets the comment string of the assQuestion object. More...
 
 setOutputType ($outputType=OUTPUT_HTML)
 Sets the output type. More...
 
 setShuffle ($shuffle=true)
 Sets the shuffle flag. More...
 
 setEstimatedWorkingTime ($hour=0, $min=0, $sec=0)
 Sets the estimated working time of a question from given hour, minute and second. More...
 
 setEstimatedWorkingTimeFromDurationString ($durationString)
 Sets the estimated working time of a question from a given datetime string. More...
 
 keyInArray ($searchkey, $array)
 returns TRUE if the key occurs in an array More...
 
 setAuthor ($author="")
 Sets the authors name of the assQuestion object. More...
 
 setOwner ($owner="")
 Sets the creator/owner ID of the assQuestion object. More...
 
 getTitle ()
 Gets the title string of the assQuestion object. More...
 
 getTitleFilenameCompliant ()
 returns the object title prepared to be used as a filename More...
 
 getId ()
 Gets the id of the assQuestion object. More...
 
 getShuffle ()
 Gets the shuffle flag. More...
 
 getTestId ()
 Gets the test id of the assQuestion object. More...
 
 getComment ()
 Gets the comment string of the assQuestion object. More...
 
 getOutputType ()
 Gets the output type. More...
 
 supportsJavascriptOutput ()
 Returns true if the question type supports JavaScript output. More...
 
 supportsNonJsOutput ()
 
 requiresJsSwitch ()
 
 getEstimatedWorkingTime ()
 Gets the estimated working time of a question. More...
 
 getAuthor ()
 Gets the authors name of the assQuestion object. More...
 
 getOwner ()
 Gets the creator/owner ID of the assQuestion object. More...
 
 getObjId ()
 Get the object id of the container object. More...
 
 setObjId ($obj_id=0)
 Set the object id of the container object. More...
 
 setExternalId ($external_id)
 
 getExternalId ()
 
 getSuggestedSolutionOutput ()
 
_getSuggestedSolution ($question_id, $subquestion_index=0)
 Returns a suggested solution for a given subquestion index. More...
 
 getSuggestedSolutions ()
 Return the suggested solutions. More...
 
 getReachedPoints ($active_id, $pass=null)
 Returns the points, a learner has reached answering the question This is the fast way to get the points directly from the database. More...
 
 getMaximumPoints ()
 Returns the maximum points, a learner can reach answering the question. More...
 
 getAdjustedReachedPoints ($active_id, $pass=null, $authorizedSolution=true)
 returns the reached points ... More...
 
 calculateResultsFromSolution ($active_id, $pass=null, $obligationsEnabled=false)
 Calculates the question results from a previously saved question solution. More...
 
 persistWorkingState ($active_id, $pass=null, $obligationsEnabled=false, $authorized=true)
 persists the working state for current testactive and testpass More...
 
 persistPreviewState (ilAssQuestionPreviewSession $previewSession)
 persists the preview state for current user and question More...
 
 validateSolutionSubmit ()
 
 saveWorkingData ($active_id, $pass=null, $authorized=true)
 Saves the learners input of the question to the database. More...
 
 moveUploadedMediaFile ($file, $name)
 Move an uploaded media file to an public accessible temp dir to present it. More...
 
 getSuggestedSolutionPath ()
 Returns the path for a suggested solution. More...
 
 getJavaPath ()
 Returns the image path for web accessable images of a question. More...
 
 getImagePath ($question_id=null, $object_id=null)
 Returns the image path for web accessable images of a question. More...
 
 buildImagePath ($questionId, $parentObjectId)
 
 getFlashPath ()
 Returns the image path for web accessable flash files of a question. More...
 
 getJavaPathWeb ()
 Returns the web image path for web accessable java applets of a question. More...
 
 getSuggestedSolutionPathWeb ()
 Returns the web path for a suggested solution. More...
 
 getImagePathWeb ()
 Returns the web image path for web accessable images of a question. More...
 
 getFlashPathWeb ()
 Returns the web image path for web accessable flash applications of a question. More...
 
 getTestOutputSolutions ($activeId, $pass)
 
 getUserSolutionPreferingIntermediate ($active_id, $pass=null)
 
 getSolutionValues ($active_id, $pass=null, $authorized=true)
 Loads solutions of a given user from the database an returns it. More...
 
 isInUse ($question_id="")
 Checks whether the question is in use or not. More...
 
 isClone ($question_id="")
 Checks whether the question is a clone of another question or not. More...
 
 pcArrayShuffle ($array)
 Shuffles the values of a given array. More...
 
 getAdditionalTableName ()
 Returns the name of the additional question data table in the database. More...
 
 getAnswerTableName ()
 Returns the name of the answer table in the database. More...
 
 deleteAnswers ($question_id)
 Deletes datasets from answers tables. More...
 
 deleteAdditionalTableData ($question_id)
 Deletes datasets from the additional question table in the database. More...
 
 delete ($question_id)
 Deletes a question and all materials from the database. More...
 
 getTotalAnswers ()
 get total number of answers More...
 
 _getTotalAnswers ($a_q_id)
 get number of answers for question id (static) note: do not use $this inside this method More...
 
 copyXHTMLMediaObjectsOfQuestion ($a_q_id)
 
 syncXHTMLMediaObjectsOfQuestion ()
 
 createPageObject ()
 create page object of question More...
 
 copyPageOfQuestion ($a_q_id)
 
 getPageOfQuestion ()
 
 setOriginalId ($original_id)
 
 getOriginalId ()
 
 fixSvgToPng ($imageFilenameContainingString)
 
 fixUnavailableSkinImageSources ($html)
 
 loadFromDb ($question_id)
 Loads the question from the database. More...
 
 createNewQuestion ($a_create_page=true)
 Creates a new question without an owner when a new question is created This assures that an ID is given to the question if a file upload or something else occurs. More...
 
 saveQuestionDataToDb ($original_id="")
 
 saveToDb ($original_id="")
 Saves the question to the database. More...
 
 setNewOriginalId ($newId)
 
 deleteSuggestedSolutions ()
 Deletes all suggestes solutions in the database. More...
 
 getSuggestedSolution ($subquestion_index=0)
 Returns a suggested solution for a given subquestion index. More...
 
 getSuggestedSolutionTitle ($subquestion_index=0)
 Returns the title of a suggested solution at a given subquestion_index. More...
 
 setSuggestedSolution ($solution_id="", $subquestion_index=0, $is_import=false)
 Sets a suggested solution for the question. More...
 
 _resolveInternalLink ($internal_link)
 
 _resolveIntLinks ($question_id)
 
 syncWithOriginal ()
 
 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...
 
 calculateReachedPoints ($active_id, $pass=null, $authorizedSolution=true, $returndetails=false)
 Returns the points, a learner has reached answering the question. More...
 
 deductHintPointsFromReachedPoints (ilAssQuestionPreviewSession $previewSession, $reachedPoints)
 
 calculateReachedPointsFromPreviewSession (ilAssQuestionPreviewSession $previewSession)
 
 isPreviewSolutionCorrect (ilAssQuestionPreviewSession $previewSession)
 
 adjustReachedPointsByScoringOptions ($points, $active_id, $pass=null)
 Adjust the given reached points by checks for all special scoring options in the test container. More...
 
 isHTML ($a_text)
 Checks if a given string contains HTML or not. More...
 
 prepareTextareaOutput ($txt_output, $prepare_for_latex_output=false, $omitNl2BrWhenTextArea=false)
 Prepares a string for a text area output in tests. More...
 
 QTIMaterialToString ($a_material)
 Reads an QTI material tag an creates a text string. More...
 
 addQTIMaterial (&$a_xml_writer, $a_material, $close_material_tag=true, $add_mobs=true)
 Creates a QTI material tag from a plain text or xhtml text. More...
 
 buildHashedImageFilename ($plain_image_filename, $unique=false)
 
 getQuestion ()
 Gets the question string of the question object. More...
 
 setQuestion ($question="")
 Sets the question string of the question object. More...
 
 getQuestionType ()
 Returns the question type of the question. More...
 
 getQuestionTypeID ()
 Returns the question type of the question. More...
 
 cleanupMediaObjectUsage ()
 synchronises appearances of media objects in the question with media object usage table More...
 
getInstances ()
 Gets all instances of the question. More...
 
 getActiveUserData ($active_id)
 Returns the user id and the test id for a given active id. More...
 
 setExportDetailsXLS ($worksheet, $startrow, $active_id, $pass)
 Creates an Excel worksheet for the detailed cumulated results of this question. More...
 
 __get ($value)
 Object getter. More...
 
 __set ($key, $value)
 Object setter. More...
 
 getNrOfTries ()
 
 setNrOfTries ($a_nr_of_tries)
 
 setExportImagePath ($a_path)
 
 formatSAQuestion ($a_q)
 Format self assessment question. More...
 
 setPreventRteUsage ($a_val)
 Set prevent rte usage. More...
 
 getPreventRteUsage ()
 Get prevent rte usage. More...
 
 migrateContentForLearningModule (ilAssSelfAssessmentMigrator $migrator)
 
 setSelfAssessmentEditingMode ($a_selfassessmenteditingmode)
 Set Self-Assessment Editing Mode. More...
 
 getSelfAssessmentEditingMode ()
 Get Self-Assessment Editing Mode. More...
 
 setDefaultNrOfTries ($a_defaultnroftries)
 Set Default Nr of Tries. More...
 
 getDefaultNrOfTries ()
 Get Default Nr of Tries. More...
 
 syncSkillAssignments ($srcParentId, $srcQuestionId, $trgParentId, $trgQuestionId)
 
 isAnswered ($active_id, $pass=null)
 returns boolean wether the question is answered during test pass or not More...
 
 isAutosaveable ()
 
 getAdditionalContentEditingMode ()
 getter for additional content editing mode for this question More...
 
 setAdditionalContentEditingMode ($additinalContentEditingMode)
 setter for additional content editing mode for this question More...
 
 isAdditionalContentEditingModePageObject ()
 isser for additional "pageobject" content editing mode More...
 
 isValidAdditionalContentEditingMode ($additionalContentEditingMode)
 returns the fact wether the passed additional content mode is valid or not More...
 
 getValidAdditionalContentEditingModes ()
 getter for valid additional content editing modes More...
 
 addQuestionChangeListener (ilQuestionChangeListener $listener)
 
 getQuestionChangeListeners ()
 
 getHtmlUserSolutionPurifier ()
 
 getHtmlQuestionContentPurifier ()
 
 setLastChange ($lastChange)
 
 getLastChange ()
 
 removeIntermediateSolution ($active_id, $pass)
 
 removeCurrentSolution ($active_id, $pass, $authorized=true)
 
 saveCurrentSolution ($active_id, $pass, $value1, $value2, $authorized=true, $tstamp=null)
 
 updateCurrentSolution ($solutionId, $value1, $value2, $authorized=true)
 
 updateCurrentSolutionsAuthorization ($activeId, $pass, $authorized, $keepTime=false)
 
 setStep ($step)
 
 getStep ()
 
 toJSON ()
 
 duplicate ($for_test=true, $title="", $author="", $owner="", $testObjId=null)
 
 intermediateSolutionExists ($active_id, $pass)
 
 authorizedSolutionExists ($active_id, $pass)
 
 authorizedOrIntermediateSolutionExists ($active_id, $pass)
 
 isAddableAnswerOptionValue ($qIndex, $answerOptionValue)
 
 addAnswerOptionValue ($qIndex, $answerOptionValue, $points)
 
 removeAllExistingSolutions ()
 
 removeExistingSolutions ($activeId, $pass)
 
 resetUsersAnswer ($activeId, $pass)
 
 removeResultRecord ($activeId, $pass)
 
 fetchValuePairsFromIndexedValues (array $indexedValues)
 
 fetchIndexedValuesFromValuePairs (array $valuePairs)
 
 areObligationsToBeConsidered ()
 
 setObligationsToBeConsidered ($obligationsToBeConsidered)
 
 updateTimestamp ()
 
 getTestPresentationConfig ()
 Get the test question configuration (initialised once) More...
 
 savePartial ()
 
- Public Member Functions inherited from ilObjQuestionScoringAdjustable
 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 ORDERING_ELEMENT_FORM_FIELD_POSTVAR = 'order_elems'
 
const ORDERING_ELEMENT_FORM_CMD_UPLOAD_IMG = 'uploadElementImage'
 
const ORDERING_ELEMENT_FORM_CMD_REMOVE_IMG = 'removeElementImage'
 
 $ordering_type
 
 $thumb_geometry = 100
 
 $element_height
 
 $old_ordering_depth = array()
 
 $leveled_ordering = array()
 
- Data Fields inherited from assQuestion
const IMG_MIME_TYPE_JPG = 'image/jpeg'
 
const IMG_MIME_TYPE_PNG = 'image/png'
 
const IMG_MIME_TYPE_GIF = 'image/gif'
 
const ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT = 'default'
 constant for additional content editing mode "default" More...
 
const ADDITIONAL_CONTENT_EDITING_MODE_PAGE_OBJECT = 'pageobject'
 constant for additional content editing mode "pageobject" More...
 
 $feedbackOBJ = null
 
 $prevent_rte_usage = false
 
 $selfassessmenteditingmode = false
 
 $defaultnroftries = 0
 
 $questionActionCmd = 'handleQuestionAction'
 
const KEY_VALUES_IMPLOSION_SEPARATOR = ':'
 
- Data Fields inherited from iQuestionCondition
const StringResultExpression = '~TEXT~'
 
const PercentageResultExpression = '%n%'
 
const NumericResultExpression = '#n#'
 
const MatchingResultExpression = ';n:m;'
 
const OrderingResultExpression = '$n,m,o,p$'
 
const NumberOfResultExpression = '+n+'
 
const ExclusiveResultExpression = '*n,m,o,p*'
 
const EmptyAnswerExpression = "?"
 

Protected Member Functions

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

Protected Attributes

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

Private Attributes

 $postSolutionOrderingElementList = null
 

Additional Inherited Members

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

Detailed Description

Class for ordering questions.

assOrderingQuestion is a class for ordering questions.

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 26 of file class.assOrderingQuestion.php.

Constructor & Destructor Documentation

◆ __construct()

assOrderingQuestion::__construct (   $title = "",
  $comment = "",
  $author = "",
  $owner = -1,
  $question = "",
  $ordering_type = OQ_TERMS 
)

assOrderingQuestion constructor

The constructor takes possible arguments an creates an instance of the assOrderingQuestion 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 ordering test
int$ordering_type

Definition at line 77 of file class.assOrderingQuestion.php.

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

Member Function Documentation

◆ afterSyncWithOriginal()

assOrderingQuestion::afterSyncWithOriginal (   $origQuestionId,
  $dupQuestionId,
  $origParentObjId,
  $dupParentObjId 
)
protected

{}

Reimplemented from assQuestion.

Definition at line 1566 of file class.assOrderingQuestion.php.

1567 {
1568 parent::afterSyncWithOriginal($origQuestionId, $dupQuestionId, $origParentObjId, $dupParentObjId);
1569 $this->duplicateImages($dupQuestionId, $dupParentObjId, $origQuestionId, $origParentObjId);
1570 }
duplicateImages($src_question_id, $src_object_id, $dest_question_id, $dest_object_id)

References duplicateImages().

+ Here is the call graph for this function:

◆ buildNestedOrderingElementInputGui()

assOrderingQuestion::buildNestedOrderingElementInputGui ( )
Returns
ilAssNestedOrderingElementsInputGUI

Definition at line 1277 of file class.assOrderingQuestion.php.

1278 {
1279 $formDataConverter = $this->buildNestedOrderingFormDataConverter();
1280
1281 require_once 'Modules/TestQuestionPool/classes/forms/class.ilAssNestedOrderingElementsInputGUI.php';
1282
1283 $orderingElementInput = new ilAssNestedOrderingElementsInputGUI(
1284 $formDataConverter,
1285 self::ORDERING_ELEMENT_FORM_FIELD_POSTVAR
1286 );
1287
1288 $orderingElementInput->setUniquePrefix($this->getId());
1289 $orderingElementInput->setOrderingType($this->getOrderingType());
1290 $orderingElementInput->setElementImagePath($this->getImagePathWeb());
1291 $orderingElementInput->setThumbPrefix($this->getThumbPrefix());
1292
1293 $this->initOrderingElementFormFieldLabels($orderingElementInput);
1294
1295 return $orderingElementInput;
1296 }
initOrderingElementFormFieldLabels(ilFormPropertyGUI $formField)
getOrderingType()
Returns the ordering question type.
getId()
Gets the id of the assQuestion object.
getImagePathWeb()
Returns the web image path for web accessable images of a question.

References buildNestedOrderingFormDataConverter(), assQuestion\getId(), assQuestion\getImagePathWeb(), getOrderingType(), getThumbPrefix(), and initOrderingElementFormFieldLabels().

Referenced by buildOrderingElementInputGui(), and fetchSolutionListFromFormSubmissionData().

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

◆ buildNestedOrderingFormDataConverter()

assOrderingQuestion::buildNestedOrderingFormDataConverter ( )
protected
Returns
ilAssOrderingFormValuesObjectsConverter

Definition at line 1695 of file class.assOrderingQuestion.php.

1696 {
1697 $formDataConverter = $this->buildOrderingElementFormDataConverter();
1699
1700 if ($this->getOrderingType() == OQ_NESTED_PICTURES) {
1701 $formDataConverter->setImageRemovalCommand(self::ORDERING_ELEMENT_FORM_CMD_REMOVE_IMG);
1702 $formDataConverter->setImageUrlPath($this->getImagePathWeb());
1703
1704 if ($this->getThumbSize() && $this->getThumbPrefix()) {
1705 $formDataConverter->setThumbnailPrefix($this->getThumbPrefix());
1706 }
1707 }
1708
1709 return $formDataConverter;
1710 }
const OQ_NESTED_PICTURES

References buildOrderingElementFormDataConverter(), ilAssOrderingFormValuesObjectsConverter\CONTEXT_MAINTAIN_HIERARCHY, assQuestion\getImagePathWeb(), getOrderingType(), getThumbPrefix(), getThumbSize(), and OQ_NESTED_PICTURES.

Referenced by buildNestedOrderingElementInputGui().

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

◆ buildOrderingElementFormDataConverter()

assOrderingQuestion::buildOrderingElementFormDataConverter ( )
protected
Returns
ilAssOrderingFormValuesObjectsConverter

Definition at line 1655 of file class.assOrderingQuestion.php.

1656 {
1657 require_once 'Modules/TestQuestionPool/classes/forms/class.ilAssOrderingFormValuesObjectsConverter.php';
1658 $converter = new ilAssOrderingFormValuesObjectsConverter();
1659 $converter->setPostVar(self::ORDERING_ELEMENT_FORM_FIELD_POSTVAR);
1660
1661 return $converter;
1662 }

Referenced by buildNestedOrderingFormDataConverter(), buildOrderingImagesFormDataConverter(), and buildOrderingTextsFormDataConverter().

+ Here is the caller graph for this function:

◆ buildOrderingElementInputGui()

assOrderingQuestion::buildOrderingElementInputGui ( )
Returns
ilAssNestedOrderingElementsInputGUI|ilAssOrderingImagesInputGUI|ilAssOrderingTextsInputGUI
Exceptions
ilTestQuestionPoolException

Definition at line 1180 of file class.assOrderingQuestion.php.

1181 {
1182 switch ($this->getOrderingType()) {
1183 case OQ_TERMS:
1184
1185 return $this->buildOrderingTextsInputGui();
1186
1187 case OQ_PICTURES:
1188
1189 return $this->buildOrderingImagesInputGui();
1190
1191 case OQ_NESTED_TERMS:
1192 case OQ_NESTED_PICTURES:
1193
1194 return $this->buildNestedOrderingElementInputGui();
1195
1196 default:
1197 throw new ilTestQuestionPoolException('unknown ordering mode');
1198 }
1199 }
const OQ_TERMS
const OQ_NESTED_TERMS
const OQ_PICTURES
Ordering question constants.

References buildNestedOrderingElementInputGui(), buildOrderingImagesInputGui(), buildOrderingTextsInputGui(), getOrderingType(), OQ_NESTED_PICTURES, OQ_NESTED_TERMS, OQ_PICTURES, and OQ_TERMS.

Referenced by ilAssOrderingQuestionAuthoringFormGUI\renewOrderingElementInput().

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

◆ buildOrderingImagesFormDataConverter()

assOrderingQuestion::buildOrderingImagesFormDataConverter ( )
protected
Returns
ilAssOrderingFormValuesObjectsConverter

Definition at line 1667 of file class.assOrderingQuestion.php.

1668 {
1669 $formDataConverter = $this->buildOrderingElementFormDataConverter();
1671
1672 $formDataConverter->setImageRemovalCommand(self::ORDERING_ELEMENT_FORM_CMD_REMOVE_IMG);
1673 $formDataConverter->setImageUrlPath($this->getImagePathWeb());
1674 $formDataConverter->setImageFsPath($this->getImagePath());
1675
1676 if ($this->getThumbSize() && $this->getThumbPrefix()) {
1677 $formDataConverter->setThumbnailPrefix($this->getThumbPrefix());
1678 }
1679 return $formDataConverter;
1680 }
getImagePath($question_id=null, $object_id=null)
Returns the image path for web accessable images of a question.

References buildOrderingElementFormDataConverter(), ilAssOrderingFormValuesObjectsConverter\CONTEXT_MAINTAIN_ELEMENT_IMAGE, assQuestion\getImagePath(), assQuestion\getImagePathWeb(), getThumbPrefix(), and getThumbSize().

Referenced by buildOrderingImagesInputGui().

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

◆ buildOrderingImagesInputGui()

assOrderingQuestion::buildOrderingImagesInputGui ( )
Returns
ilAssOrderingImagesInputGUI

Definition at line 1255 of file class.assOrderingQuestion.php.

1256 {
1257 $formDataConverter = $this->buildOrderingImagesFormDataConverter();
1258
1259 require_once 'Modules/TestQuestionPool/classes/forms/class.ilAssOrderingImagesInputGUI.php';
1260
1261 $orderingElementInput = new ilAssOrderingImagesInputGUI(
1262 $formDataConverter,
1263 self::ORDERING_ELEMENT_FORM_FIELD_POSTVAR
1264 );
1265
1266 $orderingElementInput->setImageRemovalCommand(self::ORDERING_ELEMENT_FORM_CMD_REMOVE_IMG);
1267 $orderingElementInput->setImageUploadCommand(self::ORDERING_ELEMENT_FORM_CMD_UPLOAD_IMG);
1268
1269 $this->initOrderingElementFormFieldLabels($orderingElementInput);
1270
1271 return $orderingElementInput;
1272 }

References buildOrderingImagesFormDataConverter(), and initOrderingElementFormFieldLabels().

Referenced by buildOrderingElementInputGui().

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

◆ buildOrderingTextsFormDataConverter()

assOrderingQuestion::buildOrderingTextsFormDataConverter ( )
protected
Returns
ilAssOrderingFormValuesObjectsConverter

Definition at line 1685 of file class.assOrderingQuestion.php.

1686 {
1687 $formDataConverter = $this->buildOrderingElementFormDataConverter();
1689 return $formDataConverter;
1690 }

References buildOrderingElementFormDataConverter(), and ilAssOrderingFormValuesObjectsConverter\CONTEXT_MAINTAIN_ELEMENT_TEXT.

Referenced by buildOrderingTextsInputGui().

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

◆ buildOrderingTextsInputGui()

assOrderingQuestion::buildOrderingTextsInputGui ( )
Returns
ilAssOrderingTextsInputGUI

Definition at line 1236 of file class.assOrderingQuestion.php.

1237 {
1238 $formDataConverter = $this->buildOrderingTextsFormDataConverter();
1239
1240 require_once 'Modules/TestQuestionPool/classes/forms/class.ilAssOrderingTextsInputGUI.php';
1241
1242 $orderingElementInput = new ilAssOrderingTextsInputGUI(
1243 $formDataConverter,
1244 self::ORDERING_ELEMENT_FORM_FIELD_POSTVAR
1245 );
1246
1247 $this->initOrderingElementFormFieldLabels($orderingElementInput);
1248
1249 return $orderingElementInput;
1250 }

References buildOrderingTextsFormDataConverter(), and initOrderingElementFormFieldLabels().

Referenced by buildOrderingElementInputGui().

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

◆ buildTestPresentationConfig()

assOrderingQuestion::buildTestPresentationConfig ( )

Get the test question configuration.

Returns
ilTestQuestionConfig

Reimplemented from assQuestion.

Definition at line 1578 of file class.assOrderingQuestion.php.

1580 {
1581 // hey: refactored identifiers
1582 return parent::buildTestPresentationConfig()
1583 // hey.
1584 ->setIsUnchangedAnswerPossible(true)
1585 ->setUseUnchangedAnswerLabel($this->lng->txt('tst_unchanged_order_is_correct'));
1586 }

◆ calculateReachedPoints()

assOrderingQuestion::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 659 of file class.assOrderingQuestion.php.

660 {
661 if ($returndetails) {
662 throw new ilTestException('return details not implemented for ' . __METHOD__);
663 }
664
665 if (is_null($pass)) {
666 $pass = $this->getSolutionMaxPass($active_id);
667 }
668
669 $solutionValuePairs = $this->getSolutionValues($active_id, $pass, $authorizedSolution);
670
671 if (!count($solutionValuePairs)) {
672 return 0;
673 }
674
675 $indexedSolutionValues = $this->fetchIndexedValuesFromValuePairs($solutionValuePairs);
676 $solutionOrderingElementList = $this->getSolutionOrderingElementList($indexedSolutionValues);
677
678 return $this->calculateReachedPointsForSolution($solutionOrderingElementList);
679 }
getSolutionOrderingElementList($indexedSolutionValues)
calculateReachedPointsForSolution(ilAssOrderingElementList $solutionOrderingElementList)
getSolutionValues($active_id, $pass=null, $authorized=true)
Loads solutions of a given user from the database an returns it.
getSolutionMaxPass($active_id)
Returns the maximum pass a users question solution.
fetchIndexedValuesFromValuePairs(array $valuePairs)
Base Exception for all Exceptions relating to Modules/Test.

References $pass, calculateReachedPointsForSolution(), assQuestion\fetchIndexedValuesFromValuePairs(), assQuestion\getSolutionMaxPass(), getSolutionOrderingElementList(), and assQuestion\getSolutionValues().

+ Here is the call graph for this function:

◆ calculateReachedPointsForSolution()

assOrderingQuestion::calculateReachedPointsForSolution ( ilAssOrderingElementList  $solutionOrderingElementList)
protected
Parameters
$user_order
$nested_solution
Returns
int

Definition at line 1376 of file class.assOrderingQuestion.php.

1377 {
1378 $reachedPoints = $this->getPoints();
1379
1380 foreach ($this->getOrderingElementList() as $correctElement) {
1381 $userElement = $solutionOrderingElementList->getElementByPosition($correctElement->getPosition());
1382
1383 if (!$correctElement->isSameElement($userElement)) {
1384 $reachedPoints = 0;
1385 break;
1386 }
1387 }
1388
1389 return $reachedPoints;
1390 }
getPoints()
Returns the maximum available points for the question.

References ilAssOrderingElementList\getElementByPosition(), getOrderingElementList(), and assQuestion\getPoints().

Referenced by calculateReachedPoints(), and calculateReachedPointsFromPreviewSession().

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

◆ calculateReachedPointsFromPreviewSession()

assOrderingQuestion::calculateReachedPointsFromPreviewSession ( ilAssQuestionPreviewSession  $previewSession)

Reimplemented from assQuestion.

Definition at line 681 of file class.assOrderingQuestion.php.

682 {
683 if (!$previewSession->hasParticipantSolution()) {
684 return 0;
685 }
686
687 $solutionOrderingElementList = unserialize(
688 $previewSession->getParticipantsSolution()
689 );
690
691 $reachedPoints = $this->calculateReachedPointsForSolution($solutionOrderingElementList);
692 $reachedPoints = $this->deductHintPointsFromReachedPoints($previewSession, $reachedPoints);
693
694 return $this->ensureNonNegativePoints($reachedPoints);
695 }
deductHintPointsFromReachedPoints(ilAssQuestionPreviewSession $previewSession, $reachedPoints)
ensureNonNegativePoints($points)

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

+ Here is the call graph for this function:

◆ cleanImagefiles()

assOrderingQuestion::cleanImagefiles ( )
protected

Definition at line 725 of file class.assOrderingQuestion.php.

726 {
727 if ($this->getOrderingType() == OQ_PICTURES) {
728 if (@file_exists($this->getImagePath())) {
729 $contents = ilUtil::getDir($this->getImagePath());
730 foreach ($contents as $f) {
731 if (strcmp($f['type'], 'file') == 0) {
732 $found = false;
733 foreach ($this->getOrderingElementList() as $orderElement) {
734 if (strcmp($f['entry'], $orderElement->getContent()) == 0) {
735 $found = true;
736 }
737 if (strcmp($f['entry'], $this->getThumbPrefix() . $orderElement->getContent()) == 0) {
738 $found = true;
739 }
740 }
741 if (!$found) {
742 if (@file_exists($this->getImagePath() . $f['entry'])) {
743 @unlink($this->getImagePath() . $f['entry']);
744 }
745 }
746 }
747 }
748 }
749 } else {
750 if (@file_exists($this->getImagePath())) {
752 }
753 }
754 }
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static getDir($a_dir, $a_rec=false, $a_sub_dir="")
get directory

References $f, ilUtil\delDir(), ilUtil\getDir(), assQuestion\getImagePath(), getOrderingElementList(), getOrderingType(), getThumbPrefix(), and OQ_PICTURES.

Referenced by saveAnswerSpecificDataToDb().

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

◆ copyImages()

assOrderingQuestion::copyImages (   $question_id,
  $source_questionpool 
)
Deprecated:
(!) simply use the working method duplicateImages(), we do not search the difference here and we will delete this soon (!) currently no usage found, remove for il5.3

Definition at line 346 of file class.assOrderingQuestion.php.

347 {
348 global $DIC;
349 $ilLog = $DIC['ilLog'];
350 if ($this->getOrderingType() == OQ_PICTURES) {
351 $imagepath = $this->getImagePath();
352 $imagepath_original = str_replace("/$this->id/images", "/$question_id/images", $imagepath);
353 $imagepath_original = str_replace("/$this->obj_id/", "/$source_questionpool/", $imagepath_original);
354 if (!file_exists($imagepath)) {
355 ilUtil::makeDirParents($imagepath);
356 }
357 foreach ($this->getOrderingElementList() as $element) {
358 $filename = $element->getContent();
359 if (!@copy($imagepath_original . $filename, $imagepath . $filename)) {
360 $ilLog->write("Ordering Question image could not be copied: ${imagepath_original}${filename}");
361 }
362 if (@file_exists($imagepath_original . $this->getThumbPrefix() . $filename)) {
363 if (!@copy($imagepath_original . $this->getThumbPrefix() . $filename, $imagepath . $this->getThumbPrefix() . $filename)) {
364 $ilLog->write("Ordering Question image thumbnail could not be copied: $imagepath_original" . $this->getThumbPrefix() . $filename);
365 }
366 }
367 }
368 }
369 }
$filename
Definition: buildRTE.php:89
static makeDirParents($a_dir)
Create a new directory and all parent directories.
global $DIC
Definition: saml.php:7

References $DIC, $filename, $ilLog, assQuestion\getImagePath(), getOrderingElementList(), getOrderingType(), getThumbPrefix(), ilUtil\makeDirParents(), and OQ_PICTURES.

+ Here is the call graph for this function:

◆ copyObject()

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

Copies an assOrderingQuestion object.

@access public

Definition at line 250 of file class.assOrderingQuestion.php.

251 {
252 if ($this->id <= 0) {
253 // The question has not been saved. It cannot be duplicated
254 return;
255 }
256 // duplicate the question in database
257 $clone = $this;
258 include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
260 $clone->id = -1;
261 $source_questionpool_id = $this->getObjId();
262 $clone->setObjId($target_questionpool_id);
263 if ($title) {
264 $clone->setTitle($title);
265 }
266
267 $clone->saveToDb();
268
269 // copy question page content
270 $clone->copyPageOfQuestion($original_id);
271 // copy XHTML media objects
272 $clone->copyXHTMLMediaObjectsOfQuestion($original_id);
273 // duplicate the image
274 $clone->duplicateImages($original_id, $source_questionpool_id, $clone->getId(), $target_questionpool_id);
275
276 $clone->onCopy($source_questionpool_id, $original_id, $clone->getObjId(), $clone->getId());
277
278 return $clone->id;
279 }
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:

◆ createImageThumbnail()

assOrderingQuestion::createImageThumbnail ( ilAssOrderingElement  $element)

Definition at line 832 of file class.assOrderingQuestion.php.

833 {
834 if ($this->getThumbGeometry()) {
835 $imageFile = $this->getImagePath() . $element->getContent();
836 $thumbFile = $this->getImagePath() . $this->getThumbPrefix() . $element->getContent();
837
838 ilUtil::convertImage($imageFile, $thumbFile, "JPEG", $this->getThumbGeometry());
839 }
840 }
static convertImage( $a_from, $a_to, $a_target_format="", $a_geometry="", $a_background_color="")
convert image

References ilUtil\convertImage(), ilAssOrderingElement\getContent(), assQuestion\getImagePath(), getThumbGeometry(), and getThumbPrefix().

Referenced by handleThumbnailCreation().

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

◆ createNewOriginalFromThisDuplicate()

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

Definition at line 281 of file class.assOrderingQuestion.php.

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

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

+ Here is the call graph for this function:

◆ deleteAnswer()

assOrderingQuestion::deleteAnswer (   $randomIdentifier)

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

Definition at line 629 of file class.assOrderingQuestion.php.

630 {
631 $this->getOrderingElementList()->removeElement(
632 $this->getOrderingElementList()->getElementByRandomIdentifier($randomIdentifier)
633 );
634 $this->getOrderingElementList()->saveToDb();
635 }

References getOrderingElementList().

+ Here is the call graph for this function:

◆ dropImageFile()

assOrderingQuestion::dropImageFile (   $imageFilename)

Definition at line 762 of file class.assOrderingQuestion.php.

763 {
764 if (!strlen($imageFilename)) {
765 return false;
766 }
767
768 $result = @unlink($this->getImagePath() . $imageFilename);
769 $result = $result & @unlink($this->getImagePath() . $this->getThumbPrefix() . $imageFilename);
770
771 return $result;
772 }
$result

References $result, assQuestion\getImagePath(), and getThumbPrefix().

+ Here is the call graph for this function:

◆ duplicate()

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

Duplicates an assOrderingQuestion.

@access public

Reimplemented from assQuestion.

Definition at line 190 of file class.assOrderingQuestion.php.

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

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:

◆ duplicateImages()

assOrderingQuestion::duplicateImages (   $src_question_id,
  $src_object_id,
  $dest_question_id,
  $dest_object_id 
)

Definition at line 316 of file class.assOrderingQuestion.php.

317 {
318 global $DIC;
319 $ilLog = $DIC['ilLog'];
320 if ($this->getOrderingType() == OQ_PICTURES || $this->getOrderingType() == OQ_NESTED_PICTURES) {
321 $imagepath_original = $this->getImagePath($src_question_id, $src_object_id);
322 $imagepath = $this->getImagePath($dest_question_id, $dest_object_id);
323
324 if (!file_exists($imagepath)) {
325 ilUtil::makeDirParents($imagepath);
326 }
327 foreach ($this->getOrderingElementList() as $element) {
328 $filename = $element->getContent();
329 if (!@copy($imagepath_original . $filename, $imagepath . $filename)) {
330 $ilLog->write("image could not be duplicated!!!!");
331 }
332 if (@file_exists($imagepath_original . $this->getThumbPrefix() . $filename)) {
333 if (!@copy($imagepath_original . $this->getThumbPrefix() . $filename, $imagepath . $this->getThumbPrefix() . $filename)) {
334 $ilLog->write("image thumbnail could not be duplicated!!!!");
335 }
336 }
337 }
338 }
339 }

References $DIC, $filename, $ilLog, assQuestion\getImagePath(), getOrderingElementList(), getOrderingType(), getThumbPrefix(), ilUtil\makeDirParents(), OQ_NESTED_PICTURES, and OQ_PICTURES.

Referenced by afterSyncWithOriginal().

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

◆ duplicateOrderlingElementList()

assOrderingQuestion::duplicateOrderlingElementList ( )
protected

Definition at line 238 of file class.assOrderingQuestion.php.

239 {
240 $this->getOrderingElementList()->setQuestionId($this->getId());
241 $this->getOrderingElementList()->distributeNewRandomIdentifiers();
242 $this->getOrderingElementList()->saveToDb();
243 }

References assQuestion\getId(), and getOrderingElementList().

+ Here is the call graph for this function:

◆ ensureImagePathExists()

assOrderingQuestion::ensureImagePathExists ( )
protected

Definition at line 1589 of file class.assOrderingQuestion.php.

1590 {
1591 if (!file_exists($this->getImagePath())) {
1593 }
1594 }

References assQuestion\getImagePath(), and ilUtil\makeDirParents().

Referenced by storeImageFile().

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

◆ fetchSolutionListFromFormSubmissionData()

assOrderingQuestion::fetchSolutionListFromFormSubmissionData (   $userSolutionPost)
Parameters
array$userSolutionPost
Returns
ilAssOrderingElementList
Exceptions
ilTestException

Definition at line 1312 of file class.assOrderingQuestion.php.

1313 {
1314 $orderingGUI = $this->buildNestedOrderingElementInputGui();
1316 $orderingGUI->setValueByArray($userSolutionPost);
1317
1318 if (!$orderingGUI->checkInput()) {
1319 require_once 'Modules/Test/exceptions/class.ilTestException.php';
1320 throw new ilTestException('error on validating user solution post');
1321 }
1322
1323 require_once 'Modules/TestQuestionPool/classes/questions/class.ilAssOrderingElementList.php';
1324 $solutionOrderingElementList = ilAssOrderingElementList::buildInstance($this->getId());
1325
1326 $storedElementList = $this->getOrderingElementList();
1327
1328 foreach ($orderingGUI->getElementList($this->getId()) as $submittedElement) {
1329 $solutionElement = $storedElementList->getElementByRandomIdentifier(
1330 $submittedElement->getRandomIdentifier()
1331 )->getClone();
1332
1333 $solutionElement->setPosition($submittedElement->getPosition());
1334
1335 if ($this->isOrderingTypeNested()) {
1336 $solutionElement->setIndentation($submittedElement->getIndentation());
1337 }
1338
1339 $solutionOrderingElementList->addElement($solutionElement);
1340 }
1341
1342 return $solutionOrderingElementList;
1343 }
static buildInstance($questionId, $orderingElements=array())

References ilAssOrderingElementList\buildInstance(), buildNestedOrderingElementInputGui(), ilAssNestedOrderingElementsInputGUI\CONTEXT_USER_SOLUTION_SUBMISSION, assQuestion\getId(), getOrderingElementList(), and isOrderingTypeNested().

Referenced by getSolutionListFromPostSubmit(), and getSolutionOrderingElementListForTestOutput().

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

◆ fetchSolutionListFromSubmittedForm()

assOrderingQuestion::fetchSolutionListFromSubmittedForm ( ilPropertyFormGUI  $form)
Parameters
ilPropertyFormGUI$form
Returns
ilAssOrderingElementList $submittedElementList

Definition at line 1302 of file class.assOrderingQuestion.php.

1303 {
1304 return $form->getItemByPostVar(self::ORDERING_ELEMENT_FORM_FIELD_POSTVAR)->getElementList($this->getId());
1305 }
if(isset($_POST['submit'])) $form

References $form, and assQuestion\getId().

+ Here is the call graph for this function:

◆ fetchSolutionSubmit()

assOrderingQuestion::fetchSolutionSubmit (   $formSubmissionDataStructure)
Returns
array

Definition at line 1599 of file class.assOrderingQuestion.php.

1600 {
1601 $solutionSubmit = array();
1602
1603 if (isset($formSubmissionDataStructure['orderresult'])) {
1604 $orderresult = $formSubmissionDataStructure['orderresult'];
1605
1606 if (strlen($orderresult)) {
1607 $orderarray = explode(":", $orderresult);
1608 $ordervalue = 1;
1609 foreach ($orderarray as $index) {
1610 $idmatch = null;
1611 if (preg_match("/id_(\\d+)/", $index, $idmatch)) {
1612 $randomid = $idmatch[1];
1613 foreach ($this->getOrderingElementList() as $answeridx => $answer) {
1614 if ($answer->getRandomIdentifier() == $randomid) {
1615 $solutionSubmit[$answeridx] = $ordervalue;
1616 $ordervalue++;
1617 }
1618 }
1619 }
1620 }
1621 }
1622 } elseif ($this->getOrderingType() == OQ_NESTED_TERMS || $this->getOrderingType() == OQ_NESTED_PICTURES) {
1623 $index = 0;
1624 foreach ($formSubmissionDataStructure['content'] as $randomId => $content) {
1625 $indentation = $formSubmissionDataStructure['indentation'];
1626
1627 $value1 = $index++;
1628 $value2 = implode(':', array($randomId, $indentation));
1629
1630 $solutionSubmit[$value1] = $value2;
1631 }
1632 } else {
1633 foreach ($formSubmissionDataStructure as $key => $value) {
1634 $matches = null;
1635 if (preg_match("/^order_(\d+)/", $key, $matches)) {
1636 if (!(preg_match("/initial_value_\d+/", $value))) {
1637 if (strlen($value)) {
1638 foreach ($this->getOrderingElementList() as $answeridx => $answer) {
1639 if ($answer->getRandomIdentifier() == $matches[1]) {
1640 $solutionSubmit[$answeridx] = $value;
1641 }
1642 }
1643 }
1644 }
1645 }
1646 }
1647 }
1648
1649 return $solutionSubmit;
1650 }
$key
Definition: croninfo.php:18
$index
Definition: metadata.php:60

References $index, $key, getOrderingElementList(), getOrderingType(), OQ_NESTED_PICTURES, and OQ_NESTED_TERMS.

Referenced by getSolutionPostSubmit().

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

◆ generateThumbForFile()

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

Definition at line 1110 of file class.assOrderingQuestion.php.

1111 {
1112 $filename = $path . $file;
1113 if (@file_exists($filename)) {
1114 $thumbpath = $path . $this->getThumbPrefix() . $file;
1115 $path_info = @pathinfo($filename);
1116 $ext = "";
1117 switch (strtoupper($path_info['extension'])) {
1118 case 'PNG':
1119 $ext = 'PNG';
1120 break;
1121 case 'GIF':
1122 $ext = 'GIF';
1123 break;
1124 default:
1125 $ext = 'JPEG';
1126 break;
1127 }
1128 ilUtil::convertImage($filename, $thumbpath, $ext, $this->getThumbGeometry());
1129 }
1130 }
$path
Definition: aliased.php:25

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

Referenced by rebuildThumbnails().

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

◆ getAdditionalTableName()

assOrderingQuestion::getAdditionalTableName ( )

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

Returns
string The additional table name @access public

Reimplemented from assQuestion.

Definition at line 962 of file class.assOrderingQuestion.php.

963 {
964 return "qpl_qst_ordering";
965 }

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ getAnswer()

assOrderingQuestion::getAnswer (   $index = 0)

Returns the ordering element from the given position.

Parameters
int$position
Returns
ilAssOrderingElement|null

Definition at line 612 of file class.assOrderingQuestion.php.

613 {
614 if (!$this->getOrderingElementList()->elementExistByPosition($index)) {
615 return null;
616 }
617
618 return $this->getOrderingElementList()->getElementByPosition($index);
619 }

References $index, and getOrderingElementList().

+ Here is the call graph for this function:

◆ getAnswerCount()

assOrderingQuestion::getAnswerCount ( )

Returns the number of answers.

Returns
integer The number of answers of the ordering question @access public
See also
$answers

Definition at line 644 of file class.assOrderingQuestion.php.

645 {
646 return $this->getOrderingElementList()->countElements();
647 }

References getOrderingElementList().

+ Here is the call graph for this function:

◆ getAnswerTableName()

assOrderingQuestion::getAnswerTableName ( )

Returns the name of the answer table in the database.

Returns
string The answer table name @access public

Reimplemented from assQuestion.

Definition at line 973 of file class.assOrderingQuestion.php.

974 {
975 return "qpl_a_ordering";
976 }

◆ getAvailableAnswerOptions()

assOrderingQuestion::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 1554 of file class.assOrderingQuestion.php.

1555 {
1556 if ($index !== null) {
1557 return $this->getOrderingElementList()->getElementByPosition($index);
1558 }
1559
1560 return $this->getOrderingElementList()->getElements();
1561 }

References $index, and getOrderingElementList().

+ Here is the call graph for this function:

◆ getElementHeight()

assOrderingQuestion::getElementHeight ( )

Definition at line 1078 of file class.assOrderingQuestion.php.

References $element_height.

◆ getEncryptedFilename()

assOrderingQuestion::getEncryptedFilename (   $filename)

Definition at line 716 of file class.assOrderingQuestion.php.

717 {
718 $extension = "";
719 if (preg_match("/.*\\.(\\w+)$/", $filename, $matches)) {
720 $extension = $matches[1];
721 }
722 return md5($filename) . "." . $extension;
723 }

References $filename.

◆ getExpressionTypes()

◆ getLeveledOrdering()

assOrderingQuestion::getLeveledOrdering ( )

Definition at line 1397 of file class.assOrderingQuestion.php.

References $leveled_ordering.

◆ getMaximumPoints()

assOrderingQuestion::getMaximumPoints ( )

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

Returns
double Points
See also
$points

Reimplemented from assQuestion.

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

704 {
705 return $this->getPoints();
706 }

References assQuestion\getPoints().

Referenced by isComplete().

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

◆ getOldLeveledOrdering()

assOrderingQuestion::getOldLeveledOrdering ( )

Definition at line 1402 of file class.assOrderingQuestion.php.

1403 {
1404 global $DIC;
1405 $ilDB = $DIC['ilDB'];
1406
1407 $res = $ilDB->queryF(
1408 'SELECT depth FROM qpl_a_ordering WHERE question_fi = %s ORDER BY position ASC',
1409 array('integer'),
1410 array($this->getId())
1411 );
1412 while ($row = $ilDB->fetchAssoc($res)) {
1413 $this->old_ordering_depth[] = $row['depth'];
1414 }
1416 }
$row
foreach($_POST as $key=> $value) $res
global $ilDB

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

+ Here is the call graph for this function:

◆ getOperators()

assOrderingQuestion::getOperators (   $expression)

Get all available operations for a specific question.

Parameters
string$expression

Implements iQuestionCondition.

Definition at line 1461 of file class.assOrderingQuestion.php.

1462 {
1463 require_once "./Modules/TestQuestionPool/classes/class.ilOperatorsExpressionMapping.php";
1465 }

References ilOperatorsExpressionMapping\getOperatorsByExpression().

+ Here is the call graph for this function:

◆ getOrderElements()

assOrderingQuestion::getOrderElements ( )

Returns the answers array.

Deprecated:
seriously, stop looking for this kind data at this point (!) look where it comes from and learn (!)

Definition at line 997 of file class.assOrderingQuestion.php.

998 {
999 return $this->getOrderingElementList()->getRandomIdentifierIndexedElements();
1000 }

References getOrderingElementList().

Referenced by rebuildThumbnails().

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

◆ getOrderingElementList()

◆ getOrderingElementListForSolutionOutput()

assOrderingQuestion::getOrderingElementListForSolutionOutput (   $forceCorrectSolution,
  $activeId,
  $passIndex,
  $getUseIntermediateSolution = false 
)
Parameters
$forceCorrectSolution
$activeId
$passIndex
Returns
ilAssOrderingElementList

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

417 {
418 if ($forceCorrectSolution || !$activeId || $passIndex === null) {
419 return $this->getOrderingElementList();
420 }
421
422 $solutionValues = $this->getSolutionValues($activeId, $passIndex, !$getUseIntermediateSolution);
423
424 if (!count($solutionValues)) {
425 return $this->getShuffledOrderingElementList();
426 }
427
428 return $this->getSolutionOrderingElementList($this->fetchIndexedValuesFromValuePairs($solutionValues));
429 }

References assQuestion\fetchIndexedValuesFromValuePairs(), getOrderingElementList(), getShuffledOrderingElementList(), getSolutionOrderingElementList(), and assQuestion\getSolutionValues().

+ Here is the call graph for this function:

◆ getOrderingType()

assOrderingQuestion::getOrderingType ( )

◆ getQuestionType()

assOrderingQuestion::getQuestionType ( )

Returns the question type of the question.

Returns
integer The question type of the question @access public

Reimplemented from assQuestion.

Definition at line 951 of file class.assOrderingQuestion.php.

952 {
953 return "assOrderingQuestion";
954 }

Referenced by toJSON().

+ Here is the caller graph for this function:

◆ getRTETextWithMediaObjects()

assOrderingQuestion::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 982 of file class.assOrderingQuestion.php.

983 {
984 $text = parent::getRTETextWithMediaObjects();
985
986 foreach ($this->getOrderingElementList() as $orderingElement) {
987 $text .= $orderingElement->getContent();
988 }
989
990 return $text;
991 }
$text
Definition: errorreport.php:18

References $text, and getOrderingElementList().

+ Here is the call graph for this function:

◆ getShuffledOrderingElementList()

assOrderingQuestion::getShuffledOrderingElementList ( )
Parameters
$active_id
$pass
Returns
ilAssOrderingElementList

Definition at line 539 of file class.assOrderingQuestion.php.

540 {
541 $shuffledRandomIdentifierIndex = $this->getShuffler()->shuffle(
542 $this->getOrderingElementList()->getRandomIdentifierIndex()
543 );
544
545 $shuffledElementList = $this->getOrderingElementList()->getClone();
546 $shuffledElementList->reorderByRandomIdentifiers($shuffledRandomIdentifierIndex);
547 $shuffledElementList->resetElementsIndentations();
548
549 return $shuffledElementList;
550 }

References getOrderingElementList(), and assQuestion\getShuffler().

Referenced by getOrderingElementListForSolutionOutput(), and getSolutionOrderingElementListForTestOutput().

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

◆ getSolutionListFromPostSubmit()

assOrderingQuestion::getSolutionListFromPostSubmit ( )
Returns
ilAssOrderingElementList

Definition at line 1353 of file class.assOrderingQuestion.php.

1354 {
1355 if ($this->postSolutionOrderingElementList === null) {
1357 $this->postSolutionOrderingElementList = $list;
1358 }
1359
1361 }
$_POST["username"]
fetchSolutionListFromFormSubmissionData($userSolutionPost)
if(isset($_REQUEST['delete'])) $list
Definition: registry.php:41

References $_POST, $list, $postSolutionOrderingElementList, and fetchSolutionListFromFormSubmissionData().

Referenced by savePreviewData(), saveWorkingData(), and validateSolutionSubmit().

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

◆ getSolutionOrderingElementList()

assOrderingQuestion::getSolutionOrderingElementList (   $indexedSolutionValues)
Parameters
array$valuePairs
Returns
ilAssOrderingElementList
Exceptions
ilTestQuestionPoolException

Definition at line 512 of file class.assOrderingQuestion.php.

513 {
514 $solutionOrderingList = new ilAssOrderingElementList();
515 $solutionOrderingList->setQuestionId($this->getId());
516
517 foreach ($indexedSolutionValues as $value1 => $value2) {
518 if ($this->isOrderingTypeNested()) {
519 $element = $this->getSolutionValuePairBrandedOrderingElementByRandomIdentifier($value1, $value2);
520 } else {
521 $element = $this->getSolutionValuePairBrandedOrderingElementBySolutionIdentifier($value1, $value2);
522 }
523
524 $solutionOrderingList->addElement($element);
525 }
526
527 if (!$this->getOrderingElementList()->hasSameElementSetByRandomIdentifiers($solutionOrderingList)) {
528 throw new ilTestQuestionPoolException('inconsistent solution values given');
529 }
530
531 return $solutionOrderingList;
532 }
getSolutionValuePairBrandedOrderingElementBySolutionIdentifier($value1, $value2)
getSolutionValuePairBrandedOrderingElementByRandomIdentifier($value1, $value2)

References assQuestion\getId(), getOrderingElementList(), getSolutionValuePairBrandedOrderingElementByRandomIdentifier(), getSolutionValuePairBrandedOrderingElementBySolutionIdentifier(), and isOrderingTypeNested().

Referenced by calculateReachedPoints(), getOrderingElementListForSolutionOutput(), and getSolutionOrderingElementListForTestOutput().

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

◆ getSolutionOrderingElementListForTestOutput()

assOrderingQuestion::getSolutionOrderingElementListForTestOutput ( ilAssNestedOrderingElementsInputGUI  $inputGUI,
  $lastPost,
  $activeId,
  $pass 
)
Parameters
ilAssNestedOrderingElementsInputGUI$inputGUI
array$lastPost
integer$activeId
integer$pass
Returns
ilAssOrderingElementList
Exceptions
ilTestException
ilTestQuestionPoolException

Definition at line 440 of file class.assOrderingQuestion.php.

441 {
442 if ($inputGUI->isPostSubmit($lastPost)) {
443 return $this->fetchSolutionListFromFormSubmissionData($lastPost);
444 }
445
446 // hey: prevPassSolutions - pass will be always available from now on
447 #if( $pass === null && !ilObjTest::_getUsePreviousAnswers($activeId, true) )
448 #// condition looks strange? yes - keep it null when previous solutions not enabled (!)
449 #{
450 # $pass = ilObjTest::_getPass($activeId);
451 #}
452 // hey.
453
454 $indexedSolutionValues = $this->fetchIndexedValuesFromValuePairs(
455 // hey: prevPassSolutions - obsolete due to central check
456 $this->getTestOutputSolutions($activeId, $pass)
457 // hey.
458 );
459
460 if (count($indexedSolutionValues)) {
461 return $this->getSolutionOrderingElementList($indexedSolutionValues);
462 }
463
464 return $this->getShuffledOrderingElementList();
465 }
getTestOutputSolutions($activeId, $pass)

References $pass, assQuestion\fetchIndexedValuesFromValuePairs(), fetchSolutionListFromFormSubmissionData(), getShuffledOrderingElementList(), getSolutionOrderingElementList(), assQuestion\getTestOutputSolutions(), and ilAssNestedOrderingElementsInputGUI\isPostSubmit().

+ Here is the call graph for this function:

◆ getSolutionPostSubmit()

assOrderingQuestion::getSolutionPostSubmit ( )
Returns
array

Definition at line 1366 of file class.assOrderingQuestion.php.

1367 {
1368 return $this->fetchSolutionSubmit($_POST);
1369 }
fetchSolutionSubmit($formSubmissionDataStructure)

References $_POST, and fetchSolutionSubmit().

+ Here is the call graph for this function:

◆ getSolutionValuePairBrandedOrderingElementByRandomIdentifier()

assOrderingQuestion::getSolutionValuePairBrandedOrderingElementByRandomIdentifier (   $value1,
  $value2 
)
protected
Parameters
string$value1
string$value2
Returns
ilAssOrderingElement

Definition at line 472 of file class.assOrderingQuestion.php.

473 {
474 $value2 = explode(':', $value2);
475
476 $randomIdentifier = $value2[0];
477 $selectedPosition = $value1;
478 $selectedIndentation = $value2[1];
479
480 $element = $this->getOrderingElementList()->getElementByRandomIdentifier($randomIdentifier)->getClone();
481
482 $element->setPosition($selectedPosition);
483 $element->setIndentation($selectedIndentation);
484
485 return $element;
486 }

References getOrderingElementList().

Referenced by getSolutionOrderingElementList().

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

◆ getSolutionValuePairBrandedOrderingElementBySolutionIdentifier()

assOrderingQuestion::getSolutionValuePairBrandedOrderingElementBySolutionIdentifier (   $value1,
  $value2 
)
protected
Parameters
string$value1
string$value2
Returns
ilAssOrderingElement

Definition at line 493 of file class.assOrderingQuestion.php.

494 {
495 $solutionIdentifier = $value1;
496 $selectedPosition = ($value2 - 1);
497 $selectedIndentation = 0;
498
499 $element = $this->getOrderingElementList()->getElementBySolutionIdentifier($solutionIdentifier)->getClone();
500
501 $element->setPosition($selectedPosition);
502 $element->setIndentation($selectedIndentation);
503
504 return $element;
505 }

References getOrderingElementList().

Referenced by getSolutionOrderingElementList().

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

◆ getThumbGeometry()

assOrderingQuestion::getThumbGeometry ( )

Definition at line 1053 of file class.assOrderingQuestion.php.

References $thumb_geometry.

Referenced by createImageThumbnail(), generateThumbForFile(), and getThumbSize().

+ Here is the caller graph for this function:

◆ getThumbPrefix()

assOrderingQuestion::getThumbPrefix ( )

◆ getThumbSize()

assOrderingQuestion::getThumbSize ( )

Definition at line 1058 of file class.assOrderingQuestion.php.

1059 {
1060 return $this->getThumbGeometry();
1061 }

References getThumbGeometry().

Referenced by buildNestedOrderingFormDataConverter(), and buildOrderingImagesFormDataConverter().

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

◆ handleThumbnailCreation()

assOrderingQuestion::handleThumbnailCreation ( ilAssOrderingElementList  $elementList)

Definition at line 825 of file class.assOrderingQuestion.php.

826 {
827 foreach ($elementList as $element) {
828 $this->createImageThumbnail($element);
829 }
830 }
createImageThumbnail(ilAssOrderingElement $element)

References createImageThumbnail().

+ Here is the call graph for this function:

◆ hasOrderingTypeUploadSupport()

assOrderingQuestion::hasOrderingTypeUploadSupport ( )

Definition at line 405 of file class.assOrderingQuestion.php.

406 {
407 return $this->getOrderingType() == OQ_PICTURES;
408 }

References getOrderingType(), and OQ_PICTURES.

Referenced by isImageReplaced(), and saveAnswerSpecificDataToDb().

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

◆ initOrderingElementAuthoringProperties()

assOrderingQuestion::initOrderingElementAuthoringProperties ( ilFormPropertyGUI  $formField)
Parameters
ilAssOrderingTextsInputGUI | ilAssOrderingImagesInputGUI | ilAssNestedOrderingElementsInputGUI$formField

Definition at line 1204 of file class.assOrderingQuestion.php.

1205 {
1206 switch (true) {
1207 case $formField instanceof ilAssNestedOrderingElementsInputGUI:
1208
1209 $formField->setInteractionEnabled(true);
1210 $formField->setNestingEnabled($this->isOrderingTypeNested());
1211 break;
1212
1213 case $formField instanceof ilAssOrderingTextsInputGUI:
1214 case $formField instanceof ilAssOrderingImagesInputGUI:
1215 default:
1216
1217 $formField->setEditElementOccuranceEnabled(true);
1218 $formField->setEditElementOrderEnabled(true);
1219 }
1220
1221 $formField->setRequired(true);
1222 }
setRequired($a_required)
Set Required.

References isOrderingTypeNested(), and ilFormPropertyGUI\setRequired().

Referenced by ilAssOrderingQuestionAuthoringFormGUI\renewOrderingElementInput().

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

◆ initOrderingElementFormFieldLabels()

assOrderingQuestion::initOrderingElementFormFieldLabels ( ilFormPropertyGUI  $formField)
Parameters
ilFormPropertyGUI$formField

Definition at line 1227 of file class.assOrderingQuestion.php.

1228 {
1229 $formField->setInfo($this->lng->txt('ordering_answer_sequence_info'));
1230 $formField->setTitle($this->lng->txt('answers'));
1231 }
setTitle($a_title)
Set Title.
setInfo($a_info)
Set Information Text.

References ilFormPropertyGUI\setInfo(), and ilFormPropertyGUI\setTitle().

Referenced by buildNestedOrderingElementInputGui(), buildOrderingImagesInputGui(), and buildOrderingTextsInputGui().

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

◆ isComplete()

assOrderingQuestion::isComplete ( )

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

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

Reimplemented from assQuestion.

Definition at line 95 of file class.assOrderingQuestion.php.

96 {
97 if (!$this->getAuthor()) {
98 return false;
99 }
100
101 if (!$this->getTitle()) {
102 return false;
103 }
104
105 if (!$this->getQuestion()) {
106 return false;
107 }
108
109 if (!$this->getMaximumPoints()) {
110 return false;
111 }
112
113 if (!$this->getOrderingElementList()->countElements()) {
114 return false;
115 }
116
117 return true;
118 }
getMaximumPoints()
Returns the maximum points, a learner can reach answering the question.
getTitle()
Gets the title string of the assQuestion object.
getAuthor()
Gets the authors name of the assQuestion object.
getQuestion()
Gets the question string of the question object.

References assQuestion\getAuthor(), getMaximumPoints(), getOrderingElementList(), assQuestion\getQuestion(), and assQuestion\getTitle().

+ Here is the call graph for this function:

◆ isImageFileStored()

assOrderingQuestion::isImageFileStored (   $imageFilename)

Definition at line 774 of file class.assOrderingQuestion.php.

775 {
776 if (!strlen($imageFilename)) {
777 return false;
778 }
779
780 if (!file_exists($this->getImagePath() . $imageFilename)) {
781 return false;
782 }
783
784 return is_file($this->getImagePath() . $imageFilename);
785 }

References assQuestion\getImagePath().

+ Here is the call graph for this function:

◆ isImageOrderingType()

assOrderingQuestion::isImageOrderingType ( )

Definition at line 400 of file class.assOrderingQuestion.php.

401 {
402 return in_array($this->getOrderingType(), array(OQ_PICTURES, OQ_NESTED_PICTURES));
403 }

References getOrderingType(), OQ_NESTED_PICTURES, and OQ_PICTURES.

+ Here is the call graph for this function:

◆ isImageReplaced()

assOrderingQuestion::isImageReplaced ( ilAssOrderingElement  $newElement,
ilAssOrderingElement  $oldElement 
)

Definition at line 787 of file class.assOrderingQuestion.php.

788 {
789 if (!$this->hasOrderingTypeUploadSupport()) {
790 return false;
791 }
792
793 if (!$newElement->getContent()) {
794 return false;
795 }
796
797 return $newElement->getContent() != $oldElement->getContent();
798 }

References ilAssOrderingElement\getContent(), and hasOrderingTypeUploadSupport().

+ Here is the call graph for this function:

◆ isOrderingTypeNested()

assOrderingQuestion::isOrderingTypeNested ( )

Definition at line 395 of file class.assOrderingQuestion.php.

396 {
397 return in_array($this->getOrderingType(), array(OQ_NESTED_TERMS, OQ_NESTED_PICTURES));
398 }

References getOrderingType(), OQ_NESTED_PICTURES, and OQ_NESTED_TERMS.

Referenced by fetchSolutionListFromFormSubmissionData(), getSolutionOrderingElementList(), and initOrderingElementAuthoringProperties().

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

◆ loadFromDb()

assOrderingQuestion::loadFromDb (   $question_id)

Loads a assOrderingQuestion object from a database.

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 145 of file class.assOrderingQuestion.php.

146 {
147 global $DIC;
148 $ilDB = $DIC['ilDB'];
149
150 $result = $ilDB->queryF(
151 "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",
152 array("integer"),
153 array($question_id)
154 );
155 if ($result->numRows() == 1) {
156 $data = $ilDB->fetchAssoc($result);
157 $this->setId($question_id);
158 $this->setObjId($data["obj_fi"]);
159 $this->setTitle($data["title"]);
160 $this->setComment($data["description"]);
161 $this->setOriginalId($data["original_id"]);
162 $this->setAuthor($data["author"]);
163 $this->setNrOfTries($data['nr_of_tries']);
164 $this->setPoints($data["points"]);
165 $this->setOwner($data["owner"]);
166 include_once("./Services/RTE/classes/class.ilRTE.php");
167 $this->setQuestion(ilRTE::_replaceMediaObjectImageSrc($data["question_text"], 1));
168 $this->ordering_type = strlen($data["ordering_type"]) ? $data["ordering_type"] : OQ_TERMS;
169 $this->thumb_geometry = $data["thumb_geometry"];
170 $this->element_height = $data["element_height"];
171 $this->setEstimatedWorkingTime(substr($data["working_time"], 0, 2), substr($data["working_time"], 3, 2), substr($data["working_time"], 6, 2));
172
173 try {
174 $this->setAdditionalContentEditingMode($data['add_cont_edit_mode']);
175 } catch (ilTestQuestionPoolException $e) {
176 }
177 }
178
179 $this->orderingElementList->setQuestionId($this->getId());
180 $this->orderingElementList->loadFromDb();
181
182 parent::loadFromDb($question_id);
183 }
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...
$data
Definition: bench.php:6

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

+ Here is the call graph for this function:

◆ lookupSolutionOrderByRandomid()

assOrderingQuestion::lookupSolutionOrderByRandomid (   $a_random_id)

Definition at line 1422 of file class.assOrderingQuestion.php.

1423 {
1424 global $DIC;
1425 $ilDB = $DIC['ilDB'];
1426
1427 $res = $ilDB->queryF(
1428 'SELECT solution_key FROM qpl_a_ordering WHERE random_id = %s',
1429 array('integer'),
1430 array($a_random_id)
1431 );
1432 $row = $ilDB->fetchAssoc($res);
1433
1434 return $row['solution_key'];
1435 }

References $DIC, $ilDB, $res, and $row.

◆ moveAnswerDown()

assOrderingQuestion::moveAnswerDown (   $position)
Parameters
$position

TODO: still in use? should not since element moving is js supported!?

Definition at line 591 of file class.assOrderingQuestion.php.

592 {
593 if (!$this->getOrderingElementList()->elementExistByPosition($position)) {
594 return false;
595 }
596
597 if ($this->getOrderingElementList()->isLastElementPosition($position)) {
598 return false;
599 }
600
601 $this->getOrderingElementList()->moveElementByPositions($position, $position + 1);
602
603 return true;
604 }

References getOrderingElementList().

+ Here is the call graph for this function:

◆ moveAnswerUp()

assOrderingQuestion::moveAnswerUp (   $position)
Parameters
$position

TODO: still in use? should not since element moving is js supported!?

Definition at line 573 of file class.assOrderingQuestion.php.

574 {
575 if (!$this->getOrderingElementList()->elementExistByPosition($position)) {
576 return false;
577 }
578
579 if ($this->getOrderingElementList()->isFirstElementPosition($position)) {
580 return false;
581 }
582
583 $this->getOrderingElementList()->moveElementByPositions($position, $position - 1);
584 }

References getOrderingElementList().

+ Here is the call graph for this function:

◆ rebuildThumbnails()

assOrderingQuestion::rebuildThumbnails ( )

Definition at line 1096 of file class.assOrderingQuestion.php.

1097 {
1098 if ($this->getOrderingType() == OQ_PICTURES || $this->getOrderingType() == OQ_NESTED_PICTURES) {
1099 foreach ($this->getOrderElements() as $orderingElement) {
1100 $this->generateThumbForFile($this->getImagePath(), $orderingElement->getContent());
1101 }
1102 }
1103 }
getOrderElements()
Returns the answers array.

References generateThumbForFile(), assQuestion\getImagePath(), getOrderElements(), getOrderingType(), OQ_NESTED_PICTURES, and OQ_PICTURES.

Referenced by saveAnswerSpecificDataToDb().

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

◆ saveAnswerSpecificDataToDb()

assOrderingQuestion::saveAnswerSpecificDataToDb ( )

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

Returns
mixed

Implements ilObjAnswerScoringAdjustable.

Definition at line 934 of file class.assOrderingQuestion.php.

935 {
936 $this->getOrderingElementList()->setQuestionId($this->getId());
937 $this->getOrderingElementList()->saveToDb();
938
939 if ($this->hasOrderingTypeUploadSupport()) {
940 $this->rebuildThumbnails();
941 $this->cleanImagefiles();
942 }
943 }

References cleanImagefiles(), assQuestion\getId(), getOrderingElementList(), hasOrderingTypeUploadSupport(), and rebuildThumbnails().

Referenced by saveToDb().

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

◆ savePreviewData()

assOrderingQuestion::savePreviewData ( ilAssQuestionPreviewSession  $previewSession)
protected

Reimplemented from assQuestion.

Definition at line 901 of file class.assOrderingQuestion.php.

902 {
903 if ($this->validateSolutionSubmit()) {
904 $previewSession->setParticipantsSolution(serialize($this->getSolutionListFromPostSubmit()));
905 }
906 }
validateSolutionSubmit()
Checks the data to be saved for consistency.

References getSolutionListFromPostSubmit(), ilAssQuestionPreviewSession\setParticipantsSolution(), and validateSolutionSubmit().

+ Here is the call graph for this function:

◆ saveToDb()

assOrderingQuestion::saveToDb (   $original_id = "")

Saves a assOrderingQuestion object to a database.

Parameters
string$original_id

Reimplemented from assQuestion.

Definition at line 127 of file class.assOrderingQuestion.php.

128 {
129 global $DIC;
130 $ilDB = $DIC['ilDB'];
131
135 parent::saveToDb($original_id);
136 }
saveAnswerSpecificDataToDb()
Saves the answer specific records into a question types answer table.
saveQuestionDataToDb($original_id="")
saveAdditionalQuestionDataToDb()
Saves a record to the question types additional data table.

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

+ Here is the call graph for this function:

◆ saveWorkingData()

assOrderingQuestion::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 868 of file class.assOrderingQuestion.php.

869 {
870 $entered_values = 0;
871
872 if (is_null($pass)) {
873 include_once "./Modules/Test/classes/class.ilObjTest.php";
874 $pass = ilObjTest::_getPass($active_id);
875 }
876
877 $this->getProcessLocker()->executeUserSolutionUpdateLockOperation(
878 function () use (&$entered_values, $active_id, $pass, $authorized) {
879 $this->removeCurrentSolution($active_id, $pass, $authorized);
880
881 foreach ($this->getSolutionListFromPostSubmit() as $orderingElement) {
882 $value1 = $orderingElement->getStorageValue1($this->getOrderingType());
883 $value2 = $orderingElement->getStorageValue2($this->getOrderingType());
884
885 $this->saveCurrentSolution($active_id, $pass, $value1, trim($value2), $authorized);
886
887 $entered_values++;
888 }
889 }
890 );
891
892 if ($entered_values) {
893 $this->log($active_id, 'log_user_entered_values');
894 } else {
895 $this->log($active_id, 'log_user_not_entered_values');
896 }
897
898 return true;
899 }
log($active_id, $langVar)
saveCurrentSolution($active_id, $pass, $value1, $value2, $authorized=true, $tstamp=null)
removeCurrentSolution($active_id, $pass, $authorized=true)
static _getPass($active_id)
Retrieves the actual pass of a given user for a given test.

References $pass, ilObjTest\_getPass(), getOrderingType(), assQuestion\getProcessLocker(), getSolutionListFromPostSubmit(), assQuestion\log(), assQuestion\removeCurrentSolution(), and assQuestion\saveCurrentSolution().

+ Here is the call graph for this function:

◆ setElementHeight()

assOrderingQuestion::setElementHeight (   $a_height)

Definition at line 1088 of file class.assOrderingQuestion.php.

1089 {
1090 $this->element_height = ($a_height < 20) ? "" : $a_height;
1091 }

◆ setExportDetailsXLS()

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

{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
Returns
object
}

Reimplemented from assQuestion.

Definition at line 1021 of file class.assOrderingQuestion.php.

1022 {
1023 parent::setExportDetailsXLS($worksheet, $startrow, $active_id, $pass);
1024
1025 $solutions = $this->getSolutionValues($active_id, $pass);
1026 $sol = array();
1027 foreach ($solutions as $solution) {
1028 $sol[$solution["value1"]] = $solution["value2"];
1029 }
1030 asort($sol);
1031 $sol = array_keys($sol);
1032
1033 $i = 1;
1034 foreach ($sol as $idx) {
1035 foreach ($solutions as $solution) {
1036 if ($solution["value1"] == $idx) {
1037 $worksheet->setCell($startrow + $i, 0, $solution["value2"]);
1038 }
1039 }
1040 $element = $this->getOrderingElementList()->getElementBySolutionIdentifier($idx);
1041 $worksheet->setCell($startrow + $i, 1, $element->getContent());
1042 $i++;
1043 }
1044
1045 return $startrow + $i + 1;
1046 }
$i
Definition: disco.tpl.php:19

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

+ Here is the call graph for this function:

◆ setOrderingElementList()

assOrderingQuestion::setOrderingElementList (   $orderingElementList)
Parameters
ilAssOrderingElementList$orderingElementList

Definition at line 563 of file class.assOrderingQuestion.php.

564 {
565 $this->orderingElementList = $orderingElementList;
566 }

References $orderingElementList.

◆ setOrderingType()

assOrderingQuestion::setOrderingType (   $ordering_type = OQ_TERMS)

Sets the ordering question type.

Parameters
integer$ordering_typeThe question ordering type @access public
See also
$ordering_type

Definition at line 378 of file class.assOrderingQuestion.php.

379 {
380 $this->ordering_type = $ordering_type;
381 }

References $ordering_type.

◆ setThumbGeometry()

assOrderingQuestion::setThumbGeometry (   $a_geometry)

Definition at line 1068 of file class.assOrderingQuestion.php.

1069 {
1070 $this->thumb_geometry = ($a_geometry < 1) ? 100 : $a_geometry;
1071 }

◆ storeImageFile()

assOrderingQuestion::storeImageFile (   $uploadFile,
  $targetFile 
)

Sets the image file and uploads the image to the object's image directory.

Parameters
string$image_filenameName of the original image file
string$image_tempfilenameName of the temporary uploaded image file
Returns
integer An errorcode if the image upload fails, 0 otherwise @access public

Definition at line 808 of file class.assOrderingQuestion.php.

809 {
810 if (!strlen($uploadFile)) {
811 return false;
812 }
813
814 $this->ensureImagePathExists();
815
816 // store file with hashed name
817
818 if (!ilUtil::moveUploadedFile($uploadFile, $targetFile, $this->getImagePath() . $targetFile)) {
819 return false;
820 }
821
822 return true;
823 }

References ensureImagePathExists(), and assQuestion\getImagePath().

+ Here is the call graph for this function:

◆ supportsJavascriptOutput()

assOrderingQuestion::supportsJavascriptOutput ( )

Returns true if the question type supports JavaScript output.

Returns
boolean TRUE if the question type supports JavaScript output, FALSE otherwise @access public

Reimplemented from assQuestion.

Definition at line 1008 of file class.assOrderingQuestion.php.

1009 {
1010 return true;
1011 }

◆ supportsNonJsOutput()

assOrderingQuestion::supportsNonJsOutput ( )

Reimplemented from assQuestion.

Definition at line 1013 of file class.assOrderingQuestion.php.

1014 {
1015 return false;
1016 }

◆ toJSON()

assOrderingQuestion::toJSON ( )

Returns a JSON representation of the question.

Reimplemented from assQuestion.

Definition at line 1135 of file class.assOrderingQuestion.php.

1136 {
1137 include_once("./Services/RTE/classes/class.ilRTE.php");
1138 $result = array();
1139 $result['id'] = (int) $this->getId();
1140 $result['type'] = (string) $this->getQuestionType();
1141 $result['title'] = (string) $this->getTitle();
1142 $result['question'] = $this->formatSAQuestion($this->getQuestion());
1143 $result['nr_of_tries'] = (int) $this->getNrOfTries();
1144 $result['shuffle'] = (bool) true;
1145 $result['points'] = $this->getPoints();
1146 $result['feedback'] = array(
1147 'onenotcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), false)),
1148 'allcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), true))
1149 );
1150 if ($this->getOrderingType() == OQ_PICTURES) {
1151 $result['path'] = $this->getImagePathWeb();
1152 }
1153
1154 $counter = 1;
1155 $answers = array();
1156 foreach ($this->getOrderingElementList() as $orderingElement) {
1157 $answers[$counter] = $orderingElement->getContent();
1158 $counter++;
1159 }
1160 $answers = $this->getShuffler()->shuffle($answers);
1161 $arr = array();
1162 foreach ($answers as $order => $answer) {
1163 array_push($arr, array(
1164 "answertext" => (string) $answer,
1165 "order" => (int) $order
1166 ));
1167 }
1168 $result['answers'] = $arr;
1169
1170 $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $this->getId());
1171 $result['mobs'] = $mobs;
1172
1173 return json_encode($result);
1174 }
getQuestionType()
Returns the question type of the question.
formatSAQuestion($a_q)
Format self assessment question.
static _getMobsOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
get mobs of object
$mobs

References $mobs, $result, ilObjMediaObject\_getMobsOfObject(), assQuestion\formatSAQuestion(), assQuestion\getId(), assQuestion\getImagePathWeb(), assQuestion\getNrOfTries(), getOrderingElementList(), getOrderingType(), assQuestion\getPoints(), assQuestion\getQuestion(), getQuestionType(), assQuestion\getShuffler(), assQuestion\getTitle(), and OQ_PICTURES.

+ Here is the call graph for this function:

◆ updateLeveledOrdering()

assOrderingQuestion::updateLeveledOrdering (   $a_index,
  $a_answer_text,
  $a_depth 
)

Definition at line 1437 of file class.assOrderingQuestion.php.

1438 {
1439 global $DIC;
1440 $ilDB = $DIC['ilDB'];
1441
1442 $ilDB->update(
1443 'qpl_a_ordering',
1444 array('solution_key' => array('integer', $a_index),
1445 'depth' => array('integer', $a_depth)),
1446 array('answertext' => array('text', $a_answer_text))
1447 );
1448
1449
1450 return true;
1451 }

References $DIC, and $ilDB.

◆ validateSolutionSubmit()

assOrderingQuestion::validateSolutionSubmit ( )

Checks the data to be saved for consistency.

Returns
boolean True, if the check was ok, False otherwise @access public
See also
$answers

Reimplemented from assQuestion.

Definition at line 849 of file class.assOrderingQuestion.php.

850 {
851 $submittedSolutionList = $this->getSolutionListFromPostSubmit();
852
853 if (!$submittedSolutionList->hasElements()) {
854 return true;
855 }
856
857 return $this->getOrderingElementList()->hasSameElementSetByRandomIdentifiers($submittedSolutionList);
858 }

References getOrderingElementList(), and getSolutionListFromPostSubmit().

Referenced by savePreviewData().

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

Field Documentation

◆ $element_height

assOrderingQuestion::$element_height

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

Referenced by getElementHeight().

◆ $leveled_ordering

assOrderingQuestion::$leveled_ordering = array()

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

Referenced by getLeveledOrdering().

◆ $old_ordering_depth

assOrderingQuestion::$old_ordering_depth = array()

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

Referenced by getOldLeveledOrdering().

◆ $ordering_type

assOrderingQuestion::$ordering_type

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

Referenced by __construct(), getOrderingType(), and setOrderingType().

◆ $orderingElementList

assOrderingQuestion::$orderingElementList
protected

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

Referenced by getOrderingElementList(), and setOrderingElementList().

◆ $postSolutionOrderingElementList

assOrderingQuestion::$postSolutionOrderingElementList = null
private

Definition at line 1348 of file class.assOrderingQuestion.php.

Referenced by getSolutionListFromPostSubmit().

◆ $thumb_geometry

assOrderingQuestion::$thumb_geometry = 100

Definition at line 53 of file class.assOrderingQuestion.php.

Referenced by getThumbGeometry().

◆ ORDERING_ELEMENT_FORM_CMD_REMOVE_IMG

const assOrderingQuestion::ORDERING_ELEMENT_FORM_CMD_REMOVE_IMG = 'removeElementImage'

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

◆ ORDERING_ELEMENT_FORM_CMD_UPLOAD_IMG

const assOrderingQuestion::ORDERING_ELEMENT_FORM_CMD_UPLOAD_IMG = 'uploadElementImage'

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

◆ ORDERING_ELEMENT_FORM_FIELD_POSTVAR


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