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
$userId
protected
int
$userId
= 0
userId of the logged in user
Methods
__construct()
Basic initialiser to the base controller class
public
__construct(string $id[, CWebModule $module = null ]) : mixed
Parameters
- $id : string
- $module : CWebModule = null
Tags
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
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
actionImport()
Function responsible to import a question group.
public
actionImport() : void
Tags
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
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
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
loadLibrary()
Loads a library
public
loadLibrary(string $library) : void
Parameters
- $library : string
Tags
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
_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
beforeRender()
This part comes from renderWrappedTemplate
protected
beforeRender(string $view) : bool
Parameters
- $view : string
Return values
boolcustomInit()
protected
customInit() : mixed
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
getQuestionGroupServiceClass()
Returns the QuestionGroupService class which is created with dependency injection
private
getQuestionGroupServiceClass() : QuestionGroupService
Tags
Return values
QuestionGroupServicesetLanguageData()
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