LimeSurvey API - Master branch

OpHandlerQuestionGroupReorder
in package
implements OpHandlerInterface Uses OpHandlerSurveyTrait, OpHandlerExceptionTrait, OpHandlerValidationTrait

OpHandlerQuestionGroupReorder is responsible for reordering question groups and also questions

Table of Contents

Interfaces

OpHandlerInterface

Properties

$entity  : string
$model  : QuestionGroup
$transformer  : TransformerInputQuestionGroupReorder

Methods

__construct()  : mixed
addErrorToValidationData()  : array<string|int, mixed>
Adds the error message to the validationData array
canHandle()  : bool
Checks if the operation is applicable for the given entity.
extractTempId()  : int|mixed
returns and removes tempId from dataset
getSurveyIdFromContext()  : int
Extracts and returns surveyId from context
getValidationReturn()  : array<string|int, mixed>|array<string|int, array<string|int, ValidationErrorItem>>
handle()  : void
Saves the changes to the database.
validateCollection()  : array<string|int, mixed>
checks incoming props if it's a collection otherwise adds error to validationData.
validateCollectionIndex()  : array<string|int, mixed>
validates for collection first and then checks the indexes to be numeric or alphabetic dependent on the alphabetic flag
validateEntityId()  : array<string|int, mixed>
checks for entity id being there, otherwise adds error to validationData
validateOperation()  : array<string|int, mixed>
Checks if patch is valid for this operation.
throwNoValuesException()  : void

Properties

Methods

addErrorToValidationData()

Adds the error message to the validationData array

public addErrorToValidationData(string $error, array<string|int, mixed> $validationData) : array<string|int, mixed>
Parameters
$error : string
$validationData : array<string|int, mixed>
Return values
array<string|int, mixed>

extractTempId()

returns and removes tempId from dataset

public extractTempId(array<string|int, mixed> &$dataSet) : int|mixed
Parameters
$dataSet : array<string|int, mixed>
Return values
int|mixed

handle()

Saves the changes to the database.

public handle(OpInterface $op) : void

The patch should have the following structure: "patch": [ { "entity": "questionGroupReorder", "op": "update", "id": 123456, "props": { "50": { // question group id "sortOrder": 2, "questions": { "723": { // question id "sortOrder": 0 }, "722": { // question id "sortOrder": 1 } } }, "59": { "sortOrder": 1, "questions": { "726": { "sortOrder": 3 }, "727": { "sortOrder": 2 } } } } } ]

"questions" can also be left out or be empty. Also you don't have to pass all groups / all questions.

Parameters
$op : OpInterface
Tags
throws
OpHandlerException
throws
DependencyException
throws
NotFoundException
throws
NotFoundException

validateCollection()

checks incoming props if it's a collection otherwise adds error to validationData.

public validateCollection(OpInterface $op, array<string|int, mixed> $validationData) : array<string|int, mixed>

Basically this only check for the incoming props being a multidimensional array.

Parameters
$op : OpInterface
$validationData : array<string|int, mixed>
Return values
array<string|int, mixed>

validateCollectionIndex()

validates for collection first and then checks the indexes to be numeric or alphabetic dependent on the alphabetic flag

public validateCollectionIndex(OpInterface $op, array<string|int, mixed> $validationData[, bool $alphabetic = true ]) : array<string|int, mixed>
Parameters
$op : OpInterface
$validationData : array<string|int, mixed>
$alphabetic : bool = true
Return values
array<string|int, mixed>

validateEntityId()

checks for entity id being there, otherwise adds error to validationData

public validateEntityId(OpInterface $op, array<string|int, mixed> $validationData) : array<string|int, mixed>
Parameters
$op : OpInterface
$validationData : array<string|int, mixed>
Return values
array<string|int, mixed>

        
On this page

Search results