LimeSurvey API - Master branch

AssessmentController extends LSBaseController
in package

Class LSBaseController

this controller will have all the necessary methods from the old AdminController

Table of Contents

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
Basic initialiser to the base controller class
accessRules()  : array<string|int, mixed>
It's import to have the accessRules set (security issue).
actionActivate()  : mixed
Activates assessment mode for the survey.
actionDelete()  : void
Deletes an assessment.
actionEdit()  : void
Feed JSON to modal.
actionIndex()  : mixed
Renders th view for: show the list of assessments(if assessment is activated) or the button to activate assessment mode
actionInsertUpdate()  : mixed
Save btn of modal view. This could be update or insert.
createAbsoluteUrl()  : string
Returns an absolute URL based on the given controller and action information.
loadHelper()  : void
Loads a helper
loadLibrary()  : void
Loads a library
run()  : void
Checks for action specific authorization and then executes an action
_checkInstallation()  : void
Check that installation was already done by looking for config.php Will redirect to the installer script if not exists.
beforeRender()  : bool
This part comes from renderWrappedTemplate
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
add()  : mixed
Insert the assessment with multilanguages
collectEditData()  : array<string|int, mixed>
collectGroupData()  : array<string|int, mixed>
return the groups of the current survey
getAssessmentPostData()  : array<string|int, mixed>
prepareDataArray()  : array<string|int, mixed>
setLanguagesBeforeAction()  : mixed
Set languages config for assessment
setSearchParams()  : void
Set search params from Yii grid view.
update()  : void
Updates an assessment. Receives input from POST

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()

Basic initialiser to the base controller class

public __construct(string $id[, CWebModule $module = null ]) : mixed
Parameters
$id : string
$module : CWebModule = null
Tags
access

public

accessRules()

It's import to have the accessRules set (security issue).

public accessRules() : array<string|int, mixed>

Only logged in users should have access to actions. All other permissions should be checked in the action itself.

Return values
array<string|int, mixed>

actionActivate()

Activates assessment mode for the survey.

public actionActivate( $surveyid) : mixed
Parameters
$surveyid :

actionDelete()

Deletes an assessment.

public actionDelete(int $surveyid) : void
Parameters
$surveyid : int

actionEdit()

Feed JSON to modal.

public actionEdit(int $surveyid) : void

Gets the data for the assessment from db and gives it back to the modal view to show the values.

Parameters
$surveyid : int

actionIndex()

Renders th view for: show the list of assessments(if assessment is activated) or the button to activate assessment mode

public actionIndex(int $surveyid) : mixed
Parameters
$surveyid : int

the survey ID

actionInsertUpdate()

Save btn of modal view. This could be update or insert.

public actionInsertUpdate(int $surveyid) : mixed

Redirects to the correct action

Parameters
$surveyid : int

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 functionalty 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

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

_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

beforeRender()

This part comes from renderWrappedTemplate

protected beforeRender(string $view) : bool
Parameters
$view : string

View

Return values
bool

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 mehtod

Tags
access

protected

add()

Insert the assessment with multilanguages

private add( $surveyid) : mixed
Parameters
$surveyid :

collectEditData()

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

collectGroupData()

return the groups of the current survey

private collectGroupData(Survey $oSurvey[, array<string|int, mixed> &$aData = array() ]) : array<string|int, mixed>
Parameters
$oSurvey : Survey
$aData : array<string|int, mixed> = array()
Return values
array<string|int, mixed>

$aGroups groupnames in array

getAssessmentPostData()

private getAssessmentPostData(int $iSurveyID, string $language) : array<string|int, mixed>
Parameters
$iSurveyID : int
$language : string
Return values
array<string|int, mixed>

prepareDataArray()

private prepareDataArray(array<string|int, mixed> &$aData[, bool $collectEdit = false ]) : array<string|int, mixed>
Parameters
$aData : array<string|int, mixed>
$collectEdit : bool = false
Return values
array<string|int, mixed>

setLanguagesBeforeAction()

Set languages config for assessment

private setLanguagesBeforeAction(Survey $oSurvey) : mixed
Parameters
$oSurvey : Survey

update()

Updates an assessment. Receives input from POST

private update(int $iSurveyID) : void
Parameters
$iSurveyID : int

        
On this page

Search results