LimeSurvey API - Master branch

ResponsesController extends LSBaseController
in package

class ResponsesController

Table of Contents

Constants

SELECT_ALL_HARD_CAP  = 5000

Properties

$aData  : array<string|int, mixed>
$navData  : array<string|int, mixed>
This array contains the survey / group / question id used by the menu widget.
$sTemplate  : null
$userId  : int

Methods

__construct()  : mixed
responses constructor.
actionBrowse()  : void
Show responses for survey
actionDelete()  : void
Deletes multiple responses (massive action)
actionDeleteAttachments()  : void
Delete all uploaded files for one response.
actionDeleteSingle()  : void
Deletes a single response and redirects to the gridview.
actionDownloadfile()  : void
Download individual file by response and filename
actionDownloadfiles()  : void
Construct a zip files from a list of response
actionSetFilteredColumns()  : void
Saves the hidden columns for response browsing in the session
actionTime()  : void
Time statistics for responses
actionView()  : void
View a single response in detail
actionViewbytoken()  : void
actionViewquexmlpdf()  : void
View a single response as queXML PDF
beforeRender()  : bool
this is part of renderWrappedTemplate implement in old responses.php
createAbsoluteUrl()  : string
Returns an absolute URL based on the given controller and action information.
filters()  : array<string|int, string>
Set filters for all actions
getActionParams()  : array<string|int, mixed>
Override default getActionParams
loadHelper()  : void
Loads a helper
loadLibrary()  : void
Loads a library
run()  : void
Checks for action specific authorization and then executes an action
setGridDisplay()  : void
Change the value of the max characters to elipsize headers/questions in response grid.
_checkInstallation()  : void
Check that installation was already done by looking for config.php Will redirect to the installer script if not exists.
customInit()  : mixed
loadPageStates()  : array<string|int, mixed>
Loads page states from a hidden input.
renderJSON()  : void
Method to render an array as a json document (this one called by a lot of actions in different controllers)
sessionControl()  : void
Load and set session vars
deleteResponse()  : array<string|int, int>
Deletes a response
getAllResponseIds()  : array<string|int, mixed>
Returns the ids of all responses matching the grid filters posted with the massive action. Used when the selectAll flag is posted ("Select all" in the grid).
getData()  : array<string|int, mixed>
Used to get responses data for browse etc
getSelectAllHardCap()  : int|null
Returns the maximum number of responses a "Select all" massive action may process, or null when unlimited. Capped when responses are expensive to delete: uploaded files to remove or plugins listening to the delete event.
hasHeavyDelete()  : bool
Whether deleting a response involves per-response work (uploaded files to remove or plugins listening to the delete event), which rules out bulk deletion.
zipFiles()  : void
Supply an array with the responseIds and all files will be added to the zip and it will be be spit out on success

Constants

Properties

$aData

public array<string|int, mixed> $aData = []

import for all new controllers/actions (REFACTORING) to pass data before rendering the content

$navData

This array contains the survey / group / question id used by the menu widget.

public array<string|int, mixed> $navData = array()

$sTemplate

public null $sTemplate = \null

this is needed for the preview rendering inside the questioneditor

Methods

__construct()

responses constructor.

public __construct( $controller,  $id) : mixed
Parameters
$controller :
$id :

actionBrowse()

Show responses for survey

public actionBrowse([int $surveyId = 0 ][, int $surveyid = 0 ]) : void
Parameters
$surveyId : int = 0
$surveyid : int = 0

actionDelete()

Deletes multiple responses (massive action)

public actionDelete(int $surveyId) : void
Parameters
$surveyId : int
Tags
access

public

throws
CDbException
throws
CException
throws
CHttpException

actionDeleteAttachments()

Delete all uploaded files for one response.

public actionDeleteAttachments(int $surveyId[, int|null $responseId = null ]) : void
Parameters
$surveyId : int
$responseId : int|null = null
Tags
throws
CException
throws
CHttpException

actionDeleteSingle()

Deletes a single response and redirects to the gridview.

public actionDeleteSingle(int $surveyId, int $responseId) : void
Parameters
$surveyId : int

-- the survey ID

$responseId : int

-- the response id to be deleted

Tags
throws
CDbException
throws
CHttpException

actionDownloadfile()

Download individual file by response and filename

public actionDownloadfile(int $surveyId, int $responseId, int $qid, int $index) : void
Parameters
$surveyId : int

: survey ID

$responseId : int
$qid : int
$index : int
Tags
access

public

throws
CHttpException

actionDownloadfiles()

Construct a zip files from a list of response

public actionDownloadfiles(int $surveyId[, string $responseIds = '' ]) : void
Parameters
$surveyId : int

: survey ID

$responseIds : string = ''

: list of responses as string

Tags
access

public

throws
CException
Return values
void

application/zip

actionSetFilteredColumns()

Saves the hidden columns for response browsing in the session

public actionSetFilteredColumns(int $surveyId) : void
Parameters
$surveyId : int
Tags
access

public

actionTime()

Time statistics for responses

public actionTime(int $surveyId) : void
Parameters
$surveyId : int

actionView()

View a single response in detail

public actionView(int $surveyId, int $id[, string $browseLang = '' ]) : void
Parameters
$surveyId : int
$id : int
$browseLang : string = ''
Tags
throws
CException
throws
CHttpException

actionViewbytoken()

public actionViewbytoken(int $surveyId, string $token) : void
Parameters
$surveyId : int
$token : string

actionViewquexmlpdf()

View a single response as queXML PDF

public actionViewquexmlpdf(int $surveyId, int $id[, string $browseLang = '' ]) : void
Parameters
$surveyId : int
$id : int
$browseLang : string = ''
Tags
throws
CException
throws
CHttpException

beforeRender()

this is part of renderWrappedTemplate implement in old responses.php

public beforeRender(string $view) : bool
Parameters
$view : string
Return values
bool

createAbsoluteUrl()

Returns an absolute URL based on the given controller and action information.

public createAbsoluteUrl(string $route[, array<string|int, mixed> $params = array() ][, string $schema = '' ][, string $ampersand = '&' ]) : string

The functionality was moved to \LSYii_Application::createPublicUrl, to be safe the function remains here.

Parameters
$route : string

the URL route. This should be in the format of 'ControllerID/ActionID'.

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

additional GET parameters (name=>value). Both the name and value will be URL-encoded.

$schema : string = ''

schema to use (e.g. http, https). If empty, the schema used for the current request will be used.

$ampersand : string = '&'

the token separating name-value pairs in the URL.

Return values
string

the constructed URL

filters()

Set filters for all actions

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

getActionParams()

Override default getActionParams

public getActionParams() : array<string|int, mixed>
Return values
array<string|int, mixed>

loadHelper()

Loads a helper

public loadHelper(string $helper) : void
Parameters
$helper : string
Tags
access

public

loadLibrary()

Loads a library

public loadLibrary(string $library) : void
Parameters
$library : string
Tags
access

public

run()

Checks for action specific authorization and then executes an action

public run(string $action) : void

TODO: check the dbupdate mechanism, do we really want to check db update before every action??

Parameters
$action : string
Tags
access

public

throws
CException
throws
CHttpException

setGridDisplay()

Change the value of the max characters to elipsize headers/questions in response grid.

public setGridDisplay(string $displaymode) : void

It's called via ajax request

Parameters
$displaymode : string

_checkInstallation()

Check that installation was already done by looking for config.php Will redirect to the installer script if not exists.

protected _checkInstallation() : void
Tags
access

protected

loadPageStates()

Loads page states from a hidden input.

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

the loaded page states

renderJSON()

Method to render an array as a json document (this one called by a lot of actions in different controllers)

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

sessionControl()

Load and set session vars

protected sessionControl() : void

todo REFACTORING see comments in method

Tags
access

protected

deleteResponse()

Deletes a response

private deleteResponse( $surveyId,  $iResponseId) : array<string|int, int>
Parameters
$surveyId :
$iResponseId :
Tags
throws
CDbException
Return values
array<string|int, int>

getAllResponseIds()

Returns the ids of all responses matching the grid filters posted with the massive action. Used when the selectAll flag is posted ("Select all" in the grid).

private getAllResponseIds(int $surveyId) : array<string|int, mixed>
Parameters
$surveyId : int
Return values
array<string|int, mixed>

getData()

Used to get responses data for browse etc

private getData([int|null $surveyId = null ][, int|null $responseId = null ][, string|null $language = null ]) : array<string|int, mixed>
Parameters
$surveyId : int|null = null
$responseId : int|null = null
$language : string|null = null
Return values
array<string|int, mixed>

getSelectAllHardCap()

Returns the maximum number of responses a "Select all" massive action may process, or null when unlimited. Capped when responses are expensive to delete: uploaded files to remove or plugins listening to the delete event.

private getSelectAllHardCap(int $surveyId) : int|null
Parameters
$surveyId : int
Return values
int|null

hasHeavyDelete()

Whether deleting a response involves per-response work (uploaded files to remove or plugins listening to the delete event), which rules out bulk deletion.

private hasHeavyDelete(int $surveyId) : bool
Parameters
$surveyId : int
Return values
bool

zipFiles()

Supply an array with the responseIds and all files will be added to the zip and it will be be spit out on success

private zipFiles(int $surveyId, array<string|int, mixed> $responseId, string $zipfilename) : void
Parameters
$surveyId : int
$responseId : array<string|int, mixed>
$zipfilename : string

        
On this page

Search results