LimeSurvey API - Master branch

frontend_helper.php

Table of Contents

Functions

loadanswers()  : mixed
getLanguageChangerDatas()  : array<string|int, mixed>|false
This function creates the language selector for a particular survey
getLanguageChangerDatasPublicList()  : array<string|int, mixed>|bool
This function creates the language selector for the public survey index page
makeFlashMessage()  : string
Construct flash message container Used in templatereplace to replace {FLASHMESSAGE} in startpage.tstpl
checkUploadedFileValidity()  : mixed
checkUploadedFileValidity used in SurveyRuntimeHelper
addtoarray_single()  : mixed
Takes two single element arrays and adds second to end of first if value exists Why not use array_merge($array1,array_filter($array2);
submittokens()  : mixed
Marks a tokens as completed and sends a confirmation email to the participiant.
sendSubmitNotifications()  : mixed
Send a submit notification to the email address specified in the notifications tab in the survey settings
getResponseTableReplacement()  : string
create ANSWERTABLE replacement field content
saveFailedEmail()  : bool
Saves a failed email whenever processing and sensing an email fails or overwrites a found entry with updated values
failedEmailSuccess()  : mixed
submitfailed()  : string
submitfailed : used in em_manager_helper.php
buildsurveysession()  : void
This function builds all the required session variables when a survey is first started and it loads any answer defaults from command line or from the table defaultvalues It is called from the related format script (group.php, question.php, survey.php) if the survey has just started.
checkPassthruLabel()  : void
Check if a passthru label and value have been included in the query url
prefillFromCommandLine()  : void
Prefill startvalues from command line param
initFieldArray()  : void
randomizationGroupsAndQuestions()  : void
Apply randomizationGroup and randomizationQuestion to session fieldmap
randomizationGroup()  : array<string|int, mixed>
Randomization group for groups
randomizationQuestion()  : array<string|int, mixed>
Randomization group for questions
finalizeRandomization()  : array<string|int, mixed>
Stuff?
testIfTokenIsValid()  : array<string|int, string>
Test if token is valid
getRenderWay()  : string
Returns which way should be rendered
renderRenderWayForm()  : void
Render token, captcha or register form
resetAllSessionVariables()  : void
Resets all session variables for this survey
setTotalSteps()  : void
The number of "pages" that will be presented in this survey The number of pages to be presented will differ depending on the survey format Set totalsteps in session
breakOutAndCrash()  : void
renderError()  : mixed
getNavigatorDatas()  : mixed
TODO: call this function from surveyRuntimeHelper TODO: remove surveymover()
doAssessment()  : array<string|int, mixed>
Caculate assessement scores
UpdateGroupList()  : mixed
Update SESSION VARIABLE: grouplist A list of groups in this survey, ordered by group name.
updateFieldArray()  : mixed
FieldArray contains all necessary information regarding the questions This function is needed to update it in case the survey is switched to another language
checkCompletedQuota()  : array<string|int, mixed>|void
checkCompletedQuota() returns matched quotas information for the current response
encodeEmail()  : mixed|string
encodeEmail : encode admin email in public part
getReferringUrl()  : string
GetReferringUrl() returns the referring URL
display_first_page()  : mixed
Shows the welcome page, used in group by group and question by question mode
killSurveySession()  : mixed
killSurveySession : reset $_SESSION part for the survey
resetTimers()  : mixed
Resets all question timers by expiring the related cookie - this needs to be called before any output is done
resetQuestionTimers()  : void
Removes all question timers for this survey from local storage
SetSurveyLanguage()  : mixed
Set the public survey language Control if language exist in this survey, else set to survey default language if $surveyid <= 0 : set the language to default site language
getMove()  : string
getMove get move button clicked
getSideBodyClass()  : string
Get the margin class for side-body div depending on side-menu behaviour config and page (edit or not etc).
cookieConsentLocalization()  : array<string|int, string>
For later use, don't remove.
getForwardParameters()  : array<string, mixed>
Returns an array of URL parameters that can be forwarded

Functions

getLanguageChangerDatas()

This function creates the language selector for a particular survey

getLanguageChangerDatas([string $sSelectedLanguage = "" ]) : array<string|int, mixed>|false
Parameters
$sSelectedLanguage : string = ""

: lang to be selected (forced)

Return values
array<string|int, mixed>|false

: array of data if more than one language, else false

getLanguageChangerDatasPublicList()

This function creates the language selector for the public survey index page

getLanguageChangerDatasPublicList(string $sSelectedLanguage) : array<string|int, mixed>|bool
Parameters
$sSelectedLanguage : string

The language in which all information is shown

Return values
array<string|int, mixed>|bool

makeFlashMessage()

Construct flash message container Used in templatereplace to replace {FLASHMESSAGE} in startpage.tstpl

makeFlashMessage() : string
Return values
string

checkUploadedFileValidity()

checkUploadedFileValidity used in SurveyRuntimeHelper

checkUploadedFileValidity(mixed $surveyid, mixed $move[, mixed $backok = null ]) : mixed
Parameters
$surveyid : mixed
$move : mixed
$backok : mixed = null

addtoarray_single()

Takes two single element arrays and adds second to end of first if value exists Why not use array_merge($array1,array_filter($array2);

addtoarray_single(mixed $array1, mixed $array2) : mixed
Parameters
$array1 : mixed
$array2 : mixed

submittokens()

Marks a tokens as completed and sends a confirmation email to the participiant.

submittokens([bool $quotaexit = false ]) : mixed

If $quotaexit is set to true then the user exited the survey due to a quota restriction and the according token is only marked as 'Q'

Parameters
$quotaexit : bool = false

sendSubmitNotifications()

Send a submit notification to the email address specified in the notifications tab in the survey settings

sendSubmitNotifications(int $surveyid[, array<string|int, mixed> $emails = [] ][, bool $return = false ]) : mixed
Parameters
$surveyid : int

survey ID of currently used survey

$emails : array<string|int, mixed> = []

Emailnotifications that should be sent ['responseTo' => [['failedEmailId' => 'failedEmailId1', 'responseid' => 'responseid1', 'recipient' => 'recipient1', 'language' => 'language1'], [...]], 'notificationTo' => [[..., ..., ...][...]]]

$return : bool = false

whether the function should return values

Tags
throws
Exception
throws
CException

getResponseTableReplacement()

create ANSWERTABLE replacement field content

getResponseTableReplacement( $surveyid,  $responseId,  $emailLanguage,  $bIsHTML) : string
Parameters
$surveyid :
$responseId :
$emailLanguage :
$bIsHTML :
Tags
throws
CException
Return values
string

saveFailedEmail()

Saves a failed email whenever processing and sensing an email fails or overwrites a found entry with updated values

saveFailedEmail(int|null $id, string|null $recipient, int $surveyId, int $responseId, string|null $emailType, string|null $language, LimeMailer $mailer) : bool
Parameters
$id : int|null

Id of failed email

$recipient : string|null
$surveyId : int
$responseId : int
$emailType : string|null
$language : string|null
$mailer : LimeMailer
Return values
bool

failedEmailSuccess()

failedEmailSuccess(mixed $id) : mixed
Parameters
$id : mixed

submitfailed()

submitfailed : used in em_manager_helper.php

submitfailed([string $errormsg = '' ][, string $query = null ]) : string

"Unexpected error"

Will send e-mail to adminemail if defined.

Parameters
$errormsg : string = ''
$query : string = null

Will be included in sent email

Return values
string

Error message

buildsurveysession()

This function builds all the required session variables when a survey is first started and it loads any answer defaults from command line or from the table defaultvalues It is called from the related format script (group.php, question.php, survey.php) if the survey has just started.

buildsurveysession(int $surveyid[, bool $preview = false ]) : void
Parameters
$surveyid : int
$preview : bool = false

Defaults to false

checkPassthruLabel()

Check if a passthru label and value have been included in the query url

checkPassthruLabel(int $surveyid, bool $preview, mixed $fieldmap) : void
Parameters
$surveyid : int
$preview : bool
$fieldmap : mixed

prefillFromCommandLine()

Prefill startvalues from command line param

prefillFromCommandLine(int $surveyid) : void
Parameters
$surveyid : int

initFieldArray()

initFieldArray(int $surveyid, array<string|int, mixed> $fieldmap) : void
Parameters
$surveyid : int
$fieldmap : array<string|int, mixed>

randomizationGroupsAndQuestions()

Apply randomizationGroup and randomizationQuestion to session fieldmap

randomizationGroupsAndQuestions(int $surveyid[, bool $preview = false ][, mixed $fieldmap = array() ]) : void
Parameters
$surveyid : int
$preview : bool = false
$fieldmap : mixed = array()

randomizationGroup()

Randomization group for groups

randomizationGroup(int $surveyid, array<string|int, mixed> $fieldmap, bool $preview) : array<string|int, mixed>
Parameters
$surveyid : int
$fieldmap : array<string|int, mixed>
$preview : bool
Return values
array<string|int, mixed>

($fieldmap, $randomized)

randomizationQuestion()

Randomization group for questions

randomizationQuestion(int $surveyid, array<string|int, mixed> $fieldmap, bool $preview) : array<string|int, mixed>
Parameters
$surveyid : int
$fieldmap : array<string|int, mixed>
$preview : bool
Return values
array<string|int, mixed>

($fieldmap, $randomized)

finalizeRandomization()

Stuff?

finalizeRandomization(array<string|int, mixed> $fieldmap) : array<string|int, mixed>
Parameters
$fieldmap : array<string|int, mixed>
Return values
array<string|int, mixed>

Fieldmap

testIfTokenIsValid()

Test if token is valid

testIfTokenIsValid(array<string|int, mixed> $subscenarios, array<string|int, mixed> $thissurvey, array<string|int, mixed> $aEnterTokenData, string $clienttoken) : array<string|int, string>
Parameters
$subscenarios : array<string|int, mixed>
$thissurvey : array<string|int, mixed>
$aEnterTokenData : array<string|int, mixed>
$clienttoken : string
Return values
array<string|int, string>

($renderToken, $FlashError)

getRenderWay()

Returns which way should be rendered

getRenderWay(string $renderToken, string $renderCaptcha) : string
Parameters
$renderToken : string
$renderCaptcha : string
Return values
string

renderRenderWayForm()

Render token, captcha or register form

renderRenderWayForm(string $renderWay, array<string|int, mixed> $scenarios, string $sTemplateViewPath, array<string|int, mixed> $aEnterTokenData, int $surveyid[, mixed $aSurveyInfo = null ]) : void
Parameters
$renderWay : string
$scenarios : array<string|int, mixed>
$sTemplateViewPath : string
$aEnterTokenData : array<string|int, mixed>
$surveyid : int
$aSurveyInfo : mixed = null

resetAllSessionVariables()

Resets all session variables for this survey

resetAllSessionVariables(int $surveyid) : void
Parameters
$surveyid : int

setTotalSteps()

The number of "pages" that will be presented in this survey The number of pages to be presented will differ depending on the survey format Set totalsteps in session

setTotalSteps(int $surveyid, array<string|int, mixed> $thissurvey, int $totalquestions) : void
Parameters
$surveyid : int
$thissurvey : array<string|int, mixed>
$totalquestions : int

breakOutAndCrash()

breakOutAndCrash(string $sTemplateViewPath, int $totalquestions, int $iTotalGroupsWithoutQuestions, array<string|int, mixed> $thissurvey) : void
Parameters
$sTemplateViewPath : string
$totalquestions : int
$iTotalGroupsWithoutQuestions : int
$thissurvey : array<string|int, mixed>
Tags
todo

Rename

todo

Move HTML to view

renderError()

renderError(mixed $sTitle, mixed $sMessage, mixed $thissurvey, string $sTemplateViewPath) : mixed
Parameters
$sTitle : mixed
$sMessage : mixed
$thissurvey : mixed
$sTemplateViewPath : string

getNavigatorDatas()

TODO: call this function from surveyRuntimeHelper TODO: remove surveymover()

getNavigatorDatas() : mixed

doAssessment()

Caculate assessement scores

doAssessment(int $surveyid[, bool $onlyCurrent = true ]) : array<string|int, mixed>
Parameters
$surveyid : int
$onlyCurrent : bool = true

: only current ( ASSESSMENT_CURRENT_TOTAL )

Return values
array<string|int, mixed>

UpdateGroupList()

Update SESSION VARIABLE: grouplist A list of groups in this survey, ordered by group name.

UpdateGroupList(int $surveyid, string $language) : mixed
Parameters
$surveyid : int
$language : string

updateFieldArray()

FieldArray contains all necessary information regarding the questions This function is needed to update it in case the survey is switched to another language

updateFieldArray() : mixed
Tags
todo:

Make 'fieldarray' obsolete by replacing with EM session info

checkCompletedQuota()

checkCompletedQuota() returns matched quotas information for the current response

checkCompletedQuota(int $surveyid[, bool $return = false ]) : array<string|int, mixed>|void
Parameters
$surveyid : int
  • Survey identification number
$return : bool = false
  • set to true to return information, false do the quota
Return values
array<string|int, mixed>|void
  • nested array, Quotas->Members->Fields, includes quota information matched in session.

encodeEmail()

encodeEmail : encode admin email in public part

encodeEmail(mixed $mail[, mixed $text = "" ][, mixed $class = "" ][, mixed $params = array() ]) : mixed|string
Parameters
$mail : mixed
$text : mixed = ""
$class : mixed = ""
$params : mixed = array()
Return values
mixed|string

getReferringUrl()

GetReferringUrl() returns the referring URL

getReferringUrl() : string
Return values
string

display_first_page()

Shows the welcome page, used in group by group and question by question mode

display_first_page(mixed $thissurvey, mixed $aSurveyInfo) : mixed
Parameters
$thissurvey : mixed
$aSurveyInfo : mixed

killSurveySession()

killSurveySession : reset $_SESSION part for the survey

killSurveySession(int $iSurveyID) : mixed
Parameters
$iSurveyID : int

resetTimers()

Resets all question timers by expiring the related cookie - this needs to be called before any output is done

resetTimers() : mixed
Tags
todo

Deprecated - Question timers no longer use cookies

resetQuestionTimers()

Removes all question timers for this survey from local storage

resetQuestionTimers(mixed $surveyid) : void
Parameters
$surveyid : mixed

SetSurveyLanguage()

Set the public survey language Control if language exist in this survey, else set to survey default language if $surveyid <= 0 : set the language to default site language

SetSurveyLanguage(int $surveyid, string $sLanguage) : mixed
Parameters
$surveyid : int
$sLanguage : string

getMove()

getMove get move button clicked

getMove() : string
Return values
string

getSideBodyClass()

Get the margin class for side-body div depending on side-menu behaviour config and page (edit or not etc).

getSideBodyClass([bool $sideMenustate = false ]) : string
Parameters
$sideMenustate : bool = false
  • False for pages with collapsed side-menu
Tags
throws
CException
Return values
string

cookieConsentLocalization()

For later use, don't remove.

cookieConsentLocalization() : array<string|int, string>
Return values
array<string|int, string>

getForwardParameters()

Returns an array of URL parameters that can be forwarded

getForwardParameters(LSHttpRequest $request) : array<string, mixed>
Parameters
$request : LSHttpRequest

the HTTP request

Return values
array<string, mixed>

        
On this page

Search results