ConditionsAction

Extends\SurveyCommonAction

Condition Controller

This controller performs token actions

package

LimeSurvey

subpackage

Backend

Methods

__construct

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

Arguments

$controller

$id

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 SurveyCommonAction::renderWrappedTemplate()

Throws
\CHttpException

Arguments

$params

array

Parameters to parse and populate

Response

array

Populated parameters

Switch on action to update/copy/add condition etc

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

Arguments

$p_subaction

string

$args

array

Returns content from event beforeSideMenuRender

beforeSideMenuRender(array $aData): string
inherited

REFACTORED in LayoutHelper

Arguments

$aData

array

Response

string

copyConditions

copyConditions(array $args): void
Throws
\CException

Arguments

$args

array

createNavigatorUrl

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

Arguments

$gid

integer

Group id

$qid

integer

Questino id

Response

string

url

Get extra menus from plugins that are using event beforeAdminMenuRender

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

Arguments

$aData

array

Response

\array

filterImportedResources

filterImportedResources(string $extractdir,string $destdir): array
inherited
deprecated

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

Arguments

$extractdir

string

$destdir

string

Response

array

Renders the fullpager bar That's the white bar with action buttons example: 'Back' Button

fullpagebar(array $aData)
inherited
Throws
\CException

Arguments

$aData

array

REFACTORED in LayoutHelper

generaltopbar( $aData)
inherited
Throws
\CException

Arguments

$aData

getAllScenarios

getAllScenarios(integer $qid): array<mixed,\CActiveRecord>

Arguments

$qid

integer

Response

array<mixed,\CActiveRecord>

Conditions

getAttributeName

getAttributeName(array<mixed,string> $extractedTokenAttr): string

Arguments

$extractedTokenAttr

array<mixed,string>

Response

string

getCAnswersAndCQuestions

getCAnswersAndCQuestions(array $theserows): array
Throws
\CException

Arguments

$theserows

array

Response

array

(cquestion, canswers)

getCopyForm

getCopyForm(integer $qid,integer $gid,array $conditionsList,array $pquestions): string
Throws
\CException

Arguments

$qid

integer

$gid

integer

$conditionsList

array

$pquestions

array

Response

string

html

getEDITConditionConst

getEDITConditionConst(string $subaction): string

Arguments

$subaction

string

Response

string

Get html for add/edit condition form

getEditConditionForm(array $args): string
Throws
\CException

Arguments

$args

array

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

getHiddenFields

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

Arguments

$rows

array

$leftOperandType

string

$rightOperandType

string

Response

string

html

Javascript to match question with answer

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

Arguments

$canswers

array

$cquestions

array

$surveyIsAnonymized

boolean

Response

string

js

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

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

getMethod(): array

Response

array

getPostQuestionList

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

Arguments

$qid

integer

$qrows

array

Response

array

getPostRows

getPostRows(array $postquestionlist): array

Arguments

$postquestionlist

array

Response

array

Used to calculate size of select box

getQCount(array $cquestions): integer
todo

Not used

Arguments

$cquestions

array

Response

integer

getQuestionList

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

Arguments

$qid

integer

$qrows

array

Response

array

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

getQuestionNavOptions(array $theserows,array $postrows,array $args): string
Throws
\CException

Arguments

$theserows

array

$postrows

array

$args

array

Response

string

html

getQuestionRows

getQuestionRows(): array

Response

array

getQuestionTitleAndText

getQuestionTitleAndText(integer $qid): array

Arguments

$qid

integer

Response

array

(title, question text)

Form used in quick-add modal

getQuickAddConditionForm(array $args): string|array<mixed,string>|null
Throws
\CException

Arguments

$args

array

Response

string|array<mixed,string>|null

Get posted data from quick-add modal form

getQuickAddData(\LSHttpRequest $request): array

Arguments

$request

\LSHttpRequest

Response

array

getSurveyIsAnonymized

getSurveyIsAnonymized(): boolean

Response

boolean

True if anonymized == 'Y' for this survey

getTheseRows

getTheseRows(array $questionlist): array

Arguments

$questionlist

array

Response

array

index

index(): void
inherited

Main Entry Method.

index(string $subaction,integer $iSurveyID = null,integer $gid = null,integer $qid = null): void
Throws
\CException
\CHttpException

Arguments

$subaction

string

Given Subaction

$iSurveyID

integer

Given Survey ID

$gid

integer

Given Group ID

$qid

integer

Given Question ID

Add a new condition

insertCondition(array $args): void
todo

Better way than to extract $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'

REFACTORED in LayoutHelper

listquestiongroups(array $aData)
inherited

listquestion groups

Arguments

$aData

array

REFACTORED in LayoutHelper

listquestions( $aData)
inherited
Throws
\CException

Arguments

$aData

Display notifications

notifications()
inherited
  • REFACTORED (in LayoutHelper.php)

Show admin menu for question group view

nquestiongroupbar(array $aData)
inherited

Arguments

$aData

array

?

REFACTORED in LayoutHelper

nsurveysummary(array $aData)
inherited

Survey summary

Arguments

$aData

array

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

organizequestionbar(array $aData)
inherited

REFACTORED in LayoutHelper

since 2014-09-30
author

LimeSurvey GmbH

Arguments

$aData

array

Shows admin menu for question

questionbar(array $aData)
inherited
deprecated

not in use anymore

Arguments

$aData

array

Used by quick-add form to add conditions async

quickAddCondition(): void
Throws
\CException

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

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

Arguments

$qid

integer

$gid

integer

Rendering the subviews and views of renderWrappedTemplate

renderCentralContents(string $sAction,array|string $aViewUrls,array $aData = array()): string
inherited

Arguments

$sAction

string

$aViewUrls

array|string

$aData

array

Response

string

renderInternal

renderInternal(string $_viewFile_, $_data_ = null, $_return_ = false)
inherited
inheritdoc

Arguments

$_viewFile_

string

$_data_

$_return_

Method to render an array as a json document

renderJSON(array $aData, $success = true): void
inherited

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

Arguments

$aData

array

$success

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

renderQuickmenu(array $aData): string
inherited

REFACTORED in LayoutHelper

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

Renders template(s) wrapped in header and footer

renderWrappedTemplate(string $sAction = '',array|string $aViewUrls = array(),array $aData = array(),string|boolean $sRenderFile = false)
inherited

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

NOTE FROM LOUIS : We want to remove this function, which 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 which 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

Throws
\CHttpException

Arguments

$sAction

string

Current action, the folder to fetch views from

$aViewUrls

array|string

View url(s)

$aData

array

Data to be passed on. Optional.

$sRenderFile

string|boolean

File to be rendered as a layout. Optional.

renumberScenarios

renumberScenarios(array $args): void
Throws
\CException

Arguments

$args

array

Validates that the request method is POST.

requirePostRequest()
inherited

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

Throws
\CHttpException

with 405 status if the request method is not POST.

resetSurveyLogic

resetSurveyLogic( $iSurveyID): void
Throws
\CException
\CHttpException

Arguments

$iSurveyID

Routes the action into correct subaction

route(string $sa,array<mixed,string> $get_vars): mixed
inherited
access

protected

Arguments

$sa

string

$get_vars

array<mixed,string>

Response

mixed

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

run()
inherited

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

runWithParams(array $params): boolean
inherited

Arguments

$params

array

URL Parameters

Response

boolean

Decides if "Default scenario" should be shown or not

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

Arguments

$subaction

string

$scenariocount

integer

Response

boolean

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

showadminmenu( $aData): string
inherited

REFACTORED (in LayoutHelper.php)

access

public

global

string $homedir

string $scriptname

string $surveyid

string $setfont

string $imageurl

int $surveyid

Arguments

$aData

Response

string

Header

showHeaders(array $aData, $sendHTTPHeader = true)
inherited
  • REFACTORED (in LayoutHelper.php)

Arguments

$aData

array

$sendHTTPHeader

Shows admin menu for surveys

surveybar(array $aData)
inherited
deprecated

Arguments

$aData

array

Renders the green bar with page title Also called SurveyManagerBar

surveyManagerBar(array $aData)
inherited
todo

Needs to be removed later. Duplication in LayoutHelper.

Arguments

$aData

array

Show side menu for survey view

surveysidemenu(array $aData)
inherited

REFACTORED in LayoutHelper.php

Arguments

$aData

array

all the needed data

REFACTORED in LayoutHelper.php

titlebar( $aData)
inherited
Throws
\CException

Arguments

$aData

Update a condition

updateCondition(array $args): void

Arguments

$args

array

Display the update notification

updatenotification()
inherited

REFACTORED (in LayoutHelper.php)

Load menu bar of user group controller.

userGroupBar(array $aData): void
inherited

REFACTORED (it's in UserGroupController and uses function from Layouthelper->renderMenuBar())

Arguments

$aData

array

Properties

stringComparisonOperators

stringComparisonOperators :array
var

Type(s)

array

nonStringComparisonOperators

nonStringComparisonOperators :array
var

Type(s)

array

iSurveyID

iSurveyID :integer
var

Type(s)

integer

language

language :string
var

Type(s)

string

True if there exists a survey participants table for this survey

tokenTableExists :boolean
var

Type(s)

boolean

tokenFieldsAndNames

tokenFieldsAndNames :array
var

Type(s)

array