LimeSurvey API - Master branch

qanda_helper.php

Table of Contents

Constants

CHECKED  = ' checked="checked"'
QUESTION_START  = file_get_contents(getTemplatePath($thissurvey['template']) . '/question_start.pstpl')
SELECTED  = ' selected="selected"'
SHOW_NO_ANSWER  = 1

Functions

setNoAnswerMode()  : mixed
setNoAnswerMode
retrieveAnswers()  : array<string|int, mixed>
This function returns an array containing the "question/answer" html display and a list of the question/answer fieldnames associated. It is called from question.php, group.php, survey.php or preview.php
mandatory_message()  : mixed
validation_message()  : array<string|int, mixed>
file_validation_message()  : mixed
mandatory_popup()  : mixed
validation_popup()  : mixed
file_validation_popup()  : mixed
return_timer_script()  : string
currentRelevecanceClass()  : string
Return class of a specific row (hidden by relevance)
return_display_style()  : mixed
return_array_filter_strings()  : mixed
testKeypad()  : string
do_language()  : mixed
do_list_dropdown()  : mixed
do_list_radio()  : mixed
do_listwithcomment()  : mixed
do_ranking()  : mixed
do_multiplechoice()  : mixed
do_multiplechoice_withcomments()  : mixed
do_file_upload()  : mixed
do_multipleshorttext()  : mixed
do_numerical()  : mixed
do_shortfreetext()  : mixed
getLatLongFromIp()  : mixed
do_longfreetext()  : mixed
do_hugefreetext()  : mixed
do_yesno()  : array<string|int, mixed>
Renders Yes/No Question Type.
do_gender()  : array<string|int, mixed>
Renders Gender Question Types.
do_array_5point()  : array<string|int, mixed>
Construct answer part array_5point
do_array_10point()  : array<string|int, mixed>
Construct answer part array_10point
do_array_yesnouncertain()  : mixed
do_array_increasesamedecrease()  : mixed
do_array()  : mixed
do_array_texts()  : mixed
do_array_multiflexi()  : mixed
do_arraycolumns()  : array<string|int, mixed>
Renders array by column question type.
do_array_dual()  : mixed
getLabelInputWidth()  : array<string|int, mixed>
Find the label / input width
fillDate()  : string
Take a date string and fill out missing parts, like day, hour, minutes (not seconds).
doRender()  : mixed
Render the question view.

Constants

QUESTION_START

public mixed QUESTION_START = file_get_contents(getTemplatePath($thissurvey['template']) . '/question_start.pstpl')

Functions

setNoAnswerMode()

setNoAnswerMode

setNoAnswerMode(mixed $thissurvey) : mixed
Parameters
$thissurvey : mixed

retrieveAnswers()

This function returns an array containing the "question/answer" html display and a list of the question/answer fieldnames associated. It is called from question.php, group.php, survey.php or preview.php

retrieveAnswers(array<string|int, mixed> $ia) : array<string|int, mixed>
Parameters
$ia : array<string|int, mixed>

Details of $ia can be found at top of this file

Return values
array<string|int, mixed>

Array like [array $qanda, array $inputnames] where $qanda has elements [ $qtitle (question_text) : array [ all : string; complete HTML?; all has been added for backwards compatibility with templates that use question_start.pstpl (now redundant) 'text' => $qtitle, question?? $ia[3]? 'code' => $ia[2] or title?? 'number' => $number 'help' => '' 'mandatory' => '' man_message : string; message when mandatory is not answered 'valid_message' => '' file_valid_message : string; only relevant for file upload 'class' => '' 'man_class' => '' 'input_error_class' => '' // provides a class. 'essentials' => '' ] $answer ? 'help' : string $display : ? $qid : integer $ia[2] = title; $ia[5] = group id : int $ia[1] = fieldname : string ] and $inputnames is ? used for hiddenfieldnames and upload file?

mandatory_message()

mandatory_message(mixed $ia) : mixed
Parameters
$ia : mixed

validation_message()

validation_message(array<string|int, mixed> $ia, bool $show) : array<string|int, mixed>
Parameters
$ia : array<string|int, mixed>
$show : bool
  • true if should initially be visible
Return values
array<string|int, mixed>

file_validation_message()

file_validation_message(mixed $ia) : mixed
Parameters
$ia : mixed

mandatory_popup()

mandatory_popup(mixed $ia[, mixed $notanswered = null ]) : mixed
Parameters
$ia : mixed
$notanswered : mixed = null

validation_popup()

validation_popup(mixed $ia[, mixed $notvalidated = null ]) : mixed
Parameters
$ia : mixed
$notvalidated : mixed = null

file_validation_popup()

file_validation_popup(mixed $ia[, bool $filenotvalidated = null ]) : mixed
Parameters
$ia : mixed
$filenotvalidated : bool = null

return_timer_script()

return_timer_script(mixed $aQuestionAttributes, mixed $ia[, string $disable = null ]) : string
Parameters
$aQuestionAttributes : mixed
$ia : mixed
$disable : string = null
Return values
string

currentRelevecanceClass()

Return class of a specific row (hidden by relevance)

currentRelevecanceClass(int $surveyId, string $baseName, string $name, array<string|int, mixed> $aQuestionAttributes) : string
Parameters
$surveyId : int

actual survey ID

$baseName : string

the base name of the question

$name : string

The name of the question/row to test

$aQuestionAttributes : array<string|int, mixed>

the question attributes

Return values
string

return_display_style()

return_display_style(mixed $ia, mixed $aQuestionAttributes, mixed $thissurvey, string $rowname) : mixed
Parameters
$ia : mixed
$aQuestionAttributes : mixed
$thissurvey : mixed
$rowname : string

return_array_filter_strings()

return_array_filter_strings(mixed $ia, mixed $aQuestionAttributes, mixed $thissurvey, mixed $ansrow, string $rowname, mixed $trbc, string $valuename[, mixed $method = "tbody" ][, mixed $class = null ]) : mixed
Parameters
$ia : mixed
$aQuestionAttributes : mixed
$thissurvey : mixed
$ansrow : mixed
$rowname : string
$trbc : mixed
$valuename : string
$method : mixed = "tbody"
$class : mixed = null

testKeypad()

testKeypad(string $sUseKeyPad) : string
Parameters
$sUseKeyPad : string
Return values
string

do_language()

do_language(mixed $ia) : mixed
Parameters
$ia : mixed

do_list_dropdown()

do_list_dropdown(mixed $ia) : mixed
Parameters
$ia : mixed

do_list_radio()

do_list_radio(mixed $ia) : mixed
Parameters
$ia : mixed

do_listwithcomment()

do_listwithcomment(mixed $ia) : mixed
Parameters
$ia : mixed

do_ranking()

do_ranking(mixed $ia) : mixed
Parameters
$ia : mixed
Tags
deprecated
4.0

Replaced by core\QuestionTypes\RankingStyle

do_multiplechoice()

do_multiplechoice(mixed $ia) : mixed
Parameters
$ia : mixed

do_multiplechoice_withcomments()

do_multiplechoice_withcomments(mixed $ia) : mixed
Parameters
$ia : mixed

do_file_upload()

do_file_upload(mixed $ia) : mixed
Parameters
$ia : mixed

do_multipleshorttext()

do_multipleshorttext(mixed $ia) : mixed
Parameters
$ia : mixed

do_numerical()

do_numerical(mixed $ia) : mixed
Parameters
$ia : mixed

do_shortfreetext()

do_shortfreetext(mixed $ia) : mixed
Parameters
$ia : mixed

getLatLongFromIp()

getLatLongFromIp(mixed $sIPAddress) : mixed
Parameters
$sIPAddress : mixed

do_longfreetext()

do_longfreetext(mixed $ia) : mixed
Parameters
$ia : mixed

do_hugefreetext()

do_hugefreetext(mixed $ia) : mixed
Parameters
$ia : mixed

do_yesno()

Renders Yes/No Question Type.

do_yesno(array<string|int, mixed> $ia) : array<string|int, mixed>
Parameters
$ia : array<string|int, mixed>
Return values
array<string|int, mixed>

do_gender()

Renders Gender Question Types.

do_gender(array<string|int, mixed> $ia) : array<string|int, mixed>
Parameters
$ia : array<string|int, mixed>
Return values
array<string|int, mixed>

do_array_5point()

Construct answer part array_5point

do_array_5point(array<string|int, mixed> $ia) : array<string|int, mixed>
Parameters
$ia : array<string|int, mixed>
Return values
array<string|int, mixed>

do_array_10point()

Construct answer part array_10point

do_array_10point(array<string|int, mixed> $ia) : array<string|int, mixed>
Parameters
$ia : array<string|int, mixed>
Return values
array<string|int, mixed>

do_array_yesnouncertain()

do_array_yesnouncertain(mixed $ia) : mixed
Parameters
$ia : mixed

do_array_increasesamedecrease()

do_array_increasesamedecrease(mixed $ia) : mixed
Parameters
$ia : mixed

do_array()

do_array(mixed $ia) : mixed
Parameters
$ia : mixed
Tags
deprecated
4.0

Replaced by core\QuestionTypes\RenderArrayFlexibleRow

do_array_texts()

do_array_texts(mixed $ia) : mixed
Parameters
$ia : mixed

do_array_multiflexi()

do_array_multiflexi(mixed $ia) : mixed
Parameters
$ia : mixed

do_arraycolumns()

Renders array by column question type.

do_arraycolumns(array<string|int, mixed> $ia) : array<string|int, mixed>
Parameters
$ia : array<string|int, mixed>
Tags
throws
CException
Return values
array<string|int, mixed>

do_array_dual()

do_array_dual(mixed $ia) : mixed
Parameters
$ia : mixed
Tags
deprecated
4.0

Replaced by core\QuestionTypes\ArrayMultiscale

getLabelInputWidth()

Find the label / input width

getLabelInputWidth(string|int $labelAttributeWidth, string|int $inputAttributeWidth) : array<string|int, mixed>
Parameters
$labelAttributeWidth : string|int

label width from attribute

$inputAttributeWidth : string|int

input width from attribute

Return values
array<string|int, mixed>

labelWidth as integer,inputWidth as integer,defaultWidth as boolean

fillDate()

Take a date string and fill out missing parts, like day, hour, minutes (not seconds).

fillDate(string $dateString) : string

If string is NOT in standard date format (Y-m-d H:i), this methods makes no sense. Used when fetching answer for do_date, where answer can come from a default answer expression like date('Y'). Will also truncate date('c') to format Y-m-d H:i.

Parameters
$dateString : string
Return values
string

doRender()

Render the question view.

doRender(string $sView, array<string|int, mixed> $aData[, bool $bReturn = true ]) : mixed

By default, it just renders the required core view from application/views/survey/... If user added a question template in the upload dirctory, add applied it to the question in its display settings, then the function will check if the required view exist in this directory and then will use this one to render the question.

Rem: all the logic has been moved to LSETwigViewRenderer::renderQuestion() We keep the function doRender here for convenience (it will probably be removed in further cycles of dev). *

Parameters
$sView : string

name of the view to be rendered.

$aData : array<string|int, mixed>

data to be extracted into PHP variables and made available to the view script

$bReturn : bool = true

whether the rendering result should be returned instead of being displayed to end users (should be always true)


        
On this page

Search results