LimeSurvey API - Master branch

SortingStrategy
in package

Determines the sorting strategy for question elements

Table of Contents

Methods

determine()  : string
Determine which sorting strategy to use
answersRandomizable()  : bool
Checks if answers can be randomized for the given question type.
shouldOrderAlphabetically()  : bool
Returns true if the items should be ordered alphabetically.
shouldOrderRandomly()  : bool
Returns true if the items should be ordered randomly.

Methods

determine()

Determine which sorting strategy to use

public determine(Question $question[, string $context = 'answers' ]) : string
Parameters
$question : Question

The question model

$context : string = 'answers'

'answers' or 'subquestions'

Return values
string —

'random', 'alphabetical', or 'normal'

answersRandomizable()

Checks if answers can be randomized for the given question type.

private answersRandomizable(Question $question) : bool

Determines whether the question type supports answer randomization. Currently returns false only for Array (F) and Array Dual Scale (1) question types.

Parameters
$question : Question

The question model to check

Return values
bool —

True if the question type supports answer randomization, false otherwise

shouldOrderAlphabetically()

Returns true if the items should be ordered alphabetically.

private shouldOrderAlphabetically(Question $question[, string $context = 'answers' ]) : bool
Parameters
$question : Question

The question model

$context : string = 'answers'

'answers' or 'subquestions'

Return values
bool

shouldOrderRandomly()

Returns true if the items should be ordered randomly.

private shouldOrderRandomly(Question $question[, string $context = 'answers' ]) : bool
Parameters
$question : Question

The question model

$context : string = 'answers'

'answers' or 'subquestions'

Return values
bool

        
On this page

Search results