ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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...
 
 getLifecycle ()
 
 setLifecycle (ilAssQuestionLifecycle $lifecycle)
 
 setExternalId ($external_id)
 
 getExternalId ()
 
 getSuggestedSolutionOutput ()
 
_getSuggestedSolution ($question_id, $subquestion_index=0)
 Returns a suggested solution for a given subquestion index. More...
 
 getSuggestedSolutions ()
 Return the suggested solutions. More...
 
 getReachedPoints ($active_id, $pass=null)
 Returns the points, a learner has reached answering the question This is the fast way to get the points directly from the database. More...
 
 getMaximumPoints ()
 Returns the maximum points, a learner can reach answering the question. More...
 
 getAdjustedReachedPoints ($active_id, $pass=null, $authorizedSolution=true)
 returns the reached points ... More...
 
 calculateResultsFromSolution ($active_id, $pass=null, $obligationsEnabled=false)
 Calculates the question results from a previously saved question solution. More...
 
 persistWorkingState ($active_id, $pass=null, $obligationsEnabled=false, $authorized=true)
 persists the working state for current testactive and testpass More...
 
 persistPreviewState (ilAssQuestionPreviewSession $previewSession)
 persists the preview state for current user and question More...
 
 validateSolutionSubmit ()
 
 saveWorkingData ($active_id, $pass=null, $authorized=true)
 Saves the learners input of the question to the database. More...
 
 moveUploadedMediaFile ($file, $name)
 Move an uploaded media file to an public accessible temp dir to present it. More...
 
 getSuggestedSolutionPath ()
 Returns the path for a suggested solution. More...
 
 getJavaPath ()
 Returns the image path for web accessable images of a question. More...
 
 getImagePath ($question_id=null, $object_id=null)
 Returns the image path for web accessable images of a question. More...
 
 buildImagePath ($questionId, $parentObjectId)
 
 getFlashPath ()
 Returns the image path for web accessable flash files of a question. More...
 
 getJavaPathWeb ()
 Returns the web image path for web accessable java applets of a question. More...
 
 getSuggestedSolutionPathWeb ()
 Returns the web path for a suggested solution. More...
 
 getImagePathWeb ()
 Returns the web image path for web accessable images of a question. More...
 
 getFlashPathWeb ()
 Returns the web image path for web accessable flash applications of a question. More...
 
 getTestOutputSolutions ($activeId, $pass)
 
 getUserSolutionPreferingIntermediate ($active_id, $pass=null)
 
 getSolutionValues ($active_id, $pass=null, $authorized=true)
 Loads solutions of a given user from the database an returns it. More...
 
 isInUse ($question_id="")
 Checks whether the question is in use or not. More...
 
 isClone ($question_id="")
 Checks whether the question is a clone of another question or not. More...
 
 pcArrayShuffle ($array)
 Shuffles the values of a given array. More...
 
 getAdditionalTableName ()
 Returns the name of the additional question data table in the database. More...
 
 getAnswerTableName ()
 Returns the name of the answer table in the database. More...
 
 deleteAnswers ($question_id)
 Deletes datasets from answers tables. More...
 
 deleteAdditionalTableData ($question_id)
 Deletes datasets from the additional question table in the database. More...
 
 delete ($question_id)
 Deletes a question and all materials from the database. More...
 
 getTotalAnswers ()
 get total number of answers More...
 
 _getTotalAnswers ($a_q_id)
 get number of answers for question id (static) note: do not use $this inside this method More...
 
 copyXHTMLMediaObjectsOfQuestion ($a_q_id)
 
 syncXHTMLMediaObjectsOfQuestion ()
 
 createPageObject ()
 create page object of question More...
 
 copyPageOfQuestion ($a_q_id)
 
 getPageOfQuestion ()
 
 setOriginalId ($original_id)
 
 getOriginalId ()
 
 fixSvgToPng ($imageFilenameContainingString)
 
 fixUnavailableSkinImageSources ($html)
 
 loadFromDb ($question_id)
 Loads the question from the database. More...
 
 createNewQuestion ($a_create_page=true)
 Creates a new question without an owner when a new question is created This assures that an ID is given to the question if a file upload or something else occurs. More...
 
 saveQuestionDataToDb ($original_id="")
 
 saveToDb ($original_id="")
 Saves the question to the database. More...
 
 setNewOriginalId ($newId)
 
 deleteSuggestedSolutions ()
 Deletes all suggestes solutions in the database. More...
 
 getSuggestedSolution ($subquestion_index=0)
 Returns a suggested solution for a given subquestion index. More...
 
 getSuggestedSolutionTitle ($subquestion_index=0)
 Returns the title of a suggested solution at a given subquestion_index. More...
 
 setSuggestedSolution ($solution_id="", $subquestion_index=0, $is_import=false)
 Sets a suggested solution for the question. More...
 
 _resolveInternalLink ($internal_link)
 
 _resolveIntLinks ($question_id)
 
 syncWithOriginal ()
 
 _questionExists ($question_id)
 Returns true if the question already exists in the database. More...
 
 _questionExistsInPool ($question_id)
 Returns true if the question already exists in the database and is assigned to a question pool. More...
 
 getPoints ()
 Returns the maximum available points for the question. More...
 
 setPoints ($a_points)
 Sets the maximum available points for the question. More...
 
 getSolutionMaxPass ($active_id)
 Returns the maximum pass a users question solution. More...
 
 calculateReachedPoints ($active_id, $pass=null, $authorizedSolution=true, $returndetails=false)
 Returns the points, a learner has reached answering the question. More...
 
 deductHintPointsFromReachedPoints (ilAssQuestionPreviewSession $previewSession, $reachedPoints)
 
 calculateReachedPointsFromPreviewSession (ilAssQuestionPreviewSession $previewSession)
 
 isPreviewSolutionCorrect (ilAssQuestionPreviewSession $previewSession)
 
 adjustReachedPointsByScoringOptions ($points, $active_id, $pass=null)
 Adjust the given reached points by checks for all special scoring options in the test container. More...
 
 isHTML ($a_text)
 Checks if a given string contains HTML or not. More...
 
 prepareTextareaOutput ($txt_output, $prepare_for_latex_output=false, $omitNl2BrWhenTextArea=false)
 Prepares a string for a text area output in tests. More...
 
 QTIMaterialToString ($a_material)
 Reads an QTI material tag an creates a text string. More...
 
 addQTIMaterial (&$a_xml_writer, $a_material, $close_material_tag=true, $add_mobs=true)
 Creates a QTI material tag from a plain text or xhtml text. More...
 
 buildHashedImageFilename ($plain_image_filename, $unique=false)
 
 getQuestion ()
 Gets the question string of the question object. More...
 
 setQuestion ($question="")
 Sets the question string of the question object. More...
 
 getQuestionType ()
 Returns the question type of the question. More...
 
 getQuestionTypeID ()
 Returns the question type of the question. More...
 
 cleanupMediaObjectUsage ()
 synchronises appearances of media objects in the question with media object usage table More...
 
getInstances ()
 Gets all instances of the question. More...
 
 getActiveUserData ($active_id)
 Returns the user id and the test id for a given active id. More...
 
 setExportDetailsXLS ($worksheet, $startrow, $active_id, $pass)
 Creates an Excel worksheet for the detailed cumulated results of this question. More...
 
 __get ($value)
 Object getter. More...
 
 __set ($key, $value)
 Object setter. More...
 
 getNrOfTries ()
 
 setNrOfTries ($a_nr_of_tries)
 
 setExportImagePath ($a_path)
 
 formatSAQuestion ($a_q)
 Format self assessment question. More...
 
 setPreventRteUsage ($a_val)
 Set prevent rte usage. More...
 
 getPreventRteUsage ()
 Get prevent rte usage. More...
 
 migrateContentForLearningModule (ilAssSelfAssessmentMigrator $migrator)
 
 setSelfAssessmentEditingMode ($a_selfassessmenteditingmode)
 Set Self-Assessment Editing Mode. More...
 
 getSelfAssessmentEditingMode ()
 Get Self-Assessment Editing Mode. More...
 
 setDefaultNrOfTries ($a_defaultnroftries)
 Set Default Nr of Tries. More...
 
 getDefaultNrOfTries ()
 Get Default Nr of Tries. More...
 
 syncSkillAssignments ($srcParentId, $srcQuestionId, $trgParentId, $trgQuestionId)
 
 isAnswered ($active_id, $pass=null)
 returns boolean wether the question is answered during test pass or not More...
 
 isAutosaveable ()
 
 getAdditionalContentEditingMode ()
 getter for additional content editing mode for this question More...
 
 setAdditionalContentEditingMode ($additinalContentEditingMode)
 setter for additional content editing mode for this question More...
 
 isAdditionalContentEditingModePageObject ()
 isser for additional "pageobject" content editing mode More...
 
 isValidAdditionalContentEditingMode ($additionalContentEditingMode)
 returns the fact wether the passed additional content mode is valid or not More...
 
 getValidAdditionalContentEditingModes ()
 getter for valid additional content editing modes More...
 
 addQuestionChangeListener (ilQuestionChangeListener $listener)
 
 getQuestionChangeListeners ()
 
 getHtmlUserSolutionPurifier ()
 
 getHtmlQuestionContentPurifier ()
 
 setLastChange ($lastChange)
 
 getLastChange ()
 
 removeIntermediateSolution ($active_id, $pass)
 
 removeCurrentSolution ($active_id, $pass, $authorized=true)
 
 saveCurrentSolution ($active_id, $pass, $value1, $value2, $authorized=true, $tstamp=null)
 
 updateCurrentSolution ($solutionId, $value1, $value2, $authorized=true)
 
 updateCurrentSolutionsAuthorization ($activeId, $pass, $authorized, $keepTime=false)
 
 setStep ($step)
 
 getStep ()
 
 toJSON ()
 
 duplicate ($for_test=true, $title="", $author="", $owner="", $testObjId=null)
 
 intermediateSolutionExists ($active_id, $pass)
 
 authorizedSolutionExists ($active_id, $pass)
 
 authorizedOrIntermediateSolutionExists ($active_id, $pass)
 
 isAddableAnswerOptionValue ($qIndex, $answerOptionValue)
 
 addAnswerOptionValue ($qIndex, $answerOptionValue, $points)
 
 removeAllExistingSolutions ()
 
 removeExistingSolutions ($activeId, $pass)
 
 resetUsersAnswer ($activeId, $pass)
 
 removeResultRecord ($activeId, $pass)
 
 fetchValuePairsFromIndexedValues (array $indexedValues)
 
 fetchIndexedValuesFromValuePairs (array $valuePairs)
 
 areObligationsToBeConsidered ()
 
 setObligationsToBeConsidered ($obligationsToBeConsidered)
 
 updateTimestamp ()
 
 getTestPresentationConfig ()
 Get the test question configuration (initialised once) More...
 
 savePartial ()
 
- Public Member Functions inherited from 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
 
 $lifecycle
 

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, assQuestion\$title, and ILIAS\GlobalScreen\Provider\__construct().

+ Here is the call graph for this function:

Member Function Documentation

◆ afterSyncWithOriginal()

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

{}

Reimplemented from assQuestion.

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

1573 {
1574 parent::afterSyncWithOriginal($origQuestionId, $dupQuestionId, $origParentObjId, $dupParentObjId);
1575 $this->duplicateImages($dupQuestionId, $dupParentObjId, $origQuestionId, $origParentObjId);
1576 }
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 1283 of file class.assOrderingQuestion.php.

1284 {
1285 $formDataConverter = $this->buildNestedOrderingFormDataConverter();
1286
1287 require_once 'Modules/TestQuestionPool/classes/forms/class.ilAssNestedOrderingElementsInputGUI.php';
1288
1289 $orderingElementInput = new ilAssNestedOrderingElementsInputGUI(
1290 $formDataConverter,
1291 self::ORDERING_ELEMENT_FORM_FIELD_POSTVAR
1292 );
1293
1294 $orderingElementInput->setUniquePrefix($this->getId());
1295 $orderingElementInput->setOrderingType($this->getOrderingType());
1296 $orderingElementInput->setElementImagePath($this->getImagePathWeb());
1297 $orderingElementInput->setThumbPrefix($this->getThumbPrefix());
1298
1299 $this->initOrderingElementFormFieldLabels($orderingElementInput);
1300
1301 return $orderingElementInput;
1302 }
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 1701 of file class.assOrderingQuestion.php.

1702 {
1703 $formDataConverter = $this->buildOrderingElementFormDataConverter();
1705
1706 if ($this->getOrderingType() == OQ_NESTED_PICTURES) {
1707 $formDataConverter->setImageRemovalCommand(self::ORDERING_ELEMENT_FORM_CMD_REMOVE_IMG);
1708 $formDataConverter->setImageUrlPath($this->getImagePathWeb());
1709
1710 if ($this->getThumbSize() && $this->getThumbPrefix()) {
1711 $formDataConverter->setThumbnailPrefix($this->getThumbPrefix());
1712 }
1713 }
1714
1715 return $formDataConverter;
1716 }
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 1661 of file class.assOrderingQuestion.php.

1662 {
1663 require_once 'Modules/TestQuestionPool/classes/forms/class.ilAssOrderingFormValuesObjectsConverter.php';
1664 $converter = new ilAssOrderingFormValuesObjectsConverter();
1665 $converter->setPostVar(self::ORDERING_ELEMENT_FORM_FIELD_POSTVAR);
1666
1667 return $converter;
1668 }

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

1187 {
1188 switch ($this->getOrderingType()) {
1189 case OQ_TERMS:
1190
1191 return $this->buildOrderingTextsInputGui();
1192
1193 case OQ_PICTURES:
1194
1195 return $this->buildOrderingImagesInputGui();
1196
1197 case OQ_NESTED_TERMS:
1198 case OQ_NESTED_PICTURES:
1199
1200 return $this->buildNestedOrderingElementInputGui();
1201
1202 default:
1203 throw new ilTestQuestionPoolException('unknown ordering mode');
1204 }
1205 }
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 1673 of file class.assOrderingQuestion.php.

1674 {
1675 $formDataConverter = $this->buildOrderingElementFormDataConverter();
1677
1678 $formDataConverter->setImageRemovalCommand(self::ORDERING_ELEMENT_FORM_CMD_REMOVE_IMG);
1679 $formDataConverter->setImageUrlPath($this->getImagePathWeb());
1680 $formDataConverter->setImageFsPath($this->getImagePath());
1681
1682 if ($this->getThumbSize() && $this->getThumbPrefix()) {
1683 $formDataConverter->setThumbnailPrefix($this->getThumbPrefix());
1684 }
1685 return $formDataConverter;
1686 }
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 1261 of file class.assOrderingQuestion.php.

1262 {
1263 $formDataConverter = $this->buildOrderingImagesFormDataConverter();
1264
1265 require_once 'Modules/TestQuestionPool/classes/forms/class.ilAssOrderingImagesInputGUI.php';
1266
1267 $orderingElementInput = new ilAssOrderingImagesInputGUI(
1268 $formDataConverter,
1269 self::ORDERING_ELEMENT_FORM_FIELD_POSTVAR
1270 );
1271
1272 $orderingElementInput->setImageRemovalCommand(self::ORDERING_ELEMENT_FORM_CMD_REMOVE_IMG);
1273 $orderingElementInput->setImageUploadCommand(self::ORDERING_ELEMENT_FORM_CMD_UPLOAD_IMG);
1274
1275 $this->initOrderingElementFormFieldLabels($orderingElementInput);
1276
1277 return $orderingElementInput;
1278 }

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

1692 {
1693 $formDataConverter = $this->buildOrderingElementFormDataConverter();
1695 return $formDataConverter;
1696 }

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

1243 {
1244 $formDataConverter = $this->buildOrderingTextsFormDataConverter();
1245
1246 require_once 'Modules/TestQuestionPool/classes/forms/class.ilAssOrderingTextsInputGUI.php';
1247
1248 $orderingElementInput = new ilAssOrderingTextsInputGUI(
1249 $formDataConverter,
1250 self::ORDERING_ELEMENT_FORM_FIELD_POSTVAR
1251 );
1252
1253 $this->initOrderingElementFormFieldLabels($orderingElementInput);
1254
1255 return $orderingElementInput;
1256 }

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

1586 {
1587 // hey: refactored identifiers
1588 return parent::buildTestPresentationConfig()
1589 // hey.
1590 ->setIsUnchangedAnswerPossible(true)
1591 ->setUseUnchangedAnswerLabel($this->lng->txt('tst_unchanged_order_is_correct'));
1592 }

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

666 {
667 if ($returndetails) {
668 throw new ilTestException('return details not implemented for ' . __METHOD__);
669 }
670
671 if (is_null($pass)) {
672 $pass = $this->getSolutionMaxPass($active_id);
673 }
674
675 $solutionValuePairs = $this->getSolutionValues($active_id, $pass, $authorizedSolution);
676
677 if (!count($solutionValuePairs)) {
678 return 0;
679 }
680
681 $indexedSolutionValues = $this->fetchIndexedValuesFromValuePairs($solutionValuePairs);
682 $solutionOrderingElementList = $this->getSolutionOrderingElementList($indexedSolutionValues);
683
684 return $this->calculateReachedPointsForSolution($solutionOrderingElementList);
685 }
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 1382 of file class.assOrderingQuestion.php.

1383 {
1384 $reachedPoints = $this->getPoints();
1385
1386 foreach ($this->getOrderingElementList() as $correctElement) {
1387 $userElement = $solutionOrderingElementList->getElementByPosition($correctElement->getPosition());
1388
1389 if (!$correctElement->isSameElement($userElement)) {
1390 $reachedPoints = 0;
1391 break;
1392 }
1393 }
1394
1395 return $reachedPoints;
1396 }
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 687 of file class.assOrderingQuestion.php.

688 {
689 if (!$previewSession->hasParticipantSolution()) {
690 return 0;
691 }
692
693 $solutionOrderingElementList = unserialize(
694 $previewSession->getParticipantsSolution()
695 );
696
697 $reachedPoints = $this->calculateReachedPointsForSolution($solutionOrderingElementList);
698 $reachedPoints = $this->deductHintPointsFromReachedPoints($previewSession, $reachedPoints);
699
700 return $this->ensureNonNegativePoints($reachedPoints);
701 }
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 731 of file class.assOrderingQuestion.php.

732 {
733 if ($this->getOrderingType() == OQ_PICTURES) {
734 if (@file_exists($this->getImagePath())) {
735 $contents = ilUtil::getDir($this->getImagePath());
736 foreach ($contents as $f) {
737 if (strcmp($f['type'], 'file') == 0) {
738 $found = false;
739 foreach ($this->getOrderingElementList() as $orderElement) {
740 if (strcmp($f['entry'], $orderElement->getContent()) == 0) {
741 $found = true;
742 }
743 if (strcmp($f['entry'], $this->getThumbPrefix() . $orderElement->getContent()) == 0) {
744 $found = true;
745 }
746 }
747 if (!$found) {
748 if (@file_exists($this->getImagePath() . $f['entry'])) {
749 @unlink($this->getImagePath() . $f['entry']);
750 }
751 }
752 }
753 }
754 }
755 } else {
756 if (@file_exists($this->getImagePath())) {
758 }
759 }
760 }
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 Vendor\Package\$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 352 of file class.assOrderingQuestion.php.

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

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

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

839 {
840 if ($this->getThumbGeometry()) {
841 $imageFile = $this->getImagePath() . $element->getContent();
842 $thumbFile = $this->getImagePath() . $this->getThumbPrefix() . $element->getContent();
843
844 ilUtil::convertImage($imageFile, $thumbFile, "JPEG", $this->getThumbGeometry());
845 }
846 }
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 287 of file class.assOrderingQuestion.php.

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

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

636 {
637 $this->getOrderingElementList()->removeElement(
638 $this->getOrderingElementList()->getElementByRandomIdentifier($randomIdentifier)
639 );
640 $this->getOrderingElementList()->saveToDb();
641 }

References getOrderingElementList().

+ Here is the call graph for this function:

◆ dropImageFile()

assOrderingQuestion::dropImageFile (   $imageFilename)

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

769 {
770 if (!strlen($imageFilename)) {
771 return false;
772 }
773
774 $result = @unlink($this->getImagePath() . $imageFilename);
775 $result = $result & @unlink($this->getImagePath() . $this->getThumbPrefix() . $imageFilename);
776
777 return $result;
778 }
$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 196 of file class.assOrderingQuestion.php.

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

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

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

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

245 {
246 $this->getOrderingElementList()->setQuestionId($this->getId());
247 $this->getOrderingElementList()->distributeNewRandomIdentifiers();
248 $this->getOrderingElementList()->saveToDb();
249 }

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

+ Here is the call graph for this function:

◆ ensureImagePathExists()

assOrderingQuestion::ensureImagePathExists ( )
protected

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

1596 {
1597 if (!file_exists($this->getImagePath())) {
1599 }
1600 }

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

1319 {
1320 $orderingGUI = $this->buildNestedOrderingElementInputGui();
1322 $orderingGUI->setValueByArray($userSolutionPost);
1323
1324 if (!$orderingGUI->checkInput()) {
1325 require_once 'Modules/Test/exceptions/class.ilTestException.php';
1326 throw new ilTestException('error on validating user solution post');
1327 }
1328
1329 require_once 'Modules/TestQuestionPool/classes/questions/class.ilAssOrderingElementList.php';
1330 $solutionOrderingElementList = ilAssOrderingElementList::buildInstance($this->getId());
1331
1332 $storedElementList = $this->getOrderingElementList();
1333
1334 foreach ($orderingGUI->getElementList($this->getId()) as $submittedElement) {
1335 $solutionElement = $storedElementList->getElementByRandomIdentifier(
1336 $submittedElement->getRandomIdentifier()
1337 )->getClone();
1338
1339 $solutionElement->setPosition($submittedElement->getPosition());
1340
1341 if ($this->isOrderingTypeNested()) {
1342 $solutionElement->setIndentation($submittedElement->getIndentation());
1343 }
1344
1345 $solutionOrderingElementList->addElement($solutionElement);
1346 }
1347
1348 return $solutionOrderingElementList;
1349 }
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 1308 of file class.assOrderingQuestion.php.

1309 {
1310 return $form->getItemByPostVar(self::ORDERING_ELEMENT_FORM_FIELD_POSTVAR)->getElementList($this->getId());
1311 }
getItemByPostVar($a_post_var)
Get Item by POST variable.

References assQuestion\getId(), and ilPropertyFormGUI\getItemByPostVar().

+ Here is the call graph for this function:

◆ fetchSolutionSubmit()

assOrderingQuestion::fetchSolutionSubmit (   $formSubmissionDataStructure)
Returns
array

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

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

References $index, 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 1116 of file class.assOrderingQuestion.php.

1117 {
1118 $filename = $path . $file;
1119 if (@file_exists($filename)) {
1120 $thumbpath = $path . $this->getThumbPrefix() . $file;
1121 $path_info = @pathinfo($filename);
1122 $ext = "";
1123 switch (strtoupper($path_info['extension'])) {
1124 case 'PNG':
1125 $ext = 'PNG';
1126 break;
1127 case 'GIF':
1128 $ext = 'GIF';
1129 break;
1130 default:
1131 $ext = 'JPEG';
1132 break;
1133 }
1134 ilUtil::convertImage($filename, $thumbpath, $ext, $this->getThumbGeometry());
1135 }
1136 }

References $filename, 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 968 of file class.assOrderingQuestion.php.

969 {
970 return "qpl_qst_ordering";
971 }

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

619 {
620 if (!$this->getOrderingElementList()->elementExistByPosition($index)) {
621 return null;
622 }
623
624 return $this->getOrderingElementList()->getElementByPosition($index);
625 }

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

651 {
652 return $this->getOrderingElementList()->countElements();
653 }

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

980 {
981 return "qpl_a_ordering";
982 }

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

1561 {
1562 if ($index !== null) {
1563 return $this->getOrderingElementList()->getElementByPosition($index);
1564 }
1565
1566 return $this->getOrderingElementList()->getElements();
1567 }

References $index, and getOrderingElementList().

+ Here is the call graph for this function:

◆ getElementHeight()

assOrderingQuestion::getElementHeight ( )

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

References $element_height.

◆ getEncryptedFilename()

assOrderingQuestion::getEncryptedFilename (   $filename)

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

723 {
724 $extension = "";
725 if (preg_match("/.*\\.(\\w+)$/", $filename, $matches)) {
726 $extension = $matches[1];
727 }
728 return md5($filename) . "." . $extension;
729 }

References $filename.

◆ getExpressionTypes()

◆ getLeveledOrdering()

assOrderingQuestion::getLeveledOrdering ( )

Definition at line 1403 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 709 of file class.assOrderingQuestion.php.

710 {
711 return $this->getPoints();
712 }

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

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

References $DIC, $ilDB, $old_ordering_depth, $res, 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 1467 of file class.assOrderingQuestion.php.

1468 {
1469 require_once "./Modules/TestQuestionPool/classes/class.ilOperatorsExpressionMapping.php";
1471 }

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

1004 {
1005 return $this->getOrderingElementList()->getRandomIdentifierIndexedElements();
1006 }

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

423 {
424 if ($forceCorrectSolution || !$activeId || $passIndex === null) {
425 return $this->getOrderingElementList();
426 }
427
428 $solutionValues = $this->getSolutionValues($activeId, $passIndex, !$getUseIntermediateSolution);
429
430 if (!count($solutionValues)) {
431 return $this->getShuffledOrderingElementList();
432 }
433
434 return $this->getSolutionOrderingElementList($this->fetchIndexedValuesFromValuePairs($solutionValues));
435 }

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

958 {
959 return "assOrderingQuestion";
960 }

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

989 {
990 $text = parent::getRTETextWithMediaObjects();
991
992 foreach ($this->getOrderingElementList() as $orderingElement) {
993 $text .= $orderingElement->getContent();
994 }
995
996 return $text;
997 }

References getOrderingElementList().

+ Here is the call graph for this function:

◆ getShuffledOrderingElementList()

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

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

546 {
547 $shuffledRandomIdentifierIndex = $this->getShuffler()->shuffle(
548 $this->getOrderingElementList()->getRandomIdentifierIndex()
549 );
550
551 $shuffledElementList = $this->getOrderingElementList()->getClone();
552 $shuffledElementList->reorderByRandomIdentifiers($shuffledRandomIdentifierIndex);
553 $shuffledElementList->resetElementsIndentations();
554
555 return $shuffledElementList;
556 }

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

1360 {
1361 if ($this->postSolutionOrderingElementList === null) {
1363 $this->postSolutionOrderingElementList = $list;
1364 }
1365
1367 }
$_POST["username"]
fetchSolutionListFromFormSubmissionData($userSolutionPost)

References $_POST, $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 518 of file class.assOrderingQuestion.php.

519 {
520 $solutionOrderingList = new ilAssOrderingElementList();
521 $solutionOrderingList->setQuestionId($this->getId());
522
523 foreach ($indexedSolutionValues as $value1 => $value2) {
524 if ($this->isOrderingTypeNested()) {
525 $element = $this->getSolutionValuePairBrandedOrderingElementByRandomIdentifier($value1, $value2);
526 } else {
527 $element = $this->getSolutionValuePairBrandedOrderingElementBySolutionIdentifier($value1, $value2);
528 }
529
530 $solutionOrderingList->addElement($element);
531 }
532
533 if (!$this->getOrderingElementList()->hasSameElementSetByRandomIdentifiers($solutionOrderingList)) {
534 throw new ilTestQuestionPoolException('inconsistent solution values given');
535 }
536
537 return $solutionOrderingList;
538 }
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 446 of file class.assOrderingQuestion.php.

447 {
448 if ($inputGUI->isPostSubmit($lastPost)) {
449 return $this->fetchSolutionListFromFormSubmissionData($lastPost);
450 }
451
452 // hey: prevPassSolutions - pass will be always available from now on
453 #if( $pass === null && !ilObjTest::_getUsePreviousAnswers($activeId, true) )
454 #// condition looks strange? yes - keep it null when previous solutions not enabled (!)
455 #{
456 # $pass = ilObjTest::_getPass($activeId);
457 #}
458 // hey.
459
460 $indexedSolutionValues = $this->fetchIndexedValuesFromValuePairs(
461 // hey: prevPassSolutions - obsolete due to central check
462 $this->getTestOutputSolutions($activeId, $pass)
463 // hey.
464 );
465
466 if (count($indexedSolutionValues)) {
467 return $this->getSolutionOrderingElementList($indexedSolutionValues);
468 }
469
470 return $this->getShuffledOrderingElementList();
471 }
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 1372 of file class.assOrderingQuestion.php.

1373 {
1374 return $this->fetchSolutionSubmit($_POST);
1375 }
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 478 of file class.assOrderingQuestion.php.

479 {
480 $value2 = explode(':', $value2);
481
482 $randomIdentifier = $value2[0];
483 $selectedPosition = $value1;
484 $selectedIndentation = $value2[1];
485
486 $element = $this->getOrderingElementList()->getElementByRandomIdentifier($randomIdentifier)->getClone();
487
488 $element->setPosition($selectedPosition);
489 $element->setIndentation($selectedIndentation);
490
491 return $element;
492 }

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

500 {
501 $solutionIdentifier = $value1;
502 $selectedPosition = ($value2 - 1);
503 $selectedIndentation = 0;
504
505 $element = $this->getOrderingElementList()->getElementBySolutionIdentifier($solutionIdentifier)->getClone();
506
507 $element->setPosition($selectedPosition);
508 $element->setIndentation($selectedIndentation);
509
510 return $element;
511 }

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

1065 {
1066 return $this->getThumbGeometry();
1067 }

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

832 {
833 foreach ($elementList as $element) {
834 $this->createImageThumbnail($element);
835 }
836 }
createImageThumbnail(ilAssOrderingElement $element)

References createImageThumbnail().

+ Here is the call graph for this function:

◆ hasOrderingTypeUploadSupport()

assOrderingQuestion::hasOrderingTypeUploadSupport ( )

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

412 {
413 return $this->getOrderingType() == OQ_PICTURES;
414 }

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

1211 {
1212 switch (true) {
1213 case $formField instanceof ilAssNestedOrderingElementsInputGUI:
1214
1215 $formField->setInteractionEnabled(true);
1216 $formField->setNestingEnabled($this->isOrderingTypeNested());
1217 break;
1218
1219 case $formField instanceof ilAssOrderingTextsInputGUI:
1220 case $formField instanceof ilAssOrderingImagesInputGUI:
1221 default:
1222
1223 $formField->setEditElementOccuranceEnabled(true);
1224 $formField->setEditElementOrderEnabled(true);
1225 }
1226
1227 $formField->setRequired(true);
1228 }
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 1233 of file class.assOrderingQuestion.php.

1234 {
1235 $formField->setInfo($this->lng->txt('ordering_answer_sequence_info'));
1236 $formField->setTitle($this->lng->txt('answers'));
1237 }
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 780 of file class.assOrderingQuestion.php.

781 {
782 if (!strlen($imageFilename)) {
783 return false;
784 }
785
786 if (!file_exists($this->getImagePath() . $imageFilename)) {
787 return false;
788 }
789
790 return is_file($this->getImagePath() . $imageFilename);
791 }

References assQuestion\getImagePath().

+ Here is the call graph for this function:

◆ isImageOrderingType()

assOrderingQuestion::isImageOrderingType ( )

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

407 {
408 return in_array($this->getOrderingType(), array(OQ_PICTURES, OQ_NESTED_PICTURES));
409 }

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

794 {
795 if (!$this->hasOrderingTypeUploadSupport()) {
796 return false;
797 }
798
799 if (!$newElement->getContent()) {
800 return false;
801 }
802
803 return $newElement->getContent() != $oldElement->getContent();
804 }

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

+ Here is the call graph for this function:

◆ isOrderingTypeNested()

assOrderingQuestion::isOrderingTypeNested ( )

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

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

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 {
177 }
178
179 try {
180 $this->setAdditionalContentEditingMode($data['add_cont_edit_mode']);
182 }
183 }
184
185 $this->orderingElementList->setQuestionId($this->getId());
186 $this->orderingElementList->loadFromDb();
187
188 parent::loadFromDb($question_id);
189 }
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.
setLifecycle(ilAssQuestionLifecycle $lifecycle)
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: storeScorm.php:23

References $data, $DIC, Vendor\Package\$e, $ilDB, $result, ilRTE\_replaceMediaObjectImageSrc(), getAdditionalTableName(), ilAssQuestionLifecycle\getDraftInstance(), assQuestion\getId(), ilAssQuestionLifecycle\getInstance(), OQ_TERMS, assQuestion\setAdditionalContentEditingMode(), assQuestion\setAuthor(), assQuestion\setComment(), assQuestion\setEstimatedWorkingTime(), assQuestion\setId(), assQuestion\setLifecycle(), 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 1428 of file class.assOrderingQuestion.php.

1429 {
1430 global $DIC;
1431 $ilDB = $DIC['ilDB'];
1432
1433 $res = $ilDB->queryF(
1434 'SELECT solution_key FROM qpl_a_ordering WHERE random_id = %s',
1435 array('integer'),
1436 array($a_random_id)
1437 );
1438 $row = $ilDB->fetchAssoc($res);
1439
1440 return $row['solution_key'];
1441 }

References $DIC, $ilDB, and $res.

◆ moveAnswerDown()

assOrderingQuestion::moveAnswerDown (   $position)
Parameters
$position

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

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

598 {
599 if (!$this->getOrderingElementList()->elementExistByPosition($position)) {
600 return false;
601 }
602
603 if ($this->getOrderingElementList()->isLastElementPosition($position)) {
604 return false;
605 }
606
607 $this->getOrderingElementList()->moveElementByPositions($position, $position + 1);
608
609 return true;
610 }

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

580 {
581 if (!$this->getOrderingElementList()->elementExistByPosition($position)) {
582 return false;
583 }
584
585 if ($this->getOrderingElementList()->isFirstElementPosition($position)) {
586 return false;
587 }
588
589 $this->getOrderingElementList()->moveElementByPositions($position, $position - 1);
590 }

References getOrderingElementList().

+ Here is the call graph for this function:

◆ rebuildThumbnails()

assOrderingQuestion::rebuildThumbnails ( )

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

1103 {
1104 if ($this->getOrderingType() == OQ_PICTURES || $this->getOrderingType() == OQ_NESTED_PICTURES) {
1105 foreach ($this->getOrderElements() as $orderingElement) {
1106 $this->generateThumbForFile($this->getImagePath(), $orderingElement->getContent());
1107 }
1108 }
1109 }
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 940 of file class.assOrderingQuestion.php.

941 {
942 $this->getOrderingElementList()->setQuestionId($this->getId());
943 $this->getOrderingElementList()->saveToDb();
944
945 if ($this->hasOrderingTypeUploadSupport()) {
946 $this->rebuildThumbnails();
947 $this->cleanImagefiles();
948 }
949 }

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

908 {
909 if ($this->validateSolutionSubmit()) {
910 $previewSession->setParticipantsSolution(serialize($this->getSolutionListFromPostSubmit()));
911 }
912 }
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 874 of file class.assOrderingQuestion.php.

875 {
876 $entered_values = 0;
877
878 if (is_null($pass)) {
879 include_once "./Modules/Test/classes/class.ilObjTest.php";
880 $pass = ilObjTest::_getPass($active_id);
881 }
882
883 $this->getProcessLocker()->executeUserSolutionUpdateLockOperation(
884 function () use (&$entered_values, $active_id, $pass, $authorized) {
885 $this->removeCurrentSolution($active_id, $pass, $authorized);
886
887 foreach ($this->getSolutionListFromPostSubmit() as $orderingElement) {
888 $value1 = $orderingElement->getStorageValue1($this->getOrderingType());
889 $value2 = $orderingElement->getStorageValue2($this->getOrderingType());
890
891 $this->saveCurrentSolution($active_id, $pass, $value1, trim($value2), $authorized);
892
893 $entered_values++;
894 }
895 }
896 );
897
898 if ($entered_values) {
899 $this->log($active_id, 'log_user_entered_values');
900 } else {
901 $this->log($active_id, 'log_user_not_entered_values');
902 }
903
904 return true;
905 }
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 1094 of file class.assOrderingQuestion.php.

1095 {
1096 $this->element_height = ($a_height < 20) ? "" : $a_height;
1097 }

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

1028 {
1029 parent::setExportDetailsXLS($worksheet, $startrow, $active_id, $pass);
1030
1031 $solutions = $this->getSolutionValues($active_id, $pass);
1032 $sol = array();
1033 foreach ($solutions as $solution) {
1034 $sol[$solution["value1"]] = $solution["value2"];
1035 }
1036 asort($sol);
1037 $sol = array_keys($sol);
1038
1039 $i = 1;
1040 foreach ($sol as $idx) {
1041 foreach ($solutions as $solution) {
1042 if ($solution["value1"] == $idx) {
1043 $worksheet->setCell($startrow + $i, 0, $solution["value2"]);
1044 }
1045 }
1046 $element = $this->getOrderingElementList()->getElementBySolutionIdentifier($idx);
1047 $worksheet->setCell($startrow + $i, 1, $element->getContent());
1048 $i++;
1049 }
1050
1051 return $startrow + $i + 1;
1052 }
$i
Definition: metadata.php:24

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

570 {
571 $this->orderingElementList = $orderingElementList;
572 }

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

385 {
386 $this->ordering_type = $ordering_type;
387 }

References $ordering_type.

◆ setThumbGeometry()

assOrderingQuestion::setThumbGeometry (   $a_geometry)

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

1075 {
1076 $this->thumb_geometry = ($a_geometry < 1) ? 100 : $a_geometry;
1077 }

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

815 {
816 if (!strlen($uploadFile)) {
817 return false;
818 }
819
820 $this->ensureImagePathExists();
821
822 // store file with hashed name
823
824 if (!ilUtil::moveUploadedFile($uploadFile, $targetFile, $this->getImagePath() . $targetFile)) {
825 return false;
826 }
827
828 return true;
829 }
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file

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

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

1015 {
1016 return true;
1017 }

◆ supportsNonJsOutput()

assOrderingQuestion::supportsNonJsOutput ( )

Reimplemented from assQuestion.

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

1020 {
1021 return false;
1022 }

◆ toJSON()

assOrderingQuestion::toJSON ( )

Returns a JSON representation of the question.

Reimplemented from assQuestion.

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

1142 {
1143 include_once("./Services/RTE/classes/class.ilRTE.php");
1144 $result = array();
1145 $result['id'] = (int) $this->getId();
1146 $result['type'] = (string) $this->getQuestionType();
1147 $result['title'] = (string) $this->getTitle();
1148 $result['question'] = $this->formatSAQuestion($this->getQuestion());
1149 $result['nr_of_tries'] = (int) $this->getNrOfTries();
1150 $result['shuffle'] = (bool) true;
1151 $result['points'] = $this->getPoints();
1152 $result['feedback'] = array(
1153 'onenotcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), false)),
1154 'allcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), true))
1155 );
1156 if ($this->getOrderingType() == OQ_PICTURES) {
1157 $result['path'] = $this->getImagePathWeb();
1158 }
1159
1160 $counter = 1;
1161 $answers = array();
1162 foreach ($this->getOrderingElementList() as $orderingElement) {
1163 $answers[$counter] = $orderingElement->getContent();
1164 $counter++;
1165 }
1166 $answers = $this->getShuffler()->shuffle($answers);
1167 $arr = array();
1168 foreach ($answers as $order => $answer) {
1169 array_push($arr, array(
1170 "answertext" => (string) $answer,
1171 "order" => (int) $order
1172 ));
1173 }
1174 $result['answers'] = $arr;
1175
1176 $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $this->getId());
1177 $result['mobs'] = $mobs;
1178
1179 return json_encode($result);
1180 }
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 1443 of file class.assOrderingQuestion.php.

1444 {
1445 global $DIC;
1446 $ilDB = $DIC['ilDB'];
1447
1448 $ilDB->update(
1449 'qpl_a_ordering',
1450 array('solution_key' => array('integer', $a_index),
1451 'depth' => array('integer', $a_depth)),
1452 array('answertext' => array('text', $a_answer_text))
1453 );
1454
1455
1456 return true;
1457 }

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

856 {
857 $submittedSolutionList = $this->getSolutionListFromPostSubmit();
858
859 if (!$submittedSolutionList->hasElements()) {
860 return true;
861 }
862
863 return $this->getOrderingElementList()->hasSameElementSetByRandomIdentifiers($submittedSolutionList);
864 }

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