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

Data Fields

const ORDERING_ELEMENT_FORM_FIELD_POSTVAR = 'order_elems'
 
const ORDERING_ELEMENT_FORM_CMD_UPLOAD_IMG = 'uploadElementImage'
 
const ORDERING_ELEMENT_FORM_CMD_REMOVE_IMG = 'removeElementImage'
 
 $ordering_type
 
 $thumb_geometry = 100
 
 $element_height
 
 $old_ordering_depth = array()
 
 $leveled_ordering = array()
 
- Data Fields inherited from assQuestion
const IMG_MIME_TYPE_JPG = 'image/jpeg'
 
const IMG_MIME_TYPE_PNG = 'image/png'
 
const IMG_MIME_TYPE_GIF = 'image/gif'
 
const ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT = 'default'
 constant for additional content editing mode "default" More...
 
const ADDITIONAL_CONTENT_EDITING_MODE_PAGE_OBJECT = 'pageobject'
 constant for additional content editing mode "pageobject" More...
 
 $feedbackOBJ = null
 
 $prevent_rte_usage = false
 
 $selfassessmenteditingmode = false
 
 $defaultnroftries = 0
 
 $questionActionCmd = 'handleQuestionAction'
 
const KEY_VALUES_IMPLOSION_SEPARATOR = ':'
 
- Data Fields inherited from iQuestionCondition
const StringResultExpression = '~TEXT~'
 
const PercentageResultExpression = '%n%'
 
const NumericResultExpression = '#n#'
 
const MatchingResultExpression = ';n:m;'
 
const OrderingResultExpression = '$n,m,o,p$'
 
const NumberOfResultExpression = '+n+'
 
const ExclusiveResultExpression = '*n,m,o,p*'
 
const EmptyAnswerExpression = "?"
 

Protected Member Functions

 duplicateOrderlingElementList ()
 
 getSolutionValuePairBrandedOrderingElementByRandomIdentifier ($value1, $value2)
 
 getSolutionValuePairBrandedOrderingElementBySolutionIdentifier ($value1, $value2)
 
 cleanImagefiles ()
 
 savePreviewData (ilAssQuestionPreviewSession $previewSession)
 
 reworkWorkingData ($active_id, $pass, $obligationsAnswered, $authorized)
 {Reworks the allready saved working data if neccessary.
Parameters
integer$active_id
integer$pass
boolean$obligationsAnswered
boolean$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)
 @TODO Move this to a proper place. More...
 
static logAction ($logtext="", $active_id="", $question_id="")
 Logs an action into the Test&Assessment log. More...
 
static getQuestionTypeFromDb ($question_id)
 get question type for question id More...
 
static _getTotalRightAnswers ($a_q_id)
 get number of answers for question id (static) note: do not use $this inside this method More...
 
static _getTitle ($a_q_id)
 Returns the title of a question. More...
 
static _getQuestionText ($a_q_id)
 Returns question text. More...
 
static isFileAvailable ($file)
 
static _getQuestionType ($question_id)
 Returns the question type of a question with a given id. More...
 
static _getQuestionTitle ($question_id)
 Returns the question title of a question with a given id. More...
 
static saveOriginalId ($questionId, $originalId)
 
static resetOriginalId ($questionId)
 
static _getInternalLinkHref ($target="")
 
static _getOriginalId ($question_id)
 Returns the original id of a question. More...
 
static originalQuestionExists ($questionId)
 
static _instanciateQuestion ($question_id)
 Creates an instance of a question with a given question id. More...
 
static _instantiateQuestion ($question_id)
 
static _getSolutionMaxPass ($question_id, $active_id)
 Returns the maximum pass a users question solution. More...
 
static _isWriteable ($question_id, $user_id)
 Returns true if the question is writeable by a certain user. More...
 
static _isUsedInRandomTest ($question_id="")
 Checks whether the question is used in a random test or not. More...
 
static _isWorkedThrough ($active_id, $question_id, $pass=NULL)
 Returns true if the question was worked through in the given pass Worked through means that the user entered at least one value. More...
 
static _areAnswered ($a_user_id, $a_question_ids)
 Checks if an array of question ids is answered by an user or not. More...
 
static _setReachedPoints ($active_id, $question_id, $points, $maxpoints, $pass, $manualscoring, $obligationsEnabled)
 Sets the points, a learner has reached answering the question Additionally objective results are updated. More...
 
static _needsManualScoring ($question_id)
 
static _includeClass ($question_type, $gui=0)
 Include the php class file for a given question type. More...
 
static getGuiClassNameByQuestionType ($questionType)
 
static getObjectClassNameByQuestionType ($questionType)
 
static getFeedbackClassNameByQuestionType ($questionType)
 
static isCoreQuestionType ($questionType)
 
static includeCoreClass ($questionType, $withGuiClass)
 
static includePluginClass ($questionType, $withGuiClass)
 
static _getQuestionTypeName ($type_tag)
 Return the translation for a given question type tag. More...
 
static & _instanciateQuestionGUI ($question_id)
 Creates an instance of a question gui with a given question id. More...
 
static instantiateQuestionGUI ($a_question_id)
 Creates an instance of a question gui with a given question id. More...
 
static _questionExistsInTest ($question_id, $test_id)
 
static lookupParentObjId ($questionId)
 @global ilDBInterface $ilDB More...
 
static lookupOriginalParentObjId ($originalQuestionId)
 returns the parent object id for given original question id (should be a qpl id, but theoretically it can be a tst id, too) More...
 
static isObligationPossible ($questionId)
 returns boolean wether it is possible to set this question type as obligatory or not considering the current question configuration More...
 
static implodeKeyValues ($keyValues)
 
static explodeKeyValues ($keyValues)
 
static setResultGateway ($resultGateway)
 
static getResultGateway ()
 
static sumTimesInISO8601FormatH_i_s_Extended ($time1, $time2)
 
static convertISO8601FormatH_i_s_ExtendedToSeconds ($time)
 
static missingResultRecordExists ($activeId, $pass, $questionIds)
 
static getQuestionsMissingResultRecord ($activeId, $pass, $questionIds)
 
static lookupResultRecordExist ($activeId, $questionId, $pass)
 
- Static Protected Member Functions inherited from assQuestion
static getNumExistingSolutionRecords ($activeId, $pass, $questionId)
 returns the number of existing solution records for the given test active / pass and given question id More...
 
static getKeyValuesImplosionSeparator ()
 
- Static Protected Attributes inherited from assQuestion
static $allowedFileExtensionsByMimeType
 
static $allowedCharsetsByMimeType
 
static $allowedImageMaterialFileExtensionsByMimeType
 
static $forcePassResultsUpdateEnabled = false
 
static $imageSourceFixReplaceMap
 

Detailed Description

Class for ordering questions.

assOrderingQuestion is a class for ordering questions.

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

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

Constructor & Destructor Documentation

◆ __construct()

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

assOrderingQuestion constructor

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

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

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

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

Member Function Documentation

◆ afterSyncWithOriginal()

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

{}

Reimplemented from assQuestion.

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

1649 {
1650 parent::afterSyncWithOriginal($origQuestionId, $dupQuestionId, $origParentObjId, $dupParentObjId);
1651 $this->duplicateImages($dupQuestionId, $dupParentObjId, $origQuestionId, $origParentObjId);
1652 }
duplicateImages($src_question_id, $src_object_id, $dest_question_id, $dest_object_id)

References duplicateImages().

+ Here is the call graph for this function:

◆ buildNestedOrderingElementInputGui()

assOrderingQuestion::buildNestedOrderingElementInputGui ( )
Returns
ilAssNestedOrderingElementsInputGUI

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

1353 {
1354 $formDataConverter = $this->buildNestedOrderingFormDataConverter();
1355
1356 require_once 'Modules/TestQuestionPool/classes/forms/class.ilAssNestedOrderingElementsInputGUI.php';
1357
1358 $orderingElementInput = new ilAssNestedOrderingElementsInputGUI(
1359 $formDataConverter, self::ORDERING_ELEMENT_FORM_FIELD_POSTVAR
1360 );
1361
1362 $orderingElementInput->setUniquePrefix($this->getId());
1363 $orderingElementInput->setOrderingType($this->getOrderingType());
1364 $orderingElementInput->setElementImagePath($this->getImagePathWeb());
1365 $orderingElementInput->setThumbPrefix($this->getThumbPrefix());
1366
1367 $this->initOrderingElementFormFieldLabels($orderingElementInput);
1368
1369 return $orderingElementInput;
1370 }
initOrderingElementFormFieldLabels(ilFormPropertyGUI $formField)
getOrderingType()
Returns the ordering question type.
getId()
Gets the id of the assQuestion object.
getImagePathWeb()
Returns the web image path for web accessable images of a question.

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

Referenced by buildOrderingElementInputGui(), and fetchSolutionListFromFormSubmissionData().

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

◆ buildNestedOrderingFormDataConverter()

assOrderingQuestion::buildNestedOrderingFormDataConverter ( )
protected
Returns
ilAssOrderingFormValuesObjectsConverter

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

1797 {
1798 $formDataConverter = $this->buildOrderingElementFormDataConverter();
1800
1801 if( $this->getOrderingType() == OQ_NESTED_PICTURES )
1802 {
1803 $formDataConverter->setImageRemovalCommand(self::ORDERING_ELEMENT_FORM_CMD_REMOVE_IMG);
1804 $formDataConverter->setImageUrlPath($this->getImagePathWeb());
1805
1806 if( $this->getThumbSize() && $this->getThumbPrefix() )
1807 {
1808 $formDataConverter->setThumbnailPrefix($this->getThumbPrefix());
1809 }
1810 }
1811
1812 return $formDataConverter;
1813 }
const OQ_NESTED_PICTURES

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

Referenced by buildNestedOrderingElementInputGui().

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

◆ buildOrderingElementFormDataConverter()

assOrderingQuestion::buildOrderingElementFormDataConverter ( )
protected
Returns
ilAssOrderingFormValuesObjectsConverter

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

1756 {
1757 require_once 'Modules/TestQuestionPool/classes/forms/class.ilAssOrderingFormValuesObjectsConverter.php';
1758 $converter = new ilAssOrderingFormValuesObjectsConverter();
1759 $converter->setPostVar(self::ORDERING_ELEMENT_FORM_FIELD_POSTVAR);
1760
1761 return $converter;
1762 }

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

+ Here is the caller graph for this function:

◆ buildOrderingElementInputGui()

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

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

1256 {
1257 switch( $this->getOrderingType() )
1258 {
1259 case OQ_TERMS:
1260
1261 return $this->buildOrderingTextsInputGui();
1262
1263 case OQ_PICTURES:
1264
1265 return $this->buildOrderingImagesInputGui();
1266
1267 case OQ_NESTED_TERMS:
1268 case OQ_NESTED_PICTURES:
1269
1270 return $this->buildNestedOrderingElementInputGui();
1271
1272 default:
1273 throw new ilTestQuestionPoolException('unknown ordering mode');
1274 }
1275 }
const OQ_TERMS
const OQ_NESTED_TERMS
const OQ_PICTURES
Ordering question constants.

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

Referenced by ilAssOrderingQuestionAuthoringFormGUI\renewOrderingElementInput().

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

◆ buildOrderingImagesFormDataConverter()

assOrderingQuestion::buildOrderingImagesFormDataConverter ( )
protected
Returns
ilAssOrderingFormValuesObjectsConverter

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

1768 {
1769 $formDataConverter = $this->buildOrderingElementFormDataConverter();
1771
1772 $formDataConverter->setImageRemovalCommand(self::ORDERING_ELEMENT_FORM_CMD_REMOVE_IMG);
1773 $formDataConverter->setImageUrlPath($this->getImagePathWeb());
1774 $formDataConverter->setImageFsPath($this->getImagePath());
1775
1776 if( $this->getThumbSize() && $this->getThumbPrefix() )
1777 {
1778 $formDataConverter->setThumbnailPrefix($this->getThumbPrefix());
1779 }
1780 return $formDataConverter;
1781 }
getImagePath($question_id=null, $object_id=null)
Returns the image path for web accessable images of a question.

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

Referenced by buildOrderingImagesInputGui().

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

◆ buildOrderingImagesInputGui()

assOrderingQuestion::buildOrderingImagesInputGui ( )
Returns
ilAssOrderingImagesInputGUI

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

1332 {
1333 $formDataConverter = $this->buildOrderingImagesFormDataConverter();
1334
1335 require_once 'Modules/TestQuestionPool/classes/forms/class.ilAssOrderingImagesInputGUI.php';
1336
1337 $orderingElementInput = new ilAssOrderingImagesInputGUI(
1338 $formDataConverter, self::ORDERING_ELEMENT_FORM_FIELD_POSTVAR
1339 );
1340
1341 $orderingElementInput->setImageRemovalCommand(self::ORDERING_ELEMENT_FORM_CMD_REMOVE_IMG);
1342 $orderingElementInput->setImageUploadCommand(self::ORDERING_ELEMENT_FORM_CMD_UPLOAD_IMG);
1343
1344 $this->initOrderingElementFormFieldLabels($orderingElementInput);
1345
1346 return $orderingElementInput;
1347 }

References buildOrderingImagesFormDataConverter(), and initOrderingElementFormFieldLabels().

Referenced by buildOrderingElementInputGui().

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

◆ buildOrderingTextsFormDataConverter()

assOrderingQuestion::buildOrderingTextsFormDataConverter ( )
protected
Returns
ilAssOrderingFormValuesObjectsConverter

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

1787 {
1788 $formDataConverter = $this->buildOrderingElementFormDataConverter();
1790 return $formDataConverter;
1791 }

References buildOrderingElementFormDataConverter(), and ilAssOrderingFormValuesObjectsConverter\CONTEXT_MAINTAIN_ELEMENT_TEXT.

Referenced by buildOrderingTextsInputGui().

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

◆ buildOrderingTextsInputGui()

assOrderingQuestion::buildOrderingTextsInputGui ( )
Returns
ilAssOrderingTextsInputGUI

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

1314 {
1315 $formDataConverter = $this->buildOrderingTextsFormDataConverter();
1316
1317 require_once 'Modules/TestQuestionPool/classes/forms/class.ilAssOrderingTextsInputGUI.php';
1318
1319 $orderingElementInput = new ilAssOrderingTextsInputGUI(
1320 $formDataConverter, self::ORDERING_ELEMENT_FORM_FIELD_POSTVAR
1321 );
1322
1323 $this->initOrderingElementFormFieldLabels($orderingElementInput);
1324
1325 return $orderingElementInput;
1326 }

References buildOrderingTextsFormDataConverter(), and initOrderingElementFormFieldLabels().

Referenced by buildOrderingElementInputGui().

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

◆ buildTestPresentationConfig()

assOrderingQuestion::buildTestPresentationConfig ( )

Get the test question configuration.

Returns
ilTestQuestionConfig

Reimplemented from assQuestion.

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

1662 {
1663 // hey: refactored identifiers
1664 return parent::buildTestPresentationConfig()
1665 // hey.
1666 ->setIsUnchangedAnswerPossible(true)
1667 ->setUseUnchangedAnswerLabel($this->lng->txt('tst_unchanged_order_is_correct'));
1668 }

◆ calculateReachedPoints()

assOrderingQuestion::calculateReachedPoints (   $active_id,
  $pass = NULL,
  $authorizedSolution = true,
  $returndetails = FALSE 
)

Returns the points, a learner has reached answering the question.

The points are calculated from the given answers.

@access public

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

Reimplemented from assQuestion.

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

701 {
702 if( $returndetails )
703 {
704 throw new ilTestException('return details not implemented for '.__METHOD__);
705 }
706
707 if (is_null($pass))
708 {
709 $pass = $this->getSolutionMaxPass($active_id);
710 }
711
712 $solutionValuePairs = $this->getSolutionValues($active_id, $pass, $authorizedSolution);
713
714 if( !count($solutionValuePairs) )
715 {
716 return 0;
717 }
718
719 $indexedSolutionValues = $this->fetchIndexedValuesFromValuePairs($solutionValuePairs);
720 $solutionOrderingElementList = $this->getSolutionOrderingElementList($indexedSolutionValues);
721
722 return $this->calculateReachedPointsForSolution($solutionOrderingElementList);
723 }
getSolutionOrderingElementList($indexedSolutionValues)
calculateReachedPointsForSolution(ilAssOrderingElementList $solutionOrderingElementList)
getSolutionMaxPass($active_id)
Returns the maximum pass a users question solution.
fetchIndexedValuesFromValuePairs(array $valuePairs)
getSolutionValues($active_id, $pass=NULL, $authorized=true)
Loads solutions of a given user from the database an returns it.
Base Exception for all Exceptions relating to Modules/Test.

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

+ Here is the call graph for this function:

◆ calculateReachedPointsForSolution()

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

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

1455 {
1456 $reachedPoints = $this->getPoints();
1457
1458 foreach($this->getOrderingElementList() as $correctElement)
1459 {
1460 $userElement = $solutionOrderingElementList->getElementByPosition( $correctElement->getPosition() );
1461
1462 if( !$correctElement->isSameElement($userElement) )
1463 {
1464 $reachedPoints = 0;
1465 break;
1466 }
1467 }
1468
1469 return $reachedPoints;
1470 }
getPoints()
Returns the maximum available points for the question.

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

Referenced by calculateReachedPoints(), and calculateReachedPointsFromPreviewSession().

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

◆ calculateReachedPointsFromPreviewSession()

assOrderingQuestion::calculateReachedPointsFromPreviewSession ( ilAssQuestionPreviewSession  $previewSession)

Reimplemented from assQuestion.

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

726 {
727 if( !$previewSession->hasParticipantSolution() )
728 {
729 return 0;
730 }
731
732 $solutionOrderingElementList = unserialize(
733 $previewSession->getParticipantsSolution()
734 );
735
736 $reachedPoints = $this->calculateReachedPointsForSolution($solutionOrderingElementList);
737 $reachedPoints = $this->deductHintPointsFromReachedPoints($previewSession, $reachedPoints);
738
739 return $this->ensureNonNegativePoints($reachedPoints);
740 }
deductHintPointsFromReachedPoints(ilAssQuestionPreviewSession $previewSession, $reachedPoints)
ensureNonNegativePoints($points)

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

+ Here is the call graph for this function:

◆ cleanImagefiles()

assOrderingQuestion::cleanImagefiles ( )
protected

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

772 {
773 if ($this->getOrderingType() == OQ_PICTURES)
774 {
775 if (@file_exists($this->getImagePath()))
776 {
778 foreach ($contents as $f)
779 {
780 if (strcmp($f['type'], 'file') == 0)
781 {
782 $found = false;
783 foreach($this->getOrderingElementList() as $orderElement)
784 {
785 if (strcmp($f['entry'], $orderElement->getContent()) == 0) $found = true;
786 if (strcmp($f['entry'], $this->getThumbPrefix() . $orderElement->getContent()) == 0) $found = true;
787 }
788 if (!$found)
789 {
790 if (@file_exists($this->getImagePath() . $f['entry'])) @unlink($this->getImagePath() . $f['entry']);
791 }
792 }
793 }
794 }
795 }
796 else
797 {
798 if (@file_exists($this->getImagePath()))
799 {
801 }
802 }
803 }
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static getDir($a_dir, $a_rec=false, $a_sub_dir="")
get directory

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

Referenced by saveAnswerSpecificDataToDb().

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

◆ copyImages()

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

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

370 {
371 global $ilLog;
372 if ($this->getOrderingType() == OQ_PICTURES)
373 {
374 $imagepath = $this->getImagePath();
375 $imagepath_original = str_replace("/$this->id/images", "/$question_id/images", $imagepath);
376 $imagepath_original = str_replace("/$this->obj_id/", "/$source_questionpool/", $imagepath_original);
377 if (!file_exists($imagepath)) {
378 ilUtil::makeDirParents($imagepath);
379 }
380 foreach($this->getOrderingElementList() as $element)
381 {
382 $filename = $element->getContent();
383 if (!@copy($imagepath_original . $filename, $imagepath . $filename))
384 {
385 $ilLog->write("Ordering Question image could not be copied: ${imagepath_original}${filename}");
386 }
387 if (@file_exists($imagepath_original. $this->getThumbPrefix(). $filename))
388 {
389 if (!@copy($imagepath_original . $this->getThumbPrefix() . $filename, $imagepath . $this->getThumbPrefix() . $filename))
390 {
391 $ilLog->write("Ordering Question image thumbnail could not be copied: $imagepath_original" . $this->getThumbPrefix() . $filename);
392 }
393 }
394 }
395 }
396 }
static makeDirParents($a_dir)
Create a new directory and all parent directories.

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

+ Here is the call graph for this function:

◆ copyObject()

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

Copies an assOrderingQuestion object.

@access public

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

266 {
267 if ($this->id <= 0)
268 {
269 // The question has not been saved. It cannot be duplicated
270 return;
271 }
272 // duplicate the question in database
273 $clone = $this;
274 include_once ("./Modules/TestQuestionPool/classes/class.assQuestion.php");
276 $clone->id = -1;
277 $source_questionpool_id = $this->getObjId();
278 $clone->setObjId($target_questionpool_id);
279 if ($title)
280 {
281 $clone->setTitle($title);
282 }
283
284 $clone->saveToDb();
285
286 // copy question page content
287 $clone->copyPageOfQuestion($original_id);
288 // copy XHTML media objects
289 $clone->copyXHTMLMediaObjectsOfQuestion($original_id);
290 // duplicate the image
291 $clone->duplicateImages($original_id, $source_questionpool_id, $clone->getId(), $target_questionpool_id);
292
293 $clone->onCopy($source_questionpool_id, $original_id, $clone->getObjId(), $clone->getId());
294
295 return $clone->id;
296 }
static _getOriginalId($question_id)
Returns the original id of a question.
getObjId()
Get the object id of the container object.

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

+ Here is the call graph for this function:

◆ createImageThumbnail()

assOrderingQuestion::createImageThumbnail ( ilAssOrderingElement  $element)

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

890 {
891 if( $this->getThumbGeometry() )
892 {
893 $imageFile = $this->getImagePath() . $element->getContent();
894 $thumbFile = $this->getImagePath() . $this->getThumbPrefix().$element->getContent();
895
896 ilUtil::convertImage( $imageFile, $thumbFile, "JPEG", $this->getThumbGeometry() );
897 }
898 }
static convertImage($a_from, $a_to, $a_target_format="", $a_geometry="", $a_background_color="")
convert image

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

Referenced by handleThumbnailCreation().

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

◆ createNewOriginalFromThisDuplicate()

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

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

299 {
300 if ($this->id <= 0)
301 {
302 // The question has not been saved. It cannot be duplicated
303 return;
304 }
305
306 include_once ("./Modules/TestQuestionPool/classes/class.assQuestion.php");
307
308 $sourceQuestionId = $this->id;
309 $sourceParentId = $this->getObjId();
310
311 // duplicate the question in database
312 $clone = $this;
313 $clone->id = -1;
314
315 $clone->setObjId($targetParentId);
316
317 if ($targetQuestionTitle)
318 {
319 $clone->setTitle($targetQuestionTitle);
320 }
321
322 $clone->saveToDb();
323 // copy question page content
324 $clone->copyPageOfQuestion($sourceQuestionId);
325 // copy XHTML media objects
326 $clone->copyXHTMLMediaObjectsOfQuestion($sourceQuestionId);
327 // duplicate the image
328 $clone->duplicateImages($sourceQuestionId, $sourceParentId, $clone->getId(), $clone->getObjId());
329
330 $clone->onCopy($sourceParentId, $sourceQuestionId, $clone->getObjId(), $clone->getId());
331
332 return $clone->id;
333 }

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

+ Here is the call graph for this function:

◆ deleteAnswer()

assOrderingQuestion::deleteAnswer (   $randomIdentifier)

Deletes an answer with a given index.

The index of the first answer is 0, the index of the second answer is 1 and so on.

Parameters
integer$indexA nonnegative index of the n-th answer @access public
See also
$answers

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

671 {
672 $this->getOrderingElementList()->removeElement(
673 $this->getOrderingElementList()->getElementByRandomIdentifier($randomIdentifier)
674 );
675 $this->getOrderingElementList()->saveToDb();
676 }

References getOrderingElementList().

+ Here is the call graph for this function:

◆ dropImageFile()

assOrderingQuestion::dropImageFile (   $imageFilename)

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

812 {
813 if( !strlen($imageFilename) )
814 {
815 return false;
816 }
817
818 $result = @unlink($this->getImagePath().$imageFilename);
819 $result = $result & @unlink($this->getImagePath().$this->getThumbPrefix() . $imageFilename);
820
821 return $result;
822 }
$result

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

+ Here is the call graph for this function:

◆ duplicate()

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

Duplicates an assOrderingQuestion.

@access public

Reimplemented from assQuestion.

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

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

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

+ Here is the call graph for this function:

◆ duplicateImages()

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

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

336 {
337 global $ilLog;
338 if ($this->getOrderingType() == OQ_PICTURES || $this->getOrderingType() == OQ_NESTED_PICTURES)
339 {
340 $imagepath_original = $this->getImagePath($src_question_id, $src_object_id);
341 $imagepath = $this->getImagePath($dest_question_id, $dest_object_id);
342
343 if (!file_exists($imagepath)) {
344 ilUtil::makeDirParents($imagepath);
345 }
346 foreach($this->getOrderingElementList() as $element)
347 {
348 $filename = $element->getContent();
349 if (!@copy($imagepath_original . $filename, $imagepath . $filename))
350 {
351 $ilLog->write("image could not be duplicated!!!!");
352 }
353 if (@file_exists($imagepath_original. $this->getThumbPrefix(). $filename))
354 {
355 if (!@copy($imagepath_original . $this->getThumbPrefix() . $filename, $imagepath . $this->getThumbPrefix() . $filename))
356 {
357 $ilLog->write("image thumbnail could not be duplicated!!!!");
358 }
359 }
360 }
361 }
362 }

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

Referenced by afterSyncWithOriginal().

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

◆ duplicateOrderlingElementList()

assOrderingQuestion::duplicateOrderlingElementList ( )
protected

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

254 {
255 $this->getOrderingElementList()->setQuestionId($this->getId());
256 $this->getOrderingElementList()->distributeNewRandomIdentifiers();
257 $this->getOrderingElementList()->saveToDb();
258 }

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

+ Here is the call graph for this function:

◆ ensureImagePathExists()

assOrderingQuestion::ensureImagePathExists ( )
protected

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

1672 {
1673 if( !file_exists($this->getImagePath()) )
1674 {
1676 }
1677 }

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

Referenced by storeImageFile().

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

◆ fetchSolutionListFromFormSubmissionData()

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

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

1387 {
1388 $orderingGUI = $this->buildNestedOrderingElementInputGui();
1390 $orderingGUI->setValueByArray($userSolutionPost);
1391
1392 if( !$orderingGUI->checkInput() )
1393 {
1394 require_once 'Modules/Test/exceptions/class.ilTestException.php';
1395 throw new ilTestException('error on validating user solution post');
1396 }
1397
1398 require_once 'Modules/TestQuestionPool/classes/questions/class.ilAssOrderingElementList.php';
1399 $solutionOrderingElementList = ilAssOrderingElementList::buildInstance($this->getId());
1400
1401 $storedElementList = $this->getOrderingElementList();
1402
1403 foreach($orderingGUI->getElementList($this->getId()) as $submittedElement)
1404 {
1405 $solutionElement = $storedElementList->getElementByRandomIdentifier(
1406 $submittedElement->getRandomIdentifier()
1407 )->getClone();
1408
1409 $solutionElement->setPosition($submittedElement->getPosition());
1410
1411 if( $this->isOrderingTypeNested() )
1412 {
1413 $solutionElement->setIndentation($submittedElement->getIndentation());
1414 }
1415
1416 $solutionOrderingElementList->addElement($solutionElement);
1417 }
1418
1419 return $solutionOrderingElementList;
1420 }
static buildInstance($questionId, $orderingElements=array())

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

Referenced by getSolutionListFromPostSubmit(), and getSolutionOrderingElementListForTestOutput().

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

◆ fetchSolutionListFromSubmittedForm()

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

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

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

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

+ Here is the call graph for this function:

◆ fetchSolutionSubmit()

assOrderingQuestion::fetchSolutionSubmit (   $formSubmissionDataStructure)
Returns
array

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

1683 {
1684 $solutionSubmit = array();
1685
1686 if( isset($formSubmissionDataStructure['orderresult']) )
1687 {
1688 $orderresult = $formSubmissionDataStructure['orderresult'];
1689
1690 if( strlen($orderresult) )
1691 {
1692 $orderarray = explode(":", $orderresult);
1693 $ordervalue = 1;
1694 foreach( $orderarray as $index )
1695 {
1696 $idmatch = null;
1697 if( preg_match("/id_(\\d+)/", $index, $idmatch) )
1698 {
1699 $randomid = $idmatch[1];
1700 foreach( $this->getOrderingElementList() as $answeridx => $answer )
1701 {
1702 if( $answer->getRandomIdentifier() == $randomid )
1703 {
1704 $solutionSubmit[$answeridx] = $ordervalue;
1705 $ordervalue++;
1706 }
1707 }
1708 }
1709 }
1710 }
1711 }
1712 else if( $this->getOrderingType() == OQ_NESTED_TERMS || $this->getOrderingType() == OQ_NESTED_PICTURES )
1713 {
1714 $index = 0;
1715 foreach( $formSubmissionDataStructure['content'] as $randomId => $content )
1716 {
1717 $indentation = $formSubmissionDataStructure['indentation'];
1718
1719 $value1 = $index++;
1720 $value2 = implode(':', array($randomId, $indentation));
1721
1722 $solutionSubmit[$value1] = $value2;
1723 }
1724 }
1725 else
1726 {
1727 foreach( $formSubmissionDataStructure as $key => $value )
1728 {
1729 $matches = null;
1730 if( preg_match("/^order_(\d+)/", $key, $matches) )
1731 {
1732 if( !( preg_match("/initial_value_\d+/", $value) ) )
1733 {
1734 if( strlen($value) )
1735 {
1736 foreach( $this->getOrderingElementList() as $answeridx => $answer )
1737 {
1738 if( $answer->getRandomIdentifier() == $matches[1] )
1739 {
1740 $solutionSubmit[$answeridx] = $value;
1741 }
1742 }
1743 }
1744 }
1745 }
1746 }
1747 }
1748
1749 return $solutionSubmit;
1750 }

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

Referenced by getSolutionPostSubmit().

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

◆ generateThumbForFile()

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

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

1181 {
1182 $filename = $path . $file;
1183 if (@file_exists($filename))
1184 {
1185 $thumbpath = $path . $this->getThumbPrefix() . $file;
1186 $path_info = @pathinfo($filename);
1187 $ext = "";
1188 switch (strtoupper($path_info['extension']))
1189 {
1190 case 'PNG':
1191 $ext = 'PNG';
1192 break;
1193 case 'GIF':
1194 $ext = 'GIF';
1195 break;
1196 default:
1197 $ext = 'JPEG';
1198 break;
1199 }
1200 ilUtil::convertImage($filename, $thumbpath, $ext, $this->getThumbGeometry());
1201 }
1202 }
$path
Definition: aliased.php:25
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file

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

Referenced by rebuildThumbnails().

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

◆ getAdditionalTableName()

assOrderingQuestion::getAdditionalTableName ( )

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

Returns
string The additional table name @access public

Reimplemented from assQuestion.

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

1029 {
1030 return "qpl_qst_ordering";
1031 }

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ getAnswer()

assOrderingQuestion::getAnswer (   $index = 0)

Returns the ordering element from the given position.

Parameters
int$position
Returns
ilAssOrderingElement|null

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

653 {
654 if( !$this->getOrderingElementList()->elementExistByPosition($index) )
655 {
656 return null;
657 }
658
659 return $this->getOrderingElementList()->getElementByPosition($index);
660 }

References getOrderingElementList().

+ Here is the call graph for this function:

◆ getAnswerCount()

assOrderingQuestion::getAnswerCount ( )

Returns the number of answers.

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

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

686 {
687 return $this->getOrderingElementList()->countElements();
688 }

References getOrderingElementList().

+ Here is the call graph for this function:

◆ getAnswerTableName()

assOrderingQuestion::getAnswerTableName ( )

Returns the name of the answer table in the database.

Returns
string The answer table name @access public

Reimplemented from assQuestion.

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

1040 {
1041 return "qpl_a_ordering";
1042 }

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

1636 {
1637 if($index !== null)
1638 {
1639 return $this->getOrderingElementList()->getElementByPosition($index);
1640 }
1641
1642 return $this->getOrderingElementList()->getElements();
1643 }

References getOrderingElementList().

+ Here is the call graph for this function:

◆ getElementHeight()

assOrderingQuestion::getElementHeight ( )

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

References $element_height.

◆ getEncryptedFilename()

assOrderingQuestion::getEncryptedFilename (   $filename)

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

762 {
763 $extension = "";
764 if (preg_match("/.*\\.(\\w+)$/", $filename, $matches))
765 {
766 $extension = $matches[1];
767 }
768 return md5($filename) . "." . $extension;
769 }

References $filename.

◆ getExpressionTypes()

◆ getLeveledOrdering()

assOrderingQuestion::getLeveledOrdering ( )

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

References $leveled_ordering.

◆ getMaximumPoints()

assOrderingQuestion::getMaximumPoints ( )

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

Returns
double Points
See also
$points

Reimplemented from assQuestion.

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

749 {
750 return $this->getPoints();
751 }

References assQuestion\getPoints().

Referenced by isComplete().

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

◆ getOldLeveledOrdering()

assOrderingQuestion::getOldLeveledOrdering ( )

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

1483 {
1484 global $ilDB;
1485
1486 $res = $ilDB->queryF('SELECT depth FROM qpl_a_ordering WHERE question_fi = %s ORDER BY position ASC',
1487 array('integer'), array($this->getId()));
1488 while($row = $ilDB->fetchAssoc($res))
1489 {
1490 $this->old_ordering_depth[] = $row['depth'];
1491 }
1493 }
global $ilDB

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

+ Here is the call graph for this function:

◆ getOperators()

assOrderingQuestion::getOperators (   $expression)

Get all available operations for a specific question.

Parameters
string$expression

Implements iQuestionCondition.

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

1532 {
1533 require_once "./Modules/TestQuestionPool/classes/class.ilOperatorsExpressionMapping.php";
1535 }

References ilOperatorsExpressionMapping\getOperatorsByExpression().

+ Here is the call graph for this function:

◆ getOrderElements()

assOrderingQuestion::getOrderElements ( )

Returns the answers array.

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

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

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

References getOrderingElementList().

Referenced by rebuildThumbnails().

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

◆ getOrderingElementList()

◆ getOrderingElementListForSolutionOutput()

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

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

444 {
445 if( $forceCorrectSolution || !$activeId || $passIndex === null )
446 {
447 return $this->getOrderingElementList();
448 }
449
450 $solutionValues = $this->getSolutionValues($activeId, $passIndex);
451
452 if( !count($solutionValues) )
453 {
454 return $this->getShuffledOrderingElementList();
455 }
456
457 return $this->getSolutionOrderingElementList( $this->fetchIndexedValuesFromValuePairs($solutionValues) );
458 }

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

+ Here is the call graph for this function:

◆ getOrderingType()

assOrderingQuestion::getOrderingType ( )

◆ getQuestionType()

assOrderingQuestion::getQuestionType ( )

Returns the question type of the question.

Returns
integer The question type of the question @access public

Reimplemented from assQuestion.

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

1018 {
1019 return "assOrderingQuestion";
1020 }

Referenced by toJSON().

+ Here is the caller graph for this function:

◆ getRTETextWithMediaObjects()

assOrderingQuestion::getRTETextWithMediaObjects ( )

Collects all text in the question which could contain media objects which were created with the Rich Text Editor.

Reimplemented from assQuestion.

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

1049 {
1050 $text = parent::getRTETextWithMediaObjects();
1051
1052 foreach ( $this->getOrderingElementList() as $orderingElement)
1053 {
1054 $text .= $orderingElement->getContent();
1055 }
1056
1057 return $text;
1058 }
$text

References $text, and getOrderingElementList().

+ Here is the call graph for this function:

◆ getShuffledOrderingElementList()

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

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

576 {
577 $shuffledRandomIdentifierIndex = $this->getShuffler()->shuffle(
578 $this->getOrderingElementList()->getRandomIdentifierIndex()
579 );
580
581 $shuffledElementList = $this->getOrderingElementList()->getClone();
582 $shuffledElementList->reorderByRandomIdentifiers($shuffledRandomIdentifierIndex);
583 $shuffledElementList->resetElementsIndentations();
584
585 return $shuffledElementList;
586 }

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

Referenced by getOrderingElementListForSolutionOutput(), and getSolutionOrderingElementListForTestOutput().

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

◆ getSolutionListFromPostSubmit()

assOrderingQuestion::getSolutionListFromPostSubmit ( )
Returns
ilAssOrderingElementList

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

1431 {
1432 if( $this->postSolutionOrderingElementList === null )
1433 {
1435 $this->postSolutionOrderingElementList = $list;
1436 }
1437
1439 }
$_POST["username"]
fetchSolutionListFromFormSubmissionData($userSolutionPost)

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

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

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

◆ getSolutionOrderingElementList()

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

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

544 {
545 $solutionOrderingList = new ilAssOrderingElementList();
546 $solutionOrderingList->setQuestionId($this->getId());
547
548 foreach($indexedSolutionValues as $value1 => $value2)
549 {
550 if( $this->isOrderingTypeNested() )
551 {
552 $element = $this->getSolutionValuePairBrandedOrderingElementByRandomIdentifier($value1, $value2);
553 }
554 else
555 {
556 $element = $this->getSolutionValuePairBrandedOrderingElementBySolutionIdentifier($value1, $value2);
557 }
558
559 $solutionOrderingList->addElement($element);
560 }
561
562 if( !$this->getOrderingElementList()->hasSameElementSetByRandomIdentifiers($solutionOrderingList) )
563 {
564 throw new ilTestQuestionPoolException('inconsistent solution values given');
565 }
566
567 return $solutionOrderingList;
568 }
getSolutionValuePairBrandedOrderingElementBySolutionIdentifier($value1, $value2)
getSolutionValuePairBrandedOrderingElementByRandomIdentifier($value1, $value2)

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

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

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

◆ getSolutionOrderingElementListForTestOutput()

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

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

470 {
471 if( $inputGUI->isPostSubmit($lastPost) )
472 {
473 return $this->fetchSolutionListFromFormSubmissionData($lastPost);
474 }
475
476 // hey: prevPassSolutions - pass will be always available from now on
477 #if( $pass === null && !ilObjTest::_getUsePreviousAnswers($activeId, true) )
478 #// condition looks strange? yes - keep it null when previous solutions not enabled (!)
479 #{
480 # $pass = ilObjTest::_getPass($activeId);
481 #}
482 // hey.
483
484 $indexedSolutionValues = $this->fetchIndexedValuesFromValuePairs(
485 // hey: prevPassSolutions - obsolete due to central check
486 $this->getTestOutputSolutions($activeId, $pass)
487 // hey.
488 );
489
490 if( count($indexedSolutionValues) )
491 {
492 return $this->getSolutionOrderingElementList($indexedSolutionValues);
493 }
494
495 return $this->getShuffledOrderingElementList();
496 }
getTestOutputSolutions($activeId, $pass)

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

+ Here is the call graph for this function:

◆ getSolutionPostSubmit()

assOrderingQuestion::getSolutionPostSubmit ( )
Returns
array

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

1445 {
1446 return $this->fetchSolutionSubmit($_POST);
1447 }
fetchSolutionSubmit($formSubmissionDataStructure)

References $_POST, and fetchSolutionSubmit().

+ Here is the call graph for this function:

◆ getSolutionValuePairBrandedOrderingElementByRandomIdentifier()

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

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

504 {
505 $value2 = explode(':', $value2);
506
507 $randomIdentifier = $value2[0];
508 $selectedPosition = $value1;
509 $selectedIndentation = $value2[1];
510
511 $element = $this->getOrderingElementList()->getElementByRandomIdentifier($randomIdentifier)->getClone();
512
513 $element->setPosition($selectedPosition);
514 $element->setIndentation($selectedIndentation);
515
516 return $element;
517 }

References getOrderingElementList().

Referenced by getSolutionOrderingElementList().

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

◆ getSolutionValuePairBrandedOrderingElementBySolutionIdentifier()

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

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

525 {
526 $solutionIdentifier = $value1;
527 $selectedPosition = ($value2 - 1);
528 $selectedIndentation = 0;
529
530 $element = $this->getOrderingElementList()->getElementBySolutionIdentifier($solutionIdentifier)->getClone();
531
532 $element->setPosition($selectedPosition);
533 $element->setIndentation($selectedIndentation);
534
535 return $element;
536 }

References getOrderingElementList().

Referenced by getSolutionOrderingElementList().

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

◆ getThumbGeometry()

assOrderingQuestion::getThumbGeometry ( )

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

References $thumb_geometry.

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

+ Here is the caller graph for this function:

◆ getThumbPrefix()

assOrderingQuestion::getThumbPrefix ( )

◆ getThumbSize()

assOrderingQuestion::getThumbSize ( )

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

1127 {
1128 return $this->getThumbGeometry();
1129 }

References getThumbGeometry().

Referenced by buildNestedOrderingFormDataConverter(), and buildOrderingImagesFormDataConverter().

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

◆ handleThumbnailCreation()

assOrderingQuestion::handleThumbnailCreation ( ilAssOrderingElementList  $elementList)

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

882 {
883 foreach($elementList as $element)
884 {
885 $this->createImageThumbnail($element);
886 }
887 }
createImageThumbnail(ilAssOrderingElement $element)

References createImageThumbnail().

+ Here is the call graph for this function:

◆ hasOrderingTypeUploadSupport()

assOrderingQuestion::hasOrderingTypeUploadSupport ( )

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

433 {
434 return $this->getOrderingType() == OQ_PICTURES;
435 }

References getOrderingType(), and OQ_PICTURES.

Referenced by isImageReplaced(), and saveAnswerSpecificDataToDb().

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

◆ initOrderingElementAuthoringProperties()

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

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

1281 {
1282 switch( true )
1283 {
1284 case $formField instanceof ilAssNestedOrderingElementsInputGUI:
1285
1286 $formField->setInteractionEnabled(true);
1287 $formField->setNestingEnabled($this->isOrderingTypeNested());
1288 break;
1289
1290 case $formField instanceof ilAssOrderingTextsInputGUI:
1291 case $formField instanceof ilAssOrderingImagesInputGUI:
1292 default:
1293
1294 $formField->setEditElementOccuranceEnabled(true);
1295 $formField->setEditElementOrderEnabled(true);
1296 }
1297
1298 $formField->setRequired(true);
1299 }
setRequired($a_required)
Set Required.

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

Referenced by ilAssOrderingQuestionAuthoringFormGUI\renewOrderingElementInput().

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

◆ initOrderingElementFormFieldLabels()

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

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

1305 {
1306 $formField->setInfo($this->lng->txt('ordering_answer_sequence_info'));
1307 $formField->setTitle($this->lng->txt('answers'));
1308 }
setTitle($a_title)
Set Title.
setInfo($a_info)
Set Information Text.

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

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

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

◆ isComplete()

assOrderingQuestion::isComplete ( )

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

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

Reimplemented from assQuestion.

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

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

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

+ Here is the call graph for this function:

◆ isImageFileStored()

assOrderingQuestion::isImageFileStored (   $imageFilename)

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

825 {
826 if( !strlen($imageFilename) )
827 {
828 return false;
829 }
830
831 if( !file_exists($this->getImagePath().$imageFilename) )
832 {
833 return false;
834 }
835
836 return is_file($this->getImagePath().$imageFilename);
837 }

References assQuestion\getImagePath().

+ Here is the call graph for this function:

◆ isImageOrderingType()

assOrderingQuestion::isImageOrderingType ( )

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

428 {
429 return in_array($this->getOrderingType(), array(OQ_PICTURES, OQ_NESTED_PICTURES));
430 }

References getOrderingType(), OQ_NESTED_PICTURES, and OQ_PICTURES.

+ Here is the call graph for this function:

◆ isImageReplaced()

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

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

840 {
841 if( !$this->hasOrderingTypeUploadSupport() )
842 {
843 return false;
844 }
845
846 if( !$newElement->getContent() )
847 {
848 return false;
849 }
850
851 return $newElement->getContent() != $oldElement->getContent();
852 }

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

+ Here is the call graph for this function:

◆ isOrderingTypeNested()

assOrderingQuestion::isOrderingTypeNested ( )

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

423 {
424 return in_array($this->getOrderingType(), array(OQ_NESTED_TERMS, OQ_NESTED_PICTURES));
425 }

References getOrderingType(), OQ_NESTED_PICTURES, and OQ_NESTED_TERMS.

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

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

◆ loadFromDb()

assOrderingQuestion::loadFromDb (   $question_id)

Loads a assOrderingQuestion object from a database.

Parameters
object$dbA pear DB object
integer$question_idA unique key which defines the multiple choice test in the database @access public

Reimplemented from assQuestion.

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

151 {
152 global $ilDB;
153
154 $result = $ilDB->queryF("SELECT qpl_questions.*, " . $this->getAdditionalTableName() . ".* FROM qpl_questions LEFT JOIN " . $this->getAdditionalTableName() . " ON " . $this->getAdditionalTableName() . ".question_fi = qpl_questions.question_id WHERE qpl_questions.question_id = %s",
155 array("integer"),
156 array($question_id)
157 );
158 if ($result->numRows() == 1)
159 {
160 $data = $ilDB->fetchAssoc($result);
161 $this->setId($question_id);
162 $this->setObjId($data["obj_fi"]);
163 $this->setTitle($data["title"]);
164 $this->setComment($data["description"]);
165 $this->setOriginalId($data["original_id"]);
166 $this->setAuthor($data["author"]);
167 $this->setNrOfTries($data['nr_of_tries']);
168 $this->setPoints($data["points"]);
169 $this->setOwner($data["owner"]);
170 include_once("./Services/RTE/classes/class.ilRTE.php");
171 $this->setQuestion(ilRTE::_replaceMediaObjectImageSrc($data["question_text"], 1));
172 $this->ordering_type = strlen($data["ordering_type"]) ? $data["ordering_type"] : OQ_TERMS;
173 $this->thumb_geometry = $data["thumb_geometry"];
174 $this->element_height = $data["element_height"];
175 $this->setEstimatedWorkingTime(substr($data["working_time"], 0, 2), substr($data["working_time"], 3, 2), substr($data["working_time"], 6, 2));
176
177 try
178 {
179 $this->setAdditionalContentEditingMode($data['add_cont_edit_mode']);
180 }
182 {
183 }
184 }
185
186 $this->orderingElementList->setQuestionId($this->getId());
187 $this->orderingElementList->loadFromDb();
188
189 parent::loadFromDb($question_id);
190 }
getAdditionalTableName()
Returns the name of the additional question data table in the database.
setId($id=-1)
Sets the id of the assQuestion object.
setOriginalId($original_id)
setObjId($obj_id=0)
Set the object id of the container object.
setTitle($title="")
Sets the title string of the assQuestion object.
setOwner($owner="")
Sets the creator/owner ID of the assQuestion object.
setEstimatedWorkingTime($hour=0, $min=0, $sec=0)
Sets the estimated working time of a question from given hour, minute and second.
setAuthor($author="")
Sets the authors name of the assQuestion object.
setPoints($a_points)
Sets the maximum available points for the question.
setComment($comment="")
Sets the comment string of the assQuestion object.
setNrOfTries($a_nr_of_tries)
setAdditionalContentEditingMode($additinalContentEditingMode)
setter for additional content editing mode for this question
setQuestion($question="")
Sets the question string of the question object.
static _replaceMediaObjectImageSrc($a_text, $a_direction=0, $nic=IL_INST_ID)
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...

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

+ Here is the call graph for this function:

◆ lookupSolutionOrderByRandomid()

assOrderingQuestion::lookupSolutionOrderByRandomid (   $a_random_id)

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

1500 {
1501 global $ilDB;
1502
1503 $res = $ilDB->queryF('SELECT solution_key FROM qpl_a_ordering WHERE random_id = %s',
1504 array('integer'), array($a_random_id));
1505 $row = $ilDB->fetchAssoc($res);
1506
1507 return $row['solution_key'];
1508 }

References $ilDB, $res, and $row.

◆ moveAnswerDown()

assOrderingQuestion::moveAnswerDown (   $position)
Parameters
$position

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

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

630 {
631 if( !$this->getOrderingElementList()->elementExistByPosition($position) )
632 {
633 return false;
634 }
635
636 if( $this->getOrderingElementList()->isLastElementPosition($position) )
637 {
638 return false;
639 }
640
641 $this->getOrderingElementList()->moveElementByPositions($position, $position + 1);
642
643 return true;
644 }

References getOrderingElementList().

+ Here is the call graph for this function:

◆ moveAnswerUp()

assOrderingQuestion::moveAnswerUp (   $position)
Parameters
$position

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

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

610 {
611 if( !$this->getOrderingElementList()->elementExistByPosition($position) )
612 {
613 return false;
614 }
615
616 if( $this->getOrderingElementList()->isFirstElementPosition($position) )
617 {
618 return false;
619 }
620
621 $this->getOrderingElementList()->moveElementByPositions($position, $position - 1);
622 }

References getOrderingElementList().

+ Here is the call graph for this function:

◆ rebuildThumbnails()

assOrderingQuestion::rebuildThumbnails ( )

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

1165 {
1166 if ($this->getOrderingType() == OQ_PICTURES || $this->getOrderingType() == OQ_NESTED_PICTURES)
1167 {
1168 foreach ( $this->getOrderElements() as $orderingElement)
1169 {
1170 $this->generateThumbForFile($this->getImagePath(), $orderingElement->getContent());
1171 }
1172 }
1173 }
getOrderElements()
Returns the answers array.

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

Referenced by saveAnswerSpecificDataToDb().

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

◆ reworkWorkingData()

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

{Reworks the allready saved working data if neccessary.

Parameters
integer$active_id
integer$pass
boolean$obligationsAnswered
boolean$authorized
}

Reimplemented from assQuestion.

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

1007 {
1008 // nothing to rework!
1009 }

◆ saveAnswerSpecificDataToDb()

assOrderingQuestion::saveAnswerSpecificDataToDb ( )

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

Returns
mixed

Implements ilObjAnswerScoringAdjustable.

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

992 {
993 $this->getOrderingElementList()->setQuestionId($this->getId());
994 $this->getOrderingElementList()->saveToDb();
995
996 if( $this->hasOrderingTypeUploadSupport() )
997 {
998 $this->rebuildThumbnails();
999 $this->cleanImagefiles();
1000 }
1001 }

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

Referenced by saveToDb().

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

◆ savePreviewData()

assOrderingQuestion::savePreviewData ( ilAssQuestionPreviewSession  $previewSession)
protected

Reimplemented from assQuestion.

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

961 {
962 if( $this->validateSolutionSubmit() )
963 {
964 $previewSession->setParticipantsSolution( serialize($this->getSolutionListFromPostSubmit()) );
965 }
966 }

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

+ Here is the call graph for this function:

◆ saveToDb()

assOrderingQuestion::saveToDb (   $original_id = "")

Saves a assOrderingQuestion object to a database.

Parameters
string$original_id

Reimplemented from assQuestion.

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

134 {
135 global $ilDB;
136
140 parent::saveToDb($original_id);
141 }
saveAnswerSpecificDataToDb()
Saves the answer specific records into a question types answer table.
saveQuestionDataToDb($original_id="")
saveAdditionalQuestionDataToDb()
Saves a record to the question types additional data table.

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

+ Here is the call graph for this function:

◆ saveWorkingData()

assOrderingQuestion::saveWorkingData (   $active_id,
  $pass = NULL,
  $authorized = true 
)

Saves the learners input of the question to the database.

@access public

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

Reimplemented from assQuestion.

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

922 {
923 $entered_values = 0;
924
925 if (is_null($pass))
926 {
927 include_once "./Modules/Test/classes/class.ilObjTest.php";
928 $pass = ilObjTest::_getPass($active_id);
929 }
930
931 $this->getProcessLocker()->executeUserSolutionUpdateLockOperation(
932 function() use (&$entered_values, $active_id, $pass, $authorized)
933 {
934 $this->removeCurrentSolution($active_id, $pass, $authorized);
935
936 foreach( $this->getSolutionListFromPostSubmit() as $orderingElement)
937 {
938 $value1 = $orderingElement->getStorageValue1($this->getOrderingType());
939 $value2 = $orderingElement->getStorageValue2($this->getOrderingType());
940
941 $this->saveCurrentSolution($active_id, $pass, $value1, trim($value2), $authorized);
942
943 $entered_values++;
944 }
945 }
946 );
947
948 if ($entered_values)
949 {
950 $this->log($active_id, 'log_user_entered_values');
951 }
952 else
953 {
954 $this->log($active_id, 'log_user_not_entered_values');
955 }
956
957 return true;
958 }
log($active_id, $langVar)
saveCurrentSolution($active_id, $pass, $value1, $value2, $authorized=true, $tstamp=null)
removeCurrentSolution($active_id, $pass, $authorized=true)
static _getPass($active_id)
Retrieves the actual pass of a given user for a given test.

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

+ Here is the call graph for this function:

◆ setElementHeight()

assOrderingQuestion::setElementHeight (   $a_height)

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

1157 {
1158 $this->element_height = ($a_height < 20) ? "" : $a_height;
1159 }

◆ setExportDetailsXLS()

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

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

Parameters
object$worksheetReference to the parent excel worksheet
object$startrowStartrow of the output in the excel worksheet
object$active_idActive id of the participant
object$passTest pass
Returns
object
}

Reimplemented from assQuestion.

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

1089 {
1090 parent::setExportDetailsXLS($worksheet, $startrow, $active_id, $pass);
1091
1092 $solutions = $this->getSolutionValues($active_id, $pass);
1093 $sol = array();
1094 foreach ($solutions as $solution)
1095 {
1096 $sol[$solution["value1"]] = $solution["value2"];
1097 }
1098 asort($sol);
1099 $sol = array_keys($sol);
1100
1101 $i = 1;
1102 foreach ($sol as $idx)
1103 {
1104 foreach ($solutions as $solution)
1105 {
1106 if ($solution["value1"] == $idx) $worksheet->setCell($startrow + $i, 0, $solution["value2"]);
1107 }
1108 $element = $this->getOrderingElementList()->getElementByPosition($idx);
1109 $worksheet->setCell($startrow + $i, 1, $element->getContent());
1110 $i++;
1111 }
1112
1113 return $startrow + $i + 1;
1114 }
$worksheet

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

+ Here is the call graph for this function:

◆ setOrderingElementList()

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

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

600 {
601 $this->orderingElementList = $orderingElementList;
602 }

References $orderingElementList.

◆ setOrderingType()

assOrderingQuestion::setOrderingType (   $ordering_type = OQ_TERMS)

Sets the ordering question type.

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

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

406 {
407 $this->ordering_type = $ordering_type;
408 }

References $ordering_type.

◆ setThumbGeometry()

assOrderingQuestion::setThumbGeometry (   $a_geometry)

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

1137 {
1138 $this->thumb_geometry = ($a_geometry < 1) ? 100 : $a_geometry;
1139 }

◆ storeImageFile()

assOrderingQuestion::storeImageFile (   $uploadFile,
  $targetFile 
)

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

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

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

863 {
864 if( !strlen($uploadFile) )
865 {
866 return false;
867 }
868
869 $this->ensureImagePathExists();
870
871 // store file with hashed name
872
873 if( !ilUtil::moveUploadedFile($uploadFile, $targetFile, $this->getImagePath().$targetFile) )
874 {
875 return false;
876 }
877
878 return true;
879 }
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file

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

+ Here is the call graph for this function:

◆ supportsJavascriptOutput()

assOrderingQuestion::supportsJavascriptOutput ( )

Returns true if the question type supports JavaScript output.

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

Reimplemented from assQuestion.

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

1076 {
1077 return TRUE;
1078 }

◆ supportsNonJsOutput()

assOrderingQuestion::supportsNonJsOutput ( )

Reimplemented from assQuestion.

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

1081 {
1082 return false;
1083 }

◆ toJSON()

assOrderingQuestion::toJSON ( )

Returns a JSON representation of the question.

Reimplemented from assQuestion.

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

1208 {
1209 include_once("./Services/RTE/classes/class.ilRTE.php");
1210 $result = array();
1211 $result['id'] = (int) $this->getId();
1212 $result['type'] = (string) $this->getQuestionType();
1213 $result['title'] = (string) $this->getTitle();
1214 $result['question'] = $this->formatSAQuestion($this->getQuestion());
1215 $result['nr_of_tries'] = (int) $this->getNrOfTries();
1216 $result['shuffle'] = (bool) true;
1217 $result['points'] = $this->getPoints();
1218 $result['feedback'] = array(
1219 'onenotcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), false)),
1220 'allcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), true))
1221 );
1222 if ($this->getOrderingType() == OQ_PICTURES)
1223 {
1224 $result['path'] = $this->getImagePathWeb();
1225 }
1226
1227 $counter = 1;
1228 $answers = array();
1229 foreach ( $this->getOrderingElementList() as $orderingElement)
1230 {
1231 $answers[$counter] = $orderingElement->getContent();
1232 $counter++;
1233 }
1234 $answers = $this->getShuffler()->shuffle($answers);
1235 $arr = array();
1236 foreach ($answers as $order => $answer)
1237 {
1238 array_push($arr, array(
1239 "answertext" => (string) $answer,
1240 "order" => (int) $order
1241 ));
1242 }
1243 $result['answers'] = $arr;
1244
1245 $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $this->getId());
1246 $result['mobs'] = $mobs;
1247
1248 return json_encode($result);
1249 }
getQuestionType()
Returns the question type of the question.
formatSAQuestion($a_q)
Format self assessment question.
static _getMobsOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
get mobs of object
$counter
$mobs

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

+ Here is the call graph for this function:

◆ updateLeveledOrdering()

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

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

1511 {
1512 global $ilDB;
1513
1514 $ilDB->update('qpl_a_ordering',
1515 array('solution_key'=> array('integer', $a_index),
1516 'depth' => array('integer', $a_depth)),
1517 array('answertext' => array('text', $a_answer_text)));
1518
1519
1520 return true;
1521 }

References $ilDB.

◆ validateSolutionSubmit()

assOrderingQuestion::validateSolutionSubmit ( )
  Checks the data to be saved for consistency
Returns
boolean True, if the check was ok, False otherwise @access public
See also
$answers

Reimplemented from assQuestion.

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

908 {
909 $submittedSolutionList = $this->getSolutionListFromPostSubmit();
910 return $this->getOrderingElementList()->hasSameElementSetByRandomIdentifiers($submittedSolutionList);
911 }

References getOrderingElementList(), and getSolutionListFromPostSubmit().

Referenced by savePreviewData().

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

Field Documentation

◆ $element_height

assOrderingQuestion::$element_height

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

Referenced by getElementHeight().

◆ $leveled_ordering

assOrderingQuestion::$leveled_ordering = array()

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

Referenced by getLeveledOrdering().

◆ $old_ordering_depth

assOrderingQuestion::$old_ordering_depth = array()

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

Referenced by getOldLeveledOrdering().

◆ $ordering_type

assOrderingQuestion::$ordering_type

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

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

◆ $orderingElementList

assOrderingQuestion::$orderingElementList
protected

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

Referenced by getOrderingElementList(), and setOrderingElementList().

◆ $postSolutionOrderingElementList

assOrderingQuestion::$postSolutionOrderingElementList = null
private

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