ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
assOrderingHorizontal Class Reference

Class for horizontal ordering questions. 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 (?int $original_id=null)
 Saves a assOrderingHorizontal object to a database. More...
 
 getAnswerSeparator ()
 
 loadFromDb ($question_id)
 Loads a assOrderingHorizontal object from a database. More...
 
 getMaximumPoints ()
 
 calculateReachedPoints (int $active_id, ?int $pass=null, bool $authorized_solution=true)
 
 splitAndTrimOrderElementText (string $in_string, string $separator)
 
 saveWorkingData (int $active_id, ?int $pass=null, bool $authorized=true)
 
 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...
 
 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 (?float $textsize)
 Set text size. More...
 
 getSeparator ()
 Get order text separator. More...
 
 setSeparator ($a_value)
 Set order text separator. More...
 
 toJSON ()
 Returns a JSON representation of the question. More...
 
 getOperators (string $expression)
 Get all available operations for a specific question. More...
 
 getExpressionTypes ()
 Get all available expression types for a specific question. More...
 
 getUserQuestionResult (int $active_id, int $pass)
 Get the user solution for a question by active_id and the test pass. More...
 
 getAvailableAnswerOptions (?int $index=null)
 
 buildTestPresentationConfig ()
 
 toLog (AdditionalInformationGenerator $additional_info)
 MUST return an array of the question settings that can be stored in the log. More...
 
 solutionValuesToText (array $solution_values)
 MUST convert the given solution values into text. More...
 
 getCorrectSolutionForTextOutput (int $active_id, int $pass)
 
- Public Member Functions inherited from assQuestion
 getQuestionType ()
 
 isComplete ()
 
 saveWorkingData (int $active_id, ?int $pass=null, bool $authorized=true)
 
 calculateReachedPoints (int $active_id, ?int $pass=null, bool $authorized_solution=true)
 
 getAdditionalTableName ()
 
 getAnswerTableName ()
 
 toLog (AdditionalInformationGenerator $additional_info)
 MUST return an array of the question settings that can be stored in the log. More...
 
 getCurrentUser ()
 
 getShuffler ()
 
 setShuffler (Transformation $shuffler)
 
 setProcessLocker (ilAssQuestionProcessLocker $processLocker)
 
 getProcessLocker ()
 
 fromXML (string $importdirectory, int $user_id, ilQTIItem $item, int $questionpool_id, ?int $tst_id, ?ilObject &$tst_object, int &$question_counter, array $import_mapping)
 
 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...
 
 setTitle (string $title="")
 
 setId (int $id=-1)
 
 setTestId (int $id=-1)
 
 setComment (string $comment="")
 
 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 ()
 
 getAuthor ()
 
 getAuthorForHTMLOutput ()
 
 getOwner ()
 
 getObjId ()
 
 setObjId (int $obj_id=0)
 
 getLifecycle ()
 
 setLifecycle (ilAssQuestionLifecycle $lifecycle)
 
 setExternalId (?string $external_id)
 
 getExternalId ()
 
 getSuggestedSolutionOutput ()
 
 getSuggestedSolutions ()
 
 getReachedPoints (int $active_id, int $pass)
 
 getMaximumPoints ()
 
 getAdjustedReachedPoints (int $active_id, int $pass, bool $authorized_solution=true)
 
 calculateResultsFromSolution (int $active_id, int $pass)
 Calculates the question results from a previously saved question solution. More...
 
 persistWorkingState (int $active_id, $pass, bool $authorized=true)
 persists the working state for current testactive and testpass More...
 
 persistPreviewState (ilAssQuestionPreviewSession $preview_session)
 persists the preview state for current user and question More...
 
 validateSolutionSubmit ()
 
 getSuggestedSolutionPath ()
 
 getImagePath ($question_id=null, $object_id=null)
 Returns the image path for web accessable images 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, ?int $pass=null)
 
 getSolutionValues (int $active_id, ?int $pass=null, bool $authorized=true)
 Loads solutions of a given user from the database an returns it. More...
 
 deleteAnswers (int $question_id)
 
 deleteAdditionalTableData (int $question_id)
 
 delete (int $question_id)
 
 getTotalAnswers ()
 
 cloneXHTMLMediaObjectsOfQuestion (int $source_question_id)
 
 createPageObject ()
 
 clonePageOfQuestion (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=null)
 
 duplicate (bool $for_test=true, string $title='', string $author='', int $owner=-1, $test_obj_id=null)
 
 copyObject (int $target_parent_id, string $title='')
 
 createNewOriginalFromThisDuplicate (int $target_parent_id, string $target_question_title='')
 
 saveToDb (?int $original_id=null)
 
 deleteSuggestedSolutions ()
 
 getSuggestedSolution (int $subquestion_index=0)
 
 resolveInternalLink (string $internal_link)
 
 resolveSuggestedSolutionLinks ()
 
 getInternalLinkHref (string $target)
 
 syncWithOriginal ()
 
 getPoints ()
 
 setPoints (float $points)
 
 getSolutionMaxPass (int $active_id)
 
 isWriteable ()
 
 calculateReachedPointsFromPreviewSession (ilAssQuestionPreviewSession $preview_session)
 
 isPreviewSolutionCorrect (ilAssQuestionPreviewSession $preview_session)
 
 adjustReachedPointsByScoringOptions (float $points, int $active_id)
 Adjust the given reached points by checks for all special scoring options in the test container. More...
 
 buildHashedImageFilename (string $plain_image_filename, bool $unique=false)
 
 getQuestion ()
 
 getQuestionForHTMLOutput ()
 
 setQuestion (string $question="")
 
 getQuestionTypeID ()
 
 cleanupMediaObjectUsage ()
 
 getInstances ()
 
 getActiveUserData (int $active_id)
 Returns the user id and the test id for a given active id. More...
 
 hasSpecificFeedback ()
 
 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)
 
 isAnswered (int $active_id, int $pass)
 
 getAdditionalContentEditingMode ()
 
 setAdditionalContentEditingMode (?string $additionalContentEditingMode)
 
 isAdditionalContentEditingModePageObject ()
 
 isValidAdditionalContentEditingMode (string $additionalContentEditingMode)
 
 getValidAdditionalContentEditingModes ()
 
 getHtmlUserSolutionPurifier ()
 
 getHtmlQuestionContentPurifier ()
 
 setLastChange (int $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 ()
 
 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 $value_pairs)
 
 updateTimestamp ()
 
 getTestPresentationConfig ()
 
 hasWritableOriginalInQuestionPool ()
 
 answerToParticipantInteraction (AdditionalInformationGenerator $additional_info, int $test_ref_id, int $active_id, int $pass, string $source_ip, TestParticipantInteractionTypes $interaction_type)
 
 toQuestionAdministrationInteraction (AdditionalInformationGenerator $additional_info, int $test_ref_id, TestQuestionAdministrationInteractionTypes $interaction_type)
 
 getSolutionForTextOutput (int $active_id, int $pass)
 
 getCorrectSolutionForTextOutput (int $active_id, int $pass)
 
 getVariablesAsTextArray (int $active_id, int $pass)
 
 validateSolutionSubmit ()
 
 toLog (AdditionalInformationGenerator $additional_info)
 
 answerToParticipantInteraction (AdditionalInformationGenerator $additional_info, int $test_id, int $active_id, int $pass, string $source_ip, TestParticipantInteractionTypes $interaction_type)
 
 toQuestionAdministrationInteraction (AdditionalInformationGenerator $additional_info, int $test_id, TestQuestionAdministrationInteractionTypes $interaction_type)
 
 saveAdditionalQuestionDataToDb ()
 Saves a record to the question types additional data table. More...
 
 getOperators (string $expression)
 Get all available operations for a specific question. More...
 
 getExpressionTypes ()
 Get all available expression types for a specific question. More...
 
 getUserQuestionResult (int $active_id, int $pass)
 Get the user solution for a question by active_id and the test pass. More...
 
 getAvailableAnswerOptions (?int $index=null)
 If index is null, the function returns an array with all anwser options else it returns the specific answer option. More...
 
 toJSON ()
 

Protected Member Functions

 getSolutionSubmit ()
 
 calculateReachedPointsForSolution (?string $value)
 
 solutionValuesToLog (AdditionalInformationGenerator $additional_info, array $solution_values)
 MUST convert the given solution values into an array or a string that can be stored in the log. More...
 
- Protected Member Functions inherited from assQuestion
 solutionValuesToLog (AdditionalInformationGenerator $additional_info, array $solution_values)
 MUST convert the given solution values into an array or a string that can be stored in the log. More...
 
 solutionValuesToText (array $solution_values)
 MUST convert the given solution values into text. More...
 
 getQuestionAction ()
 
 isNonEmptyItemListPostSubmission (string $post_submission_field_name)
 
 savePreviewData (ilAssQuestionPreviewSession $preview_session)
 
 deletePageOfQuestion (int $question_id)
 
 cloneQuestionTypeSpecificProperties (self $target)
 
 removeAllImageFiles (string $image_target_path)
 
 onDuplicate (int $original_parent_id, int $original_question_id, int $duplicate_parent_id, int $duplicate_question_id)
 
 afterSyncWithOriginal (int $original_question_id, int $clone_question_id, int $original_parent_id, int $clone_parent_id)
 
 onCopy (int $sourceParentId, int $sourceQuestionId, int $targetParentId, int $targetQuestionId)
 
 duplicateComments (int $parent_source_id, int $source_id, int $parent_target_id, int $target_id)
 
 deleteComments ()
 
 getNotesManager ()
 
 getNotesDataService ()
 
 getNotesRepo ()
 
 cloneSuggestedSolutions (int $source_question_id, int $target_question_id)
 
 duplicateSuggestedSolutionFiles (int $parent_id, int $question_id)
 Duplicates the files of a suggested solution if the question is duplicated. More...
 
 cloneSuggestedSolutionFiles (int $source_question_id, int $target_question_id)
 
 copySuggestedSolutions (int $target_question_id)
 
 ensureNonNegativePoints (float $points)
 
 purifyAndPrepareTextAreaOutput (string $content)
 
 getRTETextWithMediaObjects ()
 
 getSelfAssessmentFormatter ()
 
 lmMigrateQuestionTypeGenericContent (ilAssSelfAssessmentMigrator $migrator)
 
 lmMigrateQuestionTypeSpecificContent (ilAssSelfAssessmentMigrator $migrator)
 
 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 ()
 
 getSuggestedSolutionsRepo ()
 
 loadSuggestedSolutions ()
 
 answerToLog (AdditionalInformationGenerator $additional_info, int $active_id, int $pass)
 

Protected Attributes

const HAS_SPECIFIC_FEEDBACK = false
 
const DEFAULT_TEXT_SIZE = 100
 
 $ordertext
 
 $textsize
 
 $separator = "::"
 
 $answer_separator = '{::}'
 
- Protected Attributes inherited from assQuestion
const HAS_SPECIFIC_FEEDBACK = true
 
GeneralQuestionPropertiesRepository $questionrepository
 
RequestDataCollector $questionpool_request
 
QuestionFiles $question_files
 
ilAssQuestionProcessLocker $processLocker
 
ilTestQuestionConfig $testQuestionConfig
 
SuggestedSolutionsDatabaseRepository $suggestedsolution_repo
 
ILIAS $ilias
 
ilGlobalPageTemplate $tpl
 
ilLanguage $lng
 
ilDBInterface $db
 
ilObjUser $current_user
 
SkillUsageService $skillUsageService
 
HTTPServices $http
 
Refinery $refinery
 
Transformation $shuffler
 
LoggingServices $log
 
Container $dic
 
ilAssQuestionLifecycle $lifecycle
 
ilAssQuestionPage $page
 
TestResultRepository $test_result_repository
 
int $id
 
string $title
 
string $comment
 
int $owner
 
string $author
 
int $thumb_size
 
string $question
 
float $points = 0.0
 
bool $shuffle = true
 
int $test_id
 
int $obj_id = 0
 
int $original_id = null
 
int $lastChange = null
 
string $external_id = null
 
int $step = null
 
array $suggested_solutions
 

Additional Inherited Members

- Static Public Member Functions inherited from assQuestion
static setForcePassResultUpdateEnabled (bool $force_pass_results_update_enabled)
 
static isForcePassResultUpdateEnabled ()
 
static _getSuggestedSolutionOutput (int $question_id)
 
static _getReachedPoints (int $active_id, int $question_id, int $pass)
 
static isFileAvailable (string $file)
 
static saveOriginalId (int $questionId, int $originalId)
 
static resetOriginalId (int $questionId)
 
static instantiateQuestion (int $question_id)
 
static _getSolutionMaxPass (int $question_id, int $active_id)
 Returns the maximum pass a users question solution. More...
 
static getFeedbackClassNameByQuestionType (string $questionType)
 
static _questionExistsInTest (int $question_id, int $test_id)
 
static lookupParentObjId (int $question_id)
 
static implodeKeyValues (array $keyValues)
 
static explodeKeyValues (string $keyValues)
 
static convertISO8601FormatH_i_s_ExtendedToSeconds (string $time)
 
static extendedTrim (string $value)
 Trim non-printable characters from the beginning and end of a string. More...
 
- Data Fields inherited from assQuestion
const ADDITIONAL_CONTENT_EDITING_MODE_RTE = 'default'
 
const ADDITIONAL_CONTENT_EDITING_MODE_IPE = 'pageobject'
 
const TRIM_PATTERN = '/^[\p{C}\p{Z}]+|[\p{C}\p{Z}]+$/u'
 
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 $force_pass_results_update_enabled = false
 
static $imageSourceFixReplaceMap
 

Detailed Description

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 36 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 58 of file class.assOrderingHorizontal.php.

64 {
66 $this->ordertext = "";
67 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

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

+ Here is the call graph for this function:

Member Function Documentation

◆ buildTestPresentationConfig()

assOrderingHorizontal::buildTestPresentationConfig ( )

Reimplemented from assQuestion.

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

524 // hey.
525 {
526 // hey: refactored identifiers
527 return parent::buildTestPresentationConfig()
528 // hey.
530 ->setUseUnchangedAnswerLabel($this->lng->txt('tst_unchanged_order_is_correct'));
531 }
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.

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

+ Here is the call graph for this function:

◆ calculateReachedPoints()

assOrderingHorizontal::calculateReachedPoints ( int  $active_id,
?int  $pass = null,
bool  $authorized_solution = true 
)

Reimplemented from assQuestion.

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

155 : float {
156 if ($pass === null) {
157 $pass = $this->getSolutionMaxPass($active_id);
158 }
159
160 $result = $this->getCurrentSolutionResultSet($active_id, $pass, $authorized_solution);
161 $points = 0.0;
162 if ($this->db->numRows($result) > 0) {
163 $data = $this->db->fetchAssoc($result);
165 }
166
167 return $points;
168 }
calculateReachedPointsForSolution(?string $value)
getCurrentSolutionResultSet(int $active_id, int $pass, bool $authorized=true)
getSolutionMaxPass(int $active_id)

References assQuestion\getSolutionMaxPass().

+ Here is the call graph for this function:

◆ calculateReachedPointsForSolution()

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

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

512 : float
513 {
514 $value = $this->splitAndTrimOrderElementText($value ?? "", $this->answer_separator);
515 $value = join($this->answer_separator, $value);
516 if (strcmp($value, join($this->answer_separator, $this->getOrderingElements())) == 0) {
517 $points = $this->getPoints();
518 return $points;
519 }
520 return 0;
521 }
splitAndTrimOrderElementText(string $in_string, string $separator)
getOrderingElements()
Get ordering elements from order text.

◆ 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 284 of file class.assOrderingHorizontal.php.

284 : void
285 {
286 }

◆ getAdditionalTableName()

assOrderingHorizontal::getAdditionalTableName ( )

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

Returns
string The additional table name

Reimplemented from assQuestion.

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

264 : string
265 {
266 return "qpl_qst_horder";
267 }

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ getAnswerSeparator()

assOrderingHorizontal::getAnswerSeparator ( )
Returns
string

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

97 : string
98 {
100 }

References $answer_separator.

◆ getAnswerTableName()

assOrderingHorizontal::getAnswerTableName ( )

Returns the name of the answer table in the database.

Returns
string The answer table name

Reimplemented from assQuestion.

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

274 : string
275 {
276 return "";
277 }

◆ getAvailableAnswerOptions()

assOrderingHorizontal::getAvailableAnswerOptions ( ?int  $index = null)
Returns
array<ASS_AnswerSimple>|ASS_AnswerSimple|null

Implements iQuestionCondition.

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

495 : array|ASS_AnswerSimple|null
496 {
497 $elements = $this->getOrderingElements();
498 if ($index !== null) {
499 if (array_key_exists($index, $elements)) {
500 return $elements[$index];
501 }
502 return null;
503 } else {
504 return $elements;
505 }
506 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ 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 303 of file class.assOrderingHorizontal.php.

303 : array
304 {
305 $user_solution = [];
306 return $user_solution;
307 }

◆ getCorrectSolutionForTextOutput()

assOrderingHorizontal::getCorrectSolutionForTextOutput ( int  $active_id,
int  $pass 
)

Reimplemented from assQuestion.

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

571 : string
572 {
573 return $this->getOrderText();
574 }

◆ getExpressionTypes()

◆ getMaximumPoints()

assOrderingHorizontal::getMaximumPoints ( )

Reimplemented from assQuestion.

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

146 : float
147 {
148 return $this->getPoints();
149 }

References assQuestion\getPoints().

Referenced by isComplete().

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

◆ getOperators()

assOrderingHorizontal::getOperators ( string  $expression)

Get all available operations for a specific question.

Parameters
$expression

Implements iQuestionCondition.

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

430 : array
431 {
433 }
static getOperatorsByExpression(string $expression)

References ilOperatorsExpressionMapping\getOperatorsByExpression().

+ Here is the call graph for this function:

◆ getOrderingElements()

assOrderingHorizontal::getOrderingElements ( )

Get ordering elements from order text.

Returns
array Ordering elements

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

314 : array
315 {
316 return $this->splitAndTrimOrderElementText($this->getOrderText() ?? "", $this->separator);
317 }

◆ getOrderText()

assOrderingHorizontal::getOrderText ( )

Get order text.

Returns
string Order text

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

◆ getQuestionType()

assOrderingHorizontal::getQuestionType ( )

Returns the question type of the question.

Returns
integer The question type of the question

Reimplemented from assQuestion.

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

254 : string
255 {
256 return "assOrderingHorizontal";
257 }

◆ getRandomOrderingElements()

assOrderingHorizontal::getRandomOrderingElements ( )

Get ordering elements from order text in random sequence.

Returns
array Ordering elements

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

324 : array
325 {
326 $elements = $this->getOrderingElements();
327 $elements = $this->getShuffler()->transform($elements);
328 return $elements;
329 }

◆ getRTETextWithMediaObjects()

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

292 : string
293 {
294 $text = parent::getRTETextWithMediaObjects();
295 return $text;
296 }

◆ getSeparator()

assOrderingHorizontal::getSeparator ( )

Get order text separator.

Returns
string Separator

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

379 : string
380 {
381 return $this->separator;
382 }

◆ getSolutionSubmit()

assOrderingHorizontal::getSolutionSubmit ( )
protected

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

187 : string
188 {
189 return $this->questionpool_request->string('orderresult');
190 }

◆ getTextSize()

assOrderingHorizontal::getTextSize ( )

Get text size.

Returns
double Text size in percent maybe

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

◆ getUserQuestionResult()

assOrderingHorizontal::getUserQuestionResult ( int  $active_id,
int  $pass 
)

Get the user solution for a question by active_id and the test pass.

Implements iQuestionCondition.

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

449 $result = new ilUserQuestionResult($this, $active_id, $pass);
450
451 $maxStep = $this->lookupMaxStep($active_id, $pass);
452 if ($maxStep > 0) {
453 $data = $this->db->queryF(
454 "SELECT value1 FROM tst_solutions WHERE active_fi = %s AND pass = %s AND question_fi = %s AND step = %s",
455 ["integer", "integer", "integer","integer"],
456 [$active_id, $pass, $this->getId(), $maxStep]
457 );
458 } else {
459 $data = $this->db->queryF(
460 "SELECT value1 FROM tst_solutions WHERE active_fi = %s AND pass = %s AND question_fi = %s",
461 ["integer", "integer", "integer"],
462 [$active_id, $pass, $this->getId()]
463 );
464 }
465 $row = $this->db->fetchAssoc($data);
466
467 $answer_elements = $this->splitAndTrimOrderElementText($row["value1"] ?? "", $this->answer_separator);
468 $elements = $this->getOrderingElements();
469
470 foreach ($answer_elements as $answer) {
471 foreach ($elements as $key => $element) {
472 if ($element == $answer) {
473 $result->addKeyValue($key + 1, $answer);
474 }
475 }
476 }
477
478 $glue = " ";
479 if ($this->answer_separator = '{::}') {
480 $glue = "";
481 }
482 $result->addKeyValue(null, join($glue, $answer_elements));
483
484 $points = $this->calculateReachedPoints($active_id, $pass);
485 $max_points = $this->getMaximumPoints();
486
487 $result->setReachedPercentage(($points / $max_points) * 100);
488
489 return $result;
490 }
calculateReachedPoints(int $active_id, ?int $pass=null, bool $authorized_solution=true)
lookupMaxStep(int $active_id, int $pass)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ 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

Reimplemented from assQuestion.

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

74 : bool
75 {
76 if (strlen($this->title) and ($this->author) and ($this->question) and ($this->getMaximumPoints() > 0)) {
77 return true;
78 } else {
79 return false;
80 }
81 }

References getMaximumPoints().

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

109 : void
110 {
111 $result = $this->db->queryF(
112 "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",
113 ["integer"],
114 [$question_id]
115 );
116 if ($result->numRows() == 1) {
117 $data = $this->db->fetchAssoc($result);
118 $this->setId($question_id);
119 $this->setObjId($data["obj_fi"]);
120 $this->setTitle((string) $data["title"]);
121 $this->setComment((string) $data["description"]);
122 $this->setOriginalId($data["original_id"]);
123 $this->setNrOfTries($data['nr_of_tries']);
124 $this->setAuthor($data["author"]);
125 $this->setPoints($data["points"]);
126 $this->setOwner($data["owner"]);
127 $this->setQuestion(ilRTE::_replaceMediaObjectImageSrc((string) $data["question_text"], 1));
128 $this->setOrderText($data["ordertext"]);
129 $this->setTextSize($data["textsize"]);
130
131 try {
135 }
136
137 try {
138 $this->setAdditionalContentEditingMode($data['add_cont_edit_mode']);
140 }
141 }
142
143 parent::loadFromDb($question_id);
144 }
setOrderText($a_value)
Set order text.
getAdditionalTableName()
Returns the name of the additional question data table in the database.
setTextSize(?float $textsize)
Set text size.
setOriginalId(?int $original_id)
setId(int $id=-1)
setAdditionalContentEditingMode(?string $additionalContentEditingMode)
setQuestion(string $question="")
setAuthor(string $author="")
setComment(string $comment="")
setObjId(int $obj_id=0)
setOwner(int $owner=-1)
setNrOfTries(int $a_nr_of_tries)
setLifecycle(ilAssQuestionLifecycle $lifecycle)
setTitle(string $title="")
setPoints(float $points)
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...

References $data, Vendor\Package\$e, 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().

+ 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 227 of file class.assOrderingHorizontal.php.

228 {
229 // save additional data
230 $this->db->manipulateF(
231 "DELETE FROM " . $this->getAdditionalTableName()
232 . " WHERE question_fi = %s",
233 [ "integer" ],
234 [ $this->getId() ]
235 );
236
237 $this->db->manipulateF(
238 "INSERT INTO " . $this->getAdditionalTableName()
239 . " (question_fi, ordertext, textsize) VALUES (%s, %s, %s)",
240 [ "integer", "text", "float" ],
241 [
242 $this->getId(),
243 $this->getOrderText(),
244 ($this->getTextSize() < 10) ? null : (float) $this->getTextSize()
245 ]
246 );
247 }

References ILIAS\Survey\Mode\getId().

Referenced by saveToDb().

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

◆ saveToDb()

assOrderingHorizontal::saveToDb ( ?int  $original_id = null)

Saves a assOrderingHorizontal object to a database.

Reimplemented from assQuestion.

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

87 : void
88 {
91 parent::saveToDb();
92 }
saveAdditionalQuestionDataToDb()
Saves a record to the question types additional data table.
saveQuestionDataToDb(?int $original_id=null)

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

+ Here is the call graph for this function:

◆ saveWorkingData()

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

Reimplemented from assQuestion.

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

196 : bool {
197 if ($this->questionpool_request->raw('test_answer_changed') === null) {
198 return true;
199 }
200
201 if (is_null($pass)) {
202 $pass = ilObjTest::_getPass($active_id);
203 }
204
205 $answer = $this->getSolutionSubmit();
206 $this->getProcessLocker()->executeUserSolutionUpdateLockOperation(
207 function () use ($answer, $active_id, $pass, $authorized) {
208 $this->removeCurrentSolution($active_id, $pass, $authorized);
209
210 if ($answer === '') {
211 return;
212 }
213
214 $this->saveCurrentSolution(
215 $active_id,
216 $pass,
217 $answer,
218 null,
219 $authorized
220 );
221 }
222 );
223
224 return true;
225 }
saveCurrentSolution(int $active_id, int $pass, $value1, $value2, bool $authorized=true, $tstamp=0)
removeCurrentSolution(int $active_id, int $pass, bool $authorized=true)
static _getPass($active_id)
Retrieves the actual pass of a given user for a given test.

◆ setOrderText()

assOrderingHorizontal::setOrderText (   $a_value)

Set order text.

Parameters
string$a_valueOrder text

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

346 : void
347 {
348 $this->ordertext = $a_value;
349 }

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ setSeparator()

assOrderingHorizontal::setSeparator (   $a_value)

Set order text separator.

Parameters
string$a_valueSeparator

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

389 : void
390 {
391 $this->separator = $a_value;
392 }

◆ setTextSize()

assOrderingHorizontal::setTextSize ( ?float  $textsize)

Set text size.

Parameters
double$a_valueText size in percent

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

366 : void
367 {
368 if ($textsize === null || $textsize === 0.0) {
370 }
371 $this->textsize = $textsize;
372 }

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ solutionValuesToLog()

assOrderingHorizontal::solutionValuesToLog ( AdditionalInformationGenerator  $additional_info,
array  $solution_values 
)
protected

MUST convert the given solution values into an array or a string that can be stored in the log.

Language variables must be generated through the corresponding functions in the AdditionalInformationGenerator. If an array is returned it will be rendered into a line per array entry in the format "key: value". If the key exists as a language variable, it will be translated.

Reimplemented from assQuestion.

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

552 : string {
553 if (!array_key_exists(0, $solution_values) ||
554 !array_key_exists('value1', $solution_values[0])) {
555 return '';
556 }
557
558 return str_replace("{::}", " ", $solution_values[0]['value1']);
559 }

◆ solutionValuesToText()

assOrderingHorizontal::solutionValuesToText ( array  $solution_values)

MUST convert the given solution values into text.

If the text has multiple lines each line MUST be placed as an entry in an array.

Reimplemented from assQuestion.

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

561 : string
562 {
563 if (!array_key_exists(0, $solution_values) ||
564 !array_key_exists('value1', $solution_values[0])) {
565 return '';
566 }
567
568 return str_replace("{::}", " ", $solution_values[0]['value1']);
569 }

◆ splitAndTrimOrderElementText()

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

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

170 : array
171 {
172 $result = [];
173
174 if (ilStr::strPos($in_string, $separator, 0) === false) {
175 $result = preg_split("/\\s+/", $in_string);
176 } else {
177 $result = explode($separator, $in_string);
178 }
179
180 foreach ($result as $key => $value) {
181 $result[$key] = trim($value);
182 }
183
184 return $result;
185 }
static strPos(string $a_haystack, string $a_needle, int $a_offset=0)
Definition: class.ilStr.php:39

References ilStr\strPos().

+ Here is the call graph for this function:

◆ toJSON()

assOrderingHorizontal::toJSON ( )

Returns a JSON representation of the question.

Reimplemented from assQuestion.

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

397 : string
398 {
399 $result = [];
400 $result['id'] = $this->getId();
401 $result['type'] = (string) $this->getQuestionType();
402 $result['title'] = $this->getTitleForHTMLOutput();
403 $result['question'] = $this->formatSAQuestion($this->getQuestion());
404 $result['nr_of_tries'] = $this->getNrOfTries();
405 $result['shuffle'] = true;
406 $result['points'] = (bool) $this->getPoints();
407 $result['textsize'] = ((int) $this->getTextSize()) // #10923
408 ? (int) $this->getTextSize()
409 : self::DEFAULT_TEXT_SIZE;
410 $result['feedback'] = [
411 'onenotcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), false)),
412 'allcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), true))
413 ];
414
415 $arr = [];
416 foreach ($this->getOrderingElements() as $order => $answer) {
417 array_push($arr, [
418 "answertext" => (string) $answer,
419 "order" => (int) $order + 1
420 ]);
421 }
422 $result['answers'] = $arr;
423
424 $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $this->getId());
425 $result['mobs'] = $mobs;
426
427 return json_encode($result);
428 }
getQuestionType()
Returns the question type of the question.
static _getMobsOfObject(string $a_type, int $a_id, int $a_usage_hist_nr=0, string $a_lang="-")

References ilObjMediaObject\_getMobsOfObject(), ILIAS\Survey\Mode\getId(), and ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ toLog()

assOrderingHorizontal::toLog ( AdditionalInformationGenerator  $additional_info)

MUST return an array of the question settings that can be stored in the log.

Language variables must be generated through the corresponding functions in the AdditionalInformationGenerator. If an array is returned it will be rendered into a line per array entry in the format "key: value". If the key exists as a language variable, it will be translated.

Reimplemented from assQuestion.

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

533 : array
534 {
535 return [
536 AdditionalInformationGenerator::KEY_QUESTION_TYPE => (string) $this->getQuestionType(),
537 AdditionalInformationGenerator::KEY_QUESTION_TITLE => $this->getTitleForHTMLOutput(),
538 AdditionalInformationGenerator::KEY_QUESTION_TEXT => $this->formatSAQuestion($this->getQuestion()),
539 AdditionalInformationGenerator::KEY_QUESTION_TEXTSIZE => ((int) $this->getTextSize()) ? (int) $this->getTextSize() : 100,
540 AdditionalInformationGenerator::KEY_QUESTION_CORRECT_ANSWER_OPTIONS => $this->getOrderText(),
541 AdditionalInformationGenerator::KEY_QUESTION_REACHABLE_POINTS => $this->getPoints(),
542 AdditionalInformationGenerator::KEY_FEEDBACK => [
543 AdditionalInformationGenerator::KEY_QUESTION_FEEDBACK_ON_INCOMPLETE => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), false)),
544 AdditionalInformationGenerator::KEY_QUESTION_FEEDBACK_ON_COMPLETE => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), true))
545 ]
546 ];
547 }
return true

References ILIAS\Repository\int().

+ Here is the call graph for this function:

Field Documentation

◆ $answer_separator

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

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

Referenced by getAnswerSeparator().

◆ $ordertext

assOrderingHorizontal::$ordertext
protected

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

◆ $separator

assOrderingHorizontal::$separator = "::"
protected

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

◆ $textsize

assOrderingHorizontal::$textsize
protected

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

◆ DEFAULT_TEXT_SIZE

const assOrderingHorizontal::DEFAULT_TEXT_SIZE = 100
protected

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

◆ HAS_SPECIFIC_FEEDBACK

const assOrderingHorizontal::HAS_SPECIFIC_FEEDBACK = false
protected

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


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