CreateSurvey

This class is responsible for creating a new survey.

Class CreateSurvey

package

LimeSurvey\Models\Services

Methods

CreateSurvey constructor.

__construct(\Survey $survey,\SurveyLanguageSetting $newLanguageSettings)

Arguments

$survey

\Survey

the survey object

$newLanguageSettings

\SurveyLanguageSetting

new created SurveyLanguageSettings model

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).

createRelationSurveyLanguageSettings(\SurveyLanguageSetting $langsettings): void
Throws
\Exception

if not possible to save in DB

Arguments

$langsettings

\SurveyLanguageSetting

This creates a simple survey with the basic attributes set in param simpleSurveyValues

createSimple(\LimeSurvey\Datavalueobjects\SimpleSurveyValues $simpleSurveyValues,integer $userID,\Permission $permissionModel, $overrideAdministrator = true): \Survey|boolean

Arguments

$userID

integer

the id of user who is creating the survey

$permissionModel

\Permission

$overrideAdministrator

Response

\Survey|boolean

returns the survey or false if survey could not be created for any reason

Creates a unique survey id. A survey id always consists of 6 numbers [123456789].

createSurveyId()

If not possible within ATTEMPTS_CREATE_SURVEY_ID an Exception is thrown

Throws
\Exception

initialiseSurveyAttributes

initialiseSurveyAttributes( $overrideAdministrator = true): void

Arguments

$overrideAdministrator

Sets the baselanguage. If baselanguag is null or empty string Exception is thrown.

setBaseLanguage()
Throws
\Exception

if $this->baseLanguage is null or empty string

Constants

ATTEMPTS_CREATE_SURVEY_ID

ATTEMPTS_CREATE_SURVEY_ID
var

number of attempts to find a valid survey id

STRING_VALUE_FOR_NO_FALSE

STRING_VALUE_FOR_NO_FALSE
var

all attributes that have the value "NO"

STRING_VALUE_FOR_YES_TRUE

STRING_VALUE_FOR_YES_TRUE
var

all attributes that have the value "YES"

STRING_SHORT_VALUE_INHERIT

STRING_SHORT_VALUE_INHERIT
var

value to set attribute to inherit

INTEGER_VALUE_FOR_INHERIT

INTEGER_VALUE_FOR_INHERIT
var

DEFAULT_DATE_FORMAT

DEFAULT_DATE_FORMAT
var

this is the default value for DB table (it corresponds to )

Properties

the survey

survey :\Survey
var

the survey

Type(s)

\Survey

the new language settings model for the survey

newLanguageSettings :\SurveyLanguageSetting
var

the new language settings model for the survey

Type(s)

\SurveyLanguageSetting

has the simple values for creating a survey

simpleSurveyValues :\LimeSurvey\Datavalueobjects\SimpleSurveyValues
var

has the simple values for creating a survey

Type(s)

\LimeSurvey\Datavalueobjects\SimpleSurveyValues