QuestionGroupService
in package
Tags
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
$modelPermission
private
Permission
$modelPermission
$modelQuestion
private
Question
$modelQuestion
$modelQuestionGroup
private
QuestionGroup
$modelQuestionGroup
$modelQuestionGroupL10n
private
QuestionGroupL10n
$modelQuestionGroupL10n
$modelSurvey
private
Survey
$modelSurvey
$proxyExpressionManager
private
ProxyExpressionManager
$proxyExpressionManager
$proxyQuestionGroup
private
ProxyQuestionGroup
$proxyQuestionGroup
$yiiApp
private
LSYii_Application
$yiiApp
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
Return values
QuestionGroupdeleteGroup()
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
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
QuestionGroupgetQuestionGroupForUpdate()
Checks permissions for updating, and returns a specific question group.
public
getQuestionGroupForUpdate(int $surveyId, int $questionGroupId) : QuestionGroup
Throws an exception if no group can be found.
Parameters
- $surveyId : int
- $questionGroupId : int
Tags
Return values
QuestionGroupgetQuestionGroupObject()
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
Return values
QuestionGroupimportQuestionGroup()
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
Return values
QuestionGroupreorderQuestionGroups()
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
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
Return values
QuestionGroupupdateQuestionGroup()
Method to store and filter questionGroupData for editing a questionGroup
public
updateQuestionGroup(QuestionGroup $oQuestionGroup, array<string|int, mixed> $aQuestionGroupData) : QuestionGroup
Parameters
- $oQuestionGroup : QuestionGroup
- $aQuestionGroupData : array<string|int, mixed>
Tags
Return values
QuestionGroupupdateQuestionGroupLanguages()
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
getSurvey()
private
getSurvey(int $surveyId) : Survey
Parameters
- $surveyId : int
Tags
Return values
SurveyrefreshModels()
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