SurveyRuntimeHelper

package

Default

Methods

Check if the move is clearcancel or confirmquota

checkClearCancel() 

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

checkIfFinished() 

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

checkIfUseBrowserNav() 

Define prev step if not set in session.

checkPrevStep() 

Check quotas

checkQuotas() 

Display the first page if needed

displayFirstPageIfNeeded() 

fixMaxStep

fixMaxStep() 

Html error message if needed/available in the page

getErrorHtmlMessage() : string
todo

: move to coreReplacements ? Can be good.

Response

string

(html)

Construction of replacement array, actually doing it with redata

getQuestionReplacement(array $aQuestionQanda) : array
static

Arguments

$aQuestionQanda

array

: array from qanda helper

Response

array

of replacement for question.psptl

Retreive the radix

getRadix() : string

Response

string

getShowNumAndCode

getShowNumAndCode() 

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.

initDirtyStep() 

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

initFirstStep() 
  • Decide if Welcome page should be shown

Init session/params values depending of user moves

initMove() 
  • 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)

initTemplate

initTemplate() 

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

initTotalAndMaxSteps() 

..

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

makeLanguageChanger() : void

clear all system (no js or broken js)

manageClearAll() : void
uses

Perform submit if asked by user

moveSubmitIfNeeded() 

Check in a string if it uses expressions to replace them

processString(string $sString) : string

Arguments

$sString

string

the string to evaluate

Response

string

Main function

run(mixed $surveyid, mixed $args) 

Arguments

$surveyid

mixed

$args

mixed

Perform save all if user asked for it

saveAllIfNeeded() 

perform save submit if asked by user called from save survey

saveSubmitIfNeeded() 

Now it's ok ^^

setArgs() 

setGroup

setGroup() 

setJavascriptVar

setJavascriptVar(integer $iSurveyId = '') : \@void

Arguments

$iSurveyId

integer

: the survey id for the script

Response

\@void

Set the moveResult variable, depending on the user move request

setMoveResult() 

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

setNotAnsweredAndNotValidated() 

setPreview

setPreview() 

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

setPrevStep() 

Increase step in session

setStep() 

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

setSurveyMode() : string

Response

string

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

setSurveyOptions() 

TODO: move to survey model

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

setSurveySettings( $surveyid,  $args) 

Arguments

$surveyid

$args

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.

setVarFromArgs(array $args) 

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

Arguments

$args

array

NOTE: right now, captcha works ONLY if reloaded.

showTokenOrCaptchaFormsIfNeeded() 

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

Properties

param

param : 

Type(s)

previewquestion

previewquestion : 

Type(s)

previewgrp

previewgrp : 

Type(s)

preview

preview : 

Type(s)

oTemplate

oTemplate : 

Type(s)

sTemplateViewPath

sTemplateViewPath : 

Type(s)

LEMsessid

LEMsessid : 

Type(s)

LEMdebugLevel

LEMdebugLevel : 

Type(s)

LEMskipReprocessing

LEMskipReprocessing : 

Type(s)

aSurveyInfo

aSurveyInfo : 

Type(s)

iSurveyid

iSurveyid : 

Type(s)

bShowEmptyGroup

bShowEmptyGroup : 

Type(s)

sSurveyMode

sSurveyMode : 

Type(s)

aSurveyOptions

aSurveyOptions : 

Type(s)

sLangCode

sLangCode : 

Type(s)

aMoveResult

aMoveResult : 

Type(s)

sMove

sMove : 

Type(s)

bInvalidLastPage

bInvalidLastPage : 

Type(s)

aStepInfo

aStepInfo : 

Type(s)

backpopup

backpopup : 

Type(s)

popup

popup : 

Type(s)

notvalidated

notvalidated : 

Type(s)

notanswered

notanswered : 

Type(s)

filenotvalidated

filenotvalidated : 

Type(s)

completed

completed : 

Type(s)

okToShowErrors

okToShowErrors : 

Type(s)

gid

gid : 

Type(s)

groupname

groupname : 

Type(s)

groupdescription

groupdescription : 

Type(s)