LimeSurvey API - Master branch

GeneralSettings
in package

Service GeneralSettings

Service class for survey language setting updating.

Dependencies are injected to enable mocking.

Tags
SuppressWarnings

(PHPMD.ExcessiveClassComplexity)

Table of Contents

Constants

FIELD_TYPE_DATETIME  = 'datetime'
FIELD_TYPE_GAKEY  = 'gakey'
FIELD_TYPE_USE_CAPTCHA  = 'use_captcha'
FIELD_TYPE_YN  = 'yesorno'
GA_GLOBAL_KEY  = '9999useGlobal9999'

Properties

$languageConsistency  : LanguageConsistency
$modelPermission  : Permission
$modelSurvey  : Survey
$modelUser  : User
$pluginManager  : PluginManager
$restMode  : mixed
$session  : CHttpSession
$yiiApp  : LSYii_Application

Methods

__construct()  : mixed
setRestMode()  : mixed
Set REST Mode
update()  : array<string|int, mixed>
Update
calculateUseCaptchaOption()  : string|null
Transcribe from 3 checkboxes to 1 char for captcha usages Uses variables from $_POST and transferred Surveyobject
dispatchPluginEventBeforeSurveySettingsSave()  : void
Dispatch plugin event before survey settings save
dispatchPluginEventNewSurveySettings()  : void
Dispatch plugin event new survey settings
filterInput()  : array<string|int, mixed>
Filter Input
formatDateTimeInput()  : string
Format date time input
getAdditionalLanguagesArray()  : mixed
getFields()  : array<string|int, mixed>
Get Database Fields
setField()  : array<string|int, mixed>
Set Field
updateGeneralSettings()  : array<string|int, mixed>
Update General Settings

Constants

FIELD_TYPE_USE_CAPTCHA

public mixed FIELD_TYPE_USE_CAPTCHA = 'use_captcha'

Properties

Methods

setRestMode()

Set REST Mode

public setRestMode(bool $restMode) : mixed

In rest mode we have different expecations about data formats. For example datetime objects inputs/output as UTC JSON format Y-m-d\TH:i:s.000\Z.

Parameters
$restMode : bool

calculateUseCaptchaOption()

Transcribe from 3 checkboxes to 1 char for captcha usages Uses variables from $_POST and transferred Surveyobject

private calculateUseCaptchaOption(mixed $surveyaccess, mixed $registration, mixed $saveandload) : string|null

'A' = All three captcha enabled 'B' = All but save and load 'C' = All but registration 'D' = All but survey access 'X' = Only survey access 'R' = Only registration 'S' = Only save and load

'E' = All inherited 'F' = Inherited save and load + survey access + registration 'G' = Inherited survey access + registration + save and load 'H' = Inherited registration + save and load + survey access 'I' = Inherited save and load + inherited survey access + registration 'J' = Inherited survey access + inherited registration + save and load 'K' = Inherited registration + inherited save and load + survey access

'L' = Inherited survey access + save and load 'M' = Inherited survey access + registration 'O' = Inherited registration + survey access '1' = Inherited survey access + inherited registration '2' = Inherited survey access + inherited save and load '3' = Inherited registration + inherited save and load '4' = Inherited survey access '5' = Inherited save and load '6' = Inherited registration

'N' = None

Parameters
$surveyaccess : mixed
$registration : mixed
$saveandload : mixed
Tags
todo

Should really be saved as three fields in the database!

todo

Copied from Survey:::saveTranscribeCaptchaOptions() replace uses of original copy

SuppressWarnings

("php:S3776") Cognitive Complexity

SuppressWarnings

(PHPMD.ExcessiveMethodLength)

Return values
string|null

One character that corresponds to captcha usage

dispatchPluginEventBeforeSurveySettingsSave()

Dispatch plugin event before survey settings save

private dispatchPluginEventBeforeSurveySettingsSave(Survey $survey) : void
Parameters
$survey : Survey

dispatchPluginEventNewSurveySettings()

Dispatch plugin event new survey settings

private dispatchPluginEventNewSurveySettings(int $surveyId, array<string|int, mixed> $pluginSettings) : void
Parameters
$surveyId : int
$pluginSettings : array<string|int, mixed>

filterInput()

Filter Input

private filterInput(mixed $input) : array<string|int, mixed>
Parameters
$input : mixed
Return values
array<string|int, mixed>

formatDateTimeInput()

Format date time input

private formatDateTimeInput(string $inputDateTimeString) : string

Converts date time string from user local format to internal database format.

Parameters
$inputDateTimeString : string
Return values
string

getAdditionalLanguagesArray()

private getAdditionalLanguagesArray(mixed $input, Survey $survey) : mixed
Parameters
$input : mixed
$survey : Survey

getFields()

Get Database Fields

private getFields(Survey $survey) : array<string|int, mixed>
Parameters
$survey : Survey
Tags
SuppressWarnings

(PHPMD.ExcessiveMethodLength)

Return values
array<string|int, mixed>

setField()

Set Field

private setField(string $field, array<string|int, mixed> &$input, Survey $survey, array<string|int, mixed> $meta[, array<string|int, mixed>|null $fieldOpts = null ]) : array<string|int, mixed>
Parameters
$field : string
$input : array<string|int, mixed>
$survey : Survey
$meta : array<string|int, mixed>
$fieldOpts : array<string|int, mixed>|null = null
Tags
SuppressWarnings

("php:S3776") Cognitive Complexity

SuppressWarnings

(PHPMD.ExcessiveMethodLength)

Return values
array<string|int, mixed>

        
On this page

Search results