ILIAS  release_7 Revision v7.30-3-g800a261c036
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=self::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=self::OQ_TERMS)
 
 getOrderingType ()
 
 isOrderingTypeNested ()
 
 isImageOrderingType ()
 
 setContentType ($ct)
 
 setNestingType (bool $nesting)
 
 hasOrderingTypeUploadSupport ()
 
 getOrderingElementListForSolutionOutput ($forceCorrectSolution, $activeId, $passIndex, $getUseIntermediateSolution=false)
 
 getSolutionOrderingElementListForTestOutput (ilAssNestedOrderingElementsInputGUI $inputGUI, $lastPost, $activeId, $pass)
 
 getSolutionOrderingElementList ($indexedSolutionValues)
 
 getShuffledOrderingElementList ()
 
 getOrderingElementList ()
 
 setOrderingElementList (ilAssOrderingElementList $list)
 
 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 (string $upload_file, string $upload_name)
 
 validateSolutionSubmit ()
 Checks the data to be saved for consistency. More...
 
 saveWorkingData ($active_id, $pass=null, $authorized=true)
 Saves the learners input of the question to the database. More...
 
 saveAnswerSpecificDataToDb ()
 Saves the answer specific records into a question types answer table. More...
 
 getQuestionType ()
 Returns the question type of the question. More...
 
 getAdditionalTableName ()
 Returns the name of the additional question data table in the database. More...
 
 getAnswerTableName ()
 Returns the name of the answer table in the database. More...
 
 getRTETextWithMediaObjects ()
 Collects all text in the question which could contain media objects which were created with the Rich Text Editor. More...
 
 getOrderElements ()
 Returns the answers array. More...
 
 supportsJavascriptOutput ()
 Returns true if the question type supports JavaScript output. More...
 
 supportsNonJsOutput ()
 
 setExportDetailsXLS ($worksheet, $startrow, $active_id, $pass)
 {Creates an Excel worksheet for the detailed cumulated results of this question.
Parameters
object$worksheetReference to the parent excel worksheet
object$startrowStartrow of the output in the excel worksheet
object$active_idActive id of the participant
object$passTest pass
Returns
object
} More...
 
 getThumbGeometry ()
 
 getThumbSize ()
 
 setThumbGeometry ($a_geometry)
 
 getElementHeight ()
 
 setElementHeight ($a_height)
 
 rebuildThumbnails ()
 
 getThumbPrefix ()
 
 toJSON ()
 Returns a JSON representation of the question. More...
 
 buildOrderingElementInputGui ()
 
 initOrderingElementAuthoringProperties (ilFormPropertyGUI $formField)
 
 initOrderingElementFormFieldLabels (ilFormPropertyGUI $formField)
 
 buildOrderingTextsInputGui ()
 
 buildOrderingImagesInputGui ()
 
 buildNestedOrderingElementInputGui ()
 
 fetchSolutionListFromFormSubmissionData ($userSolutionPost)
 
 getSolutionListFromPostSubmit ()
 
 getSolutionPostSubmit ()
 
 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
 getShuffler ()
 
 setShuffler (ilArrayElementShuffler $shuffler)
 
 setProcessLocker ($processLocker)
 
 getProcessLocker ()
 
 fromXML (&$item, &$questionpool_id, &$tst_id, &$tst_object, &$question_counter, &$import_mapping, array $solutionhints=[])
 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...
 
 getDescriptionForHTMLOutput ()
 
 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...
 
 getAuthorForHTMLOutput ()
 
 getOwner ()
 Gets the creator/owner ID of the assQuestion object. More...
 
 getObjId ()
 Get the object id of the container object. More...
 
 setObjId ($obj_id=0)
 Set the object id of the container object. More...
 
 getLifecycle ()
 
 setLifecycle (ilAssQuestionLifecycle $lifecycle)
 
 setExternalId ($external_id)
 
 getExternalId ()
 
 getSuggestedSolutionOutput ()
 
_getSuggestedSolution ($question_id, $subquestion_index=0)
 Returns a suggested solution for a given subquestion index. More...
 
 getSuggestedSolutions ()
 Return the suggested solutions. More...
 
 getReachedPoints ($active_id, $pass=null)
 Returns the points, a learner has reached answering the question This is the fast way to get the points directly from the database. More...
 
 getMaximumPoints ()
 Returns the maximum points, a learner can reach answering the question. More...
 
 getAdjustedReachedPoints ($active_id, $pass=null, $authorizedSolution=true)
 returns the reached points ... More...
 
 calculateResultsFromSolution ($active_id, $pass=null, $obligationsEnabled=false)
 Calculates the question results from a previously saved question solution. More...
 
 persistWorkingState ($active_id, $pass=null, $obligationsEnabled=false, $authorized=true)
 persists the working state for current testactive and testpass More...
 
 persistPreviewState (ilAssQuestionPreviewSession $previewSession)
 persists the preview state for current user and question More...
 
 validateSolutionSubmit ()
 
 saveWorkingData ($active_id, $pass=null, $authorized=true)
 Saves the learners input of the question to the database. More...
 
 moveUploadedMediaFile ($file, $name)
 Move an uploaded media file to an public accessible temp dir to present it. More...
 
 getSuggestedSolutionPath ()
 Returns the path for a suggested solution. More...
 
 getJavaPath ()
 Returns the image path for web accessable images of a question. More...
 
 getImagePath ($question_id=null, $object_id=null)
 Returns the image path for web accessable images of a question. More...
 
 buildImagePath ($questionId, $parentObjectId)
 
 getFlashPath ()
 Returns the image path for web accessable flash files of a question. More...
 
 getJavaPathWeb ()
 Returns the web image path for web accessable java applets of a question. More...
 
 getSuggestedSolutionPathWeb ()
 Returns the web path for a suggested solution. More...
 
 getImagePathWeb ()
 Returns the web image path for web accessable images of a question. More...
 
 getFlashPathWeb ()
 Returns the web image path for web accessable flash applications of a question. More...
 
 getTestOutputSolutions ($activeId, $pass)
 
 getUserSolutionPreferingIntermediate ($active_id, $pass=null)
 
 getSolutionValues ($active_id, $pass=null, $authorized=true)
 Loads solutions of a given user from the database an returns it. More...
 
 isInUse ($question_id="")
 Checks whether the question is in use or not. More...
 
 isClone ($question_id="")
 Checks whether the question is a clone of another question or not. More...
 
 pcArrayShuffle ($array)
 Shuffles the values of a given array. More...
 
 getAdditionalTableName ()
 Returns the name of the additional question data table in the database. More...
 
 getAnswerTableName ()
 Returns the name of the answer table in the database. More...
 
 deleteAnswers ($question_id)
 Deletes datasets from answers tables. More...
 
 deleteAdditionalTableData ($question_id)
 Deletes datasets from the additional question table in the database. More...
 
 delete ($question_id)
 Deletes a question and all materials from the database. More...
 
 getTotalAnswers ()
 get total number of answers More...
 
 _getTotalAnswers ($a_q_id)
 get number of answers for question id (static) note: do not use $this inside this method More...
 
 copyXHTMLMediaObjectsOfQuestion ($a_q_id)
 
 syncXHTMLMediaObjectsOfQuestion ()
 
 createPageObject ()
 create page object of question More...
 
 copyPageOfQuestion ($a_q_id)
 
 getPageOfQuestion ()
 
 setOriginalId ($original_id)
 
 getOriginalId ()
 
 fixSvgToPng ($imageFilenameContainingString)
 
 fixUnavailableSkinImageSources ($html)
 
 loadFromDb ($question_id)
 Loads the question from the database. More...
 
 createNewQuestion ($a_create_page=true)
 Creates a new question without an owner when a new question is created This assures that an ID is given to the question if a file upload or something else occurs. More...
 
 saveQuestionDataToDb ($original_id="")
 
 saveToDb ($original_id="")
 Saves the question to the database. More...
 
 setNewOriginalId ($newId)
 
 deleteSuggestedSolutions ()
 Deletes all suggestes solutions in the database. More...
 
 getSuggestedSolution ($subquestion_index=0)
 Returns a suggested solution for a given subquestion index. More...
 
 getSuggestedSolutionTitle ($subquestion_index=0)
 Returns the title of a suggested solution at a given subquestion_index. More...
 
 setSuggestedSolution ($solution_id="", $subquestion_index=0, $is_import=false)
 Sets a suggested solution for the question. More...
 
 _resolveInternalLink ($internal_link)
 
 _resolveIntLinks ($question_id)
 
 syncWithOriginal ()
 
 _questionExists ($question_id)
 Returns true if the question already exists in the database. More...
 
 _questionExistsInPool ($question_id)
 Returns true if the question already exists in the database and is assigned to a question pool. More...
 
 getPoints ()
 Returns the maximum available points for the question. More...
 
 setPoints ($a_points)
 Sets the maximum available points for the question. More...
 
 getSolutionMaxPass ($active_id)
 Returns the maximum pass a users question solution. More...
 
 calculateReachedPoints ($active_id, $pass=null, $authorizedSolution=true, $returndetails=false)
 Returns the points, a learner has reached answering the question. More...
 
 deductHintPointsFromReachedPoints (ilAssQuestionPreviewSession $previewSession, $reachedPoints)
 
 calculateReachedPointsFromPreviewSession (ilAssQuestionPreviewSession $previewSession)
 
 isPreviewSolutionCorrect (ilAssQuestionPreviewSession $previewSession)
 
 adjustReachedPointsByScoringOptions ($points, $active_id, $pass=null)
 Adjust the given reached points by checks for all special scoring options in the test container. More...
 
 isHTML ($a_text)
 Checks if a given string contains HTML or not. More...
 
 prepareTextareaOutput ($txt_output, $prepare_for_latex_output=false, $omitNl2BrWhenTextArea=false)
 Prepares a string for a text area output in tests. More...
 
 QTIMaterialToString ($a_material)
 Reads an QTI material tag an creates a text string. More...
 
 addQTIMaterial (&$a_xml_writer, $a_material, $close_material_tag=true, $add_mobs=true)
 Creates a QTI material tag from a plain text or xhtml text. More...
 
 buildHashedImageFilename ($plain_image_filename, $unique=false)
 
 getQuestion ()
 Gets the question string of the question object. More...
 
 setQuestion ($question="")
 Sets the question string of the question object. More...
 
 getQuestionForHTMLOutput ()
 
 getQuestionType ()
 Returns the question type of the question. More...
 
 getQuestionTypeID ()
 Returns the question type of the question. More...
 
 cleanupMediaObjectUsage ()
 synchronises appearances of media objects in the question with media object usage table More...
 
getInstances ()
 Gets all instances of the question. More...
 
 getActiveUserData ($active_id)
 Returns the user id and the test id for a given active id. More...
 
 setExportDetailsXLS ($worksheet, $startrow, $active_id, $pass)
 Creates an Excel worksheet for the detailed cumulated results of this question. More...
 
 __get ($value)
 Object getter. More...
 
 __set ($key, $value)
 Object setter. More...
 
 getNrOfTries ()
 
 setNrOfTries ($a_nr_of_tries)
 
 setExportImagePath ($a_path)
 
 formatSAQuestion ($a_q)
 Format self assessment question. More...
 
 setPreventRteUsage ($a_val)
 Set prevent rte usage. More...
 
 getPreventRteUsage ()
 Get prevent rte usage. More...
 
 migrateContentForLearningModule (ilAssSelfAssessmentMigrator $migrator)
 
 setSelfAssessmentEditingMode ($a_selfassessmenteditingmode)
 Set Self-Assessment Editing Mode. More...
 
 getSelfAssessmentEditingMode ()
 Get Self-Assessment Editing Mode. More...
 
 setDefaultNrOfTries ($a_defaultnroftries)
 Set Default Nr of Tries. More...
 
 getDefaultNrOfTries ()
 Get Default Nr of Tries. More...
 
 syncSkillAssignments ($srcParentId, $srcQuestionId, $trgParentId, $trgQuestionId)
 
 isAnswered ($active_id, $pass=null)
 returns boolean wether the question is answered during test pass or not More...
 
 isAutosaveable ()
 
 getAdditionalContentEditingMode ()
 getter for additional content editing mode for this question More...
 
 setAdditionalContentEditingMode ($additinalContentEditingMode)
 setter for additional content editing mode for this question More...
 
 isAdditionalContentEditingModePageObject ()
 isser for additional "pageobject" content editing mode More...
 
 isValidAdditionalContentEditingMode ($additionalContentEditingMode)
 returns the fact wether the passed additional content mode is valid or not More...
 
 getValidAdditionalContentEditingModes ()
 getter for valid additional content editing modes More...
 
 addQuestionChangeListener (ilQuestionChangeListener $listener)
 
 getQuestionChangeListeners ()
 
 getHtmlUserSolutionPurifier ()
 
 getHtmlQuestionContentPurifier ()
 
 setLastChange ($lastChange)
 
 getLastChange ()
 
 removeIntermediateSolution ($active_id, $pass)
 
 removeCurrentSolution ($active_id, $pass, $authorized=true)
 
 saveCurrentSolution ($active_id, $pass, $value1, $value2, $authorized=true, $tstamp=null)
 
 updateCurrentSolution ($solutionId, $value1, $value2, $authorized=true)
 
 updateCurrentSolutionsAuthorization ($activeId, $pass, $authorized, $keepTime=false)
 
 setStep ($step)
 
 getStep ()
 
 toJSON ()
 
 duplicate ($for_test=true, $title="", $author="", $owner="", $testObjId=null)
 
 intermediateSolutionExists ($active_id, $pass)
 
 authorizedSolutionExists ($active_id, $pass)
 
 authorizedOrIntermediateSolutionExists ($active_id, $pass)
 
 isAddableAnswerOptionValue ($qIndex, $answerOptionValue)
 
 addAnswerOptionValue ($qIndex, $answerOptionValue, $points)
 
 removeAllExistingSolutions ()
 
 removeExistingSolutions ($activeId, $pass)
 
 resetUsersAnswer ($activeId, $pass)
 
 removeResultRecord ($activeId, $pass)
 
 fetchValuePairsFromIndexedValues (array $indexedValues)
 
 fetchIndexedValuesFromValuePairs (array $valuePairs)
 
 areObligationsToBeConsidered ()
 
 setObligationsToBeConsidered ($obligationsToBeConsidered)
 
 updateTimestamp ()
 
 getTestPresentationConfig ()
 Get the test question configuration (initialised once) More...
 
 savePartial ()
 
 isInActiveTest ()
 
- 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'
 
const OQ_PICTURES = 0
 
const OQ_TERMS = 1
 
const OQ_NESTED_PICTURES = 2
 
const OQ_NESTED_TERMS = 3
 
const OQ_CT_PICTURES = 'pics'
 
const OQ_CT_TERMS = 'terms'
 
const VALID_UPLOAD_SUFFIXES = ["jpg", "jpeg", "png", "gif"]
 
 $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_RTE = 'default'
 constant for additional content editing mode "default" More...
 
const ADDITIONAL_CONTENT_EDITING_MODE_IPE = '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

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

Protected Attributes

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

Private Attributes

 $postSolutionOrderingElementList = null
 

Additional Inherited Members

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

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

assOrderingQuestion::__construct (   $title = "",
  $comment = "",
  $author = "",
  $owner = -1,
  $question = "",
  $ordering_type = self::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 92 of file class.assOrderingQuestion.php.

References assQuestion\$author, assQuestion\$comment, $ordering_type, assQuestion\$owner, assQuestion\$question, assQuestion\$title, and ILIAS\GlobalScreen\Provider\__construct().

+ Here is the call graph for this function:

Member Function Documentation

◆ afterSyncWithOriginal()

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

{}

Reimplemented from assQuestion.

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

1516 {
1517 parent::afterSyncWithOriginal($origQuestionId, $dupQuestionId, $origParentObjId, $dupParentObjId);
1518 $this->duplicateImages($dupQuestionId, $dupParentObjId, $origQuestionId, $origParentObjId);
1519 }
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 1295 of file class.assOrderingQuestion.php.

1296 {
1297 $formDataConverter = $this->buildNestedOrderingFormDataConverter();
1298
1299 require_once 'Modules/TestQuestionPool/classes/forms/class.ilAssNestedOrderingElementsInputGUI.php';
1300
1301 $orderingElementInput = new ilAssNestedOrderingElementsInputGUI(
1302 $formDataConverter,
1303 self::ORDERING_ELEMENT_FORM_FIELD_POSTVAR
1304 );
1305
1306 $orderingElementInput->setUniquePrefix($this->getId());
1307 $orderingElementInput->setOrderingType($this->getOrderingType());
1308 $orderingElementInput->setElementImagePath($this->getImagePathWeb());
1309 $orderingElementInput->setThumbPrefix($this->getThumbPrefix());
1310
1311 $this->initOrderingElementFormFieldLabels($orderingElementInput);
1312
1313 return $orderingElementInput;
1314 }
initOrderingElementFormFieldLabels(ilFormPropertyGUI $formField)
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 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 1644 of file class.assOrderingQuestion.php.

1645 {
1646 $formDataConverter = $this->buildOrderingElementFormDataConverter();
1648
1649 if ($this->getOrderingType() == OQ_NESTED_PICTURES) {
1650 $formDataConverter->setImageRemovalCommand(self::ORDERING_ELEMENT_FORM_CMD_REMOVE_IMG);
1651 $formDataConverter->setImageUrlPath($this->getImagePathWeb());
1652 $formDataConverter->setThumbnailPrefix($this->getThumbPrefix());
1653 }
1654
1655 return $formDataConverter;
1656 }

References buildOrderingElementFormDataConverter(), ilAssOrderingFormValuesObjectsConverter\CONTEXT_MAINTAIN_HIERARCHY, assQuestion\getImagePathWeb(), getOrderingType(), getThumbPrefix(), 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 1604 of file class.assOrderingQuestion.php.

1605 {
1606 require_once 'Modules/TestQuestionPool/classes/forms/class.ilAssOrderingFormValuesObjectsConverter.php';
1607 $converter = new ilAssOrderingFormValuesObjectsConverter();
1608 $converter->setPostVar(self::ORDERING_ELEMENT_FORM_FIELD_POSTVAR);
1609
1610 return $converter;
1611 }

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

1214 {
1215 if ($this->isImageOrderingType()) {
1216 return $this->buildOrderingImagesInputGui();
1217 }
1218 return $this->buildOrderingTextsInputGui();
1219 }

References buildOrderingImagesInputGui(), buildOrderingTextsInputGui(), and isImageOrderingType().

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

1617 {
1618 $formDataConverter = $this->buildOrderingElementFormDataConverter();
1620
1621 $formDataConverter->setImageRemovalCommand(self::ORDERING_ELEMENT_FORM_CMD_REMOVE_IMG);
1622 $formDataConverter->setImageUrlPath($this->getImagePathWeb());
1623 $formDataConverter->setImageFsPath($this->getImagePath());
1624
1625 if ($this->getThumbSize() && $this->getThumbPrefix()) {
1626 $formDataConverter->setThumbnailPrefix($this->getThumbPrefix());
1627 }
1628 return $formDataConverter;
1629 }
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 1273 of file class.assOrderingQuestion.php.

1274 {
1275 $formDataConverter = $this->buildOrderingImagesFormDataConverter();
1276
1277 require_once 'Modules/TestQuestionPool/classes/forms/class.ilAssOrderingImagesInputGUI.php';
1278
1279 $orderingElementInput = new ilAssOrderingImagesInputGUI(
1280 $formDataConverter,
1281 self::ORDERING_ELEMENT_FORM_FIELD_POSTVAR
1282 );
1283
1284 $orderingElementInput->setImageUploadCommand(self::ORDERING_ELEMENT_FORM_CMD_UPLOAD_IMG);
1285 $orderingElementInput->setImageRemovalCommand(self::ORDERING_ELEMENT_FORM_CMD_REMOVE_IMG);
1286
1287 $this->initOrderingElementFormFieldLabels($orderingElementInput);
1288
1289 return $orderingElementInput;
1290 }

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

1635 {
1636 $formDataConverter = $this->buildOrderingElementFormDataConverter();
1638 return $formDataConverter;
1639 }

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

1255 {
1256 $formDataConverter = $this->buildOrderingTextsFormDataConverter();
1257
1258 require_once 'Modules/TestQuestionPool/classes/forms/class.ilAssOrderingTextsInputGUI.php';
1259
1260 $orderingElementInput = new ilAssOrderingTextsInputGUI(
1261 $formDataConverter,
1262 self::ORDERING_ELEMENT_FORM_FIELD_POSTVAR
1263 );
1264
1265 $this->initOrderingElementFormFieldLabels($orderingElementInput);
1266
1267 return $orderingElementInput;
1268 }

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

1529 {
1530 // hey: refactored identifiers
1531 return parent::buildTestPresentationConfig()
1532 // hey.
1533 ->setIsUnchangedAnswerPossible(true)
1534 ->setUseUnchangedAnswerLabel($this->lng->txt('tst_unchanged_order_is_correct'));
1535 }

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

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

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

+ Here is the call graph for this function:

◆ calculateReachedPointsForSolution()

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

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

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

733 {
734 if (!$previewSession->hasParticipantSolution()) {
735 return 0;
736 }
737
738 $solutionOrderingElementList = unserialize(
739 $previewSession->getParticipantsSolution()
740 );
741
742 $reachedPoints = $this->calculateReachedPointsForSolution($solutionOrderingElementList);
743 $reachedPoints = $this->deductHintPointsFromReachedPoints($previewSession, $reachedPoints);
744
745 return $this->ensureNonNegativePoints($reachedPoints);
746 }
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 776 of file class.assOrderingQuestion.php.

777 {
778 if ($this->getOrderingType() == self::OQ_PICTURES) {
779 if (@file_exists($this->getImagePath())) {
780 $contents = ilUtil::getDir($this->getImagePath());
781 foreach ($contents as $f) {
782 if (strcmp($f['type'], 'file') == 0) {
783 $found = false;
784 foreach ($this->getOrderingElementList() as $orderElement) {
785 if (strcmp($f['entry'], $orderElement->getContent()) == 0) {
786 $found = true;
787 }
788 if (strcmp($f['entry'], $this->getThumbPrefix() . $orderElement->getContent()) == 0) {
789 $found = true;
790 }
791 }
792 if (!$found) {
793 if (@file_exists($this->getImagePath() . $f['entry'])) {
794 @unlink($this->getImagePath() . $f['entry']);
795 }
796 }
797 }
798 }
799 }
800 } else {
801 if (@file_exists($this->getImagePath())) {
803 }
804 }
805 }
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
const OQ_PICTURES
Ordering question constants.

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

+ Here is the call 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 379 of file class.assOrderingQuestion.php.

380 {
381 global $DIC;
382 $ilLog = $DIC['ilLog'];
383 if ($this->getOrderingType() == OQ_PICTURES) {
384 $imagepath = $this->getImagePath();
385 $imagepath_original = str_replace("/$this->id/images", "/$question_id/images", $imagepath);
386 $imagepath_original = str_replace("/$this->obj_id/", "/$source_questionpool/", $imagepath_original);
387 if (!file_exists($imagepath)) {
388 ilUtil::makeDirParents($imagepath);
389 }
390 foreach ($this->getOrderingElementList() as $element) {
391 $filename = $element->getContent();
392 if (!@copy($imagepath_original . $filename, $imagepath . $filename)) {
393 $ilLog->write("Ordering Question image could not be copied: ${imagepath_original}${filename}");
394 }
395 if (@file_exists($imagepath_original . $this->getThumbPrefix() . $filename)) {
396 if (!@copy($imagepath_original . $this->getThumbPrefix() . $filename, $imagepath . $this->getThumbPrefix() . $filename)) {
397 $ilLog->write("Ordering Question image thumbnail could not be copied: $imagepath_original" . $this->getThumbPrefix() . $filename);
398 }
399 }
400 }
401 }
402 }
$filename
Definition: buildRTE.php:89
static makeDirParents($a_dir)
Create a new directory and all parent directories.
global $DIC
Definition: goto.php:24

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

269 {
270 if ($this->id <= 0) {
271 // The question has not been saved. It cannot be duplicated
272 return;
273 }
274 // duplicate the question in database
275 $clone = clone $this;
276 $this_id = $this->getId();
278 $clone->id = -1;
279 $source_questionpool_id = $this->getObjId();
280 $clone->setObjId($target_questionpool_id);
281 if ($title) {
282 $clone->setTitle($title);
283 }
284 $clone->saveToDb();
285
286 $list = $this->getRepository()->getOrderingList($this_id)
287 ->withQuestionId($clone->getId());
288 $list->distributeNewRandomIdentifiers();
289 $clone->setOrderingElementList($list);
290 $clone->saveToDb();
291
292 $clone->copyPageOfQuestion($original_id);
293 $clone->copyXHTMLMediaObjectsOfQuestion($original_id);
294 $clone->duplicateImages($original_id, $source_questionpool_id, $clone->getId(), $target_questionpool_id);
295
296 $clone->onCopy($source_questionpool_id, $original_id, $clone->getObjId(), $clone->getId());
297
298 return $clone->getId();
299 }
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(), assQuestion\getId(), assQuestion\getObjId(), and getRepository().

+ Here is the call graph for this function:

◆ createNewOriginalFromThisDuplicate()

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

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

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

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

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

681 {
682 $this->getOrderingElementList()->removeElement(
683 $this->getOrderingElementList()->getElementByRandomIdentifier($randomIdentifier)
684 );
685 $this->getOrderingElementList()->saveToDb();
686 }

References getOrderingElementList().

+ Here is the call graph for this function:

◆ dropImageFile()

assOrderingQuestion::dropImageFile (   $imageFilename)

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

814 {
815 if (!strlen($imageFilename)) {
816 return false;
817 }
818
819 $result = @unlink($this->getImagePath() . $imageFilename);
820 $result = $result & @unlink($this->getImagePath() . $this->getThumbPrefix() . $imageFilename);
821
822 return $result;
823 }
$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 215 of file class.assOrderingQuestion.php.

216 {
217 if ($this->id <= 0) {
218 // The question has not been saved. It cannot be duplicated
219 return;
220 }
221 // duplicate the question in database
222 $this_id = $this->getId();
223 $thisObjId = $this->getObjId();
224
225 $clone = clone $this;
227 $clone->id = -1;
228
229 if ((int) $testObjId > 0) {
230 $clone->setObjId($testObjId);
231 }
232
233 if ($title) {
234 $clone->setTitle($title);
235 }
236 if ($author) {
237 $clone->setAuthor($author);
238 }
239 if ($owner) {
240 $clone->setOwner($owner);
241 }
242 if ($for_test) {
243 $clone->saveToDb($original_id);
244 } else {
245 $clone->saveToDb();
246 }
247
248 //$list = $this->getRepository()->getOrderingList($original_id)
249 $list = $this->getRepository()->getOrderingList($this_id)
250 ->withQuestionId($clone->getId());
251 $list->distributeNewRandomIdentifiers();
252 $clone->setOrderingElementList($list);
253 $clone->saveToDb();
254
255 $clone->copyPageOfQuestion($this_id);
256 $clone->copyXHTMLMediaObjectsOfQuestion($this_id);
257 $clone->duplicateImages($this_id, $thisObjId, $clone->getId(), $testObjId);
258
259 $clone->onDuplicate($thisObjId, $this_id, $clone->getObjId(), $clone->getId());
260 return $clone->getId();
261 }

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

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

343 {
344 global $DIC;
345 $ilLog = $DIC['ilLog'];
346 if ($this->isImageOrderingType()) {
347 $imagepath_original = $this->getImagePath($src_question_id, $src_object_id);
348 $imagepath = $this->getImagePath($dest_question_id, $dest_object_id);
349
350 if (!file_exists($imagepath)) {
351 ilUtil::makeDirParents($imagepath);
352 }
353 foreach ($this->getOrderingElementList() as $element) {
354 $filename = $element->getContent();
355
356 if($filename === "" || $filename === null) {
357 continue;
358 }
359
360 if (!file_exists($imagepath_original . $filename)
361 || !copy($imagepath_original . $filename, $imagepath . $filename)) {
362 $ilLog->write("image could not be duplicated!!!!");
363 $ilLog->write($imagepath_original . $filename);
364 $ilLog->write($imagepath . $filename);
365 }
366 if (file_exists($imagepath_original . $this->getThumbPrefix() . $filename)
367 && !copy($imagepath_original . $this->getThumbPrefix() . $filename, $imagepath . $this->getThumbPrefix() . $filename)) {
368 $ilLog->write("image thumbnail could not be duplicated!!!!");
369 }
370 }
371 }
372 }

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

Referenced by afterSyncWithOriginal().

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

◆ ensureImagePathExists()

assOrderingQuestion::ensureImagePathExists ( )
protected

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

1539 {
1540 if (!file_exists($this->getImagePath())) {
1542 }
1543 }

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

1323 {
1324 $orderingGUI = $this->buildNestedOrderingElementInputGui();
1326 $orderingGUI->setValueByArray($userSolutionPost);
1327
1328 if (!$orderingGUI->checkInput()) {
1329 require_once 'Modules/Test/exceptions/class.ilTestException.php';
1330 throw new ilTestException('error on validating user solution post');
1331 }
1332
1333 require_once 'Modules/TestQuestionPool/classes/questions/class.ilAssOrderingElementList.php';
1334 $solutionOrderingElementList = ilAssOrderingElementList::buildInstance($this->getId());
1335
1336 $storedElementList = $this->getOrderingElementList();
1337
1338 foreach ($orderingGUI->getElementList($this->getId()) as $submittedElement) {
1339 $solutionElement = $storedElementList->getElementByRandomIdentifier(
1340 $submittedElement->getRandomIdentifier()
1341 )->getClone();
1342
1343 $solutionElement->setPosition($submittedElement->getPosition());
1344
1345 if ($this->isOrderingTypeNested()) {
1346 $solutionElement->setIndentation($submittedElement->getIndentation());
1347 }
1348
1349 $solutionOrderingElementList->addElement($solutionElement);
1350 }
1351
1352 return $solutionOrderingElementList;
1353 }
static buildInstance(int $question_id, array $elements=[])

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:

◆ fetchSolutionSubmit()

assOrderingQuestion::fetchSolutionSubmit (   $formSubmissionDataStructure)
Returns
array

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

1549 {
1550 $solutionSubmit = array();
1551
1552 if (isset($formSubmissionDataStructure['orderresult'])) {
1553 $orderresult = $formSubmissionDataStructure['orderresult'];
1554
1555 if (strlen($orderresult)) {
1556 $orderarray = explode(":", $orderresult);
1557 $ordervalue = 1;
1558 foreach ($orderarray as $index) {
1559 $idmatch = null;
1560 if (preg_match("/id_(\\d+)/", $index, $idmatch)) {
1561 $randomid = $idmatch[1];
1562 foreach ($this->getOrderingElementList() as $answeridx => $answer) {
1563 if ($answer->getRandomIdentifier() == $randomid) {
1564 $solutionSubmit[$answeridx] = $ordervalue;
1565 $ordervalue++;
1566 }
1567 }
1568 }
1569 }
1570 }
1571 } elseif ($this->getOrderingType() == OQ_NESTED_TERMS || $this->getOrderingType() == OQ_NESTED_PICTURES) {
1572 $index = 0;
1573 foreach ($formSubmissionDataStructure['content'] as $randomId => $content) {
1574 $indentation = $formSubmissionDataStructure['indentation'];
1575
1576 $value1 = $index++;
1577 $value2 = implode(':', array($randomId, $indentation));
1578
1579 $solutionSubmit[$value1] = $value2;
1580 }
1581 } else {
1582 foreach ($formSubmissionDataStructure as $key => $value) {
1583 $matches = null;
1584 if (preg_match("/^order_(\d+)/", $key, $matches)) {
1585 if (!(preg_match("/initial_value_\d+/", $value))) {
1586 if (strlen($value)) {
1587 foreach ($this->getOrderingElementList() as $answeridx => $answer) {
1588 if ($answer->getRandomIdentifier() == $matches[1]) {
1589 $solutionSubmit[$answeridx] = $value;
1590 }
1591 }
1592 }
1593 }
1594 }
1595 }
1596 }
1597
1598 return $solutionSubmit;
1599 }
$index
Definition: metadata.php:128

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

Referenced by getSolutionPostSubmit().

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

◆ generateThumbForFile()

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

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

1144 {
1145 $filename = $path . $file;
1146 if (@file_exists($filename)) {
1147 $thumbpath = $path . $this->getThumbPrefix() . $file;
1148 $path_info = @pathinfo($filename);
1149 $ext = "";
1150 switch (strtoupper($path_info['extension'])) {
1151 case 'PNG':
1152 $ext = 'PNG';
1153 break;
1154 case 'GIF':
1155 $ext = 'GIF';
1156 break;
1157 default:
1158 $ext = 'JPEG';
1159 break;
1160 }
1161 ilUtil::convertImage($filename, $thumbpath, $ext, $this->getThumbGeometry());
1162 }
1163 }
static convertImage( $a_from, $a_to, $a_target_format="", $a_geometry="", $a_background_color="")
convert image

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

Referenced by rebuildThumbnails().

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

◆ getAdditionalTableName()

assOrderingQuestion::getAdditionalTableName ( )

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

Returns
string The additional table name @access public

Reimplemented from assQuestion.

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

995 {
996 return "qpl_qst_ordering";
997 }

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

664 {
665 if (!$this->getOrderingElementList()->elementExistByPosition($index)) {
666 return null;
667 }
668
669 return $this->getOrderingElementList()->getElementByPosition($index);
670 }

References $index, and getOrderingElementList().

+ Here is the call graph for this function:

◆ getAnswerCount()

assOrderingQuestion::getAnswerCount ( )

Returns the number of answers.

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

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

696 {
697 return $this->getOrderingElementList()->countElements();
698 }

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

1006 {
1007 return "qpl_a_ordering";
1008 }

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

1504 {
1505 if ($index !== null) {
1506 return $this->getOrderingElementList()->getElementByPosition($index);
1507 }
1508
1509 return $this->getOrderingElementList()->getElements();
1510 }

References $index, and getOrderingElementList().

+ Here is the call graph for this function:

◆ getElementHeight()

assOrderingQuestion::getElementHeight ( )

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

References $element_height.

◆ getEncryptedFilename()

assOrderingQuestion::getEncryptedFilename (   $filename)

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

768 {
769 $extension = "";
770 if (preg_match("/.*\\.(\\w+)$/", $filename, $matches)) {
771 $extension = $matches[1];
772 }
773 return md5($filename) . "." . $extension;
774 }

References $filename.

◆ getExpressionTypes()

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

755 {
756 return $this->getPoints();
757 }

References assQuestion\getPoints().

Referenced by isComplete().

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

◆ getOperators()

assOrderingQuestion::getOperators (   $expression)

Get all available operations for a specific question.

Parameters
string$expression

Implements iQuestionCondition.

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

1411 {
1412 require_once "./Modules/TestQuestionPool/classes/class.ilOperatorsExpressionMapping.php";
1414 }

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

1030 {
1031 return $this->getOrderingElementList()->getRandomIdentifierIndexedElements();
1032 }

References getOrderingElementList().

Referenced by rebuildThumbnails().

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

◆ getOrderingElementList()

◆ getOrderingElementListForSolutionOutput()

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

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

499 {
500 if ($forceCorrectSolution || !$activeId || $passIndex === null) {
501 return $this->getOrderingElementList();
502 }
503
504 $solutionValues = $this->getSolutionValues($activeId, $passIndex, !$getUseIntermediateSolution);
505
506 if (!count($solutionValues)) {
507 return $this->getShuffledOrderingElementList();
508 }
509
510 return $this->getSolutionOrderingElementList($this->fetchIndexedValuesFromValuePairs($solutionValues));
511 }

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

+ Here is the call graph for this function:

◆ getOrderingType()

assOrderingQuestion::getOrderingType ( )

◆ getQuestionRepository()

assOrderingQuestion::getQuestionRepository ( )
protected

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

967 {
968 global $DIC;
969 $ilDB = $DIC['ilDB'];
970 return new \ILIAS\TA\Questions\Ordering\assOrderingQuestionDatabaseRepository($ilDB);
971 }
repository for assOrderingQuestion (the answer elements within, at least...)
global $ilDB

References $DIC, and $ilDB.

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

984 {
985 return "assOrderingQuestion";
986 }

Referenced by toJSON().

+ Here is the caller graph for this function:

◆ getRepository()

assOrderingQuestion::getRepository ( )
protected

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

132 {
133 if (is_null($this->oq_repository)) {
134 global $DIC;
135 $ilDB = $DIC['ilDB'];
136 $this->oq_repository = new OQRepository($ilDB);
137 }
139 }

References $DIC, $ilDB, and $oq_repository.

Referenced by copyObject(), createNewOriginalFromThisDuplicate(), duplicate(), getOrderingElementList(), and setOrderingElementList().

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

1015 {
1016 $text = parent::getRTETextWithMediaObjects();
1017
1018 foreach ($this->getOrderingElementList() as $orderingElement) {
1019 $text .= $orderingElement->getContent();
1020 }
1021
1022 return $text;
1023 }

References getOrderingElementList().

+ Here is the call graph for this function:

◆ getShuffledOrderingElementList()

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

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

622 {
623 $shuffledRandomIdentifierIndex = $this->getShuffler()->shuffle(
624 $this->getOrderingElementList()->getRandomIdentifierIndex()
625 );
626
627 $shuffledElementList = $this->getOrderingElementList()->getClone();
628 $shuffledElementList->reorderByRandomIdentifiers($shuffledRandomIdentifierIndex);
629 $shuffledElementList->resetElementsIndentations();
630
631 return $shuffledElementList;
632 }

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

1364 {
1365 if ($this->postSolutionOrderingElementList === null) {
1367 $this->postSolutionOrderingElementList = $list;
1368 }
1369
1371 }
$_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 594 of file class.assOrderingQuestion.php.

595 {
596 $solutionOrderingList = new ilAssOrderingElementList();
597 $solutionOrderingList->setQuestionId($this->getId());
598
599 foreach ($indexedSolutionValues as $value1 => $value2) {
600 if ($this->isOrderingTypeNested()) {
601 $element = $this->getSolutionValuePairBrandedOrderingElementByRandomIdentifier($value1, $value2);
602 } else {
603 $element = $this->getSolutionValuePairBrandedOrderingElementBySolutionIdentifier($value1, $value2);
604 }
605
606 $solutionOrderingList->addElement($element);
607 }
608
609 if (!$this->getOrderingElementList()->hasSameElementSetByRandomIdentifiers($solutionOrderingList)) {
610 throw new ilTestQuestionPoolException('inconsistent solution values given');
611 }
612
613 return $solutionOrderingList;
614 }
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 522 of file class.assOrderingQuestion.php.

523 {
524 if ($inputGUI->isPostSubmit($lastPost)) {
525 return $this->fetchSolutionListFromFormSubmissionData($lastPost);
526 }
527
528 // hey: prevPassSolutions - pass will be always available from now on
529 #if( $pass === null && !ilObjTest::_getUsePreviousAnswers($activeId, true) )
530 #// condition looks strange? yes - keep it null when previous solutions not enabled (!)
531 #{
532 # $pass = ilObjTest::_getPass($activeId);
533 #}
534 // hey.
535
536 $indexedSolutionValues = $this->fetchIndexedValuesFromValuePairs(
537 // hey: prevPassSolutions - obsolete due to central check
538 $this->getTestOutputSolutions($activeId, $pass)
539 // hey.
540 );
541
542 if (count($indexedSolutionValues)) {
543 return $this->getSolutionOrderingElementList($indexedSolutionValues);
544 }
545
546 return $this->getShuffledOrderingElementList();
547 }
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 1376 of file class.assOrderingQuestion.php.

1377 {
1378 return $this->fetchSolutionSubmit($_POST);
1379 }
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 554 of file class.assOrderingQuestion.php.

555 {
556 $value2 = explode(':', $value2);
557
558 $randomIdentifier = $value2[0];
559 $selectedPosition = $value1;
560 $selectedIndentation = $value2[1];
561
562 $element = $this->getOrderingElementList()->getElementByRandomIdentifier($randomIdentifier)->getClone();
563
564 $element->setPosition($selectedPosition);
565 $element->setIndentation($selectedIndentation);
566
567 return $element;
568 }

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

576 {
577 $solutionIdentifier = $value1;
578 $selectedPosition = ($value2 - 1);
579 $selectedIndentation = 0;
580
581 $element = $this->getOrderingElementList()->getElementBySolutionIdentifier($solutionIdentifier)->getClone();
582
583 $element->setPosition($selectedPosition);
584 $element->setIndentation($selectedIndentation);
585
586 return $element;
587 }

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

References $thumb_geometry.

Referenced by generateThumbForFile(), getThumbSize(), setContentType(), and storeImageFile().

+ Here is the caller graph for this function:

◆ getThumbPrefix()

assOrderingQuestion::getThumbPrefix ( )

◆ getThumbSize()

assOrderingQuestion::getThumbSize ( )

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

1092 {
1093 return $this->getThumbGeometry();
1094 }

References getThumbGeometry().

Referenced by buildOrderingImagesFormDataConverter().

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

◆ getValidOrderingTypes()

assOrderingQuestion::getValidOrderingTypes ( )
protected

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

404 : array
405 {
406 return [
411 ];
412 }

References OQ_NESTED_PICTURES, OQ_NESTED_TERMS, OQ_PICTURES, and OQ_TERMS.

Referenced by setOrderingType().

+ Here is the caller graph for this function:

◆ hasOrderingTypeUploadSupport()

assOrderingQuestion::hasOrderingTypeUploadSupport ( )

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

488 {
489 return $this->isImageOrderingType();
490 }

References isImageOrderingType().

Referenced by isImageReplaced().

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

1226 {
1227 switch (true) {
1228 case $formField instanceof ilAssNestedOrderingElementsInputGUI:
1229 $formField->setInteractionEnabled(true);
1230 $formField->setNestingEnabled($this->isOrderingTypeNested());
1231 break;
1232
1233 case $formField instanceof ilAssOrderingTextsInputGUI:
1234 case $formField instanceof ilAssOrderingImagesInputGUI:
1235 default:
1236
1237 $formField->setEditElementOccuranceEnabled(true);
1238 $formField->setEditElementOrderEnabled(true);
1239 }
1240 }

References isOrderingTypeNested().

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

1246 {
1247 $formField->setInfo($this->lng->txt('ordering_answer_sequence_info'));
1248 $formField->setTitle($this->lng->txt('answers'));
1249 }
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 110 of file class.assOrderingQuestion.php.

110 : bool
111 {
112 $elements = array_filter(
113 $this->getOrderingElementList()->getElements(),
114 function ($element) {
115 return trim($element->getContent()) != '';
116 }
117 );
118 $has_at_least_two_elements = count($elements) > 1;
119
120 $complete = $this->getAuthor()
121 && $this->getTitle()
122 && $this->getQuestion()
123 && $this->getMaximumPoints()
124 && $has_at_least_two_elements;
125
126 return $complete;
127 }
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 825 of file class.assOrderingQuestion.php.

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

References assQuestion\getImagePath().

+ Here is the call graph for this function:

◆ isImageOrderingType()

assOrderingQuestion::isImageOrderingType ( )

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

437 {
438 $with_images = [
441 ];
442 return in_array($this->getOrderingType(), $with_images);
443 }

References getOrderingType(), OQ_NESTED_PICTURES, and OQ_PICTURES.

Referenced by ilAssOrderingQuestionAuthoringFormGUI\addSpecificOrderingQuestionCommandButtons(), buildOrderingElementInputGui(), duplicateImages(), hasOrderingTypeUploadSupport(), rebuildThumbnails(), and setNestingType().

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

◆ isImageReplaced()

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

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

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

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

+ Here is the call graph for this function:

◆ isOrderingTypeNested()

assOrderingQuestion::isOrderingTypeNested ( )

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

428 {
429 $nested = [
432 ];
433 return in_array($this->getOrderingType(), $nested);
434 }

References getOrderingType(), OQ_NESTED_PICTURES, and OQ_NESTED_TERMS.

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

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

168 {
169 global $DIC;
170 $ilDB = $DIC['ilDB'];
171
172 $result = $ilDB->queryF(
173 "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",
174 array("integer"),
175 array($question_id)
176 );
177 if ($result->numRows() == 1) {
178 $data = $ilDB->fetchAssoc($result);
179 $this->setId($question_id);
180 $this->setObjId($data["obj_fi"]);
181 $this->setTitle($data["title"]);
182 $this->setComment($data["description"]);
183 $this->setOriginalId($data["original_id"]);
184 $this->setAuthor($data["author"]);
185 $this->setNrOfTries($data['nr_of_tries']);
186 $this->setPoints($data["points"]);
187 $this->setOwner($data["owner"]);
188 include_once("./Services/RTE/classes/class.ilRTE.php");
189 $this->setQuestion(ilRTE::_replaceMediaObjectImageSrc($data["question_text"], 1));
190 $this->ordering_type = strlen($data["ordering_type"]) ? $data["ordering_type"] : OQ_TERMS;
191 $this->thumb_geometry = $data["thumb_geometry"];
192 $this->element_height = $data["element_height"];
193 $this->setEstimatedWorkingTime(substr($data["working_time"], 0, 2), substr($data["working_time"], 3, 2), substr($data["working_time"], 6, 2));
194
195 try {
199 }
200
201 try {
202 $this->setAdditionalContentEditingMode($data['add_cont_edit_mode']);
204 }
205 }
206
207 parent::loadFromDb($question_id);
208 }
getAdditionalTableName()
Returns the name of the additional question data table in the database.
setId($id=-1)
Sets the id of the assQuestion object.
setOriginalId($original_id)
setObjId($obj_id=0)
Set the object id of the container object.
setTitle($title="")
Sets the title string of the assQuestion object.
setOwner($owner="")
Sets the creator/owner ID of the assQuestion object.
setEstimatedWorkingTime($hour=0, $min=0, $sec=0)
Sets the estimated working time of a question from given hour, minute and second.
setAuthor($author="")
Sets the authors name of the assQuestion object.
setLifecycle(ilAssQuestionLifecycle $lifecycle)
setPoints($a_points)
Sets the maximum available points for the question.
setComment($comment="")
Sets the comment string of the assQuestion object.
setNrOfTries($a_nr_of_tries)
setAdditionalContentEditingMode($additinalContentEditingMode)
setter for additional content editing mode for this question
setQuestion($question="")
Sets the question string of the question object.
static _replaceMediaObjectImageSrc($a_text, $a_direction=0, $nic=IL_INST_ID)
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
$data
Definition: storeScorm.php:23

References $data, $DIC, Vendor\Package\$e, $ilDB, $result, ilRTE\_replaceMediaObjectImageSrc(), getAdditionalTableName(), ilAssQuestionLifecycle\getDraftInstance(), ilAssQuestionLifecycle\getInstance(), OQ_TERMS, assQuestion\setAdditionalContentEditingMode(), assQuestion\setAuthor(), assQuestion\setComment(), assQuestion\setEstimatedWorkingTime(), assQuestion\setId(), assQuestion\setLifecycle(), assQuestion\setNrOfTries(), assQuestion\setObjId(), assQuestion\setOriginalId(), assQuestion\setOwner(), assQuestion\setPoints(), assQuestion\setQuestion(), and assQuestion\setTitle().

+ Here is the call graph for this function:

◆ rebuildThumbnails()

assOrderingQuestion::rebuildThumbnails ( )

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

1130 {
1131 if ($this->isImageOrderingType()) {
1132 foreach ($this->getOrderElements() as $orderingElement) {
1133 $this->generateThumbForFile($this->getImagePath(), $orderingElement->getContent());
1134 }
1135 }
1136 }
getOrderElements()
Returns the answers array.

References generateThumbForFile(), assQuestion\getImagePath(), getOrderElements(), and isImageOrderingType().

+ Here is the call graph for this function:

◆ saveAnswerSpecificDataToDb()

assOrderingQuestion::saveAnswerSpecificDataToDb ( )

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

Returns
mixed

Implements ilObjAnswerScoringAdjustable.

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

974 {
975 }

◆ savePreviewData()

assOrderingQuestion::savePreviewData ( ilAssQuestionPreviewSession  $previewSession)
protected

Reimplemented from assQuestion.

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

933 {
934 if ($this->validateSolutionSubmit()) {
935 $previewSession->setParticipantsSolution(serialize($this->getSolutionListFromPostSubmit()));
936 }
937 }
validateSolutionSubmit()
Checks the data to be saved for consistency.

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

+ Here is the call graph for this function:

◆ saveToDb()

assOrderingQuestion::saveToDb (   $original_id = "")

Saves a assOrderingQuestion object to a database.

Parameters
string$original_id

Reimplemented from assQuestion.

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

150 {
151 if ($original_id == '') {
152 $this->saveQuestionDataToDb();
153 } else {
155 }
157 parent::saveToDb($original_id);
158 }
saveQuestionDataToDb($original_id="")
saveAdditionalQuestionDataToDb()
Saves a record to the question types additional data table.

References assQuestion\$original_id, ilObjQuestionScoringAdjustable\saveAdditionalQuestionDataToDb(), 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 899 of file class.assOrderingQuestion.php.

900 {
901 $entered_values = 0;
902
903 if (is_null($pass)) {
904 include_once "./Modules/Test/classes/class.ilObjTest.php";
905 $pass = ilObjTest::_getPass($active_id);
906 }
907
908 $this->getProcessLocker()->executeUserSolutionUpdateLockOperation(
909 function () use (&$entered_values, $active_id, $pass, $authorized) {
910 $this->removeCurrentSolution($active_id, $pass, $authorized);
911
912 foreach ($this->getSolutionListFromPostSubmit() as $orderingElement) {
913 $value1 = $orderingElement->getStorageValue1($this->getOrderingType());
914 $value2 = $orderingElement->getStorageValue2($this->getOrderingType());
915
916 $this->saveCurrentSolution($active_id, $pass, $value1, trim($value2), $authorized);
917
918 $entered_values++;
919 }
920 }
921 );
922
923 if ($entered_values) {
924 $this->log($active_id, 'log_user_entered_values');
925 } else {
926 $this->log($active_id, 'log_user_not_entered_values');
927 }
928
929 return true;
930 }
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:

◆ setContentType()

assOrderingQuestion::setContentType (   $ct)

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

446 {
447 if (!in_array($ct, [
448 self::OQ_CT_PICTURES,
449 self::OQ_CT_TERMS
450 ])) {
451 throw new \InvalidArgumentException("use OQ content-type", 1);
452 }
453 if ($ct == self::OQ_CT_PICTURES) {
454 if ($this->isOrderingTypeNested()) {
456 } else {
458 }
459 $this->setThumbGeometry($this->getThumbGeometry());
460 }
461 if ($ct == self::OQ_CT_TERMS) {
462 if ($this->isOrderingTypeNested()) {
464 } else {
466 }
467 }
468 }
setOrderingType($ordering_type=self::OQ_TERMS)
const OQ_NESTED_PICTURES
const OQ_TERMS
const OQ_NESTED_TERMS

References getThumbGeometry(), isOrderingTypeNested(), OQ_NESTED_PICTURES, OQ_NESTED_TERMS, OQ_PICTURES, OQ_TERMS, setOrderingType(), and setThumbGeometry().

+ Here is the call graph for this function:

◆ setElementHeight()

assOrderingQuestion::setElementHeight (   $a_height)

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

1122 {
1123 $this->element_height = ($a_height < 20) ? "" : $a_height;
1124 }

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

1054 {
1055 parent::setExportDetailsXLS($worksheet, $startrow, $active_id, $pass);
1056
1057 $solutions = $this->getSolutionValues($active_id, $pass);
1058 $sol = array();
1059 foreach ($solutions as $solution) {
1060 $sol[$solution["value1"]] = $solution["value2"];
1061 }
1062 asort($sol);
1063 $sol = array_keys($sol);
1064
1065 $i = 1;
1066 foreach ($sol as $idx) {
1067 foreach ($solutions as $solution) {
1068 if ($solution["value1"] == $idx) {
1069 $worksheet->setCell($startrow + $i, 0, $solution["value2"]);
1070 $worksheet->setBold($worksheet->getColumnCoord(0) . ($startrow + $i));
1071 }
1072 }
1073 $element = $this->getOrderingElementList()->getElementBySolutionIdentifier($idx);
1074 $worksheet->setCell($startrow + $i, 2, $element->getContent());
1075 $i++;
1076 }
1077
1078 return $startrow + $i + 1;
1079 }
$i
Definition: metadata.php:24

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

+ Here is the call graph for this function:

◆ setNestingType()

assOrderingQuestion::setNestingType ( bool  $nesting)

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

471 {
472 if ($nesting) {
473 if ($this->isImageOrderingType()) {
475 } else {
477 }
478 } else {
479 if ($this->isImageOrderingType()) {
481 } else {
483 }
484 }
485 }

References isImageOrderingType(), OQ_NESTED_PICTURES, OQ_NESTED_TERMS, OQ_PICTURES, OQ_TERMS, and setOrderingType().

+ Here is the call graph for this function:

◆ setOrderingElementList()

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

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

645 : void
646 {
647 $list = $list->withQuestionId($this->getId());
648 $elements = $list->getElements();
649 $nu = [];
650 foreach ($elements as $e) {
651 $nu[] = $list->ensureValidIdentifiers($e);
652 }
653 $list = $list->withElements($nu);
654 $this->getRepository()->updateOrderingList($list);
655 }
ensureValidIdentifiers(ilAssOrderingElement $element)

References Vendor\Package\$e, ilAssOrderingElementList\ensureValidIdentifiers(), ilAssOrderingElementList\getElements(), assQuestion\getId(), getRepository(), ilAssOrderingElementList\withElements(), and ilAssOrderingElementList\withQuestionId().

+ Here is the call graph for this function:

◆ setOrderingType()

assOrderingQuestion::setOrderingType (   $ordering_type = self::OQ_TERMS)

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

415 {
416 if (!in_array($ordering_type, $this->getValidOrderingTypes())) {
417 throw new \InvalidArgumentException('Must be valid ordering type.');
418 }
419 $this->ordering_type = $ordering_type;
420 }

References $ordering_type, and getValidOrderingTypes().

Referenced by setContentType(), and setNestingType().

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

◆ setThumbGeometry()

assOrderingQuestion::setThumbGeometry (   $a_geometry)

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

1102 {
1103 $this->thumb_geometry = ((int) $a_geometry < 1) ? 100 : $a_geometry;
1104 }

Referenced by setContentType().

+ Here is the caller graph for this function:

◆ storeImageFile()

assOrderingQuestion::storeImageFile ( string  $upload_file,
string  $upload_name 
)

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

852 : ?string
853 {
854 $suffix = strtolower(array_pop(explode(".", $upload_name)));
855 if (!in_array($suffix, self::VALID_UPLOAD_SUFFIXES)) {
856 return null;
857 }
858
859 $this->ensureImagePathExists();
860 $target_filename = $this->buildHashedImageFilename($upload_name, true);
861 $target_filepath = $this->getImagePath() . $target_filename;
862 if (ilUtil::moveUploadedFile($upload_file, $target_filename, $target_filepath)) {
863 $thumb_path = $this->getImagePath() . $this->getThumbPrefix() . $target_filename;
864 if ($this->getThumbGeometry()) {
865 ilUtil::convertImage($target_filepath, $thumb_path, "JPEG", $this->getThumbGeometry());
866 }
867 return $target_filename;
868 }
869
870 return null;
871 }
buildHashedImageFilename($plain_image_filename, $unique=false)
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file

References assQuestion\buildHashedImageFilename(), ilUtil\convertImage(), ensureImagePathExists(), assQuestion\getImagePath(), getThumbGeometry(), getThumbPrefix(), 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 1040 of file class.assOrderingQuestion.php.

1041 {
1042 return true;
1043 }

◆ supportsNonJsOutput()

assOrderingQuestion::supportsNonJsOutput ( )

Reimplemented from assQuestion.

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

1046 {
1047 return false;
1048 }

◆ toJSON()

assOrderingQuestion::toJSON ( )

Returns a JSON representation of the question.

Reimplemented from assQuestion.

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

1169 {
1170 include_once("./Services/RTE/classes/class.ilRTE.php");
1171 $result = array();
1172 $result['id'] = (int) $this->getId();
1173 $result['type'] = (string) $this->getQuestionType();
1174 $result['title'] = (string) $this->getTitle();
1175 $result['question'] = $this->formatSAQuestion($this->getQuestion());
1176 $result['nr_of_tries'] = (int) $this->getNrOfTries();
1177 $result['shuffle'] = (bool) true;
1178 $result['points'] = $this->getPoints();
1179 $result['feedback'] = array(
1180 'onenotcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), false)),
1181 'allcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), true))
1182 );
1183 if ($this->getOrderingType() == self::OQ_PICTURES) {
1184 $result['path'] = $this->getImagePathWeb();
1185 }
1186
1187 $counter = 1;
1188 $answers = array();
1189 foreach ($this->getOrderingElementList() as $orderingElement) {
1190 $answers[$counter] = $orderingElement->getContent();
1191 $counter++;
1192 }
1193 $answers = $this->getShuffler()->shuffle($answers);
1194 $arr = array();
1195 foreach ($answers as $order => $answer) {
1196 array_push($arr, array(
1197 "answertext" => (string) $answer,
1198 "order" => (int) $order
1199 ));
1200 }
1201 $result['answers'] = $arr;
1202
1203 $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $this->getId());
1204 $result['mobs'] = $mobs;
1205
1206 return json_encode($result);
1207 }
getQuestionType()
Returns the question type of the question.
formatSAQuestion($a_q)
Format self assessment question.
static _getMobsOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_lang="-")
get mobs of object
$mobs
Definition: imgupload.php:54

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

+ Here is the call graph for this function:

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

881 {
882 $submittedSolutionList = $this->getSolutionListFromPostSubmit();
883
884 if (!$submittedSolutionList->hasElements()) {
885 return true;
886 }
887
888 return $this->getOrderingElementList()->hasSameElementSetByRandomIdentifiers($submittedSolutionList);
889 }

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

Referenced by getElementHeight().

◆ $leveled_ordering

assOrderingQuestion::$leveled_ordering = array()

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

◆ $old_ordering_depth

assOrderingQuestion::$old_ordering_depth = array()

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

◆ $oq_repository

assOrderingQuestion::$oq_repository = null
protected

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

Referenced by getRepository().

◆ $ordering_type

assOrderingQuestion::$ordering_type
protected

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

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

◆ $orderingElementList

assOrderingQuestion::$orderingElementList
protected

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

◆ $postSolutionOrderingElementList

assOrderingQuestion::$postSolutionOrderingElementList = null
private

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

Referenced by getSolutionListFromPostSubmit().

◆ $thumb_geometry

assOrderingQuestion::$thumb_geometry = 100

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

Referenced by getThumbGeometry().

◆ OQ_CT_PICTURES

const assOrderingQuestion::OQ_CT_PICTURES = 'pics'

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

◆ OQ_CT_TERMS

const assOrderingQuestion::OQ_CT_TERMS = 'terms'

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

◆ OQ_NESTED_PICTURES

◆ OQ_NESTED_TERMS

◆ OQ_PICTURES

◆ OQ_TERMS

◆ ORDERING_ELEMENT_FORM_CMD_REMOVE_IMG

const assOrderingQuestion::ORDERING_ELEMENT_FORM_CMD_REMOVE_IMG = 'removeElementImage'

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

◆ ORDERING_ELEMENT_FORM_CMD_UPLOAD_IMG

const assOrderingQuestion::ORDERING_ELEMENT_FORM_CMD_UPLOAD_IMG = 'uploadElementImage'

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

◆ ORDERING_ELEMENT_FORM_FIELD_POSTVAR

◆ VALID_UPLOAD_SUFFIXES

const assOrderingQuestion::VALID_UPLOAD_SUFFIXES = ["jpg", "jpeg", "png", "gif"]

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