CreateSurvey
in package
This class is responsible for creating a new survey.
Class CreateSurvey
Table of Contents
Constants
- ATTEMPTS_CREATE_SURVEY_ID = 50
- DEFAULT_DATE_FORMAT = 1
- INTEGER_VALUE_FOR_INHERIT = -1
- STRING_SHORT_VALUE_INHERIT = 'I'
- STRING_VALUE_FOR_NO_FALSE = 'N'
- STRING_VALUE_FOR_YES_TRUE = 'Y'
Properties
- $newLanguageSettings : SurveyLanguageSetting
- $simpleSurveyValues : SimpleSurveyValues
- $survey : Survey
Methods
- __construct() : mixed
- CreateSurvey constructor.
- createSimple() : Survey|bool
- This creates a simple survey with the basic attributes set in param simpleSurveyValues
- createRelationSurveyLanguageSettings() : void
- Insert new entry in surveys_languagesettings (sets surveyid, title, language). All other values are set to default values (user can change them later in survey administration).
- createSurveyId() : mixed
- Creates a unique survey ID. A survey ID always consists of 6 numbers [123456789].
- initialiseSurveyAttributes() : void
- setBaseLanguage() : mixed
- Sets the baselanguage. If baselanguag is null or empty string Exception is thrown.
Constants
ATTEMPTS_CREATE_SURVEY_ID
public
int
ATTEMPTS_CREATE_SURVEY_ID
= 50
number of attempts to find a valid survey ID
DEFAULT_DATE_FORMAT
public
int
DEFAULT_DATE_FORMAT
= 1
this is the default value for DB table (it corresponds to )
INTEGER_VALUE_FOR_INHERIT
public
int
INTEGER_VALUE_FOR_INHERIT
= -1
STRING_SHORT_VALUE_INHERIT
public
string
STRING_SHORT_VALUE_INHERIT
= 'I'
value to set attribute to inherit
STRING_VALUE_FOR_NO_FALSE
public
string
STRING_VALUE_FOR_NO_FALSE
= 'N'
all attributes that have the value "NO"
STRING_VALUE_FOR_YES_TRUE
public
string
STRING_VALUE_FOR_YES_TRUE
= 'Y'
all attributes that have the value "YES"
Properties
$newLanguageSettings
private
SurveyLanguageSetting
$newLanguageSettings
the new language settings model for the survey
$simpleSurveyValues
private
SimpleSurveyValues
$simpleSurveyValues
has the simple values for creating a survey
$survey
private
Survey
$survey
the survey
Methods
__construct()
CreateSurvey constructor.
public
__construct(Survey $survey, SurveyLanguageSetting $newLanguageSettings) : mixed
Parameters
- $survey : Survey
-
the survey object
- $newLanguageSettings : SurveyLanguageSetting
-
new created SurveyLanguageSettings model
createSimple()
This creates a simple survey with the basic attributes set in param simpleSurveyValues
public
createSimple(SimpleSurveyValues $simpleSurveyValues, int $userID, Permission $permissionModel[, mixed $overrideAdministrator = true ]) : Survey|bool
Parameters
- $simpleSurveyValues : SimpleSurveyValues
- $userID : int
-
the id of user who is creating the survey
- $permissionModel : Permission
- $overrideAdministrator : mixed = true
Return values
Survey|bool —returns the survey or false if survey could not be created for any reason
createRelationSurveyLanguageSettings()
Insert new entry in surveys_languagesettings (sets surveyid, title, language). All other values are set to default values (user can change them later in survey administration).
private
createRelationSurveyLanguageSettings(SurveyLanguageSetting $langsettings) : void
Parameters
- $langsettings : SurveyLanguageSetting
Tags
createSurveyId()
Creates a unique survey ID. A survey ID always consists of 6 numbers [123456789].
private
createSurveyId() : mixed
If not possible within ATTEMPTS_CREATE_SURVEY_ID an Exception is thrown
Tags
initialiseSurveyAttributes()
private
initialiseSurveyAttributes([mixed $overrideAdministrator = true ]) : void
Parameters
- $overrideAdministrator : mixed = true
setBaseLanguage()
Sets the baselanguage. If baselanguag is null or empty string Exception is thrown.
private
setBaseLanguage() : mixed