LimeSurvey API - Master branch

CreateSurvey

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

Methods

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
throws
Exception

if not possible to save in DB

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
throws
Exception

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
Tags
throws
Exception

if $this->baseLanguage is null or empty string


        
On this page

Search results