LimeSurvey API - Master branch

SurveyThemeConfiguration
in package

Table of Contents

Properties

$permission  : Permission

Methods

__construct()  : mixed
getAvailableTemplates()  : array<int, array{name: string, folder: string}>
Returns the list of available templates for the current user, optionally filtered to only those that are (or extend from) a given base template.
getSurveyThemeOptionsAttributes()  : array<string|int, mixed>
Returns the theme option attributes with custom format for react
getThemeViewData()  : TemplateConfiguration, inheritedThemeName: string, aTemplateList: array}
Returns the theme-related view data (themeConf, inheritedThemeName, aTemplateList) needed by _generaloptions_panel.php.
updateCommon()  : array<string|int, mixed>
Returns all attributes and options needed to display the themeoptions including inheritance.
updateThemeOption()  : void
extractDropdownOptions()  : array<string|int, mixed>
Extracts option values and labels from HTML dropdown options string
getOptionAttributeDataValue()  : string
Gets the specific data value for an option based on its value
isBasedOn()  : bool
Checks whether a given template is the specified base template or extends from it (walks up the full inheritance chain).

Properties

Methods

getAvailableTemplates()

Returns the list of available templates for the current user, optionally filtered to only those that are (or extend from) a given base template.

public getAvailableTemplates([string|null $baseTemplateName = null ][, string|null $currentTemplateName = null ]) : array<int, array{name: string, folder: string}>

Each entry contains 'name' and 'folder'. Permission checks mirror what _generaloptions_panel.php does:

  • global 'templates' read permission, OR
  • specific template permission, OR
  • the template is the survey's currently assigned template.
Parameters
$baseTemplateName : string|null = null

If provided, only templates that ARE this template or inherit from it (directly or transitively) are returned.

$currentTemplateName : string|null = null

The survey's currently assigned template name. Always included regardless of permissions.

Return values
array<int, array{name: string, folder: string}>

getSurveyThemeOptionsAttributes()

Returns the theme option attributes with custom format for react

public getSurveyThemeOptionsAttributes(array<string|int, mixed> $themeData) : array<string|int, mixed>
Parameters
$themeData : array<string|int, mixed>
Return values
array<string|int, mixed>

getThemeViewData()

Returns the theme-related view data (themeConf, inheritedThemeName, aTemplateList) needed by _generaloptions_panel.php.

public getThemeViewData(string|null $surveyTemplate[, object|null $surveyOptions = null ]) : TemplateConfiguration, inheritedThemeName: string, aTemplateList: array}

Centralizes logic previously duplicated across multiple controllers.

Parameters
$surveyTemplate : string|null

The survey's current template value (e.g. 'inherit' or a theme name).

$surveyOptions : object|null = null

The resolved survey options object (must have ->template property).

Return values
TemplateConfiguration, inheritedThemeName: string, aTemplateList: array}

updateCommon()

Returns all attributes and options needed to display the themeoptions including inheritance.

public updateCommon(TemplateConfiguration $themeConfiguration[, int|null $sid = null ][, int|null $gsid = null ]) : array<string|int, mixed>
Parameters
$themeConfiguration : TemplateConfiguration

Template Configuration

$sid : int|null = null

Survey ID

$gsid : int|null = null

Survey Group ID

Tags
throws
NotFoundException
Return values
array<string|int, mixed>

updateThemeOption()

public updateThemeOption(int $surveyId, array<string|int, mixed> $props) : void
Parameters
$surveyId : int
$props : array<string|int, mixed>

properties (in options json string)

Tags
throws
PermissionDeniedException

extractDropdownOptions()

Extracts option values and labels from HTML dropdown options string

protected extractDropdownOptions(string $optionsHtml) : array<string|int, mixed>
Parameters
$optionsHtml : string

string containing option tags

Return values
array<string|int, mixed>

values and labels

getOptionAttributeDataValue()

Gets the specific data value for an option based on its value

protected getOptionAttributeDataValue([int $iSurveyId = 0 ][, string $sTemplateName = null ][, string $optionValue = '' ][, string $optionType = '' ]) : string
Parameters
$iSurveyId : int = 0

The survey ID

$sTemplateName : string = null

The template name

$optionValue : string = ''

The value of the option to find

$optionType : string = ''

The type of option ('font' || 'cssframework')

Return values
string

isBasedOn()

Checks whether a given template is the specified base template or extends from it (walks up the full inheritance chain).

protected isBasedOn(string $templateName, string $baseTemplateName) : bool

Delegates to Template::isBasedOn().

Parameters
$templateName : string

The template to check.

$baseTemplateName : string

The base template name to look for.

Return values
bool

        
On this page

Search results