QuestionGroupsAdministrationController

Extends\LSBaseController

Class LSBaseController

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

package

Default

Methods

Basic initialiser to the base controller class

__construct(string $id,\CWebModule $module = null)
inherited
access

public

Arguments

$id

string

$module

\CWebModule

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

_checkInstallation(): void
inherited
access

protected

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

accessRules(): array

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

Response

array

Render view to add new question group.

actionAdd(integer $surveyid,string $landOnSideMenuTab = 'structure'): void

Arguments

$surveyid

integer

$landOnSideMenuTab

string

Action to delete a question group.

actionDelete(boolean $asJson = false): void

Could be an ajaxRequest OR a redirect to list question groups

access

public

Throws
\CHttpException

if not authorized or invalid question group

Arguments

$asJson

boolean

Value of to Render as JSON

Renders the html for the question group edit.

actionEdit(integer $surveyid,integer $gid,string $landOnSideMenuTab = 'structure')

Arguments

$surveyid

integer

survey id is important here if group does not exist

$gid

integer

$landOnSideMenuTab

string

  • @return void

Ajax request to get the question group topbar as json (see view question_group_topbar)

actionGetQuestionGroupTopBar(integer $sid, $gid = null): mixed
Throws
\CException

Arguments

$sid

integer

ID of survey

$gid

Response

mixed

Ajax request

actionGetQuestionsForGroup( $iQuestionGroupId): void

Returns all questions that belong to the group.

Arguments

$iQuestionGroupId

integer ID of question group

Function responsible to import a question group.

actionImport(): void
access

public

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

actionImportView(integer $surveyid, $landOnSideMenuTab = 'structure'): void

Arguments

$surveyid

integer

$landOnSideMenuTab

Load list question groups view for a specified by $iSurveyID

actionListquestiongroups(integer $surveyid): void

(this action comes from old surveyadmin controller ...)

access

public

Arguments

$surveyid

integer

The survey ID

Ajax request

actionLoadQuestionGroup(integer $surveyid,null $iQuestionGroupId = null)

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?

Arguments

$surveyid

integer

$iQuestionGroupId

null

Ajax request

actionSaveQuestionGroupData(integer $sid): void

Creates and updates question groups

Throws
\CException

Arguments

$sid

integer

ID of survey

Reorder the questiongroups based on the new order in the adminsidepanel

actionUpdateOrder(integer $surveyid): false|null|string|array<mixed,string>
Throws
\CException

Arguments

$surveyid

integer

Response

false|null|string|array<mixed,string>

Renders the html for the question group view.

actionView(integer $surveyid,integer $gid,string $landOnSideMenuTab = 'structure',string $mode = 'auto')

Arguments

$surveyid

integer

survey id is important here for new questiongroups without groupid

$gid

integer

$landOnSideMenuTab

string

$mode

string

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

  • @return void

Stores questiongroup languages.

applyI10N(\QuestionGroup &$oQuestionGroup,array $dataSet): boolean

Arguments

$oQuestionGroup

\QuestionGroup

$dataSet

array

array with languages

Response

boolean

true if ALL languages could be safed, false otherwise

This part comes from renderWrappedTemplate (not the best way to refactoring, but a temporary solution)

beforeRender(string $view): boolean
inherited

todo REFACTORING find all actions that set $aData['surveyid'] and change the layout directly in the action

Arguments

$view

string

Response

boolean

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

createAbsoluteUrl(string $route,array $params = array(),string $schema = '',string $ampersand = '&'): string
inherited

Arguments

$route

string

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

$params

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.

Response

string

the constructed URL

customInit

customInit()
inherited

Method to store and filter questionGroupData for editing a questionGroup

editQuestionGroup(\QuestionGroup &$oQuestionGroup,array $aQuestionGroupData): \QuestionGroup
Throws
\CException

Arguments

$oQuestionGroup

\QuestionGroup

$aQuestionGroupData

array

Response

\QuestionGroup

Returns the QuestionGroup (existing one or new created one)

getQuestionGroupObject(integer $iSurveyId, $iQuestionGroupId = null): \QuestionGroup

Arguments

$iSurveyId

integer

$iQuestionGroupId

Response

\QuestionGroup

Loads a helper

loadHelper(string $helper): void
inherited
access

public

Arguments

$helper

string

Loads a library

loadLibrary(string $library): void
inherited
access

public

Arguments

$library

string

Loads page states from a hidden input.

loadPageStates(): array
inherited

Response

array

the loaded page states

Method to store and filter questionData for a new question

newQuestionGroup(integer $iSurveyId,array $aQuestionGroupData = null): \QuestionGroup
Throws
\CException

Arguments

$iSurveyId

integer

$aQuestionGroupData

array

Response

\QuestionGroup

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

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

Arguments

$aData

array

$success

Checks for action specific authorization and then executes an action

run(string $action): void
inherited

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

access

public

Throws
\CException
\CHttpException

Arguments

$action

string

Load and set session vars

sessionControl(): void
inherited

todo REFACTORING see comments in mehtod

access

protected

Properties

this is needed for the preview rendering inside the questioneditor

sTemplate :null
inherited
var

this is needed for the preview rendering inside the questioneditor

Type(s)

null

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

aData :array
inherited
var

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

Type(s)

array

userId of the logged in user

userId :integer
inherited
var

userId of the logged in user

Type(s)

integer

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

navData :array
inherited
var

Type(s)

array