ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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)
 
 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)
 {} More...
 
 getThumbGeometry ()
 
 getThumbSize ()
 
 setThumbGeometry ($a_geometry)
 
 getElementHeight ()
 
 setElementHeight ($a_height)
 
 rebuildThumbnails ()
 
 getThumbPrefix ()
 
 toJSON ()
 Returns a JSON representation of the question. More...
 
 buildOrderingElementInputGui ()
 
 initOrderingElementAuthoringProperties (ilFormPropertyGUI $formField)
 
 initOrderingElementFormFieldLabels (ilFormPropertyGUI $formField)
 
 buildOrderingTextsInputGui ()
 
 buildOrderingImagesInputGui ()
 
 buildNestedOrderingElementInputGui ()
 
 fetchSolutionListFromSubmittedForm (ilPropertyFormGUI $form)
 
 fetchSolutionListFromFormSubmissionData ($userSolutionPost)
 
 getSolutionListFromPostSubmit ()
 
 getSolutionPostSubmit ()
 
 getLeveledOrdering ()
 
 getOldLeveledOrdering ()
 
 lookupSolutionOrderByRandomid ($a_random_id)
 
 updateLeveledOrdering ($a_index, $a_answer_text, $a_depth)
 
 getOperators ($expression)
 Get all available operations for a specific question. More...
 
 getExpressionTypes ()
 Get all available expression types for a specific question. More...
 
 getAvailableAnswerOptions ($index=null)
 If index is null, the function returns an array with all anwser options Else it returns the specific answer option. More...
 
 buildTestPresentationConfig ()
 Get the test question configuration. More...
 
 fetchSolutionSubmit ($formSubmissionDataStructure)
 
- Public Member Functions inherited from assQuestion
 __construct ( $title="", $comment="", $author="", $owner=-1, $question="")
 assQuestion constructor More...
 
 getShuffler ()
 
 setShuffler (ilArrayElementShuffler $shuffler)
 
 setProcessLocker ($processLocker)
 
 getProcessLocker ()
 
 fromXML (&$item, &$questionpool_id, &$tst_id, &$tst_object, &$question_counter, &$import_mapping)
 Receives parameters from a QTI parser and creates a valid ILIAS question object. More...
 
 toXML ($a_include_header=true, $a_include_binary=true, $a_shuffle=false, $test_output=false, $force_image_references=false)
 Returns a QTI xml representation of the question. More...
 
 isComplete ()
 Returns true, if a question is complete for use. More...
 
 questionTitleExists ($questionpool_id, $title)
 Returns TRUE if the question title exists in the database. More...
 
 setTitle ($title="")
 Sets the title string of the assQuestion object. More...
 
 setId ($id=-1)
 Sets the id of the assQuestion object. More...
 
 setTestId ($id=-1)
 Sets the test id of the assQuestion object. More...
 
 setComment ($comment="")
 Sets the comment string of the assQuestion object. More...
 
 setOutputType ($outputType=OUTPUT_HTML)
 Sets the output type. More...
 
 setShuffle ($shuffle=true)
 Sets the shuffle flag. More...
 
 setEstimatedWorkingTime ($hour=0, $min=0, $sec=0)
 Sets the estimated working time of a question from given hour, minute and second. More...
 
 setEstimatedWorkingTimeFromDurationString ($durationString)
 Sets the estimated working time of a question from a given datetime string. More...
 
 keyInArray ($searchkey, $array)
 returns TRUE if the key occurs in an array More...
 
 setAuthor ($author="")
 Sets the authors name of the assQuestion object. More...
 
 setOwner ($owner="")
 Sets the creator/owner ID of the assQuestion object. More...
 
 getTitle ()
 Gets the title string of the assQuestion object. More...
 
 getTitleFilenameCompliant ()
 returns the object title prepared to be used as a filename More...
 
 getId ()
 Gets the id of the assQuestion object. More...
 
 getShuffle ()
 Gets the shuffle flag. More...
 
 getTestId ()
 Gets the test id of the assQuestion object. More...
 
 getComment ()
 Gets the comment string of the assQuestion object. More...
 
 getOutputType ()
 Gets the output type. More...
 
 supportsJavascriptOutput ()
 Returns true if the question type supports JavaScript output. More...
 
 supportsNonJsOutput ()
 
 requiresJsSwitch ()
 
 getEstimatedWorkingTime ()
 Gets the estimated working time of a question. More...
 
 getAuthor ()
 Gets the authors name of the assQuestion object. More...
 
 getOwner ()
 Gets the creator/owner ID of the assQuestion object. More...
 
 getObjId ()
 Get the object id of the container object. More...
 
 setObjId ($obj_id=0)
 Set the object id of the container object. More...
 
 setExternalId ($external_id)
 
 getExternalId ()
 
 getSuggestedSolutionOutput ()
 
_getSuggestedSolution ($question_id, $subquestion_index=0)
 Returns a suggested solution for a given subquestion index. More...
 
 getSuggestedSolutions ()
 Return the suggested solutions. More...
 
 getReachedPoints ($active_id, $pass=null)
 Returns the points, a learner has reached answering the question This is the fast way to get the points directly from the database. More...
 
 getMaximumPoints ()
 Returns the maximum points, a learner can reach answering the question. More...
 
 getAdjustedReachedPoints ($active_id, $pass=null, $authorizedSolution=true)
 returns the reached points ... More...
 
 calculateResultsFromSolution ($active_id, $pass=null, $obligationsEnabled=false)
 Calculates the question results from a previously saved question solution. More...
 
 persistWorkingState ($active_id, $pass=null, $obligationsEnabled=false, $authorized=true)
 persists the working state for current testactive and testpass More...
 
 persistPreviewState (ilAssQuestionPreviewSession $previewSession)
 persists the preview state for current user and question More...
 
 validateSolutionSubmit ()
 
 saveWorkingData ($active_id, $pass=null, $authorized=true)
 Saves the learners input of the question to the database. More...
 
 moveUploadedMediaFile ($file, $name)
 Move an uploaded media file to an public accessible temp dir to present it. More...
 
 getSuggestedSolutionPath ()
 Returns the path for a suggested solution. More...
 
 getJavaPath ()
 Returns the image path for web accessable images of a question. More...
 
 getImagePath ($question_id=null, $object_id=null)
 Returns the image path for web accessable images of a question. More...
 
 buildImagePath ($questionId, $parentObjectId)
 
 getFlashPath ()
 Returns the image path for web accessable flash files of a question. More...
 
 getJavaPathWeb ()
 Returns the web image path for web accessable java applets of a question. More...
 
 getSuggestedSolutionPathWeb ()
 Returns the web path for a suggested solution. More...
 
 getImagePathWeb ()
 Returns the web image path for web accessable images of a question. More...
 
 getFlashPathWeb ()
 Returns the web image path for web accessable flash applications of a question. More...
 
 getTestOutputSolutions ($activeId, $pass)
 
 getUserSolutionPreferingIntermediate ($active_id, $pass=null)
 
 getSolutionValues ($active_id, $pass=null, $authorized=true)
 Loads solutions of a given user from the database an returns it. More...
 
 isInUse ($question_id="")
 Checks whether the question is in use or not. More...
 
 isClone ($question_id="")
 Checks whether the question is a clone of another question or not. More...
 
 pcArrayShuffle ($array)
 Shuffles the values of a given array. More...
 
 getAdditionalTableName ()
 Returns the name of the additional question data table in the database. More...
 
 getAnswerTableName ()
 Returns the name of the answer table in the database. More...
 
 deleteAnswers ($question_id)
 Deletes datasets from answers tables. More...
 
 deleteAdditionalTableData ($question_id)
 Deletes datasets from the additional question table in the database. More...
 
 delete ($question_id)
 Deletes a question and all materials from the database. More...
 
 getTotalAnswers ()
 get total number of answers More...
 
 _getTotalAnswers ($a_q_id)
 get number of answers for question id (static) note: do not use $this inside this method More...
 
 copyXHTMLMediaObjectsOfQuestion ($a_q_id)
 
 syncXHTMLMediaObjectsOfQuestion ()
 
 createPageObject ()
 create page object of question More...
 
 copyPageOfQuestion ($a_q_id)
 
 getPageOfQuestion ()
 
 setOriginalId ($original_id)
 
 getOriginalId ()
 
 fixSvgToPng ($imageFilenameContainingString)
 
 fixUnavailableSkinImageSources ($html)
 
 loadFromDb ($question_id)
 Loads the question from the database. More...
 
 createNewQuestion ($a_create_page=true)
 Creates a new question without an owner when a new question is created This assures that an ID is given to the question if a file upload or something else occurs. More...
 
 saveQuestionDataToDb ($original_id="")
 
 saveToDb ($original_id="")
 Saves the question to the database. More...
 
 setNewOriginalId ($newId)
 
 deleteSuggestedSolutions ()
 Deletes all suggestes solutions in the database. More...
 
 getSuggestedSolution ($subquestion_index=0)
 Returns a suggested solution for a given subquestion index. More...
 
 getSuggestedSolutionTitle ($subquestion_index=0)
 Returns the title of a suggested solution at a given subquestion_index. More...
 
 setSuggestedSolution ($solution_id="", $subquestion_index=0, $is_import=false)
 Sets a suggested solution for the question. More...
 
 _resolveInternalLink ($internal_link)
 
 _resolveIntLinks ($question_id)
 
 syncWithOriginal ()
 
 createRandomSolution ($test_id, $user_id)
 
 _questionExists ($question_id)
 Returns true if the question already exists in the database. More...
 
 _questionExistsInPool ($question_id)
 Returns true if the question already exists in the database and is assigned to a question pool. More...
 
 getPoints ()
 Returns the maximum available points for the question. More...
 
 setPoints ($a_points)
 Sets the maximum available points for the question. More...
 
 getSolutionMaxPass ($active_id)
 Returns the maximum pass a users question solution. More...
 
 calculateReachedPoints ($active_id, $pass=null, $authorizedSolution=true, $returndetails=false)
 Returns the points, a learner has reached answering the question. More...
 
 deductHintPointsFromReachedPoints (ilAssQuestionPreviewSession $previewSession, $reachedPoints)
 
 calculateReachedPointsFromPreviewSession (ilAssQuestionPreviewSession $previewSession)
 
 isPreviewSolutionCorrect (ilAssQuestionPreviewSession $previewSession)
 
 adjustReachedPointsByScoringOptions ($points, $active_id, $pass=null)
 Adjust the given reached points by checks for all special scoring options in the test container. More...
 
 isHTML ($a_text)
 Checks if a given string contains HTML or not. More...
 
 prepareTextareaOutput ($txt_output, $prepare_for_latex_output=false, $omitNl2BrWhenTextArea=false)
 Prepares a string for a text area output in tests. More...
 
 QTIMaterialToString ($a_material)
 Reads an QTI material tag an creates a text string. More...
 
 addQTIMaterial (&$a_xml_writer, $a_material, $close_material_tag=true, $add_mobs=true)
 Creates a QTI material tag from a plain text or xhtml text. More...
 
 buildHashedImageFilename ($plain_image_filename, $unique=false)
 
 getQuestion ()
 Gets the question string of the question object. More...
 
 setQuestion ($question="")
 Sets the question string of the question object. More...
 
 getQuestionType ()
 Returns the question type of the question. More...
 
 getQuestionTypeID ()
 Returns the question type of the question. More...
 
 cleanupMediaObjectUsage ()
 synchronises appearances of media objects in the question with media object usage table More...
 
getInstances ()
 Gets all instances of the question. More...
 
 getActiveUserData ($active_id)
 Returns the user id and the test id for a given active id. More...
 
 setExportDetailsXLS ($worksheet, $startrow, $active_id, $pass)
 Creates an Excel worksheet for the detailed cumulated results of this question. More...
 
 __get ($value)
 Object getter. More...
 
 __set ($key, $value)
 Object setter. More...
 
 getNrOfTries ()
 
 setNrOfTries ($a_nr_of_tries)
 
 setExportImagePath ($a_path)
 
 formatSAQuestion ($a_q)
 Format self assessment question. More...
 
 setPreventRteUsage ($a_val)
 Set prevent rte usage. More...
 
 getPreventRteUsage ()
 Get prevent rte usage. More...
 
 migrateContentForLearningModule (ilAssSelfAssessmentMigrator $migrator)
 
 setSelfAssessmentEditingMode ($a_selfassessmenteditingmode)
 Set Self-Assessment Editing Mode. More...
 
 getSelfAssessmentEditingMode ()
 Get Self-Assessment Editing Mode. More...
 
 setDefaultNrOfTries ($a_defaultnroftries)
 Set Default Nr of Tries. More...
 
 getDefaultNrOfTries ()
 Get Default Nr of Tries. More...
 
 syncSkillAssignments ($srcParentId, $srcQuestionId, $trgParentId, $trgQuestionId)
 
 isAnswered ($active_id, $pass=null)
 returns boolean wether the question is answered during test pass or not More...
 
 isAutosaveable ()
 
 getAdditionalContentEditingMode ()
 getter for additional content editing mode for this question More...
 
 setAdditionalContentEditingMode ($additinalContentEditingMode)
 setter for additional content editing mode for this question More...
 
 isAdditionalContentEditingModePageObject ()
 isser for additional "pageobject" content editing mode More...
 
 isValidAdditionalContentEditingMode ($additionalContentEditingMode)
 returns the fact wether the passed additional content mode is valid or not More...
 
 getValidAdditionalContentEditingModes ()
 getter for valid additional content editing modes More...
 
 addQuestionChangeListener (ilQuestionChangeListener $listener)
 
 getQuestionChangeListeners ()
 
 getHtmlUserSolutionPurifier ()
 
 getHtmlQuestionContentPurifier ()
 
 setLastChange ($lastChange)
 
 getLastChange ()
 
 removeIntermediateSolution ($active_id, $pass)
 
 removeCurrentSolution ($active_id, $pass, $authorized=true)
 
 saveCurrentSolution ($active_id, $pass, $value1, $value2, $authorized=true, $tstamp=null)
 
 updateCurrentSolution ($solutionId, $value1, $value2, $authorized=true)
 
 updateCurrentSolutionsAuthorization ($activeId, $pass, $authorized, $keepTime=false)
 
 setStep ($step)
 
 getStep ()
 
 toJSON ()
 
 duplicate ($for_test=true, $title="", $author="", $owner="", $testObjId=null)
 
 intermediateSolutionExists ($active_id, $pass)
 
 authorizedSolutionExists ($active_id, $pass)
 
 authorizedOrIntermediateSolutionExists ($active_id, $pass)
 
 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...
 
- Public Member Functions inherited from ilObjQuestionScoringAdjustable
 saveAdditionalQuestionDataToDb ()
 Saves a record to the question types additional data table. More...
 
- Public Member Functions inherited from iQuestionCondition
 getUserQuestionResult ($active_id, $pass)
 Get the user solution for a question by active_id and the test pass. More...
 

Data Fields

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)
 
 reworkWorkingData ($active_id, $pass, $obligationsAnswered, $authorized)
 {} More...
 
 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)
 
 reworkWorkingData ($active_id, $pass, $obligationsAnswered, $authorized)
 Reworks the allready saved working data if neccessary. More...
 
 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)
 
 deleteSolutionRecordByValues ($activeId, $passIndex, $authorized, $matchValues)
 
 duplicateIntermediateSolutionAuthorized ($activeId, $passIndex)
 
 forceExistingIntermediateSolution ($activeId, $passIndex, $considerDummyRecordCreation)
 
 buildTestPresentationConfig ()
 build basic test question configuration instance More...
 

Protected Attributes

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

Private Attributes

 $postSolutionOrderingElementList = null
 

Additional Inherited Members

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

Detailed Description

Class for ordering questions.

assOrderingQuestion is a class for ordering questions.

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

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

Constructor & Destructor Documentation

◆ __construct()

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

assOrderingQuestion constructor

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

Parameters
string$titleA title string to describe the question
string$commentA comment string to describe the question
string$authorA string containing the name of the questions author
integer$ownerA numerical ID to identify the owner/creator
string$questionThe question string of the ordering test
int$ordering_type

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

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

Member Function Documentation

◆ afterSyncWithOriginal()

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

{}

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

References duplicateImages().

1561  {
1562  parent::afterSyncWithOriginal($origQuestionId, $dupQuestionId, $origParentObjId, $dupParentObjId);
1563  $this->duplicateImages($dupQuestionId, $dupParentObjId, $origQuestionId, $origParentObjId);
1564  }
duplicateImages($src_question_id, $src_object_id, $dest_question_id, $dest_object_id)
+ Here is the call graph for this function:

◆ buildNestedOrderingElementInputGui()

assOrderingQuestion::buildNestedOrderingElementInputGui ( )
Returns
ilAssNestedOrderingElementsInputGUI

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

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

Referenced by buildOrderingElementInputGui(), and fetchSolutionListFromFormSubmissionData().

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

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

Referenced by buildNestedOrderingElementInputGui().

1690  {
1691  $formDataConverter = $this->buildOrderingElementFormDataConverter();
1693 
1694  if ($this->getOrderingType() == OQ_NESTED_PICTURES) {
1695  $formDataConverter->setImageRemovalCommand(self::ORDERING_ELEMENT_FORM_CMD_REMOVE_IMG);
1696  $formDataConverter->setImageUrlPath($this->getImagePathWeb());
1697 
1698  if ($this->getThumbSize() && $this->getThumbPrefix()) {
1699  $formDataConverter->setThumbnailPrefix($this->getThumbPrefix());
1700  }
1701  }
1702 
1703  return $formDataConverter;
1704  }
getOrderingType()
Returns the ordering question type.
getImagePathWeb()
Returns the web image path for web accessable images of a question.
const OQ_NESTED_PICTURES
+ 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 1649 of file class.assOrderingQuestion.php.

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

1650  {
1651  require_once 'Modules/TestQuestionPool/classes/forms/class.ilAssOrderingFormValuesObjectsConverter.php';
1652  $converter = new ilAssOrderingFormValuesObjectsConverter();
1653  $converter->setPostVar(self::ORDERING_ELEMENT_FORM_FIELD_POSTVAR);
1654 
1655  return $converter;
1656  }
+ Here is the caller graph for this function:

◆ buildOrderingElementInputGui()

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

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

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

Referenced by ilAssOrderingQuestionAuthoringFormGUI\renewOrderingElementInput().

1179  {
1180  switch ($this->getOrderingType()) {
1181  case OQ_TERMS:
1182 
1183  return $this->buildOrderingTextsInputGui();
1184 
1185  case OQ_PICTURES:
1186 
1187  return $this->buildOrderingImagesInputGui();
1188 
1189  case OQ_NESTED_TERMS:
1190  case OQ_NESTED_PICTURES:
1191 
1192  return $this->buildNestedOrderingElementInputGui();
1193 
1194  default:
1195  throw new ilTestQuestionPoolException('unknown ordering mode');
1196  }
1197  }
getOrderingType()
Returns the ordering question type.
const OQ_NESTED_TERMS
const OQ_PICTURES
Ordering question constants.
const OQ_TERMS
const OQ_NESTED_PICTURES
+ 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 1661 of file class.assOrderingQuestion.php.

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

Referenced by buildOrderingImagesInputGui().

1662  {
1663  $formDataConverter = $this->buildOrderingElementFormDataConverter();
1665 
1666  $formDataConverter->setImageRemovalCommand(self::ORDERING_ELEMENT_FORM_CMD_REMOVE_IMG);
1667  $formDataConverter->setImageUrlPath($this->getImagePathWeb());
1668  $formDataConverter->setImageFsPath($this->getImagePath());
1669 
1670  if ($this->getThumbSize() && $this->getThumbPrefix()) {
1671  $formDataConverter->setThumbnailPrefix($this->getThumbPrefix());
1672  }
1673  return $formDataConverter;
1674  }
getImagePathWeb()
Returns the web image path for web accessable images of a question.
getImagePath($question_id=null, $object_id=null)
Returns the image path for web accessable images of a question.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildOrderingImagesInputGui()

assOrderingQuestion::buildOrderingImagesInputGui ( )
Returns
ilAssOrderingImagesInputGUI

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

References buildOrderingImagesFormDataConverter(), and initOrderingElementFormFieldLabels().

Referenced by buildOrderingElementInputGui().

1254  {
1255  $formDataConverter = $this->buildOrderingImagesFormDataConverter();
1256 
1257  require_once 'Modules/TestQuestionPool/classes/forms/class.ilAssOrderingImagesInputGUI.php';
1258 
1259  $orderingElementInput = new ilAssOrderingImagesInputGUI(
1260  $formDataConverter,
1261  self::ORDERING_ELEMENT_FORM_FIELD_POSTVAR
1262  );
1263 
1264  $orderingElementInput->setImageRemovalCommand(self::ORDERING_ELEMENT_FORM_CMD_REMOVE_IMG);
1265  $orderingElementInput->setImageUploadCommand(self::ORDERING_ELEMENT_FORM_CMD_UPLOAD_IMG);
1266 
1267  $this->initOrderingElementFormFieldLabels($orderingElementInput);
1268 
1269  return $orderingElementInput;
1270  }
initOrderingElementFormFieldLabels(ilFormPropertyGUI $formField)
+ 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 1679 of file class.assOrderingQuestion.php.

References buildOrderingElementFormDataConverter(), and ilAssOrderingFormValuesObjectsConverter\CONTEXT_MAINTAIN_ELEMENT_TEXT.

Referenced by buildOrderingTextsInputGui().

1680  {
1681  $formDataConverter = $this->buildOrderingElementFormDataConverter();
1683  return $formDataConverter;
1684  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildOrderingTextsInputGui()

assOrderingQuestion::buildOrderingTextsInputGui ( )
Returns
ilAssOrderingTextsInputGUI

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

References buildOrderingTextsFormDataConverter(), and initOrderingElementFormFieldLabels().

Referenced by buildOrderingElementInputGui().

1235  {
1236  $formDataConverter = $this->buildOrderingTextsFormDataConverter();
1237 
1238  require_once 'Modules/TestQuestionPool/classes/forms/class.ilAssOrderingTextsInputGUI.php';
1239 
1240  $orderingElementInput = new ilAssOrderingTextsInputGUI(
1241  $formDataConverter,
1242  self::ORDERING_ELEMENT_FORM_FIELD_POSTVAR
1243  );
1244 
1245  $this->initOrderingElementFormFieldLabels($orderingElementInput);
1246 
1247  return $orderingElementInput;
1248  }
initOrderingElementFormFieldLabels(ilFormPropertyGUI $formField)
+ 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

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

1574  {
1575  // hey: refactored identifiers
1576  return parent::buildTestPresentationConfig()
1577  // hey.
1578  ->setIsUnchangedAnswerPossible(true)
1579  ->setUseUnchangedAnswerLabel($this->lng->txt('tst_unchanged_order_is_correct'));
1580  }

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

public

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

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

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

Referenced by getExpressionTypes().

656  {
657  if ($returndetails) {
658  throw new ilTestException('return details not implemented for ' . __METHOD__);
659  }
660 
661  if (is_null($pass)) {
662  $pass = $this->getSolutionMaxPass($active_id);
663  }
664 
665  $solutionValuePairs = $this->getSolutionValues($active_id, $pass, $authorizedSolution);
666 
667  if (!count($solutionValuePairs)) {
668  return 0;
669  }
670 
671  $indexedSolutionValues = $this->fetchIndexedValuesFromValuePairs($solutionValuePairs);
672  $solutionOrderingElementList = $this->getSolutionOrderingElementList($indexedSolutionValues);
673 
674  return $this->calculateReachedPointsForSolution($solutionOrderingElementList);
675  }
calculateReachedPointsForSolution(ilAssOrderingElementList $solutionOrderingElementList)
getSolutionOrderingElementList($indexedSolutionValues)
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.
Base Exception for all Exceptions relating to Modules/Test.
fetchIndexedValuesFromValuePairs(array $valuePairs)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calculateReachedPointsForSolution()

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

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

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

Referenced by calculateReachedPoints(), and calculateReachedPointsFromPreviewSession().

1375  {
1376  $reachedPoints = $this->getPoints();
1377 
1378  foreach ($this->getOrderingElementList() as $correctElement) {
1379  $userElement = $solutionOrderingElementList->getElementByPosition($correctElement->getPosition());
1380 
1381  if (!$correctElement->isSameElement($userElement)) {
1382  $reachedPoints = 0;
1383  break;
1384  }
1385  }
1386 
1387  return $reachedPoints;
1388  }
getPoints()
Returns the maximum available points for the question.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calculateReachedPointsFromPreviewSession()

assOrderingQuestion::calculateReachedPointsFromPreviewSession ( ilAssQuestionPreviewSession  $previewSession)

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

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

678  {
679  if (!$previewSession->hasParticipantSolution()) {
680  return 0;
681  }
682 
683  $solutionOrderingElementList = unserialize(
684  $previewSession->getParticipantsSolution()
685  );
686 
687  $reachedPoints = $this->calculateReachedPointsForSolution($solutionOrderingElementList);
688  $reachedPoints = $this->deductHintPointsFromReachedPoints($previewSession, $reachedPoints);
689 
690  return $this->ensureNonNegativePoints($reachedPoints);
691  }
calculateReachedPointsForSolution(ilAssOrderingElementList $solutionOrderingElementList)
ensureNonNegativePoints($points)
deductHintPointsFromReachedPoints(ilAssQuestionPreviewSession $previewSession, $reachedPoints)
+ Here is the call graph for this function:

◆ cleanImagefiles()

assOrderingQuestion::cleanImagefiles ( )
protected

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

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

Referenced by saveAnswerSpecificDataToDb().

722  {
723  if ($this->getOrderingType() == OQ_PICTURES) {
724  if (@file_exists($this->getImagePath())) {
726  foreach ($contents as $f) {
727  if (strcmp($f['type'], 'file') == 0) {
728  $found = false;
729  foreach ($this->getOrderingElementList() as $orderElement) {
730  if (strcmp($f['entry'], $orderElement->getContent()) == 0) {
731  $found = true;
732  }
733  if (strcmp($f['entry'], $this->getThumbPrefix() . $orderElement->getContent()) == 0) {
734  $found = true;
735  }
736  }
737  if (!$found) {
738  if (@file_exists($this->getImagePath() . $f['entry'])) {
739  @unlink($this->getImagePath() . $f['entry']);
740  }
741  }
742  }
743  }
744  }
745  } else {
746  if (@file_exists($this->getImagePath())) {
747  ilUtil::delDir($this->getImagePath());
748  }
749  }
750  }
getOrderingType()
Returns the ordering question type.
static getDir($a_dir, $a_rec=false, $a_sub_dir="")
get directory
getImagePath($question_id=null, $object_id=null)
Returns the image path for web accessable images of a question.
const OQ_PICTURES
Ordering question constants.
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
+ 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 343 of file class.assOrderingQuestion.php.

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

344  {
345  global $ilLog;
346  if ($this->getOrderingType() == OQ_PICTURES) {
347  $imagepath = $this->getImagePath();
348  $imagepath_original = str_replace("/$this->id/images", "/$question_id/images", $imagepath);
349  $imagepath_original = str_replace("/$this->obj_id/", "/$source_questionpool/", $imagepath_original);
350  if (!file_exists($imagepath)) {
351  ilUtil::makeDirParents($imagepath);
352  }
353  foreach ($this->getOrderingElementList() as $element) {
354  $filename = $element->getContent();
355  if (!@copy($imagepath_original . $filename, $imagepath . $filename)) {
356  $ilLog->write("Ordering Question image could not be copied: ${imagepath_original}${filename}");
357  }
358  if (@file_exists($imagepath_original . $this->getThumbPrefix() . $filename)) {
359  if (!@copy($imagepath_original . $this->getThumbPrefix() . $filename, $imagepath . $this->getThumbPrefix() . $filename)) {
360  $ilLog->write("Ordering Question image thumbnail could not be copied: $imagepath_original" . $this->getThumbPrefix() . $filename);
361  }
362  }
363  }
364  }
365  }
static makeDirParents($a_dir)
Create a new directory and all parent directories.
getOrderingType()
Returns the ordering question type.
getImagePath($question_id=null, $object_id=null)
Returns the image path for web accessable images of a question.
const OQ_PICTURES
Ordering question constants.
+ Here is the call graph for this function:

◆ copyObject()

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

Copies an assOrderingQuestion object.

public

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

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

249  {
250  if ($this->id <= 0) {
251  // The question has not been saved. It cannot be duplicated
252  return;
253  }
254  // duplicate the question in database
255  $clone = $this;
256  include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
258  $clone->id = -1;
259  $source_questionpool_id = $this->getObjId();
260  $clone->setObjId($target_questionpool_id);
261  if ($title) {
262  $clone->setTitle($title);
263  }
264 
265  $clone->saveToDb();
266 
267  // copy question page content
268  $clone->copyPageOfQuestion($original_id);
269  // copy XHTML media objects
270  $clone->copyXHTMLMediaObjectsOfQuestion($original_id);
271  // duplicate the image
272  $clone->duplicateImages($original_id, $source_questionpool_id, $clone->getId(), $target_questionpool_id);
273 
274  $clone->onCopy($source_questionpool_id, $original_id, $clone->getObjId(), $clone->getId());
275 
276  return $clone->id;
277  }
static _getOriginalId($question_id)
Returns the original id of a question.
getObjId()
Get the object id of the container object.
+ Here is the call graph for this function:

◆ createImageThumbnail()

assOrderingQuestion::createImageThumbnail ( ilAssOrderingElement  $element)

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

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

Referenced by handleThumbnailCreation().

829  {
830  if ($this->getThumbGeometry()) {
831  $imageFile = $this->getImagePath() . $element->getContent();
832  $thumbFile = $this->getImagePath() . $this->getThumbPrefix() . $element->getContent();
833 
834  ilUtil::convertImage($imageFile, $thumbFile, "JPEG", $this->getThumbGeometry());
835  }
836  }
getImagePath($question_id=null, $object_id=null)
Returns the image path for web accessable images of a question.
static convertImage( $a_from, $a_to, $a_target_format="", $a_geometry="", $a_background_color="")
convert image
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createNewOriginalFromThisDuplicate()

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

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

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

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

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

References getOrderingElementList().

626  {
627  $this->getOrderingElementList()->removeElement(
628  $this->getOrderingElementList()->getElementByRandomIdentifier($randomIdentifier)
629  );
630  $this->getOrderingElementList()->saveToDb();
631  }
+ Here is the call graph for this function:

◆ dropImageFile()

assOrderingQuestion::dropImageFile (   $imageFilename)

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

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

759  {
760  if (!strlen($imageFilename)) {
761  return false;
762  }
763 
764  $result = @unlink($this->getImagePath() . $imageFilename);
765  $result = $result & @unlink($this->getImagePath() . $this->getThumbPrefix() . $imageFilename);
766 
767  return $result;
768  }
$result
getImagePath($question_id=null, $object_id=null)
Returns the image path for web accessable images of a question.
+ Here is the call graph for this function:

◆ duplicate()

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

Duplicates an assOrderingQuestion.

public

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

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

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

◆ duplicateImages()

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

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

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

Referenced by afterSyncWithOriginal().

315  {
316  global $ilLog;
317  if ($this->getOrderingType() == OQ_PICTURES || $this->getOrderingType() == OQ_NESTED_PICTURES) {
318  $imagepath_original = $this->getImagePath($src_question_id, $src_object_id);
319  $imagepath = $this->getImagePath($dest_question_id, $dest_object_id);
320 
321  if (!file_exists($imagepath)) {
322  ilUtil::makeDirParents($imagepath);
323  }
324  foreach ($this->getOrderingElementList() as $element) {
325  $filename = $element->getContent();
326  if (!@copy($imagepath_original . $filename, $imagepath . $filename)) {
327  $ilLog->write("image could not be duplicated!!!!");
328  }
329  if (@file_exists($imagepath_original . $this->getThumbPrefix() . $filename)) {
330  if (!@copy($imagepath_original . $this->getThumbPrefix() . $filename, $imagepath . $this->getThumbPrefix() . $filename)) {
331  $ilLog->write("image thumbnail could not be duplicated!!!!");
332  }
333  }
334  }
335  }
336  }
static makeDirParents($a_dir)
Create a new directory and all parent directories.
getOrderingType()
Returns the ordering question type.
getImagePath($question_id=null, $object_id=null)
Returns the image path for web accessable images of a question.
const OQ_PICTURES
Ordering question constants.
const OQ_NESTED_PICTURES
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ duplicateOrderlingElementList()

assOrderingQuestion::duplicateOrderlingElementList ( )
protected

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

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

237  {
238  $this->getOrderingElementList()->setQuestionId($this->getId());
239  $this->getOrderingElementList()->distributeNewRandomIdentifiers();
240  $this->getOrderingElementList()->saveToDb();
241  }
getId()
Gets the id of the assQuestion object.
+ Here is the call graph for this function:

◆ ensureImagePathExists()

assOrderingQuestion::ensureImagePathExists ( )
protected

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

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

Referenced by storeImageFile().

1584  {
1585  if (!file_exists($this->getImagePath())) {
1587  }
1588  }
static makeDirParents($a_dir)
Create a new directory and all parent directories.
getImagePath($question_id=null, $object_id=null)
Returns the image path for web accessable images of a question.
+ 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 1310 of file class.assOrderingQuestion.php.

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

Referenced by getSolutionListFromPostSubmit(), and getSolutionOrderingElementListForTestOutput().

1311  {
1312  $orderingGUI = $this->buildNestedOrderingElementInputGui();
1314  $orderingGUI->setValueByArray($userSolutionPost);
1315 
1316  if (!$orderingGUI->checkInput()) {
1317  require_once 'Modules/Test/exceptions/class.ilTestException.php';
1318  throw new ilTestException('error on validating user solution post');
1319  }
1320 
1321  require_once 'Modules/TestQuestionPool/classes/questions/class.ilAssOrderingElementList.php';
1322  $solutionOrderingElementList = ilAssOrderingElementList::buildInstance($this->getId());
1323 
1324  $storedElementList = $this->getOrderingElementList();
1325 
1326  foreach ($orderingGUI->getElementList($this->getId()) as $submittedElement) {
1327  $solutionElement = $storedElementList->getElementByRandomIdentifier(
1328  $submittedElement->getRandomIdentifier()
1329  )->getClone();
1330 
1331  $solutionElement->setPosition($submittedElement->getPosition());
1332 
1333  if ($this->isOrderingTypeNested()) {
1334  $solutionElement->setIndentation($submittedElement->getIndentation());
1335  }
1336 
1337  $solutionOrderingElementList->addElement($solutionElement);
1338  }
1339 
1340  return $solutionOrderingElementList;
1341  }
getId()
Gets the id of the assQuestion object.
static buildInstance($questionId, $orderingElements=array())
Base Exception for all Exceptions relating to Modules/Test.
+ 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 1300 of file class.assOrderingQuestion.php.

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

1301  {
1302  return $form->getItemByPostVar(self::ORDERING_ELEMENT_FORM_FIELD_POSTVAR)->getElementList($this->getId());
1303  }
getId()
Gets the id of the assQuestion object.
getItemByPostVar($a_post_var)
Get Item by POST variable.
+ Here is the call graph for this function:

◆ fetchSolutionSubmit()

assOrderingQuestion::fetchSolutionSubmit (   $formSubmissionDataStructure)
Returns
array

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

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

Referenced by getSolutionPostSubmit().

1594  {
1595  $solutionSubmit = array();
1596 
1597  if (isset($formSubmissionDataStructure['orderresult'])) {
1598  $orderresult = $formSubmissionDataStructure['orderresult'];
1599 
1600  if (strlen($orderresult)) {
1601  $orderarray = explode(":", $orderresult);
1602  $ordervalue = 1;
1603  foreach ($orderarray as $index) {
1604  $idmatch = null;
1605  if (preg_match("/id_(\\d+)/", $index, $idmatch)) {
1606  $randomid = $idmatch[1];
1607  foreach ($this->getOrderingElementList() as $answeridx => $answer) {
1608  if ($answer->getRandomIdentifier() == $randomid) {
1609  $solutionSubmit[$answeridx] = $ordervalue;
1610  $ordervalue++;
1611  }
1612  }
1613  }
1614  }
1615  }
1616  } elseif ($this->getOrderingType() == OQ_NESTED_TERMS || $this->getOrderingType() == OQ_NESTED_PICTURES) {
1617  $index = 0;
1618  foreach ($formSubmissionDataStructure['content'] as $randomId => $content) {
1619  $indentation = $formSubmissionDataStructure['indentation'];
1620 
1621  $value1 = $index++;
1622  $value2 = implode(':', array($randomId, $indentation));
1623 
1624  $solutionSubmit[$value1] = $value2;
1625  }
1626  } else {
1627  foreach ($formSubmissionDataStructure as $key => $value) {
1628  $matches = null;
1629  if (preg_match("/^order_(\d+)/", $key, $matches)) {
1630  if (!(preg_match("/initial_value_\d+/", $value))) {
1631  if (strlen($value)) {
1632  foreach ($this->getOrderingElementList() as $answeridx => $answer) {
1633  if ($answer->getRandomIdentifier() == $matches[1]) {
1634  $solutionSubmit[$answeridx] = $value;
1635  }
1636  }
1637  }
1638  }
1639  }
1640  }
1641  }
1642 
1643  return $solutionSubmit;
1644  }
getOrderingType()
Returns the ordering question type.
const OQ_NESTED_TERMS
$index
Definition: metadata.php:60
Create styles array
The data for the language used.
const OQ_NESTED_PICTURES
$key
Definition: croninfo.php:18
+ 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 1108 of file class.assOrderingQuestion.php.

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

Referenced by rebuildThumbnails().

1109  {
1110  $filename = $path . $file;
1111  if (@file_exists($filename)) {
1112  $thumbpath = $path . $this->getThumbPrefix() . $file;
1113  $path_info = @pathinfo($filename);
1114  $ext = "";
1115  switch (strtoupper($path_info['extension'])) {
1116  case 'PNG':
1117  $ext = 'PNG';
1118  break;
1119  case 'GIF':
1120  $ext = 'GIF';
1121  break;
1122  default:
1123  $ext = 'JPEG';
1124  break;
1125  }
1126  ilUtil::convertImage($filename, $thumbpath, $ext, $this->getThumbGeometry());
1127  }
1128  }
static convertImage( $a_from, $a_to, $a_target_format="", $a_geometry="", $a_background_color="")
convert image
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
+ 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 public

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

Referenced by loadFromDb(), and savePreviewData().

961  {
962  return "qpl_qst_ordering";
963  }
+ 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 608 of file class.assOrderingQuestion.php.

References $index, and getOrderingElementList().

609  {
610  if (!$this->getOrderingElementList()->elementExistByPosition($index)) {
611  return null;
612  }
613 
614  return $this->getOrderingElementList()->getElementByPosition($index);
615  }
$index
Definition: metadata.php:60
+ 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 public
See also
$answers

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

References getOrderingElementList().

641  {
642  return $this->getOrderingElementList()->countElements();
643  }
+ 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 public

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

972  {
973  return "qpl_a_ordering";
974  }

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

References $index, and getOrderingElementList().

1549  {
1550  if ($index !== null) {
1551  return $this->getOrderingElementList()->getElementByPosition($index);
1552  }
1553 
1554  return $this->getOrderingElementList()->getElements();
1555  }
$index
Definition: metadata.php:60
+ Here is the call graph for this function:

◆ getElementHeight()

assOrderingQuestion::getElementHeight ( )

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

References $element_height.

Referenced by savePreviewData().

1077  {
1078  return $this->element_height;
1079  }
+ Here is the caller graph for this function:

◆ getEncryptedFilename()

assOrderingQuestion::getEncryptedFilename (   $filename)

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

References $filename.

713  {
714  $extension = "";
715  if (preg_match("/.*\\.(\\w+)$/", $filename, $matches)) {
716  $extension = $matches[1];
717  }
718  return md5($filename) . "." . $extension;
719  }

◆ getExpressionTypes()

assOrderingQuestion::getExpressionTypes ( )

◆ getLeveledOrdering()

assOrderingQuestion::getLeveledOrdering ( )

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

References $leveled_ordering.

1396  {
1397  return $this->leveled_ordering;
1398  }

◆ getMaximumPoints()

assOrderingQuestion::getMaximumPoints ( )

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

Returns
double Points
See also
$points

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

References assQuestion\getPoints().

Referenced by getExpressionTypes(), and isComplete().

700  {
701  return $this->getPoints();
702  }
getPoints()
Returns the maximum available points for the question.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getOldLeveledOrdering()

assOrderingQuestion::getOldLeveledOrdering ( )

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

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

1401  {
1402  global $ilDB;
1403 
1404  $res = $ilDB->queryF(
1405  'SELECT depth FROM qpl_a_ordering WHERE question_fi = %s ORDER BY position ASC',
1406  array('integer'),
1407  array($this->getId())
1408  );
1409  while ($row = $ilDB->fetchAssoc($res)) {
1410  $this->old_ordering_depth[] = $row['depth'];
1411  }
1413  }
getId()
Gets the id of the assQuestion object.
foreach($_POST as $key=> $value) $res
Create styles array
The data for the language used.
global $ilDB
+ 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 1456 of file class.assOrderingQuestion.php.

References ilOperatorsExpressionMapping\getOperatorsByExpression().

1457  {
1458  require_once "./Modules/TestQuestionPool/classes/class.ilOperatorsExpressionMapping.php";
1460  }
+ 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 995 of file class.assOrderingQuestion.php.

References getOrderingElementList().

Referenced by rebuildThumbnails().

996  {
997  return $this->getOrderingElementList()->getRandomIdentifierIndexedElements();
998  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getOrderingElementList()

◆ getOrderingElementListForSolutionOutput()

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

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

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

413  {
414  if ($forceCorrectSolution || !$activeId || $passIndex === null) {
415  return $this->getOrderingElementList();
416  }
417 
418  $solutionValues = $this->getSolutionValues($activeId, $passIndex);
419 
420  if (!count($solutionValues)) {
421  return $this->getShuffledOrderingElementList();
422  }
423 
424  return $this->getSolutionOrderingElementList($this->fetchIndexedValuesFromValuePairs($solutionValues));
425  }
getSolutionOrderingElementList($indexedSolutionValues)
getSolutionValues($active_id, $pass=null, $authorized=true)
Loads solutions of a given user from the database an returns it.
fetchIndexedValuesFromValuePairs(array $valuePairs)
+ Here is the call graph for this function:

◆ getOrderingType()

◆ getQuestionType()

assOrderingQuestion::getQuestionType ( )

Returns the question type of the question.

Returns
integer The question type of the question public

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

Referenced by toJSON().

950  {
951  return "assOrderingQuestion";
952  }
+ 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.

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

References $text, and getOrderingElementList().

981  {
982  $text = parent::getRTETextWithMediaObjects();
983 
984  foreach ($this->getOrderingElementList() as $orderingElement) {
985  $text .= $orderingElement->getContent();
986  }
987 
988  return $text;
989  }
$text
Definition: errorreport.php:18
+ Here is the call graph for this function:

◆ getShuffledOrderingElementList()

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

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

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

Referenced by getOrderingElementListForSolutionOutput(), and getSolutionOrderingElementListForTestOutput().

536  {
537  $shuffledRandomIdentifierIndex = $this->getShuffler()->shuffle(
538  $this->getOrderingElementList()->getRandomIdentifierIndex()
539  );
540 
541  $shuffledElementList = $this->getOrderingElementList()->getClone();
542  $shuffledElementList->reorderByRandomIdentifiers($shuffledRandomIdentifierIndex);
543  $shuffledElementList->resetElementsIndentations();
544 
545  return $shuffledElementList;
546  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSolutionListFromPostSubmit()

assOrderingQuestion::getSolutionListFromPostSubmit ( )
Returns
ilAssOrderingElementList

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

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

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

1352  {
1353  if ($this->postSolutionOrderingElementList === null) {
1355  $this->postSolutionOrderingElementList = $list;
1356  }
1357 
1359  }
fetchSolutionListFromFormSubmissionData($userSolutionPost)
if(isset($_REQUEST['delete'])) $list
Definition: registry.php:41
$_POST["username"]
+ 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 508 of file class.assOrderingQuestion.php.

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

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

509  {
510  $solutionOrderingList = new ilAssOrderingElementList();
511  $solutionOrderingList->setQuestionId($this->getId());
512 
513  foreach ($indexedSolutionValues as $value1 => $value2) {
514  if ($this->isOrderingTypeNested()) {
515  $element = $this->getSolutionValuePairBrandedOrderingElementByRandomIdentifier($value1, $value2);
516  } else {
517  $element = $this->getSolutionValuePairBrandedOrderingElementBySolutionIdentifier($value1, $value2);
518  }
519 
520  $solutionOrderingList->addElement($element);
521  }
522 
523  if (!$this->getOrderingElementList()->hasSameElementSetByRandomIdentifiers($solutionOrderingList)) {
524  throw new ilTestQuestionPoolException('inconsistent solution values given');
525  }
526 
527  return $solutionOrderingList;
528  }
getId()
Gets the id of the assQuestion object.
getSolutionValuePairBrandedOrderingElementBySolutionIdentifier($value1, $value2)
getSolutionValuePairBrandedOrderingElementByRandomIdentifier($value1, $value2)
+ 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 436 of file class.assOrderingQuestion.php.

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

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

◆ getSolutionPostSubmit()

assOrderingQuestion::getSolutionPostSubmit ( )
Returns
array

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

References $_POST, and fetchSolutionSubmit().

1365  {
1366  return $this->fetchSolutionSubmit($_POST);
1367  }
fetchSolutionSubmit($formSubmissionDataStructure)
$_POST["username"]
+ Here is the call graph for this function:

◆ getSolutionValuePairBrandedOrderingElementByRandomIdentifier()

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

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

References getOrderingElementList().

Referenced by getSolutionOrderingElementList().

469  {
470  $value2 = explode(':', $value2);
471 
472  $randomIdentifier = $value2[0];
473  $selectedPosition = $value1;
474  $selectedIndentation = $value2[1];
475 
476  $element = $this->getOrderingElementList()->getElementByRandomIdentifier($randomIdentifier)->getClone();
477 
478  $element->setPosition($selectedPosition);
479  $element->setIndentation($selectedIndentation);
480 
481  return $element;
482  }
+ 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 489 of file class.assOrderingQuestion.php.

References getOrderingElementList().

Referenced by getSolutionOrderingElementList().

490  {
491  $solutionIdentifier = $value1;
492  $selectedPosition = ($value2 - 1);
493  $selectedIndentation = 0;
494 
495  $element = $this->getOrderingElementList()->getElementBySolutionIdentifier($solutionIdentifier)->getClone();
496 
497  $element->setPosition($selectedPosition);
498  $element->setIndentation($selectedIndentation);
499 
500  return $element;
501  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getThumbGeometry()

assOrderingQuestion::getThumbGeometry ( )

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

References $thumb_geometry.

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

1052  {
1053  return $this->thumb_geometry;
1054  }
+ Here is the caller graph for this function:

◆ getThumbPrefix()

assOrderingQuestion::getThumbPrefix ( )

◆ getThumbSize()

assOrderingQuestion::getThumbSize ( )

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

References getThumbGeometry().

Referenced by buildNestedOrderingFormDataConverter(), and buildOrderingImagesFormDataConverter().

1057  {
1058  return $this->getThumbGeometry();
1059  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleThumbnailCreation()

assOrderingQuestion::handleThumbnailCreation ( ilAssOrderingElementList  $elementList)

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

References createImageThumbnail().

822  {
823  foreach ($elementList as $element) {
824  $this->createImageThumbnail($element);
825  }
826  }
createImageThumbnail(ilAssOrderingElement $element)
+ Here is the call graph for this function:

◆ hasOrderingTypeUploadSupport()

assOrderingQuestion::hasOrderingTypeUploadSupport ( )

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

References getOrderingType(), and OQ_PICTURES.

Referenced by isImageReplaced(), and saveAnswerSpecificDataToDb().

402  {
403  return $this->getOrderingType() == OQ_PICTURES;
404  }
getOrderingType()
Returns the ordering question type.
const OQ_PICTURES
Ordering question constants.
+ 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 1202 of file class.assOrderingQuestion.php.

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

Referenced by ilAssOrderingQuestionAuthoringFormGUI\renewOrderingElementInput().

1203  {
1204  switch (true) {
1205  case $formField instanceof ilAssNestedOrderingElementsInputGUI:
1206 
1207  $formField->setInteractionEnabled(true);
1208  $formField->setNestingEnabled($this->isOrderingTypeNested());
1209  break;
1210 
1211  case $formField instanceof ilAssOrderingTextsInputGUI:
1212  case $formField instanceof ilAssOrderingImagesInputGUI:
1213  default:
1214 
1215  $formField->setEditElementOccuranceEnabled(true);
1216  $formField->setEditElementOrderEnabled(true);
1217  }
1218 
1219  $formField->setRequired(true);
1220  }
setRequired($a_required)
Set Required.
+ 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 1225 of file class.assOrderingQuestion.php.

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

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

1226  {
1227  $formField->setInfo($this->lng->txt('ordering_answer_sequence_info'));
1228  $formField->setTitle($this->lng->txt('answers'));
1229  }
setInfo($a_info)
Set Information Text.
setTitle($a_title)
Set Title.
+ 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

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

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

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  }
getAuthor()
Gets the authors name of the assQuestion object.
getQuestion()
Gets the question string of the question object.
getTitle()
Gets the title string of the assQuestion object.
getMaximumPoints()
Returns the maximum points, a learner can reach answering the question.
+ Here is the call graph for this function:

◆ isImageFileStored()

assOrderingQuestion::isImageFileStored (   $imageFilename)

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

References assQuestion\getImagePath().

771  {
772  if (!strlen($imageFilename)) {
773  return false;
774  }
775 
776  if (!file_exists($this->getImagePath() . $imageFilename)) {
777  return false;
778  }
779 
780  return is_file($this->getImagePath() . $imageFilename);
781  }
getImagePath($question_id=null, $object_id=null)
Returns the image path for web accessable images of a question.
+ Here is the call graph for this function:

◆ isImageOrderingType()

assOrderingQuestion::isImageOrderingType ( )

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

References array, getOrderingType(), OQ_NESTED_PICTURES, and OQ_PICTURES.

397  {
398  return in_array($this->getOrderingType(), array(OQ_PICTURES, OQ_NESTED_PICTURES));
399  }
getOrderingType()
Returns the ordering question type.
const OQ_PICTURES
Ordering question constants.
Create styles array
The data for the language used.
const OQ_NESTED_PICTURES
+ Here is the call graph for this function:

◆ isImageReplaced()

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

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

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

784  {
785  if (!$this->hasOrderingTypeUploadSupport()) {
786  return false;
787  }
788 
789  if (!$newElement->getContent()) {
790  return false;
791  }
792 
793  return $newElement->getContent() != $oldElement->getContent();
794  }
+ Here is the call graph for this function:

◆ isOrderingTypeNested()

assOrderingQuestion::isOrderingTypeNested ( )

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

References array, getOrderingType(), OQ_NESTED_PICTURES, and OQ_NESTED_TERMS.

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

392  {
393  return in_array($this->getOrderingType(), array(OQ_NESTED_TERMS, OQ_NESTED_PICTURES));
394  }
getOrderingType()
Returns the ordering question type.
const OQ_NESTED_TERMS
Create styles array
The data for the language used.
const OQ_NESTED_PICTURES
+ 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 public

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

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

145  {
146  global $ilDB;
147 
148  $result = $ilDB->queryF(
149  "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",
150  array("integer"),
151  array($question_id)
152  );
153  if ($result->numRows() == 1) {
154  $data = $ilDB->fetchAssoc($result);
155  $this->setId($question_id);
156  $this->setObjId($data["obj_fi"]);
157  $this->setTitle($data["title"]);
158  $this->setComment($data["description"]);
159  $this->setOriginalId($data["original_id"]);
160  $this->setAuthor($data["author"]);
161  $this->setNrOfTries($data['nr_of_tries']);
162  $this->setPoints($data["points"]);
163  $this->setOwner($data["owner"]);
164  include_once("./Services/RTE/classes/class.ilRTE.php");
165  $this->setQuestion(ilRTE::_replaceMediaObjectImageSrc($data["question_text"], 1));
166  $this->ordering_type = strlen($data["ordering_type"]) ? $data["ordering_type"] : OQ_TERMS;
167  $this->thumb_geometry = $data["thumb_geometry"];
168  $this->element_height = $data["element_height"];
169  $this->setEstimatedWorkingTime(substr($data["working_time"], 0, 2), substr($data["working_time"], 3, 2), substr($data["working_time"], 6, 2));
170 
171  try {
172  $this->setAdditionalContentEditingMode($data['add_cont_edit_mode']);
173  } catch (ilTestQuestionPoolException $e) {
174  }
175  }
176 
177  $this->orderingElementList->setQuestionId($this->getId());
178  $this->orderingElementList->loadFromDb();
179 
180  parent::loadFromDb($question_id);
181  }
getId()
Gets the id of the assQuestion object.
$result
setId($id=-1)
Sets the id of the assQuestion object.
setEstimatedWorkingTime($hour=0, $min=0, $sec=0)
Sets the estimated working time of a question from given hour, minute and second. ...
setNrOfTries($a_nr_of_tries)
setAdditionalContentEditingMode($additinalContentEditingMode)
setter for additional content editing mode for this question
static _replaceMediaObjectImageSrc($a_text, $a_direction=0, $nic=IL_INST_ID)
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
setAuthor($author="")
Sets the authors name of the assQuestion object.
Create styles array
The data for the language used.
setPoints($a_points)
Sets the maximum available points for the question.
const OQ_TERMS
setQuestion($question="")
Sets the question string of the question object.
global $ilDB
setOriginalId($original_id)
setTitle($title="")
Sets the title string of the assQuestion object.
setObjId($obj_id=0)
Set the object id of the container object.
setComment($comment="")
Sets the comment string of the assQuestion object.
getAdditionalTableName()
Returns the name of the additional question data table in the database.
setOwner($owner="")
Sets the creator/owner ID of the assQuestion object.
+ Here is the call graph for this function:

◆ lookupSolutionOrderByRandomid()

assOrderingQuestion::lookupSolutionOrderByRandomid (   $a_random_id)

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

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

1420  {
1421  global $ilDB;
1422 
1423  $res = $ilDB->queryF(
1424  'SELECT solution_key FROM qpl_a_ordering WHERE random_id = %s',
1425  array('integer'),
1426  array($a_random_id)
1427  );
1428  $row = $ilDB->fetchAssoc($res);
1429 
1430  return $row['solution_key'];
1431  }
foreach($_POST as $key=> $value) $res
Create styles array
The data for the language used.
global $ilDB

◆ moveAnswerDown()

assOrderingQuestion::moveAnswerDown (   $position)
Parameters
$positionTODO: still in use? should not since element moving is js supported!?

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

References getOrderingElementList().

588  {
589  if (!$this->getOrderingElementList()->elementExistByPosition($position)) {
590  return false;
591  }
592 
593  if ($this->getOrderingElementList()->isLastElementPosition($position)) {
594  return false;
595  }
596 
597  $this->getOrderingElementList()->moveElementByPositions($position, $position + 1);
598 
599  return true;
600  }
+ Here is the call graph for this function:

◆ moveAnswerUp()

assOrderingQuestion::moveAnswerUp (   $position)
Parameters
$positionTODO: still in use? should not since element moving is js supported!?

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

References getOrderingElementList().

570  {
571  if (!$this->getOrderingElementList()->elementExistByPosition($position)) {
572  return false;
573  }
574 
575  if ($this->getOrderingElementList()->isFirstElementPosition($position)) {
576  return false;
577  }
578 
579  $this->getOrderingElementList()->moveElementByPositions($position, $position - 1);
580  }
+ Here is the call graph for this function:

◆ rebuildThumbnails()

assOrderingQuestion::rebuildThumbnails ( )

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

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

Referenced by saveAnswerSpecificDataToDb().

1095  {
1096  if ($this->getOrderingType() == OQ_PICTURES || $this->getOrderingType() == OQ_NESTED_PICTURES) {
1097  foreach ($this->getOrderElements() as $orderingElement) {
1098  $this->generateThumbForFile($this->getImagePath(), $orderingElement->getContent());
1099  }
1100  }
1101  }
getOrderingType()
Returns the ordering question type.
getOrderElements()
Returns the answers array.
getImagePath($question_id=null, $object_id=null)
Returns the image path for web accessable images of a question.
const OQ_PICTURES
Ordering question constants.
const OQ_NESTED_PICTURES
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reworkWorkingData()

assOrderingQuestion::reworkWorkingData (   $active_id,
  $pass,
  $obligationsAnswered,
  $authorized 
)
protected

{}

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

939  {
940  // nothing to rework!
941  }

◆ saveAnswerSpecificDataToDb()

assOrderingQuestion::saveAnswerSpecificDataToDb ( )

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

Returns
mixed

Implements ilObjAnswerScoringAdjustable.

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

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

Referenced by saveToDb().

925  {
926  $this->getOrderingElementList()->setQuestionId($this->getId());
927  $this->getOrderingElementList()->saveToDb();
928 
929  if ($this->hasOrderingTypeUploadSupport()) {
930  $this->rebuildThumbnails();
931  $this->cleanImagefiles();
932  }
933  }
getId()
Gets the id of the assQuestion object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ savePreviewData()

assOrderingQuestion::savePreviewData ( ilAssQuestionPreviewSession  $previewSession)
protected

◆ saveToDb()

assOrderingQuestion::saveToDb (   $original_id = "")

Saves a assOrderingQuestion object to a database.

Parameters
string$original_id

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

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

128  {
129  global $ilDB;
130 
134  parent::saveToDb($original_id);
135  }
saveAdditionalQuestionDataToDb()
Saves a record to the question types additional data table.
saveQuestionDataToDb($original_id="")
global $ilDB
saveAnswerSpecificDataToDb()
Saves the answer specific records into a question types answer table.
+ 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.

public

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

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

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

860  {
861  $entered_values = 0;
862 
863  if (is_null($pass)) {
864  include_once "./Modules/Test/classes/class.ilObjTest.php";
865  $pass = ilObjTest::_getPass($active_id);
866  }
867 
868  $this->getProcessLocker()->executeUserSolutionUpdateLockOperation(
869  function () use (&$entered_values, $active_id, $pass, $authorized) {
870  $this->removeCurrentSolution($active_id, $pass, $authorized);
871 
872  foreach ($this->getSolutionListFromPostSubmit() as $orderingElement) {
873  $value1 = $orderingElement->getStorageValue1($this->getOrderingType());
874  $value2 = $orderingElement->getStorageValue2($this->getOrderingType());
875 
876  $this->saveCurrentSolution($active_id, $pass, $value1, trim($value2), $authorized);
877 
878  $entered_values++;
879  }
880  }
881  );
882 
883  if ($entered_values) {
884  $this->log($active_id, 'log_user_entered_values');
885  } else {
886  $this->log($active_id, 'log_user_not_entered_values');
887  }
888 
889  return true;
890  }
static _getPass($active_id)
Retrieves the actual pass of a given user for a given test.
getOrderingType()
Returns the ordering question type.
log($active_id, $langVar)
saveCurrentSolution($active_id, $pass, $value1, $value2, $authorized=true, $tstamp=null)
removeCurrentSolution($active_id, $pass, $authorized=true)
+ Here is the call graph for this function:

◆ setElementHeight()

assOrderingQuestion::setElementHeight (   $a_height)

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

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

◆ setExportDetailsXLS()

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

{}

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

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

1020  {
1021  parent::setExportDetailsXLS($worksheet, $startrow, $active_id, $pass);
1022 
1023  $solutions = $this->getSolutionValues($active_id, $pass);
1024  $sol = array();
1025  foreach ($solutions as $solution) {
1026  $sol[$solution["value1"]] = $solution["value2"];
1027  }
1028  asort($sol);
1029  $sol = array_keys($sol);
1030 
1031  $i = 1;
1032  foreach ($sol as $idx) {
1033  foreach ($solutions as $solution) {
1034  if ($solution["value1"] == $idx) {
1035  $worksheet->setCell($startrow + $i, 0, $solution["value2"]);
1036  }
1037  }
1038  $element = $this->getOrderingElementList()->getElementBySolutionIdentifier($idx);
1039  $worksheet->setCell($startrow + $i, 1, $element->getContent());
1040  $i++;
1041  }
1042 
1043  return $startrow + $i + 1;
1044  }
$worksheet
getSolutionValues($active_id, $pass=null, $authorized=true)
Loads solutions of a given user from the database an returns it.
Create styles array
The data for the language used.
$i
Definition: disco.tpl.php:19
+ Here is the call graph for this function:

◆ setOrderingElementList()

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

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

References $orderingElementList.

560  {
561  $this->orderingElementList = $orderingElementList;
562  }

◆ setOrderingType()

assOrderingQuestion::setOrderingType (   $ordering_type = OQ_TERMS)

Sets the ordering question type.

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

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

References $ordering_type.

375  {
376  $this->ordering_type = $ordering_type;
377  }

◆ setThumbGeometry()

assOrderingQuestion::setThumbGeometry (   $a_geometry)

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

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

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

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

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

805  {
806  if (!strlen($uploadFile)) {
807  return false;
808  }
809 
810  $this->ensureImagePathExists();
811 
812  // store file with hashed name
813 
814  if (!ilUtil::moveUploadedFile($uploadFile, $targetFile, $this->getImagePath() . $targetFile)) {
815  return false;
816  }
817 
818  return true;
819  }
getImagePath($question_id=null, $object_id=null)
Returns the image path for web accessable images of a question.
+ 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 public

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

1007  {
1008  return true;
1009  }

◆ supportsNonJsOutput()

assOrderingQuestion::supportsNonJsOutput ( )

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

1012  {
1013  return false;
1014  }

◆ toJSON()

assOrderingQuestion::toJSON ( )

Returns a JSON representation of the question.

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

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

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

◆ updateLeveledOrdering()

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

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

References $ilDB, and array.

1434  {
1435  global $ilDB;
1436 
1437  $ilDB->update(
1438  'qpl_a_ordering',
1439  array('solution_key'=> array('integer', $a_index),
1440  'depth' => array('integer', $a_depth)),
1441  array('answertext' => array('text', $a_answer_text))
1442  );
1443 
1444 
1445  return true;
1446  }
Create styles array
The data for the language used.
global $ilDB

◆ validateSolutionSubmit()

assOrderingQuestion::validateSolutionSubmit ( )

Checks the data to be saved for consistency.

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

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

References getOrderingElementList(), and getSolutionListFromPostSubmit().

Referenced by savePreviewData().

846  {
847  $submittedSolutionList = $this->getSolutionListFromPostSubmit();
848  return $this->getOrderingElementList()->hasSameElementSetByRandomIdentifiers($submittedSolutionList);
849  }
+ 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 1346 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

const assOrderingQuestion::ORDERING_ELEMENT_FORM_FIELD_POSTVAR = 'order_elems'

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