ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
assOrderingHorizontal Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for assOrderingHorizontal:
+ Collaboration diagram for assOrderingHorizontal:

Public Member Functions

 __construct ( $title="", $comment="", $author="", $owner=-1, $question="")
 assOrderingHorizontal constructor More...
 
 isComplete ()
 Returns true, if a single choice question is complete for use. More...
 
 saveToDb ($original_id="")
 Saves a assOrderingHorizontal object to a database. More...
 
 getAnswerSeparator ()
 
 loadFromDb ($question_id)
 Loads a assOrderingHorizontal object from a database. More...
 
 duplicate (bool $for_test=true, string $title="", string $author="", string $owner="", $testObjId=null)
 Duplicates an assOrderingHorizontal. More...
 
 copyObject ($target_questionpool_id, $title="")
 Copies an assOrderingHorizontal object. More...
 
 createNewOriginalFromThisDuplicate ($targetParentId, $targetQuestionTitle="")
 
 getMaximumPoints ()
 Returns the maximum points, a learner can reach answering the question. More...
 
 calculateReachedPoints ($active_id, $pass=null, $authorizedSolution=true, $returndetails=false)
 Returns the points, a learner has reached answering the question. More...
 
 splitAndTrimOrderElementText (string $in_string, string $separator)
 Splits the answer string either by space(s) or the separator (eg. More...
 
 getSolutionSubmit ()
 
 saveWorkingData ($active_id, $pass=null, $authorized=true)
 Saves the learners input of the question to the database. More...
 
 saveAdditionalQuestionDataToDb ()
 Saves a record to the question types additional data 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...
 
 deleteAnswers ($question_id)
 Deletes datasets from answers tables. More...
 
 getRTETextWithMediaObjects ()
 Collects all text in the question which could contain media objects which were created with the Rich Text Editor. More...
 
 setExportDetailsXLS (ilAssExcelFormatHelper $worksheet, int $startrow, int $active_id, int $pass)
 {} More...
 
 fromXML ($item, int $questionpool_id, ?int $tst_id, &$tst_object, int &$question_counter, array $import_mapping, array &$solutionhints=[])
 Creates a question from a QTI file. 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 and sets the internal domxml variable with the DOM XML representation of the QTI xml representation. More...
 
 getBestSolution ($active_id, $pass)
 Returns the best solution for a given pass of a participant. More...
 
 getOrderingElements ()
 Get ordering elements from order text. More...
 
 getRandomOrderingElements ()
 Get ordering elements from order text in random sequence. More...
 
 getOrderText ()
 Get order text. More...
 
 setOrderText ($a_value)
 Set order text. More...
 
 getTextSize ()
 Get text size. More...
 
 setTextSize ($a_value)
 Set text size. More...
 
 getSeparator ()
 Get order text separator. More...
 
 setSeparator ($a_value)
 Set order text separator. More...
 
 supportsJavascriptOutput ()
 
 supportsNonJsOutput ()
 
 toJSON ()
 Returns a JSON representation of the question. More...
 
 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...
 
- Public Member Functions inherited from assQuestion
 __construct (string $title="", string $comment="", string $author="", int $owner=-1, string $question="")
 assQuestion constructor More...
 
 getShuffler ()
 
 setShuffler (Transformation $shuffler)
 
 setProcessLocker (ilAssQuestionProcessLocker $processLocker)
 
 getProcessLocker ()
 
 fromXML ($item, int $questionpool_id, ?int $tst_id, &$tst_object, int &$question_counter, array $import_mapping, array &$solutionhints=[])
 Receives parameters from a QTI parser and creates a valid ILIAS question object. More...
 
 toXML (bool $a_include_header=true, bool $a_include_binary=true, bool $a_shuffle=false, bool $test_output=false, bool $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 (int $questionpool_id, string $title)
 Returns TRUE if the question title exists in a question pool in the database. More...
 
 setTitle (string $title="")
 
 setId (int $id=-1)
 
 setTestId (int $id=-1)
 
 setComment (string $comment="")
 
 setOutputType (int $outputType=OUTPUT_HTML)
 
 setShuffle (?bool $shuffle=true)
 
 setAuthor (string $author="")
 
 setOwner (int $owner=-1)
 
 getTitle ()
 
 getTitleForHTMLOutput ()
 
 getTitleFilenameCompliant ()
 
 getId ()
 
 getShuffle ()
 
 getTestId ()
 
 getComment ()
 
 getDescriptionForHTMLOutput ()
 
 getThumbSize ()
 
 setThumbSize (int $a_size)
 
 getMinimumThumbSize ()
 
 getMaximumThumbSize ()
 
 getOutputType ()
 
 supportsJavascriptOutput ()
 
 supportsNonJsOutput ()
 
 requiresJsSwitch ()
 
 getAuthor ()
 
 getAuthorForHTMLOutput ()
 
 getOwner ()
 
 getObjId ()
 
 setObjId (int $obj_id=0)
 
 getLifecycle ()
 
 setLifecycle (ilAssQuestionLifecycle $lifecycle)
 
 setExternalId (?string $external_id)
 
 getExternalId ()
 
 getSuggestedSolutionOutput ()
 
 _getSuggestedSolution (int $question_id, int $subquestion_index=0)
 
 loadSuggestedSolution (int $question_id, int $subquestion_index=0)
 Returns a suggested solution for a given subquestion index. More...
 
 getSuggestedSolutions ()
 
 getReachedPoints (int $active_id, int $pass)
 
 getMaximumPoints ()
 
 getAdjustedReachedPoints (int $active_id, int $pass, bool $authorizedSolution=true)
 returns the reached points ... More...
 
 calculateResultsFromSolution (int $active_id, int $pass, bool $obligationsEnabled=false)
 Calculates the question results from a previously saved question solution. More...
 
 persistWorkingState (int $active_id, $pass, bool $obligationsEnabled=false, bool $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 (int $active_id, int $pass, bool $authorized=true)
 Saves the learners input of the question to the database. More...
 
 moveUploadedMediaFile (string $file, string $name)
 Move an uploaded media file to an public accessible temp dir to present it. More...
 
 getSuggestedSolutionPath ()
 
 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...
 
 getSuggestedSolutionPathWeb ()
 
 getImagePathWeb ()
 Returns the web image path for web accessable images of a question. More...
 
 getTestOutputSolutions (int $activeId, int $pass)
 
 getUserSolutionPreferingIntermediate (int $active_id, $pass=null)
 
 getSolutionValues ($active_id, $pass=null, bool $authorized=true)
 Loads solutions of a given user from the database an returns it. More...
 
 isInUse (int $question_id=0)
 Checks whether the question is in use or not in pools or tests. More...
 
 usageNumber (int $question_id=0)
 Returns the number of place the question is in use in pools or tests. More...
 
 isClone (int $question_id=0)
 Checks whether the question is a clone of another question or not. More...
 
 getAdditionalTableName ()
 
 getAnswerTableName ()
 
 deleteAnswers (int $question_id)
 
 deleteAdditionalTableData (int $question_id)
 
 delete (int $question_id)
 
 getTotalAnswers ()
 
 copyXHTMLMediaObjectsOfQuestion (int $a_q_id)
 
 syncXHTMLMediaObjectsOfQuestion ()
 
 createPageObject ()
 
 copyPageOfQuestion (int $a_q_id)
 
 getPageOfQuestion ()
 
 setOriginalId (?int $original_id)
 
 getOriginalId ()
 
 fixSvgToPng (string $imageFilenameContainingString)
 
 fixUnavailableSkinImageSources (string $html)
 
 loadFromDb (int $question_id)
 
 createNewQuestion (bool $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 (int $original_id=-1)
 
 saveToDb ()
 
 setNewOriginalId (int $newId)
 
 deleteSuggestedSolutions ()
 
 getSuggestedSolution (int $subquestion_index=0)
 Returns a suggested solution for a given subquestion index. More...
 
 getSuggestedSolutionTitle (int $subquestion_index=0)
 Returns the title of a suggested solution at a given subquestion_index. More...
 
 setSuggestedSolution (string $solution_id="", int $subquestion_index=0, bool $is_import=false)
 Sets a suggested solution for the question. More...
 
 updateSuggestedSolutions (int $original_id=-1, int $original_obj_id=-1)
 
 _resolveInternalLink (string $internal_link)
 
 _resolveIntLinks (int $question_id)
 
 syncWithOriginal ()
 
 _questionExists ($question_id)
 Returns true if the question already exists in the database. More...
 
 _questionExistsInPool (int $question_id)
 
 getPoints ()
 
 setPoints (float $points)
 
 getSolutionMaxPass (int $active_id)
 
 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 (string $txt_output, bool $prepare_for_latex_output=false, bool $omitNl2BrWhenTextArea=false)
 
 QTIMaterialToString (ilQTIMaterial $a_material)
 Reads an QTI material tag and creates a text or XHTML string. More...
 
 addQTIMaterial (ilXmlWriter $a_xml_writer, string $a_material, bool $close_material_tag=true, bool $add_mobs=true)
 
 buildHashedImageFilename (string $plain_image_filename, bool $unique=false)
 
 getQuestion ()
 
 getQuestionForHTMLOutput ()
 
 setQuestion (string $question="")
 
 getQuestionType ()
 Returns the question type of the question. More...
 
 getQuestionTypeID ()
 
 syncHints ()
 
 cleanupMediaObjectUsage ()
 
 getInstances ()
 
 getActiveUserData (int $active_id)
 Returns the user id and the test id for a given active id. More...
 
 hasSpecificFeedback ()
 
 setExportDetailsXLS (ilAssExcelFormatHelper $worksheet, int $startrow, int $active_id, int $pass)
 
 __get ($value)
 Object getter. More...
 
 __set ($key, $value)
 Object setter. More...
 
 __isset ($key)
 Object issetter. More...
 
 getNrOfTries ()
 
 setNrOfTries (int $a_nr_of_tries)
 
 setExportImagePath (string $path)
 
 formatSAQuestion ($a_q)
 
 setPreventRteUsage (bool $prevent_rte_usage)
 
 getPreventRteUsage ()
 
 migrateContentForLearningModule (ilAssSelfAssessmentMigrator $migrator)
 
 setSelfAssessmentEditingMode (bool $selfassessmenteditingmode)
 
 getSelfAssessmentEditingMode ()
 
 setDefaultNrOfTries (int $defaultnroftries)
 
 getDefaultNrOfTries ()
 
 syncSkillAssignments (int $srcParentId, int $srcQuestionId, int $trgParentId, int $trgQuestionId)
 
 ensureHintPageObjectExists ($pageObjectId)
 
 isAnswered (int $active_id, int $pass)
 
 isAutosaveable ()
 
 getAdditionalContentEditingMode ()
 
 setAdditionalContentEditingMode (?string $additionalContentEditingMode)
 
 isAdditionalContentEditingModePageObject ()
 
 isValidAdditionalContentEditingMode (string $additionalContentEditingMode)
 
 getValidAdditionalContentEditingModes ()
 
 getHtmlUserSolutionPurifier ()
 
 getHtmlQuestionContentPurifier ()
 
 setLastChange ($lastChange)
 
 getLastChange ()
 
 removeIntermediateSolution (int $active_id, int $pass)
 
 removeCurrentSolution (int $active_id, int $pass, bool $authorized=true)
 
 saveCurrentSolution (int $active_id, int $pass, $value1, $value2, bool $authorized=true, $tstamp=0)
 
 updateCurrentSolution (int $solutionId, $value1, $value2, bool $authorized=true)
 
 updateCurrentSolutionsAuthorization (int $activeId, int $pass, bool $authorized, bool $keepTime=false)
 
 setStep ($step)
 
 getStep ()
 
 toJSON ()
 
 duplicate (bool $for_test=true, string $title="", string $author="", string $owner="", $testObjId=null)
 
 intermediateSolutionExists (int $active_id, int $pass)
 
 authorizedSolutionExists (int $active_id, ?int $pass)
 
 authorizedOrIntermediateSolutionExists (int $active_id, int $pass)
 
 lookupForExistingSolutions (int $activeId, int $pass)
 Lookup if an authorized or intermediate solution exists. More...
 
 isAddableAnswerOptionValue (int $qIndex, string $answerOptionValue)
 
 addAnswerOptionValue (int $qIndex, string $answerOptionValue, float $points)
 
 removeAllExistingSolutions ()
 
 removeExistingSolutions (int $activeId, int $pass)
 
 resetUsersAnswer (int $activeId, int $pass)
 
 removeResultRecord (int $activeId, int $pass)
 
 fetchValuePairsFromIndexedValues (array $indexedValues)
 
 fetchIndexedValuesFromValuePairs (array $valuePairs)
 
 areObligationsToBeConsidered ()
 
 setObligationsToBeConsidered (bool $obligationsToBeConsidered)
 
 updateTimestamp ()
 
 getTestPresentationConfig ()
 
 savePartial ()
 
 isInActiveTest ()
 
- Public Member Functions inherited from iQuestionCondition
 getUserQuestionResult ($active_id, $pass)
 Get the user solution for a question by active_id and the test pass. More...
 

Protected Member Functions

 calculateReachedPointsForSolution ($value)
 
- Protected Member Functions inherited from assQuestion
 getQuestionAction ()
 
 isNonEmptyItemListPostSubmission (string $postSubmissionFieldname)
 
 ensureCurrentTestPass (int $active_id, int $pass)
 
 lookupCurrentTestPass (int $active_id, int $pass)
 
 lookupTestId (int $active_id)
 Move to ilObjTest or similar More...
 
 log (int $active_id, string $langVar)
 
 savePreviewData (ilAssQuestionPreviewSession $previewSession)
 
 deletePageOfQuestion (int $question_id)
 
 onDuplicate (int $originalParentId, int $originalQuestionId, int $duplicateParentId, int $duplicateQuestionId)
 
 beforeSyncWithOriginal (int $origQuestionId, int $dupQuestionId, int $origParentObjId, int $dupParentObjId)
 
 afterSyncWithOriginal (int $origQuestionId, int $dupQuestionId, int $origParentObjId, int $dupParentObjId)
 
 onCopy (int $sourceParentId, int $sourceQuestionId, int $targetParentId, int $targetQuestionId)
 
 duplicateSuggestedSolutionFiles (int $parent_id, int $question_id)
 Duplicates the files of a suggested solution if the question is duplicated. More...
 
 syncSuggestedSolutionFiles (int $target_question_id, int $target_obj_id)
 
 copySuggestedSolutionFiles (int $source_questionpool_id, int $source_question_id)
 
 ensureNonNegativePoints ($points)
 
 purifyAndPrepareTextAreaOutput (string $content)
 
 getRTETextWithMediaObjects ()
 
 getSelfAssessmentFormatter ()
 
 lmMigrateQuestionTypeGenericContent (ilAssSelfAssessmentMigrator $migrator)
 
 lmMigrateQuestionTypeSpecificContent (ilAssSelfAssessmentMigrator $migrator)
 
 duplicateQuestionHints (int $originalQuestionId, int $duplicateQuestionId)
 
 duplicateSkillAssignments (int $srcParentId, int $srcQuestionId, int $trgParentId, int $trgQuestionId)
 
 buildQuestionDataQuery ()
 
 getCurrentSolutionResultSet (int $active_id, int $pass, bool $authorized=true)
 
 removeSolutionRecordById (int $solutionId)
 
 getSolutionRecordById (int $solutionId)
 
 deleteDummySolutionRecord (int $activeId, int $passIndex)
 
 isDummySolutionRecord (array $solutionRecord)
 
 deleteSolutionRecordByValues (int $activeId, int $passIndex, bool $authorized, array $matchValues)
 
 duplicateIntermediateSolutionAuthorized (int $activeId, int $passIndex)
 
 forceExistingIntermediateSolution (int $activeId, int $passIndex, bool $considerDummyRecordCreation)
 
 lookupMaxStep (int $active_id, int $pass)
 
 buildTestPresentationConfig ()
 build basic test question configuration instance More...
 

Protected Attributes

const HAS_SPECIFIC_FEEDBACK = false
 
 $ordertext
 
 $textsize
 
 $separator = "::"
 
 $answer_separator = '{::}'
 
- Protected Attributes inherited from assQuestion
const HAS_SPECIFIC_FEEDBACK = true
 
ILIAS HTTP Services $http
 
ILIAS Refinery Factory $refinery
 
ILIAS DI LoggingServices $ilLog
 
int $id
 
string $title
 
string $comment
 
string $owner
 
string $author
 
int $thumb_size
 
string $question
 The question text. More...
 
float $points
 The maximum available points for the question. More...
 
bool $shuffle
 Indicates whether the answers will be shuffled or not. More...
 
int $test_id
 The database id of a test in which the question is contained. More...
 
int $obj_id = 0
 Object id of the container object. More...
 
 $ilias
 
ilGlobalPageTemplate $tpl
 
ilLanguage $lng
 
ilDBInterface $db
 
Container $dic
 
int $outputType = OUTPUT_JAVASCRIPT
 Contains the output type of a question. More...
 
array $suggested_solutions
 
int $original_id = null
 
 $page
 
string $external_id = null
 
ilAssQuestionProcessLocker $processLocker
 
 $step
 
 $lastChange
 
Transformation $shuffler
 
ilTestQuestionConfig $testQuestionConfig
 
ilAssQuestionLifecycle $lifecycle
 
ilObjUser $current_user
 

Additional Inherited Members

- Static Public Member Functions inherited from assQuestion
static setForcePassResultUpdateEnabled (bool $forcePassResultsUpdateEnabled)
 
static isForcePassResultUpdateEnabled ()
 
static isAllowedImageMimeType ($mimeType)
 
static fetchMimeTypeIdentifier (string $contentType)
 
static getAllowedFileExtensionsForMimeType (string $mimeType)
 
static isAllowedImageFileExtension (string $mimeType, string $fileExtension)
 
static getAllowedImageMaterialFileExtensions ()
 
static _getMaximumPoints (int $question_id)
 Returns the maximum points, a learner can reach answering the question. More...
 
static _getQuestionInfo (int $question_id)
 
static _getSuggestedSolutionCount (int $question_id)
 
static _getSuggestedSolutionOutput (int $question_id)
 
static _getReachedPoints (int $active_id, int $question_id, int $pass)
 
static _updateTestResultCache (int $active_id, ilAssQuestionProcessLocker $processLocker=null)
 Move this to a proper place. More...
 
static logAction (string $logtext, int $active_id, int $question_id)
 
static getQuestionTypeFromDb (int $question_id)
 
static _getTotalRightAnswers (int $a_q_id)
 
static _getTitle (int $a_q_id)
 
static _getQuestionText (int $a_q_id)
 
static isFileAvailable (string $file)
 
static _getQuestionType (int $question_id)
 
static _getQuestionTitle (int $question_id)
 
static saveOriginalId (int $questionId, int $originalId)
 
static resetOriginalId (int $questionId)
 
static _getInternalLinkHref (string $target="")
 
static _getOriginalId (int $question_id)
 
static originalQuestionExists (int $questionId)
 
static _instanciateQuestion (int $question_id)
 
static _instantiateQuestion (int $question_id)
 
static instantiateQuestion (int $question_id)
 
static _getSolutionMaxPass (int $question_id, int $active_id)
 Returns the maximum pass a users question solution. More...
 
static _isWriteable (int $question_id, int $user_id)
 
static _isUsedInRandomTest (int $question_id)
 
static _isWorkedThrough (int $active_id, int $question_id, int $pass)
 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 (int $a_user_id, array $a_question_ids)
 Checks if an array of question ids is answered by a user or not. More...
 
static _setReachedPoints (int $active_id, int $question_id, float $points, float $maxpoints, int $pass, bool $manualscoring, bool $obligationsEnabled)
 Sets the points, a learner has reached answering the question Additionally objective results are updated. More...
 
static _needsManualScoring (int $question_id)
 
static _includeClass (string $question_type, int $gui=0)
 
static getFeedbackClassNameByQuestionType (string $questionType)
 
static isCoreQuestionType (string $questionType)
 
static includeCoreClass ($questionType, $withGuiClass)
 
static _getQuestionTypeName ($type_tag)
 
static _instanciateQuestionGUI (int $question_id)
 
static instantiateQuestionGUI (int $a_question_id)
 
static _questionExistsInTest (int $question_id, int $test_id)
 
static lookupParentObjId (int $questionId)
 
static lookupOriginalParentObjId (int $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 (int $questionId)
 
static implodeKeyValues (array $keyValues)
 
static explodeKeyValues (string $keyValues)
 
static convertISO8601FormatH_i_s_ExtendedToSeconds (string $time)
 
static missingResultRecordExists (int $activeId, int $pass, array $questionIds)
 
static getQuestionsMissingResultRecord (int $activeId, int $pass, array $questionIds)
 
static lookupResultRecordExist (int $activeId, int $questionId, int $pass)
 
static extendedTrim (string $value)
 Trim non-printable characters from the beginning and end of a string. More...
 
- 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 TRIM_PATTERN = '/^[\p{C}\p{Z}]+|[\p{C}\p{Z}]+$/u'
 
const ADDITIONAL_CONTENT_EDITING_MODE_RTE = 'default'
 
const ADDITIONAL_CONTENT_EDITING_MODE_IPE = 'pageobject'
 
ilAssQuestionFeedback $feedbackOBJ
 
bool $prevent_rte_usage = false
 
bool $selfassessmenteditingmode = false
 
int $defaultnroftries = 0
 
string $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 = "?"
 
- Static Protected Member Functions inherited from assQuestion
static getNumExistingSolutionRecords (int $activeId, int $pass, int $questionId)
 
- Static Protected Attributes inherited from assQuestion
static $allowedFileExtensionsByMimeType
 
static $allowedCharsetsByMimeType
 
static $allowedImageMaterialFileExtensionsByMimeType
 
static $forcePassResultsUpdateEnabled = false
 
static $imageSourceFixReplaceMap
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class for horizontal ordering questions

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

Definition at line 32 of file class.assOrderingHorizontal.php.

Constructor & Destructor Documentation

◆ __construct()

assOrderingHorizontal::__construct (   $title = "",
  $comment = "",
  $author = "",
  $owner = -1,
  $question = "" 
)

assOrderingHorizontal constructor

The constructor takes possible arguments an creates an instance of the assOrderingHorizontal 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 single choice question
See also
assQuestion:__construct()

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

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

59  {
61  $this->ordertext = "";
62  }
string $question
The question text.
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ buildTestPresentationConfig()

assOrderingHorizontal::buildTestPresentationConfig ( )

Get the test question configuration.

Returns
ilTestQuestionConfig

Definition at line 791 of file class.assOrderingHorizontal.php.

References ILIAS\Repository\lng(), and ilTestQuestionConfig\setIsUnchangedAnswerPossible().

792  // hey.
793  {
794  // hey: refactored identifiers
795  return parent::buildTestPresentationConfig()
796  // hey.
798  ->setUseUnchangedAnswerLabel($this->lng->txt('tst_unchanged_order_is_correct'));
799  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setIsUnchangedAnswerPossible($isUnchangedAnswerPossible)
Set if the saving of an unchanged answer is supported with an additional checkbox.
+ Here is the call graph for this function:

◆ calculateReachedPoints()

assOrderingHorizontal::calculateReachedPoints (   $active_id,
  $pass = null,
  $authorizedSolution = true,
  $returndetails = false 
)

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

The points are calculated from the given answers.

public

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

Definition at line 280 of file class.assOrderingHorizontal.php.

References $data, $DIC, $ilDB, assQuestion\$points, calculateReachedPointsForSolution(), assQuestion\getCurrentSolutionResultSet(), and assQuestion\getSolutionMaxPass().

Referenced by getExpressionTypes().

281  {
282  if ($returndetails) {
283  throw new ilTestException('return details not implemented for ' . __METHOD__);
284  }
285 
286  global $DIC;
287  $ilDB = $DIC['ilDB'];
288 
289  $found_values = array();
290  if (is_null($pass)) {
291  $pass = $this->getSolutionMaxPass($active_id);
292  }
293  $result = $this->getCurrentSolutionResultSet($active_id, $pass, $authorizedSolution);
294  $points = 0;
295 
296  if ($ilDB->numRows($result) > 0) {
297  $data = $ilDB->fetchAssoc($result);
298  $points = $this->calculateReachedPointsForSolution($data['value1']);
299  }
300 
301  return $points;
302  }
float $points
The maximum available points for the question.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
getSolutionMaxPass(int $active_id)
getCurrentSolutionResultSet(int $active_id, int $pass, bool $authorized=true)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calculateReachedPointsForSolution()

assOrderingHorizontal::calculateReachedPointsForSolution (   $value)
protected
Parameters
$value
Returns
float

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

References assQuestion\$points, getOrderingElements(), assQuestion\getPoints(), and splitAndTrimOrderElementText().

Referenced by calculateReachedPoints().

774  : float
775  {
776  $value = $this->splitAndTrimOrderElementText($value ?? "", $this->answer_separator);
777  $value = join($this->answer_separator, $value);
778  if (strcmp($value, join($this->answer_separator, $this->getOrderingElements())) == 0) {
779  $points = $this->getPoints();
780  return $points;
781  }
782  return 0;
783  }
float $points
The maximum available points for the question.
splitAndTrimOrderElementText(string $in_string, string $separator)
Splits the answer string either by space(s) or the separator (eg.
getOrderingElements()
Get ordering elements from order text.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copyObject()

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

Copies an assOrderingHorizontal object.

Definition at line 202 of file class.assOrderingHorizontal.php.

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

202  : int
203  {
204  if ($this->getId() <= 0) {
205  throw new RuntimeException('The question has not been saved. It cannot be duplicated');
206  }
207  // duplicate the question in database
208  $clone = $this;
209  include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
211  $clone->id = -1;
212  $source_questionpool_id = $this->getObjId();
213  $clone->setObjId($target_questionpool_id);
214  if ($title) {
215  $clone->setTitle($title);
216  }
217  $clone->saveToDb();
218  // copy question page content
219  $clone->copyPageOfQuestion($original_id);
220  // copy XHTML media objects
221  $clone->copyXHTMLMediaObjectsOfQuestion($original_id);
222 
223  $clone->onCopy($source_questionpool_id, $original_id, $clone->getObjId(), $clone->getId());
224 
225  return $clone->id;
226  }
static _getOriginalId(int $question_id)
+ Here is the call graph for this function:

◆ createNewOriginalFromThisDuplicate()

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

Definition at line 228 of file class.assOrderingHorizontal.php.

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

228  : int
229  {
230  if ($this->getId() <= 0) {
231  throw new RuntimeException('The question has not been saved. It cannot be duplicated');
232  }
233 
234  include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
235 
236  $sourceQuestionId = $this->id;
237  $sourceParentId = $this->getObjId();
238 
239  // duplicate the question in database
240  $clone = $this;
241  $clone->id = -1;
242 
243  $clone->setObjId($targetParentId);
244 
245  if ($targetQuestionTitle) {
246  $clone->setTitle($targetQuestionTitle);
247  }
248 
249  $clone->saveToDb();
250  // copy question page content
251  $clone->copyPageOfQuestion($sourceQuestionId);
252  // copy XHTML media objects
253  $clone->copyXHTMLMediaObjectsOfQuestion($sourceQuestionId);
254 
255  $clone->onCopy($sourceParentId, $sourceQuestionId, $clone->getObjId(), $clone->getId());
256 
257  return $clone->id;
258  }
+ Here is the call graph for this function:

◆ deleteAnswers()

assOrderingHorizontal::deleteAnswers (   $question_id)

Deletes datasets from answers tables.

Parameters
integer$question_idThe question id which should be deleted in the answers table

Definition at line 457 of file class.assOrderingHorizontal.php.

457  : void
458  {
459  }

◆ duplicate()

assOrderingHorizontal::duplicate ( bool  $for_test = true,
string  $title = "",
string  $author = "",
string  $owner = "",
  $testObjId = null 
)

Duplicates an assOrderingHorizontal.

Definition at line 153 of file class.assOrderingHorizontal.php.

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

153  : int
154  {
155  if ($this->id <= 0) {
156  // The question has not been saved. It cannot be duplicated
157  return -1;
158  }
159  // duplicate the question in database
160  $this_id = $this->getId();
161  $thisObjId = $this->getObjId();
162 
163  $clone = $this;
164  include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
166  $clone->id = -1;
167 
168  if ((int) $testObjId > 0) {
169  $clone->setObjId($testObjId);
170  }
171 
172  if ($title) {
173  $clone->setTitle($title);
174  }
175 
176  if ($author) {
177  $clone->setAuthor($author);
178  }
179  if ($owner) {
180  $clone->setOwner($owner);
181  }
182 
183  if ($for_test) {
184  $clone->saveToDb($original_id);
185  } else {
186  $clone->saveToDb();
187  }
188 
189  // copy question page content
190  $clone->copyPageOfQuestion($this_id);
191  // copy XHTML media objects
192  $clone->copyXHTMLMediaObjectsOfQuestion($this_id);
193 
194  $clone->onDuplicate($thisObjId, $this_id, $clone->getObjId(), $clone->getId());
195 
196  return $clone->id;
197  }
static _getOriginalId(int $question_id)
+ Here is the call graph for this function:

◆ fromXML()

assOrderingHorizontal::fromXML (   $item,
int  $questionpool_id,
?int  $tst_id,
$tst_object,
int &  $question_counter,
array  $import_mapping,
array &  $solutionhints = [] 
)

Creates a question from a QTI file.

Receives parameters from a QTI parser and creates a valid ILIAS question object

Parameters
ilQTIItem$itemThe QTI item object
integer$questionpool_idThe id of the parent questionpool
integer$tst_idThe id of the parent test if the question is part of a test
object$tst_objectA reference to the parent test object
integer$question_counterA reference to a question counter to count the questions of an imported question pool
array$import_mappingAn array containing references to included ILIAS objects

Definition at line 502 of file class.assOrderingHorizontal.php.

502  : array
503  {
504  include_once "./Modules/TestQuestionPool/classes/import/qti12/class.assOrderingHorizontalImport.php";
505  $import = new assOrderingHorizontalImport($this);
506  return $import->fromXML($item, $questionpool_id, $tst_id, $tst_object, $question_counter, $import_mapping);
507  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ getAdditionalTableName()

assOrderingHorizontal::getAdditionalTableName ( )

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

Returns
string The additional table name

Definition at line 437 of file class.assOrderingHorizontal.php.

Referenced by loadFromDb(), and saveAdditionalQuestionDataToDb().

437  : string
438  {
439  return "qpl_qst_horder";
440  }
+ Here is the caller graph for this function:

◆ getAnswerSeparator()

assOrderingHorizontal::getAnswerSeparator ( )
Returns
string

Definition at line 97 of file class.assOrderingHorizontal.php.

References $answer_separator.

97  : string
98  {
100  }

◆ getAnswerTableName()

assOrderingHorizontal::getAnswerTableName ( )

Returns the name of the answer table in the database.

Returns
string The answer table name

Definition at line 447 of file class.assOrderingHorizontal.php.

447  : string
448  {
449  return "";
450  }

◆ getAvailableAnswerOptions()

assOrderingHorizontal::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 757 of file class.assOrderingHorizontal.php.

References $index, and getOrderingElements().

758  {
759  $elements = $this->getOrderingElements();
760  if ($index !== null) {
761  if (array_key_exists($index, $elements)) {
762  return $elements[$index];
763  }
764  return null;
765  } else {
766  return $elements;
767  }
768  }
$index
Definition: metadata.php:145
getOrderingElements()
Get ordering elements from order text.
+ Here is the call graph for this function:

◆ getBestSolution()

assOrderingHorizontal::getBestSolution (   $active_id,
  $pass 
)

Returns the best solution for a given pass of a participant.

Returns
array An associated array containing the best solution

Definition at line 527 of file class.assOrderingHorizontal.php.

527  : array
528  {
529  $user_solution = array();
530  return $user_solution;
531  }

◆ getExpressionTypes()

◆ getMaximumPoints()

assOrderingHorizontal::getMaximumPoints ( )

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

See also
$points

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

References assQuestion\getPoints().

Referenced by getExpressionTypes(), and isComplete().

265  : float
266  {
267  return $this->getPoints();
268  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getOperators()

assOrderingHorizontal::getOperators (   $expression)

Get all available operations for a specific question.

Parameters
$expression

Implements iQuestionCondition.

Definition at line 672 of file class.assOrderingHorizontal.php.

References ilOperatorsExpressionMapping\getOperatorsByExpression().

672  : array
673  {
675  }
+ Here is the call graph for this function:

◆ getOrderingElements()

assOrderingHorizontal::getOrderingElements ( )

Get ordering elements from order text.

Returns
array Ordering elements

Definition at line 538 of file class.assOrderingHorizontal.php.

References getOrderText(), and splitAndTrimOrderElementText().

Referenced by calculateReachedPointsForSolution(), getAvailableAnswerOptions(), getExpressionTypes(), getRandomOrderingElements(), and toJSON().

538  : array
539  {
540  return $this->splitAndTrimOrderElementText($this->getOrderText() ?? "", $this->separator);
541  }
splitAndTrimOrderElementText(string $in_string, string $separator)
Splits the answer string either by space(s) or the separator (eg.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getOrderText()

assOrderingHorizontal::getOrderText ( )

Get order text.

Returns
string Order text

Definition at line 560 of file class.assOrderingHorizontal.php.

References $ordertext.

Referenced by getOrderingElements(), and saveAdditionalQuestionDataToDb().

+ Here is the caller graph for this function:

◆ getQuestionType()

assOrderingHorizontal::getQuestionType ( )

Returns the question type of the question.

Returns
integer The question type of the question

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

Referenced by toJSON().

427  : string
428  {
429  return "assOrderingHorizontal";
430  }
+ Here is the caller graph for this function:

◆ getRandomOrderingElements()

assOrderingHorizontal::getRandomOrderingElements ( )

Get ordering elements from order text in random sequence.

Returns
array Ordering elements

Definition at line 548 of file class.assOrderingHorizontal.php.

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

548  : array
549  {
550  $elements = $this->getOrderingElements();
551  $elements = $this->getShuffler()->transform($elements);
552  return $elements;
553  }
getOrderingElements()
Get ordering elements from order text.
+ Here is the call graph for this function:

◆ getRTETextWithMediaObjects()

assOrderingHorizontal::getRTETextWithMediaObjects ( )

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

Definition at line 465 of file class.assOrderingHorizontal.php.

465  : string
466  {
467  $text = parent::getRTETextWithMediaObjects();
468  return $text;
469  }

◆ getSeparator()

assOrderingHorizontal::getSeparator ( )

Get order text separator.

Returns
string Separator

Definition at line 602 of file class.assOrderingHorizontal.php.

References $separator.

602  : string
603  {
604  return $this->separator;
605  }

◆ getSolutionSubmit()

assOrderingHorizontal::getSolutionSubmit ( )

Definition at line 331 of file class.assOrderingHorizontal.php.

Referenced by saveWorkingData().

332  {
333  return $_POST["orderresult"];
334  }
+ Here is the caller graph for this function:

◆ getTextSize()

assOrderingHorizontal::getTextSize ( )

Get text size.

Returns
double Text size in percent maybe

Definition at line 580 of file class.assOrderingHorizontal.php.

References $textsize.

Referenced by saveAdditionalQuestionDataToDb(), and toJSON().

+ Here is the caller graph for this function:

◆ isComplete()

assOrderingHorizontal::isComplete ( )

Returns true, if a single choice question is complete for use.

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

Definition at line 69 of file class.assOrderingHorizontal.php.

References getMaximumPoints().

69  : bool
70  {
71  if (strlen($this->title) and ($this->author) and ($this->question) and ($this->getMaximumPoints() > 0)) {
72  return true;
73  } else {
74  return false;
75  }
76  }
getMaximumPoints()
Returns the maximum points, a learner can reach answering the question.
+ Here is the call graph for this function:

◆ loadFromDb()

assOrderingHorizontal::loadFromDb (   $question_id)

Loads a assOrderingHorizontal object from a database.

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

Definition at line 109 of file class.assOrderingHorizontal.php.

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

109  : void
110  {
111  global $DIC;
112  $ilDB = $DIC['ilDB'];
113 
114  $result = $ilDB->queryF(
115  "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",
116  array("integer"),
117  array($question_id)
118  );
119  if ($result->numRows() == 1) {
120  $data = $ilDB->fetchAssoc($result);
121  $this->setId($question_id);
122  $this->setObjId($data["obj_fi"]);
123  $this->setTitle((string) $data["title"]);
124  $this->setComment((string) $data["description"]);
125  $this->setOriginalId($data["original_id"]);
126  $this->setNrOfTries($data['nr_of_tries']);
127  $this->setAuthor($data["author"]);
128  $this->setPoints($data["points"]);
129  $this->setOwner($data["owner"]);
130  include_once("./Services/RTE/classes/class.ilRTE.php");
131  $this->setQuestion(ilRTE::_replaceMediaObjectImageSrc((string) $data["question_text"], 1));
132  $this->setOrderText($data["ordertext"]);
133  $this->setTextSize($data["textsize"]);
134 
135  try {
139  }
140 
141  try {
142  $this->setAdditionalContentEditingMode($data['add_cont_edit_mode']);
143  } catch (ilTestQuestionPoolException $e) {
144  }
145  }
146 
147  parent::loadFromDb($question_id);
148  }
static _replaceMediaObjectImageSrc(string $a_text, int $a_direction=0, string $nic='')
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
setNrOfTries(int $a_nr_of_tries)
setOwner(int $owner=-1)
setOrderText($a_value)
Set order text.
setComment(string $comment="")
global $DIC
Definition: feed.php:28
getAdditionalTableName()
Returns the name of the additional question data table in the database.
setPoints(float $points)
setObjId(int $obj_id=0)
setTextSize($a_value)
Set text size.
setId(int $id=-1)
setOriginalId(?int $original_id)
setTitle(string $title="")
setLifecycle(ilAssQuestionLifecycle $lifecycle)
setAuthor(string $author="")
setAdditionalContentEditingMode(?string $additionalContentEditingMode)
setQuestion(string $question="")
+ Here is the call graph for this function:

◆ saveAdditionalQuestionDataToDb()

assOrderingHorizontal::saveAdditionalQuestionDataToDb ( )

Saves a record to the question types additional data table.

Returns
mixed

Implements ilObjQuestionScoringAdjustable.

Definition at line 397 of file class.assOrderingHorizontal.php.

References $DIC, $ilDB, getAdditionalTableName(), assQuestion\getId(), getOrderText(), and getTextSize().

Referenced by saveToDb().

398  {
399  global $DIC;
400  $ilDB = $DIC['ilDB'];
401 
402  // save additional data
403  $ilDB->manipulateF(
404  "DELETE FROM " . $this->getAdditionalTableName()
405  . " WHERE question_fi = %s",
406  array( "integer" ),
407  array( $this->getId() )
408  );
409 
410  $ilDB->manipulateF(
411  "INSERT INTO " . $this->getAdditionalTableName()
412  . " (question_fi, ordertext, textsize) VALUES (%s, %s, %s)",
413  array( "integer", "text", "float" ),
414  array(
415  $this->getId(),
416  $this->getOrderText(),
417  ($this->getTextSize() < 10) ? null : (float) $this->getTextSize()
418  )
419  );
420  }
global $DIC
Definition: feed.php:28
getAdditionalTableName()
Returns the name of the additional question data table in the database.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveToDb()

assOrderingHorizontal::saveToDb (   $original_id = "")

Saves a assOrderingHorizontal object to a database.

Definition at line 82 of file class.assOrderingHorizontal.php.

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

82  : void
83  {
84  if ($original_id == "") {
85  $this->saveQuestionDataToDb();
86  } else {
88  }
89 
91  parent::saveToDb();
92  }
saveQuestionDataToDb(int $original_id=-1)
saveAdditionalQuestionDataToDb()
Saves a record to the question types additional data table.
+ Here is the call graph for this function:

◆ saveWorkingData()

assOrderingHorizontal::saveWorkingData (   $active_id,
  $pass = null,
  $authorized = true 
)

Saves the learners input of the question to the database.

public

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

Definition at line 344 of file class.assOrderingHorizontal.php.

References $DIC, $ilDB, $ilUser, ilObjAssessmentFolder\_enabledAssessmentLogging(), ilObjAssessmentFolder\_getLogLanguage(), ilObjTest\_getPass(), assQuestion\getId(), assQuestion\getProcessLocker(), getSolutionSubmit(), ILIAS\Repository\lng(), assQuestion\logAction(), assQuestion\removeCurrentSolution(), and assQuestion\saveCurrentSolution().

344  : bool
345  {
346  global $DIC;
347  if ($DIC->testQuestionPool()->internal()->request()->raw('test_answer_changed') === null) {
348  return true;
349  }
350 
351  global $DIC;
352  $ilDB = $DIC['ilDB'];
353  $ilUser = $DIC['ilUser'];
354 
355  if (is_null($pass)) {
356  include_once "./Modules/Test/classes/class.ilObjTest.php";
357  $pass = ilObjTest::_getPass($active_id);
358  }
359 
360  $entered_values = false;
361 
362  $this->getProcessLocker()->executeUserSolutionUpdateLockOperation(function () use (&$entered_values, $active_id, $pass, $authorized) {
363  $this->removeCurrentSolution($active_id, $pass, $authorized);
364 
365  $solutionSubmit = $this->getSolutionSubmit();
366 
367  $entered_values = false;
368  if (strlen($solutionSubmit)) {
369  $this->saveCurrentSolution($active_id, $pass, $_POST['orderresult'], null, $authorized);
370  $entered_values = true;
371  }
372  });
373 
374  if ($entered_values) {
375  include_once("./Modules/Test/classes/class.ilObjAssessmentFolder.php");
377  assQuestion::logAction($this->lng->txtlng(
378  "assessment",
379  "log_user_entered_values",
381  ), $active_id, $this->getId());
382  }
383  } else {
384  include_once("./Modules/Test/classes/class.ilObjAssessmentFolder.php");
386  assQuestion::logAction($this->lng->txtlng(
387  "assessment",
388  "log_user_not_entered_values",
390  ), $active_id, $this->getId());
391  }
392  }
393 
394  return true;
395  }
static _getPass($active_id)
Retrieves the actual pass of a given user for a given test.
global $DIC
Definition: feed.php:28
saveCurrentSolution(int $active_id, int $pass, $value1, $value2, bool $authorized=true, $tstamp=0)
static logAction(string $logtext, int $active_id, int $question_id)
removeCurrentSolution(int $active_id, int $pass, bool $authorized=true)
$ilUser
Definition: imgupload.php:34
+ Here is the call graph for this function:

◆ setExportDetailsXLS()

assOrderingHorizontal::setExportDetailsXLS ( ilAssExcelFormatHelper  $worksheet,
int  $startrow,
int  $active_id,
int  $pass 
)

{}

Definition at line 474 of file class.assOrderingHorizontal.php.

References $i, assQuestion\getSolutionValues(), and ilAssExcelFormatHelper\setCell().

474  : int
475  {
476  parent::setExportDetailsXLS($worksheet, $startrow, $active_id, $pass);
477 
478  $solutionvalue = "";
479  $solutions = $this->getSolutionValues($active_id, $pass);
480  if (array_key_exists(0, $solutions)) {
481  $solutionvalue = str_replace("{::}", " ", $solutions[0]["value1"]);
482  }
483  $i = 1;
484  $worksheet->setCell($startrow + $i, 2, $solutionvalue);
485  $i++;
486 
487  return $startrow + $i + 1;
488  }
getSolutionValues($active_id, $pass=null, bool $authorized=true)
Loads solutions of a given user from the database an returns it.
setCell($a_row, $a_col, $a_value, $datatype=null)
$i
Definition: metadata.php:41
+ Here is the call graph for this function:

◆ setOrderText()

assOrderingHorizontal::setOrderText (   $a_value)

Set order text.

Parameters
string$a_valueOrder text

Definition at line 570 of file class.assOrderingHorizontal.php.

Referenced by loadFromDb().

570  : void
571  {
572  $this->ordertext = $a_value;
573  }
+ Here is the caller graph for this function:

◆ setSeparator()

assOrderingHorizontal::setSeparator (   $a_value)

Set order text separator.

Parameters
string$a_valueSeparator

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

612  : void
613  {
614  $this->separator = $a_value;
615  }

◆ setTextSize()

assOrderingHorizontal::setTextSize (   $a_value)

Set text size.

Parameters
double$a_valueText size in percent

Definition at line 590 of file class.assOrderingHorizontal.php.

Referenced by loadFromDb().

590  : void
591  {
592  if ($a_value >= 10) {
593  $this->textsize = $a_value;
594  }
595  }
+ Here is the caller graph for this function:

◆ splitAndTrimOrderElementText()

assOrderingHorizontal::splitAndTrimOrderElementText ( string  $in_string,
string  $separator 
)

Splits the answer string either by space(s) or the separator (eg.

::) and trims the resulting array elements.

Parameters
string$in_stringOrderElements
string$separatorto be used for splitting.
Returns
array

Definition at line 313 of file class.assOrderingHorizontal.php.

References ILIAS\LTI\ToolProvider\$key, and ilStr\strPos().

Referenced by calculateReachedPointsForSolution(), getExpressionTypes(), and getOrderingElements().

313  : array
314  {
315  $result = array();
316  include_once "./Services/Utilities/classes/class.ilStr.php";
317 
318  if (ilStr::strPos($in_string, $separator) === false) {
319  $result = preg_split("/\\s+/", $in_string);
320  } else {
321  $result = explode($separator, $in_string);
322  }
323 
324  foreach ($result as $key => $value) {
325  $result[$key] = trim($value);
326  }
327 
328  return $result;
329  }
static strPos(string $a_haystack, string $a_needle, ?int $a_offset=null)
Definition: class.ilStr.php:42
string $key
Consumer key/client ID value.
Definition: System.php:193
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ supportsJavascriptOutput()

assOrderingHorizontal::supportsJavascriptOutput ( )

Definition at line 617 of file class.assOrderingHorizontal.php.

617  : bool
618  {
619  return true;
620  }

◆ supportsNonJsOutput()

assOrderingHorizontal::supportsNonJsOutput ( )

Definition at line 622 of file class.assOrderingHorizontal.php.

622  : bool
623  {
624  return false;
625  }

◆ toJSON()

assOrderingHorizontal::toJSON ( )

Returns a JSON representation of the question.

Definition at line 630 of file class.assOrderingHorizontal.php.

References $mobs, ilObjMediaObject\_getMobsOfObject(), assQuestion\formatSAQuestion(), assQuestion\getId(), assQuestion\getNrOfTries(), getOrderingElements(), assQuestion\getPoints(), assQuestion\getQuestion(), getQuestionType(), getTextSize(), assQuestion\getTitleForHTMLOutput(), and ILIAS\Repository\int().

630  : string
631  {
632  include_once("./Services/RTE/classes/class.ilRTE.php");
633  $result = array();
634  $result['id'] = $this->getId();
635  $result['type'] = (string) $this->getQuestionType();
636  $result['title'] = $this->getTitleForHTMLOutput();
637  $result['question'] = $this->formatSAQuestion($this->getQuestion());
638  $result['nr_of_tries'] = $this->getNrOfTries();
639  $result['shuffle'] = true;
640  $result['points'] = (bool) $this->getPoints();
641  $result['textsize'] = ((int) $this->getTextSize()) // #10923
642  ? (int) $this->getTextSize()
643  : 100;
644  $result['feedback'] = array(
645  'onenotcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), false)),
646  'allcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), true))
647  );
648 
649  $arr = array();
650  foreach ($this->getOrderingElements() as $order => $answer) {
651  array_push($arr, array(
652  "answertext" => (string) $answer,
653  "order" => (int) $order + 1
654  ));
655  }
656  $result['answers'] = $arr;
657 
658  $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $this->getId());
659  $result['mobs'] = $mobs;
660 
661  return json_encode($result);
662  }
$mobs
Definition: imgupload.php:70
static _getMobsOfObject(string $a_type, int $a_id, int $a_usage_hist_nr=0, string $a_lang="-")
getQuestionType()
Returns the question type of the question.
getOrderingElements()
Get ordering elements from order text.
+ Here is the call graph for this function:

◆ toXML()

assOrderingHorizontal::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 and sets the internal domxml variable with the DOM XML representation of the QTI xml representation.

Returns
string The QTI xml representation of the question

Definition at line 515 of file class.assOrderingHorizontal.php.

515  : string
516  {
517  include_once "./Modules/TestQuestionPool/classes/export/qti12/class.assOrderingHorizontalExport.php";
518  $export = new assOrderingHorizontalExport($this);
519  return $export->toXML($a_include_header, $a_include_binary, $a_shuffle, $test_output, $force_image_references);
520  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

Field Documentation

◆ $answer_separator

assOrderingHorizontal::$answer_separator = '{::}'
protected

Definition at line 39 of file class.assOrderingHorizontal.php.

Referenced by getAnswerSeparator().

◆ $ordertext

assOrderingHorizontal::$ordertext
protected

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

Referenced by getOrderText().

◆ $separator

assOrderingHorizontal::$separator = "::"
protected

Definition at line 38 of file class.assOrderingHorizontal.php.

Referenced by getSeparator().

◆ $textsize

assOrderingHorizontal::$textsize
protected

Definition at line 37 of file class.assOrderingHorizontal.php.

Referenced by getTextSize().

◆ HAS_SPECIFIC_FEEDBACK

const assOrderingHorizontal::HAS_SPECIFIC_FEEDBACK = false
protected

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


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