conditionsaction

Extends \Survey_Common_Action

Condition Controller

This controller performs token actions

package

LimeSurvey

subpackage

Backend

Methods

__construct

__construct($controller = null, $id = null) 
inherited

Arguments

$controller

$id

index

index(string $subaction, int $iSurveyID = null, int $gid = null, int $qid = null) : void

Arguments

$subaction

string

$iSurveyID

int

$gid

int

$qid

int

_showSpeaker

_showSpeaker(string $hinttext) : string
todo

Not used?

Arguments

$hinttext

string

Response

string

html

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

getMethod() : array

Response

array

resetSurveyLogic

resetSurveyLogic($iSurveyID) : void

Arguments

$iSurveyID

Add a new condition

insertCondition(array $args) : void
todo

Better way than to extract $args

params

$args

Arguments

$args

array

As insertCondition() but using Ajax, called from quickAddCondition

insertConditionAjax($args) : array
todo

Code duplication

Arguments

$args

Response

array

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

Used by quick-add form to add conditions async

quickAddCondition() : void

Get posted data from quick-add modal form

getQuickAddData(\LSHttpRequest $request) : array

Arguments

$request

\LSHttpRequest

Response

array

Update a condition

updateCondition(array $args) : void

Arguments

$args

array

renumberScenarios

renumberScenarios(array $args) : void

Arguments

$args

array

copyConditions

copyConditions(array $args) : void

Arguments

$args

array

Switch on action to update/copy/add condition etc

applySubaction(string $p_subaction, array $args) : void

Arguments

$p_subaction

string

$args

array

Renders template(s) wrapped in header and footer

_renderWrappedTemplate(string $sAction = '', string|array $aViewUrls = array(), array $aData = array()) 
inherited

Addition of parameters should be avoided if they can be added to $aData

NOTE FROM LOUIS : We want to remove this function, wich doesn't respect MVC pattern. The work it's doing should be handle by layout files, and subviews inside views. Eg : for route "admin/survey/sa/listquestiongroups/surveyid/282267" the Group controller should use a main layout (with admin menu bar as a widget), then render the list view, in wich the question group bar is called as a subview.

So for now, we try to evacuate all the renderWrappedTemplate logic (if statements, etc.) to subfunctions, then it will be easier to remove. Comments starting with //// indicate how it should work in the future

Arguments

$sAction

string

Current action, the folder to fetch views from

$aViewUrls

string|array

View url(s)

$aData

array

Data to be passed on. Optional.

getTheseRows

getTheseRows(array $questionlist) : array

Arguments

$questionlist

array

Response

array

getPostRows

getPostRows(array $postquestionlist) : array

Arguments

$postquestionlist

array

Response

array

getQuestionTitleAndText

getQuestionTitleAndText(int $qid) : array

Arguments

$qid

int

Response

array

(title, question text)

getSurveyIsAnonymized

getSurveyIsAnonymized() : boolean

Response

boolean

True if anonymized == 'Y' for this survey

getQuestionRows

getQuestionRows(int $qid) : array

Arguments

$qid

int

Response

array

getQuestionList

getQuestionList(int $qid, array $qrows) : array

Arguments

$qid

int

$qrows

array

Response

array

getPostQuestionList

getPostQuestionList(int $qid, array $qrows) : array

Arguments

$qid

int

$qrows

array

Response

array

getCAnswersAndCQuestions

getCAnswersAndCQuestions(array $theserows) : array

Arguments

$theserows

array

Response

array

(cquestion, canswers)

getCopyForm

getCopyForm(int $qid, int $gid, array $conditionsList, array $pquestions) : string

Arguments

$qid

int

$gid

int

$conditionsList

array

$pquestions

array

Response

string

html

Get html for add/edit condition form

getEditConditionForm(array $args) : string

Arguments

$args

array

Response

string

Form used in quick-add modal

getQuickAddConditionForm(array $args) 

Arguments

$args

array

getJsAnswersToSelect

getJsAnswersToSelect(array $cquestions, string $p_cquestions, array $p_canswers) : string

Arguments

$cquestions

array

$p_cquestions

string

Question SGID

$p_canswers

array

E.g. array('A2')

Response

string

JS code

getEDITConditionConst

getEDITConditionConst(string $subaction) : string

Arguments

$subaction

string

Response

string

getEDITConditionRegexp

getEDITConditionRegexp(string $subaction) : string

Arguments

$subaction

string

Response

string

Generates some JS used by form

getEditFormJavascript(string $subaction) : string

Arguments

$subaction

string

Response

string

JS

getEditSourceTab

getEditSourceTab() : string

Response

string

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

getEditTargetTab

getEditTargetTab() : string

Response

string

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

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

getQuestionNavOptions(array $theserows, array $postrows, array $args) : string

Arguments

$theserows

array

$postrows

array

$args

array

Response

string

html

createNavigatorUrl

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

Arguments

$gid

int

Group id

$qid

int

Questino id

Response

string

url

Javascript to match question with answer

getJavascriptForMatching(array $canswers, array $cquestions, boolean $surveyIsAnonymized) : string

Arguments

$canswers

array

$cquestions

array

$surveyIsAnonymized

boolean

Response

string

js

getAttributeName

getAttributeName(string[] $extractedTokenAttr) : string

Arguments

$extractedTokenAttr

string[]

Response

string

getHiddenFields

getHiddenFields(array $rows, string $leftOperandType, string $rightOperandType) : string

Arguments

$rows

array

$leftOperandType

string

$rightOperandType

string

Response

string

html

getAllScenarios

getAllScenarios(int $qid) : \Condition[]

Arguments

$qid

int

Response

\Condition[]

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

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

Arguments

$qid

int

$gid

int

Decides if "Default scenario" should be shown or not

shouldShowScenario(string $subaction, int $scenariocount) : boolean

Arguments

$subaction

string

$scenariocount

int

Response

boolean

Used to calculate size of select box

getQCount(array $cquestions) : int
todo

Not used

Arguments

$cquestions

array

Response

int

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

runWithParams(array $params) 
inherited

Arguments

$params

array

URL Parameters

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.

_addPseudoParams(array $params) : array
inherited

This is also used while rendering wrapped template {@link Survey_Common_Action::_renderWrappedTemplate()}

Arguments

$params

array

Parameters to parse and populate

Response

array

Populated parameters

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

run() 
inherited

Routes the action into correct subaction

route(string $sa, string[] $get_vars) : void
inherited
access

protected

Arguments

$sa

string

$get_vars

string[]

Display the update notification

_updatenotification() 
inherited

Display notifications

_notifications() 
inherited

Survey summary

_nsurveysummary($aData) 
inherited

Arguments

$aData

Header

_showHeaders($aData) 
inherited

Arguments

$aData

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

_showadminmenu($aData) : string
inherited
access

public

global

string $homedir

string $scriptname

string $surveyid

string $setfont

string $imageurl

int $surveyid

Arguments

$aData

Response

string

$adminmenu

_titlebar

_titlebar($aData) 
inherited

Arguments

$aData

_tokenbar

_tokenbar($aData) 
inherited

Arguments

$aData

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

_organizequestionbar(array $aData) 
inherited
since 2014-09-30
author

Olle Haerstedt

Arguments

$aData

array

Shows admin menu for question

_questionbar($aData) 
inherited

Arguments

$aData

Show admin menu for question group view

_nquestiongroupbar(array $aData) 
inherited

Arguments

$aData

array

?

_fullpagebar

_fullpagebar($aData) 
inherited

Arguments

$aData

Shows admin menu for surveys

_surveybar($aData) 
inherited

Arguments

$aData

Show side menu for survey view

_surveysidemenu(array $aData) 
inherited

Arguments

$aData

array

all the needed data

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

renderQuickmenu(array $aData) : string
inherited

Only show home-icon for now.

Add support for plugin to attach icon elements using event afterQuickMenuLoad

todo

Make quick-menu user configurable

Arguments

$aData

array

Response

string

listquestion groups

_listquestiongroups($aData) 
inherited

Arguments

$aData

_listquestions

_listquestions($aData) 
inherited

Arguments

$aData

Show survey summary

_surveysummary($aData) 
inherited

Arguments

$aData

Browse Menu Bar

_browsemenubar($aData) 
inherited

Arguments

$aData

Load menu bar of user group controller.

_userGroupBar($aData) : void
inherited

Arguments

$aData

This function will register a script file, and will choose if it should use the asset manager or not

registerScriptFile(string $cPATH, string $sFile) 
inherited

Arguments

$cPATH

string

: the CONSTANT name of the path of the script file (need to be converted in url if asset manager is not used)

$sFile

string

: the file to publish

This function will register a script file, and will choose if it should use the asset manager or not

registerCssFile(string $sPath, string $sFile) 
inherited

Arguments

$sPath

string

: the type the path of the css file to publish ( public, template, etc)

$sFile

string

: the file to publish

_filterImportedResources

_filterImportedResources(string $extractdir, string $destdir) 
inherited

Arguments

$extractdir

string

$destdir

string

Creates a temporary directory

_tempdir(string $dir, string $prefix = '', int $mode = 448) : string
inherited
access

protected

Arguments

$dir

string

$prefix

string

$mode

int

Response

string

Get extra menus from plugins that are using event beforeAdminMenuRender

fetchExtraMenus(array $aData) : \array<ExtraMenu>
inherited

Arguments

$aData

array

Response

\array

Properties

stringComparisonOperators

stringComparisonOperators : array
var

Type(s)

array

nonStringComparisonOperators

nonStringComparisonOperators : array
var

Type(s)

array

iSurveyID

iSurveyID : int
var

Type(s)

int

language

language : string
var

Type(s)

string

True if there exists a token table for this survey

tokenTableExists : boolean
var

Type(s)

boolean

tokenFieldsAndNames

tokenFieldsAndNames : array
var

Type(s)

array