LimeSurvey API - Master branch

ConditionsAction extends SurveyCommonAction
in package

Condition Controller

This controller performs token actions

Tags
subpackage

Backend

Table of Contents

Properties

$iSurveyID  : int
$language  : string
$nonStringComparisonOperators  : array<string|int, mixed>
$stringComparisonOperators  : array<string|int, mixed>
$tokenFieldsAndNames  : array<string|int, mixed>
$tokenTableExists  : bool
True if there exists a survey participants table for this survey

Methods

__construct()  : mixed
Init some stuff
index()  : void
index()  : void
Main Entry Method.
questionbar()  : mixed
Shows admin menu for question
quickAddCondition()  : void
Used by quick-add form to add conditions async
renderInternal()  : mixed
run()  : mixed
Action classes require them to have a run method. We reroute it to index if called.
runWithParams()  : bool
Override runWithParams() implementation in CAction to help us parse requests with subactions.
surveybar()  : mixed
Shows admin menu for surveys
applySubaction()  : void
Switch on action to update/copy/add condition etc
beforeSideMenuRender()  : string
Returns content from event beforeSideMenuRender
copyConditions()  : void
createNavigatorUrl()  : string
fetchExtraMenus()  : array<string|int, ExtraMenu>
Get extra menus from plugins that are using event beforeAdminMenuRender
filterImportedResources()  : array<string|int, mixed>
getAllScenarios()  : array<string|int, CActiveRecord>
getAttributeName()  : string
getCAnswersAndCQuestions()  : array<string|int, mixed>
getCopyForm()  : string
getEDITConditionConst()  : string
getEditConditionForm()  : string
Get html for add/edit condition form
getEDITConditionRegexp()  : string
getEditFormJavascript()  : string
Generates some JS used by form
getEditSourceTab()  : string
getEditTargetTab()  : string
getHiddenFields()  : string
getJavascriptForMatching()  : string
Javascript to match question with answer
getJsAnswersToSelect()  : string
getMethod()  : array<string|int, mixed>
This array will be used to explain which conditions is used to evaluate the question
getPostQuestionList()  : array<string|int, mixed>
getPostRows()  : array<string|int, mixed>
getQCount()  : int
Used to calculate size of select box
getQuestionList()  : array<string|int, mixed>
getQuestionNavOptions()  : string
The navigator that lets user quickly move to another question within the survey.
getQuestionRows()  : array<string|int, mixed>
getQuestionTitleAndText()  : array<string|int, mixed>
getQuickAddConditionForm()  : string|array<string|int, string>|null
Form used in quick-add modal
getQuickAddData()  : array<string|int, mixed>
Get posted data from quick-add modal form
getSurveyIsAnonymized()  : bool
getTheseRows()  : array<string|int, mixed>
insertCondition()  : void
Add a new condition
insertConditionAjax()  : array<string|int, mixed>
As insertCondition() but using Ajax, called from quickAddCondition
listquestiongroups()  : mixed
REFACTORED in LayoutHelper
listquestions()  : mixed
REFACTORED in LayoutHelper
notifications()  : mixed
Display notifications
nsurveysummary()  : mixed
REFACTORED in LayoutHelper
organizequestionbar()  : mixed
Render the save/cancel bar for Organize question groups/questions
redirectToConditionStart()  : void
After add/delete/etc, redirect to conditions start page
renderCentralContents()  : string
Rendering the subviews and views of renderWrappedTemplate
renderJSON()  : void
Method to render an array as a json document
renderQuickmenu()  : string
Render the quick-menu that is shown when side-menu is hidden.
renderWrappedTemplate()  : void
Renders template(s) wrapped in header and footer
renumberScenarios()  : void
requirePostRequest()  : mixed
Validates that the request method is POST.
resetSurveyLogic()  : void
route()  : mixed
Routes the action into correct subaction
shouldShowScenario()  : bool
Decides if "Default scenario" should be shown or not
showadminmenu()  : string
showadminmenu() function returns html text for the administration button bar
showHeaders()  : mixed
Header
surveysidemenu()  : mixed
Show side menu for survey view
titlebar()  : mixed
REFACTORED in LayoutHelper.php
updateCondition()  : void
Update a condition
updatenotification()  : mixed
Display the update notification
addPseudoParams()  : array<string|int, mixed>
Some functions have different parameters, which are just an alias of the usual parameters we're getting in the url. This function just populates those variables so that we don't end up in an error.

Properties

$nonStringComparisonOperators

private array<string|int, mixed> $nonStringComparisonOperators

$stringComparisonOperators

private array<string|int, mixed> $stringComparisonOperators

$tokenFieldsAndNames

private array<string|int, mixed> $tokenFieldsAndNames

$tokenTableExists

True if there exists a survey participants table for this survey

private bool $tokenTableExists

Methods

__construct()

Init some stuff

public __construct([null $controller = null ][, null $id = null ]) : mixed
Parameters
$controller : null = null
$id : null = null

index()

Main Entry Method.

public index(string $subaction[, int $iSurveyID = null ][, int $gid = null ][, int $qid = null ]) : void
Parameters
$subaction : string

Given Subaction

$iSurveyID : int = null

Given Survey ID

$gid : int = null

Given Group ID

$qid : int = null

Given Question ID

Tags
throws
CException
throws
CHttpException

questionbar()

Shows admin menu for question

public questionbar(array<string|int, mixed> $aData) : mixed
Parameters
$aData : array<string|int, mixed>
Tags
deprecated

not in use anymore

quickAddCondition()

Used by quick-add form to add conditions async

public quickAddCondition() : void
Tags
throws
CException

renderInternal()

public renderInternal(string $_viewFile_[, mixed $_data_ = null ][, mixed $_return_ = false ]) : mixed
Parameters
$_viewFile_ : string
$_data_ : mixed = null
$_return_ : mixed = false
Tags
inheritdoc

run()

Action classes require them to have a run method. We reroute it to index if called.

public run() : mixed

runWithParams()

Override runWithParams() implementation in CAction to help us parse requests with subactions.

public runWithParams(array<string|int, mixed> $params) : bool
Parameters
$params : array<string|int, mixed>

URL Parameters

Return values
bool

surveybar()

Shows admin menu for surveys

public surveybar(array<string|int, mixed> $aData) : mixed
Parameters
$aData : array<string|int, mixed>
Tags
deprecated

applySubaction()

Switch on action to update/copy/add condition etc

protected applySubaction(string $p_subaction, array<string|int, mixed> $args) : void
Parameters
$p_subaction : string
$args : array<string|int, mixed>

beforeSideMenuRender()

Returns content from event beforeSideMenuRender

protected beforeSideMenuRender(array<string|int, mixed> $aData) : string

REFACTORED in LayoutHelper

Parameters
$aData : array<string|int, mixed>
Return values
string

copyConditions()

protected copyConditions(array<string|int, mixed> $args) : void
Parameters
$args : array<string|int, mixed>
Tags
throws
CException

createNavigatorUrl()

protected createNavigatorUrl(int $gid, int $qid) : string
Parameters
$gid : int

Group id

$qid : int

Questino id

Return values
string

url

fetchExtraMenus()

Get extra menus from plugins that are using event beforeAdminMenuRender

protected fetchExtraMenus(array<string|int, mixed> $aData) : array<string|int, ExtraMenu>
Parameters
$aData : array<string|int, mixed>
Return values
array<string|int, ExtraMenu>

filterImportedResources()

protected filterImportedResources(string $extractdir, string $destdir) : array<string|int, mixed>
Parameters
$extractdir : string
$destdir : string
Tags
deprecated

use ServiceClass FilterImportedResources instead ... (models/services/)

Return values
array<string|int, mixed>

getAllScenarios()

protected getAllScenarios(int $qid) : array<string|int, CActiveRecord>
Parameters
$qid : int
Return values
array<string|int, CActiveRecord>

Conditions

getAttributeName()

protected getAttributeName(array<string|int, string> $extractedTokenAttr) : string
Parameters
$extractedTokenAttr : array<string|int, string>
Return values
string

getCAnswersAndCQuestions()

protected getCAnswersAndCQuestions(array<string|int, mixed> $theserows) : array<string|int, mixed>
Parameters
$theserows : array<string|int, mixed>
Tags
throws
CException
Return values
array<string|int, mixed>

(cquestion, canswers)

getCopyForm()

protected getCopyForm(int $qid, int $gid, array<string|int, mixed> $conditionsList, array<string|int, mixed> $pquestions) : string
Parameters
$qid : int
$gid : int
$conditionsList : array<string|int, mixed>
$pquestions : array<string|int, mixed>
Tags
throws
CException
Return values
string

html

getEDITConditionConst()

protected getEDITConditionConst(string $subaction) : string
Parameters
$subaction : string
Return values
string

getEditConditionForm()

Get html for add/edit condition form

protected getEditConditionForm(array<string|int, mixed> $args) : string
Parameters
$args : array<string|int, mixed>
Tags
throws
CException
Return values
string

getEDITConditionRegexp()

protected getEDITConditionRegexp(string $subaction) : string
Parameters
$subaction : string
Return values
string

getEditFormJavascript()

Generates some JS used by form

protected getEditFormJavascript(string $subaction) : string
Parameters
$subaction : string
Return values
string

JS

getEditSourceTab()

protected getEditSourceTab() : string
Return values
string

Either '#SRCTOKENATTRS' or '#SRCPREVQUEST'; defaults to '#SRCPREVQUEST' if nothing is posted

getEditTargetTab()

protected getEditTargetTab() : string
Return values
string

Predfined, constant, questions, token field or regexp; defaults to predefined

getHiddenFields()

protected getHiddenFields(array<string|int, mixed> $rows, string $leftOperandType, string $rightOperandType) : string
Parameters
$rows : array<string|int, mixed>
$leftOperandType : string
$rightOperandType : string
Return values
string

html

getJavascriptForMatching()

Javascript to match question with answer

protected getJavascriptForMatching(array<string|int, mixed> $canswers, array<string|int, mixed> $cquestions, bool $surveyIsAnonymized) : string
Parameters
$canswers : array<string|int, mixed>
$cquestions : array<string|int, mixed>
$surveyIsAnonymized : bool
Return values
string

js

getJsAnswersToSelect()

protected getJsAnswersToSelect(array<string|int, mixed> $cquestions, string $p_cquestions, array<string|int, mixed> $p_canswers) : string
Parameters
$cquestions : array<string|int, mixed>
$p_cquestions : string

Question SGID

$p_canswers : array<string|int, mixed>

E.g. array('A2')

Return values
string

JS code

getMethod()

This array will be used to explain which conditions is used to evaluate the question

protected getMethod() : array<string|int, mixed>
Return values
array<string|int, mixed>

getPostQuestionList()

protected getPostQuestionList(int $qid, array<string|int, mixed> $qrows) : array<string|int, mixed>
Parameters
$qid : int
$qrows : array<string|int, mixed>
Return values
array<string|int, mixed>

getPostRows()

protected getPostRows(array<string|int, mixed> $postquestionlist) : array<string|int, mixed>
Parameters
$postquestionlist : array<string|int, mixed>
Return values
array<string|int, mixed>

getQCount()

Used to calculate size of select box

protected getQCount(array<string|int, mixed> $cquestions) : int
Parameters
$cquestions : array<string|int, mixed>
Tags
todo

Not used

Return values
int

getQuestionList()

protected getQuestionList(int $qid, array<string|int, mixed> $qrows) : array<string|int, mixed>
Parameters
$qid : int
$qrows : array<string|int, mixed>
Return values
array<string|int, mixed>

getQuestionNavOptions()

The navigator that lets user quickly move to another question within the survey.

protected getQuestionNavOptions(array<string|int, mixed> $theserows, array<string|int, mixed> $postrows, array<string|int, mixed> $args) : string
Parameters
$theserows : array<string|int, mixed>
$postrows : array<string|int, mixed>
$args : array<string|int, mixed>
Tags
throws
CException
Return values
string

html

getQuestionRows()

protected getQuestionRows() : array<string|int, mixed>
Return values
array<string|int, mixed>

getQuestionTitleAndText()

protected getQuestionTitleAndText(int $qid) : array<string|int, mixed>
Parameters
$qid : int
Return values
array<string|int, mixed>

(title, question text)

getQuickAddConditionForm()

Form used in quick-add modal

protected getQuickAddConditionForm(array<string|int, mixed> $args) : string|array<string|int, string>|null
Parameters
$args : array<string|int, mixed>
Tags
throws
CException
Return values
string|array<string|int, string>|null

getQuickAddData()

Get posted data from quick-add modal form

protected getQuickAddData(LSHttpRequest $request) : array<string|int, mixed>
Parameters
$request : LSHttpRequest
Return values
array<string|int, mixed>

getSurveyIsAnonymized()

protected getSurveyIsAnonymized() : bool
Return values
bool

True if anonymized == 'Y' for this survey

getTheseRows()

protected getTheseRows(array<string|int, mixed> $questionlist) : array<string|int, mixed>
Parameters
$questionlist : array<string|int, mixed>
Return values
array<string|int, mixed>

insertCondition()

Add a new condition

protected insertCondition(array<string|int, mixed> $args) : void
Parameters
$args : array<string|int, mixed>
Tags
todo

Better way than to extract $args

insertConditionAjax()

As insertCondition() but using Ajax, called from quickAddCondition

protected insertConditionAjax(mixed $args) : array<string|int, mixed>
Parameters
$args : mixed
Tags
todo

Code duplication

Return values
array<string|int, mixed>

[message, result], where result = 'success' or 'error'

listquestiongroups()

REFACTORED in LayoutHelper

protected listquestiongroups(array<string|int, mixed> $aData) : mixed

listquestion groups

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

listquestions()

REFACTORED in LayoutHelper

protected listquestions( $aData) : mixed
Parameters
$aData :
Tags
throws
CException

notifications()

Display notifications

protected notifications() : mixed
  • REFACTORED (in LayoutHelper.php)

nsurveysummary()

REFACTORED in LayoutHelper

protected nsurveysummary(array<string|int, mixed> $aData) : mixed

Survey summary

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

organizequestionbar()

Render the save/cancel bar for Organize question groups/questions

protected organizequestionbar(array<string|int, mixed> $aData) : mixed

REFACTORED in LayoutHelper

Parameters
$aData : array<string|int, mixed>
Tags
since
2014-09-30
author

LimeSurvey GmbH

redirectToConditionStart()

After add/delete/etc, redirect to conditions start page

protected redirectToConditionStart(int $qid, int $gid) : void
Parameters
$qid : int
$gid : int

renderCentralContents()

Rendering the subviews and views of renderWrappedTemplate

protected renderCentralContents(string $sAction, array<string|int, mixed>|string $aViewUrls[, array<string|int, mixed> $aData = [] ]) : string
Parameters
$sAction : string
$aViewUrls : array<string|int, mixed>|string
$aData : array<string|int, mixed> = []
Return values
string

renderJSON()

Method to render an array as a json document

protected renderJSON(array<string|int, mixed> $aData[, mixed $success = true ]) : void

REFACTORED in LSBaseController (this one called by a lot of actions in different controllers)

Parameters
$aData : array<string|int, mixed>
$success : mixed = true

renderQuickmenu()

Render the quick-menu that is shown when side-menu is hidden.

protected renderQuickmenu(array<string|int, mixed> $aData) : string

REFACTORED in LayoutHelper

Only show home-icon for now.

Add support for plugin to attach icon elements using event afterQuickMenuLoad

Parameters
$aData : array<string|int, mixed>
Tags
todo

Make quick-menu user configurable

Return values
string

renderWrappedTemplate()

Renders template(s) wrapped in header and footer

protected renderWrappedTemplate([string $sAction = 'conditions' ][, string|array<string|int, mixed> $aViewUrls = array() ][, array<string|int, mixed> $aData = array() ][, bool $sRenderFile = false ]) : void
Parameters
$sAction : string = 'conditions'

Current action, the folder to fetch views from

$aViewUrls : string|array<string|int, mixed> = array()

View url(s)

$aData : array<string|int, mixed> = array()

Data to be passed on. Optional.

$sRenderFile : bool = false
Tags
throws
CHttpException

renumberScenarios()

protected renumberScenarios(array<string|int, mixed> $args) : void
Parameters
$args : array<string|int, mixed>
Tags
throws
CException

requirePostRequest()

Validates that the request method is POST.

protected requirePostRequest() : mixed

This is intended to be used on subactions. When possible (eg. when refactoring a SurveyCommonAction into an actual controller), use 'postOnly' filter instead.

Tags
throws
CHttpException

with 405 status if the request method is not POST.

resetSurveyLogic()

protected resetSurveyLogic( $iSurveyID) : void
Parameters
$iSurveyID :
Tags
throws
CException
throws
CHttpException

route()

Routes the action into correct subaction

protected route(string $sa, array<string|int, string> $get_vars) : mixed
Parameters
$sa : string
$get_vars : array<string|int, string>
Tags
access

protected

shouldShowScenario()

Decides if "Default scenario" should be shown or not

protected shouldShowScenario(string $subaction, int $scenariocount) : bool
Parameters
$subaction : string
$scenariocount : int
Return values
bool

showadminmenu()

showadminmenu() function returns html text for the administration button bar

protected showadminmenu( $aData) : string

REFACTORED (in LayoutHelper.php)

Parameters
$aData :
Tags
access

public

global

string $homedir

global

string $scriptname

global

string $surveyid

global

string $setfont

global

string $imageurl

global

int $surveyid

Return values
string

showHeaders()

Header

protected showHeaders(array<string|int, mixed> $aData[, mixed $sendHTTPHeader = true ]) : mixed
  • REFACTORED (in LayoutHelper.php)
Parameters
$aData : array<string|int, mixed>
$sendHTTPHeader : mixed = true

surveysidemenu()

Show side menu for survey view

protected surveysidemenu(array<string|int, mixed> $aData) : mixed

REFACTORED in LayoutHelper.php

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

all the needed data

titlebar()

REFACTORED in LayoutHelper.php

protected titlebar( $aData) : mixed
Parameters
$aData :
Tags
throws
CException

updateCondition()

Update a condition

protected updateCondition(array<string|int, mixed> $args) : void
Parameters
$args : array<string|int, mixed>

updatenotification()

Display the update notification

protected updatenotification() : mixed

REFACTORED (in LayoutHelper.php)

Tags
throws
CException

addPseudoParams()

Some functions have different parameters, which are just an alias of the usual parameters we're getting in the url. This function just populates those variables so that we don't end up in an error.

private addPseudoParams(array<string|int, mixed> $params) : array<string|int, mixed>

This is also used while rendering wrapped template

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

Parameters to parse and populate

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

Populated parameters


        
On this page

Search results