CopyQuestion

Class CopyQuestion

This class is responsible for the copy question process.

package

LimeSurvey\Models\Services

Methods

CopyQuestion constructor.

__construct(\LimeSurvey\Datavalueobjects\CopyQuestionValues $copyQuestionValues)

Arguments

Copies the question and all necessary values/parameters (languages, subquestions, answeroptions, defaultanswers, settings)

copyQuestion(array $copyOptions): boolean

Arguments

$copyOptions

array

has the following boolean elements ['copySubquestions'] ['copyAnswerOptions'] ['copyDefaultAnswers'] ['copySettings'] --> generalSettings and advancedSettings

Response

boolean

True if new copied question could be saved, false otherwise

Copies the languages of a question.

copyQuestionLanguages(\Question $oQuestion,\LimeSurvey\Models\Services\array<string,\LimeSurvey\Datavalueobjects\CopyQuestionTextValues> $newQuestionL10nData = array()): boolean
before

$this->newQuestion must exist and should not be null

Arguments

$oQuestion

\Question

old question from where to copy the languages (see table questions_l10ns)

$newQuestionL10nData

\LimeSurvey\Models\Services\array

the text values to override

Response

boolean

true if all languages could be copied, false if no language was copied or save failed for one language

Copies the answer options of a question

copyQuestionsAnswerOptions(integer $questionIdToCopy)
  • @before $this->newQuestion must exist and should not be null

Arguments

$questionIdToCopy

integer

Copies the default answers of the question

copyQuestionsDefaultAnswers(integer $questionIdToCopy)
  • @before $this->newQuestion must exist and should not be null

Arguments

$questionIdToCopy

integer

Copies the question settings (general_settings (on the left in questioneditor) and advanced settings (bottom)

copyQuestionsSettings( $questionIdToCopy): boolean

Arguments

$questionIdToCopy

  • @before $this->newQuestion must exist and should not be null

Response

boolean

True if settings are copied, false otherwise

Copy subquestions of a question

copyQuestionsSubQuestions(integer $parentId): boolean

Arguments

$parentId

integer

id of question to be copied

  • @before $this->newQuestion must exist and should not be null

Response

boolean

true if all subquestions could be copied&saved, false if a subquestion could not be saved

Creates a new question copying the values from questionToCopy

createNewCopiedQuestion(string $questionCode,integer $groupId,\Question $questionToCopy): boolean

Arguments

$questionCode

string

$groupId

integer

$questionToCopy

\Question

the question that should be copied

Response

boolean

true if question could be saved, false otherwise

Returns the new created question or null if question was not copied.

getNewCopiedQuestion(): \Question|null

Response

\Question|null

Properties

values needed to copy a question (e.g. questioncode, questionGroupId ...)

copyQuestionValues :\LimeSurvey\Datavalueobjects\CopyQuestionValues
var

values needed to copy a question (e.g. questioncode, questionGroupId ...)

Type(s)

\LimeSurvey\Datavalueobjects\CopyQuestionValues

the new question

newQuestion :\Question
var

the new question

Type(s)

\Question