CopySurvey
in package
This class is responsible for copying a survey.
Class CopySurvey
Tags
Table of Contents
Properties
- $newSurveyId : int|null
- $options : CopySurveyOptions
- $sourceSurvey : Survey
Methods
- __construct() : mixed
- copy() : CopySurveyResult
- Copy the survey and return the results.
- mapGroupIdsToSubquestions() : void
- Assigns the correct group ids to the subquestions of the main question.
- copyConditions() : int
- Copies the conditions of a survey.
- copyDefaultAnswers() : int
- Copy default answers from table "defaultvalues" for the questions.
- copyGroupsAndQuestions() : array<string|int, mixed>
- Copies the question groups and the questions from the source survey to the destination survey.
- copyQuestionGroup() : array<string|int, mixed>
- Copy all question groups of the survey to the destination survey.
- copySurveyAssessments() : void
- Copies the assessments of a survey
- copySurveyLanguages() : void
- Copies survey languages
- copySurveyPluginSettings() : void
- Copy survey-scoped plugin settings to the destination survey.
- getValidSurveyId() : Survey
- Searches for a valid survey id for the destination survey and retries if necessary.
Properties
$newSurveyId
private
int|null
$newSurveyId
$options
private
CopySurveyOptions
$options
$sourceSurvey
private
Survey
$sourceSurvey
Methods
__construct()
public
__construct(Survey $sourceSurvey, CopySurveyOptions $options[, int|null $newSurveyId = null ]) : mixed
Parameters
- $sourceSurvey : Survey
- $options : CopySurveyOptions
- $newSurveyId : int|null = null
copy()
Copy the survey and return the results.
public
copy() : CopySurveyResult
Tags
Return values
CopySurveyResult —Returns results, success and error messages
mapGroupIdsToSubquestions()
Assigns the correct group ids to the subquestions of the main question.
public
mapGroupIdsToSubquestions(Question $parentQuestion, int $destinationSurveyId, int $groupId) : void
Parameters
- $parentQuestion : Question
- $destinationSurveyId : int
- $groupId : int
copyConditions()
Copies the conditions of a survey.
private
copyConditions(array<string|int, mixed> $mappingQuestionIds, array<string|int, mixed> $mappingGroupIds, int $destinationSurveyId) : int
Parameters
- $mappingQuestionIds : array<string|int, mixed>
- $mappingGroupIds : array<string|int, mixed>
- $destinationSurveyId : int
Tags
Return values
int —number of conditions copied
copyDefaultAnswers()
Copy default answers from table "defaultvalues" for the questions.
private
copyDefaultAnswers(array<string|int, mixed> $mappingQuestionIds, array<string|int, mixed> $mappedSuquestionIds) : int
Parameters
- $mappingQuestionIds : array<string|int, mixed>
-
mapping of question ids
- $mappedSuquestionIds : array<string|int, mixed>
-
mapping of subquestion ids (if any)
Return values
int —number of default answers copied
copyGroupsAndQuestions()
Copies the question groups and the questions from the source survey to the destination survey.
private
copyGroupsAndQuestions(CopySurveyResult $copyResults, Survey $destinationSurvey) : array<string|int, mixed>
A mapping of groupIds and questionIds is returned.
Parameters
- $copyResults : CopySurveyResult
- $destinationSurvey : Survey
Tags
Return values
array<string|int, mixed> —mapping of groupIds and questionIds
copyQuestionGroup()
Copy all question groups of the survey to the destination survey.
private
copyQuestionGroup(CopySurveyResult $copyResults, Survey $destinationSurvey) : array<string|int, mixed>
Parameters
- $copyResults : CopySurveyResult
- $destinationSurvey : Survey
Tags
Return values
array<string|int, mixed>copySurveyAssessments()
Copies the assessments of a survey
private
copySurveyAssessments(CopySurveyResult $copySurveyResult, Survey $destinationSurvey, array<string|int, mixed> $mappingGroupIds) : void
Parameters
- $copySurveyResult : CopySurveyResult
- $destinationSurvey : Survey
- $mappingGroupIds : array<string|int, mixed>
-
the mapped ids of question groups
copySurveyLanguages()
Copies survey languages
private
copySurveyLanguages(CopySurveyResult $copySurveyResult, Survey $destinationSurvey) : void
Parameters
- $copySurveyResult : CopySurveyResult
- $destinationSurvey : Survey
Tags
copySurveyPluginSettings()
Copy survey-scoped plugin settings to the destination survey.
private
copySurveyPluginSettings(Survey $destinationSurvey) : void
Parameters
- $destinationSurvey : Survey
Tags
getValidSurveyId()
Searches for a valid survey id for the destination survey and retries if necessary.
private
getValidSurveyId(Survey $destinationSurvey) : Survey
Parameters
- $destinationSurvey : Survey