LimeSurvey API - Master branch

QuestionGroupService
in package

Tags
TODO

There is a separate service GroupHelper.php whose function(s) should be moved here in the future

SuppressWarnings

(PHPMD.ExcessiveClassComplexity)

Table of Contents

Properties

$modelPermission  : Permission
$modelQuestion  : Question
$modelQuestionGroup  : QuestionGroup
$modelQuestionGroupL10n  : QuestionGroupL10n
$modelSurvey  : Survey
$proxyExpressionManager  : ProxyExpressionManager
$proxyQuestionGroup  : ProxyQuestionGroup
$yiiApp  : LSYii_Application

Methods

__construct()  : mixed
createGroup()  : QuestionGroup
Creates a question group and all the languages.
deleteGroup()  : int|null
Deletes a question group and all its dependencies.
getGroupData()  : QuestionGroup
Returns question group data for dataprovider of gridview in "Overview question and groups". Search input parameter is taken into account.
getQuestionGroupForUpdate()  : QuestionGroup
Checks permissions for updating, and returns a specific question group.
getQuestionGroupObject()  : QuestionGroup
Returns a QuestionGroup (existing one or new created one)
importQuestionGroup()  : array<string|int, mixed>
Imports an uploaded question group. Returns array of import results.
newQuestionGroup()  : QuestionGroup
Creates a new question group, and also adds plain entries for the required QuestionGroupL10n data
reorderQuestionGroups()  : array<string|int, mixed>
Reorders question groups based on the group array.
updateGroup()  : QuestionGroup
Updates a question group and all the languages.
updateQuestionGroup()  : QuestionGroup
Method to store and filter questionGroupData for editing a questionGroup
updateQuestionGroupLanguages()  : bool
Stores questiongroup languages.
getSurvey()  : Survey
refreshModels()  : void
Resets questionGroup model for cases when multiple groups are created simultaneously
updateQuestionsForReorder()  : bool
Gets array with question related parameters (qid, question_order, gid) and updates them in those questions and their subquestions

Properties

Methods

__construct()

public __construct(Permission $modelPermission, Survey $modelSurvey, Question $modelQuestion, QuestionGroup $modelQuestionGroup, QuestionGroupL10n $modelQuestionGroupL10n, ProxyExpressionManager $proxyExpressionManager, ProxyQuestionGroup $proxyQuestionGroup, LSYii_Application $yiiApp) : mixed
Parameters
$modelPermission : Permission
$modelSurvey : Survey
$modelQuestion : Question
$modelQuestionGroup : QuestionGroup
$modelQuestionGroupL10n : QuestionGroupL10n
$proxyExpressionManager : ProxyExpressionManager
$proxyQuestionGroup : ProxyQuestionGroup
$yiiApp : LSYii_Application

createGroup()

Creates a question group and all the languages.

public createGroup(int $surveyId, array<string|int, mixed> $input) : QuestionGroup
Parameters
$surveyId : int

the survey ID

$input : array<string|int, mixed>

has the data for a question group, including an array for languages ['questionGroup'] [gid] [sid] [group_order] [randomization_group] [grelevance] ['questionGroupL10N'] [en] [group_name] [description] [...] //more languages

Tags
throws
NotFoundException
throws
PermissionDeniedException
throws
PersistErrorException
Return values
QuestionGroup

deleteGroup()

Deletes a question group and all its dependencies.

public deleteGroup(int $questionGroupId, int $surveyId) : int|null
Parameters
$questionGroupId : int

the question group id

$surveyId : int

the survey ID

Tags
throws
PermissionDeniedException
Return values
int|null

number of deleted rows

getGroupData()

Returns question group data for dataprovider of gridview in "Overview question and groups". Search input parameter is taken into account.

public getGroupData(Survey $survey, array<string|int, mixed> $questionGroupArray) : QuestionGroup
Parameters
$survey : Survey
$questionGroupArray : array<string|int, mixed>
Return values
QuestionGroup

getQuestionGroupObject()

Returns a QuestionGroup (existing one or new created one)

public getQuestionGroupObject(int $surveyId[, int|null $questionGroupId = null ]) : QuestionGroup
Parameters
$surveyId : int
$questionGroupId : int|null = null
Tags
throws
NotFoundException
Return values
QuestionGroup

importQuestionGroup()

Imports an uploaded question group. Returns array of import results.

public importQuestionGroup(int $surveyId, string $tmpDir, string $transLinksFields) : array<string|int, mixed>
Parameters
$surveyId : int
$tmpDir : string
$transLinksFields : string
Return values
array<string|int, mixed>

newQuestionGroup()

Creates a new question group, and also adds plain entries for the required QuestionGroupL10n data

public newQuestionGroup(int $surveyId[, array<string|int, mixed>|null $aQuestionGroupData = null ]) : QuestionGroup
Parameters
$surveyId : int
$aQuestionGroupData : array<string|int, mixed>|null = null
Tags
throws
NotFoundException
throws
PersistErrorException
Return values
QuestionGroup

reorderQuestionGroups()

Reorders question groups based on the group array.

public reorderQuestionGroups(int $surveyId, array<string|int, mixed> $groupArray) : array<string|int, mixed>

Returns array containing success (boolean), message (string).

Parameters
$surveyId : int
$groupArray : array<string|int, mixed>
Tags
throws
NotFoundException
Return values
array<string|int, mixed>

updateGroup()

Updates a question group and all the languages.

public updateGroup(int $surveyId, int $questionGroupId, array<string|int, mixed> $input) : QuestionGroup
Parameters
$surveyId : int

the survey ID

$questionGroupId : int

the question group id

$input : array<string|int, mixed>

has the data for a question group, including an array for languages ['questionGroup'] [gid] [sid] [group_order] [randomization_group] [grelevance] ['questionGroupL10N'] [en] [group_name] [description] [...] //more languages

Tags
throws
NotFoundException
throws
PermissionDeniedException
throws
PersistErrorException
Return values
QuestionGroup

updateQuestionGroupLanguages()

Stores questiongroup languages.

public updateQuestionGroupLanguages(QuestionGroup $oQuestionGroup, array<string|int, mixed> $dataSet) : bool
Parameters
$oQuestionGroup : QuestionGroup
$dataSet : array<string|int, mixed>

array with languages

Return values
bool

true if ALL languages could be saved, false otherwise

refreshModels()

Resets questionGroup model for cases when multiple groups are created simultaneously

private refreshModels() : void

updateQuestionsForReorder()

Gets array with question related parameters (qid, question_order, gid) and updates them in those questions and their subquestions

private updateQuestionsForReorder(array<string|int, mixed> $aQuestion, int $surveyId, bool $success) : bool
Parameters
$aQuestion : array<string|int, mixed>
$surveyId : int
$success : bool
Return values
bool

        
On this page

Search results