LimeSurvey API - Master branch

SurveyRuntimeHelper
in package

LimeSurvey Copyright (C) 2007-2011 The LimeSurvey Project Team / Carsten Schmitz All rights reserved.

License: GNU/GPL License v2 or later, see LICENSE.php LimeSurvey is free software. This version may have been modified pursuant to the GNU General Public License, and as distributed it includes or is derivative of works licensed under the GNU General Public License or other free or open source software licenses. See COPYRIGHT.php for copyright notices and details.

Table of Contents

Properties

$aMoveResult  : array<string|int, mixed>|bool
Contains the result of LimeExpressionManager::JumpTo() OR LimeExpressionManager::NavigateBackwards() OR NavigateForwards::LimeExpressionManager(). TODO: create a function LimeExpressionManager::MoveTo that call the right method
$aStepInfo  : array<string|int, mixed>|null
$aSurveyInfo  : array<string|int, mixed>|null
Survey settings: TODO: To respect object oriented design, all those "states" should be move to SurveyDynamic model, or its related models via relations.
$aSurveyOptions  : array<string|int, mixed>|null
Few options comming from thissurvey, App->getConfig, LEM. Could be replaced by $oSurvey + relations ; the one coming from LEM and getConfig should be public variable on the surveyModel, set via public methods (active, allowsave, anonymized, assessments, datestamp, deletenonvalues, ipaddr, radix, refurl, savetimings, surveyls_dateformat, startlanguage, target, tempdir,timeadjust)
$backpopup  : mixed
$bInvalidLastPage  : bool
Just a variable used to check if user submitted a survey while it's not finished. Just a variable for a logic step ==> should not be a Class variable (for now, only here for the redata== get_defined_vars mess)
$bShowEmptyGroup  : bool
True only when $_SESSION[$this->LEMsessid]['step'] == 0 ; Just a variable for a logic step ==> should not be a Class variable (for now, only here for the redata== get_defined_vars mess)
$completed  : mixed
$filenotvalidated  : mixed
$gid  : mixed
$groupdescription  : mixed
$groupname  : mixed
$iSurveyid  : int|null
The survey ID
$LEMdebugLevel  : int
customizable debugging for Lime ExpressionScript Engine ; LEM_DEBUG_TIMING; (LEM_DEBUG_TIMING + LEM_DEBUG_VALIDATION_SUMMARY + LEM_DEBUG_VALIDATION_DETAIL);
$LEMsessid  : int|null
$LEMskipReprocessing  : bool
true if used GetLastMoveResult to avoid generation of unneeded extra JavaScript
$notanswered  : mixed
$notvalidated  : mixed
$okToShowErrors  : mixed
$oTemplate  : Template|null
Template configuration object (set in model TemplateConfiguration)
$param  : array<string|int, mixed>
Parameters
$popup  : mixed
$preview  : bool
$previewgrp  : bool
$previewquestion  : bool
$sLangCode  : string|null
$sMove  : int|null
The move requested by user. Set by frontend_helper::getMove() from the POST request.
$sSurveyMode  : string|null
Group By Group, All in one, Question by question
$sTemplateViewPath  : string|null
Path of the layout files in template
$thissurvey  : mixed

Methods

getCurrentQuestionClasses()  : string
Retrieve the question classes for a given question id
getShowNumAndCode()  : array<string, bool>
run()  : void
Main function
saveAllIfNeeded()  : mixed
Perform save all if user asked for it
setJavascriptVar()  : void
setJavascriptVar
doBeforeQuestionRenderEvent()  : array<string|int, mixed>
Apply the plugin even beforeQuestionRender to question data.
checkClearCancel()  : mixed
Check if the move is clearcancel or confirmquota
checkForDataSecurityAccepted()  : mixed
checkIfFinished()  : mixed
Test if the the moveresult is finished, to decide to set the new $this->sMove value
checkIfUseBrowserNav()  : mixed
It checks if user used the browser navigation (prev, next, reload page etc) and feed te backpopup variable if needed
checkPrevStep()  : mixed
Define prev step if not set in session.
checkQuotas()  : mixed
Check quotas
displayFirstPageIfNeeded()  : mixed
Display the first page if needed
fixMaxStep()  : mixed
getErrorHtmlMessage()  : string
Html error message if needed/available in the page
getRadix()  : string
Retrieve the radix
initDirtyStep()  : mixed
If a step is requested, but the survey ID in the session is different from the requested one It reload the needed infos for the requested survey and jump to the requested step.
initFirstStep()  : mixed
If it's the first time the survey is loaded: - Init session, randomization and filed array - Check surveyid coherence - Init $LEM states.
initMove()  : mixed
Init session/params values depending of user moves
initTemplate()  : mixed
initTotalAndMaxSteps()  : mixed
Seems to be a quick fix to avoid the total and max steps to be null.
makeLanguageChanger()  : void
Set alanguageChanger.show to true if we need to show the language changer.
manageClearAll()  : void
clear all system (no js or broken js)
moveSubmitIfNeeded()  : mixed
Perform submit if asked by user
processString()  : string
Check in a string if it uses expressions to replace them
saveSubmitIfNeeded()  : mixed
perform save submit if asked by user called from save survey
setArgs()  : mixed
Now it's ok ^^
setGroup()  : mixed
setMoveResult()  : mixed
Set the moveResult variable, depending on the user move request
setNotAnsweredAndNotValidated()  : mixed
check mandatory questions if necessary CHECK IF ALL CONDITIONAL MANDATORY QUESTIONS THAT APPLY HAVE BEEN ANSWERED
setPreview()  : mixed
setPrevStep()  : mixed
Set prev step in session depending on move type If not in a specific page, prevstep stock the value of step just before it get updated
setStep()  : mixed
Increase step in session
setSurveyMode()  : string
Retrieve the survey format (mode?) TODO: move to survey model
setSurveyOptions()  : mixed
Retreives dew options comming from thissurvey, App->getConfig, LEM.
setSurveySettings()  : mixed
This method will set survey values in public property of the class So, any value here set as $this->xxx will be available as $xxx after : eg: $this->LEMsessid
setVarFromArgs()  : mixed
The run method fed $redata with using get_defined_var(). So it was very hard to move a piece of code from the run method to a new one.
showTokenOrCaptchaFormsIfNeeded()  : mixed
NOTE: right now, captcha works ONLY if reloaded... need to be debug.

Properties

$aMoveResult

Contains the result of LimeExpressionManager::JumpTo() OR LimeExpressionManager::NavigateBackwards() OR NavigateForwards::LimeExpressionManager(). TODO: create a function LimeExpressionManager::MoveTo that call the right method

private array<string|int, mixed>|bool $aMoveResult = \false

$aSurveyInfo

Survey settings: TODO: To respect object oriented design, all those "states" should be move to SurveyDynamic model, or its related models via relations.

private array<string|int, mixed>|null $aSurveyInfo = \null

The only private variable here should be $oSurvey. Array returned by common_helper::getSurveyInfo(); (survey row + language settings );

$aSurveyOptions

Few options comming from thissurvey, App->getConfig, LEM. Could be replaced by $oSurvey + relations ; the one coming from LEM and getConfig should be public variable on the surveyModel, set via public methods (active, allowsave, anonymized, assessments, datestamp, deletenonvalues, ipaddr, radix, refurl, savetimings, surveyls_dateformat, startlanguage, target, tempdir,timeadjust)

private array<string|int, mixed>|null $aSurveyOptions = \null

$bInvalidLastPage

Just a variable used to check if user submitted a survey while it's not finished. Just a variable for a logic step ==> should not be a Class variable (for now, only here for the redata== get_defined_vars mess)

private bool $bInvalidLastPage = \false

$bShowEmptyGroup

True only when $_SESSION[$this->LEMsessid]['step'] == 0 ; Just a variable for a logic step ==> should not be a Class variable (for now, only here for the redata== get_defined_vars mess)

private bool $bShowEmptyGroup = \false

$LEMdebugLevel

customizable debugging for Lime ExpressionScript Engine ; LEM_DEBUG_TIMING; (LEM_DEBUG_TIMING + LEM_DEBUG_VALIDATION_SUMMARY + LEM_DEBUG_VALIDATION_DETAIL);

private int $LEMdebugLevel = 0

$LEMskipReprocessing

true if used GetLastMoveResult to avoid generation of unneeded extra JavaScript

private bool $LEMskipReprocessing = \false

$sMove

The move requested by user. Set by frontend_helper::getMove() from the POST request.

private int|null $sMove = \null

$sSurveyMode

Group By Group, All in one, Question by question

private string|null $sSurveyMode = \null

$sTemplateViewPath

Path of the layout files in template

private string|null $sTemplateViewPath = \null

Methods

getCurrentQuestionClasses()

Retrieve the question classes for a given question id

public getCurrentQuestionClasses(int $iQid) : string
Parameters
$iQid : int

the question id

Return values
string

the classes

getShowNumAndCode()

public getShowNumAndCode() : array<string, bool>
Return values
array<string, bool>

run()

Main function

public run(int $surveyid, array<string|int, mixed> $args) : void
Parameters
$surveyid : int
$args : array<string|int, mixed>

saveAllIfNeeded()

Perform save all if user asked for it

public saveAllIfNeeded() : mixed

setJavascriptVar()

setJavascriptVar

public setJavascriptVar([mixed $iSurveyId = '' ]) : void
Parameters
$iSurveyId : mixed = ''

: the survey ID for the script

doBeforeQuestionRenderEvent()

Apply the plugin even beforeQuestionRender to question data.

protected doBeforeQuestionRenderEvent(array<string|int, mixed> $data) : array<string|int, mixed>
Parameters
$data : array<string|int, mixed>

Question data

Tags
see
https://manual.limesurvey.org/BeforeQuestionRender
Return values
array<string|int, mixed>

Question data modified by plugin

checkClearCancel()

Check if the move is clearcancel or confirmquota

private checkClearCancel() : mixed

checkIfFinished()

Test if the the moveresult is finished, to decide to set the new $this->sMove value

private checkIfFinished() : mixed

checkIfUseBrowserNav()

It checks if user used the browser navigation (prev, next, reload page etc) and feed te backpopup variable if needed

private checkIfUseBrowserNav() : mixed

checkPrevStep()

Define prev step if not set in session.

private checkPrevStep() : mixed

displayFirstPageIfNeeded()

Display the first page if needed

private displayFirstPageIfNeeded() : mixed

getErrorHtmlMessage()

Html error message if needed/available in the page

private getErrorHtmlMessage() : string
Tags
todo

: move to coreReplacements ? Can be good.

Return values
string

(html)

initDirtyStep()

If a step is requested, but the survey ID in the session is different from the requested one It reload the needed infos for the requested survey and jump to the requested step.

private initDirtyStep() : mixed

initFirstStep()

If it's the first time the survey is loaded: - Init session, randomization and filed array - Check surveyid coherence - Init $LEM states.

private initFirstStep() : mixed
  • Decide if Welcome page should be shown

initMove()

Init session/params values depending of user moves

private initMove() : mixed
  • It init the needed variables for navigation: initFirstStep, initTotalAndMaxSteps, setMoveResult
  • Then perform all the needed checks before moving:
    • did the participant used browser navigation?
    • did he pressed clear cancel, is he a confirmed quota?
    • Is the previous step set?
    • Is the survey finished?
    • Are all the answer validated? (like: participant didn't answered to a mandatory question)

initTotalAndMaxSteps()

Seems to be a quick fix to avoid the total and max steps to be null.

private initTotalAndMaxSteps() : mixed

..

makeLanguageChanger()

Set alanguageChanger.show to true if we need to show the language changer.

private makeLanguageChanger() : void

manageClearAll()

clear all system (no js or broken js)

private manageClearAll() : void
Tags
uses

$this->iSurveyid

uses

$this->sTemplateViewPath

moveSubmitIfNeeded()

Perform submit if asked by user

private moveSubmitIfNeeded() : mixed

processString()

Check in a string if it uses expressions to replace them

private processString(string|null $sString[, mixed $iRecursionLevel = 1 ][, bool $static = false ]) : string
Parameters
$sString : string|null

the string to evaluate

$iRecursionLevel : mixed = 1
$static : bool = false
  • return static string
Tags
todo

: find/get current qid for processing string

Return values
string

saveSubmitIfNeeded()

perform save submit if asked by user called from save survey

private saveSubmitIfNeeded() : mixed

setMoveResult()

Set the moveResult variable, depending on the user move request

private setMoveResult() : mixed

setNotAnsweredAndNotValidated()

check mandatory questions if necessary CHECK IF ALL CONDITIONAL MANDATORY QUESTIONS THAT APPLY HAVE BEEN ANSWERED

private setNotAnsweredAndNotValidated() : mixed

setPrevStep()

Set prev step in session depending on move type If not in a specific page, prevstep stock the value of step just before it get updated

private setPrevStep() : mixed

setSurveyMode()

Retrieve the survey format (mode?) TODO: move to survey model

private setSurveyMode() : string
Return values
string

setSurveyOptions()

Retreives dew options comming from thissurvey, App->getConfig, LEM.

private setSurveyOptions() : mixed

TODO: move to survey model

setSurveySettings()

This method will set survey values in public property of the class So, any value here set as $this->xxx will be available as $xxx after : eg: $this->LEMsessid

private setSurveySettings(mixed $surveyid, mixed $args) : mixed
Parameters
$surveyid : mixed
$args : mixed

setVarFromArgs()

The run method fed $redata with using get_defined_var(). So it was very hard to move a piece of code from the run method to a new one.

private setVarFromArgs(array<string|int, mixed> $args) : mixed

To make it easier, private variables has been added to this class: So when a piece of code changes a variable (a variable that originally was finally added to redata get_defined_var()), now, it also changes its private variable version. Then, before performing the get_defined_var, the private variables are used to recreate those variables. So we can move piece of codes to sub methods. setVarFromArgs($args) will set the original state of those private variables using the parameter $args passed to the run() method

Parameters
$args : array<string|int, mixed>

showTokenOrCaptchaFormsIfNeeded()

NOTE: right now, captcha works ONLY if reloaded... need to be debug.

private showTokenOrCaptchaFormsIfNeeded() : mixed

NOTE: I bet we have the same problem on 2.6x.x NOTE: when token + captcha: works fine


        
On this page

Search results