LimeSurvey API - Master branch

QuestionGroupsAdministrationController 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).
actionAdd()  : void
Render view to add new question group.
actionDelete()  : void
Action to delete a question group.
actionEdit()  : mixed
Renders the html for the question group edit.
actionGetQuestionsForGroup()  : void
Ajax request todo: is this function still in use?
actionImport()  : void
Function responsible to import a question group.
actionImportView()  : void
Import a question group. If user has no permission for that, it redirects to list of questionGroupsAdministration
actionLoadQuestionGroup()  : mixed
Ajax request
actionSaveQuestionGroupData()  : void
Ajax request
actionUpdateOrder()  : false|null|string|array<string|int, string>
Reorder the questiongroups based on the new order in the adminsidepanel (structure tab).
actionView()  : mixed
Renders the html for the question group view.
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
getQuestionGroupServiceClass()  : QuestionGroupService
Returns the QuestionGroupService class which is created with dependency injection
setLanguageData()  : array<string|int, mixed>
Sets language related data of question group into passed array before returning it.
setSidemenuData()  : array<string|int, mixed>
Sets sidemenu parameters to aData array before returning it.
setSurveyIdAndObject()  : array<string|int, mixed>
Sets survey ID and object into passed array

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>

actionAdd()

Render view to add new question group.

public actionAdd(int $surveyid[, string $landOnSideMenuTab = 'structure' ]) : void
Parameters
$surveyid : int
$landOnSideMenuTab : string = 'structure'

actionDelete()

Action to delete a question group.

public actionDelete([bool $asJson = false ]) : void

Could be an ajaxRequest OR a redirect to list question groups

Parameters
$asJson : bool = false

Value of to Render as JSON

Tags
access

public

throws
CHttpException

if not authorized or invalid question group

actionEdit()

Renders the html for the question group edit.

public actionEdit(int $surveyid, int $gid[, string $landOnSideMenuTab = 'structure' ]) : mixed
Parameters
$surveyid : int

survey ID is important here if group does not exist

$gid : int
$landOnSideMenuTab : string = 'structure'
  • @return void

actionGetQuestionsForGroup()

Ajax request todo: is this function still in use?

public actionGetQuestionsForGroup( $iQuestionGroupId) : void

Returns all questions that belong to the group.

Parameters
$iQuestionGroupId :

integer ID of question group

actionImportView()

Import a question group. If user has no permission for that, it redirects to list of questionGroupsAdministration

public actionImportView(int $surveyid[, mixed $landOnSideMenuTab = 'structure' ]) : void
Parameters
$surveyid : int
$landOnSideMenuTab : mixed = 'structure'

actionLoadQuestionGroup()

Ajax request

public actionLoadQuestionGroup(int $surveyid[, null $iQuestionGroupId = null ]) : mixed

Returns the data for a question group. If question group does not exists a new question group will be returned (not saved)

todo: is this function still in use?

Parameters
$surveyid : int
$iQuestionGroupId : null = null

actionSaveQuestionGroupData()

Ajax request

public actionSaveQuestionGroupData(int $sid) : void

Creates and updates question groups

Parameters
$sid : int

ID of survey

Tags
throws
CException

actionUpdateOrder()

Reorder the questiongroups based on the new order in the adminsidepanel (structure tab).

public actionUpdateOrder(int $surveyid) : false|null|string|array<string|int, string>
Parameters
$surveyid : int
Tags
throws
CException
Return values
false|null|string|array<string|int, string>

actionView()

Renders the html for the question group view.

public actionView(int $surveyid, int $gid[, string $landOnSideMenuTab = 'structure' ][, string $mode = 'auto' ]) : mixed
Parameters
$surveyid : int

survey ID is important here for new questiongroups without groupid

$gid : int
$landOnSideMenuTab : string = 'structure'
$mode : string = 'auto'

either 'overview' or 'auto'. The 'overview' mode ignores the 'noViewMode' user setting

  • @return void

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

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

getQuestionGroupServiceClass()

Returns the QuestionGroupService class which is created with dependency injection

private getQuestionGroupServiceClass() : QuestionGroupService
Tags
throws
DependencyException
throws
NotFoundException
Return values
QuestionGroupService

setLanguageData()

Sets language related data of question group into passed array before returning it.

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

setSidemenuData()

Sets sidemenu parameters to aData array before returning it.

private setSidemenuData(array<string|int, mixed> $aData, QuestionGroup $questionGroup, string $landOnSideMenuTab) : array<string|int, mixed>
Parameters
$aData : array<string|int, mixed>
$questionGroup : QuestionGroup
$landOnSideMenuTab : string
Return values
array<string|int, mixed>

setSurveyIdAndObject()

Sets survey ID and object into passed array

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

        
On this page

Search results