QuestionEditorController

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

_init

_init()
inherited

accessRules

accessRules()

Action (called by ajaxrequest and returning json) Returns a preformatted json of advanced settings.

actionGetAdvancedOptions(integer $iQuestionId = null,string $sQuestionType = null,boolean $returnArray = false,string $question_template = 'core'): void|array
Throws
\CException

Arguments

$iQuestionId

integer

$sQuestionType

string

$returnArray

boolean

$question_template

string

Response

void|array

actionGetGeneralOptions

actionGetGeneralOptions(integer $iQuestionId = null,string $sQuestionType = null,integer $gid = null,boolean $returnArray = false,string $question_template = 'core'): void|array
todo

document me

Throws
\CException

Arguments

$iQuestionId

integer

$sQuestionType

string

$gid

integer

$returnArray

boolean

$question_template

string

Response

void|array

Returns all languages in a specific survey as a JSON document

actionGetPossibleLanguages(integer $iSurveyId): void

todo: is this action still in use?? where in the frontend?

Arguments

$iSurveyId

integer

Collect initial question data This either creates a temporary question object, or calls a question object from the database

actionGetQuestionData(integer $iQuestionId = null,integer $gid = null,string $type = null): void
Throws
\CException

Arguments

$iQuestionId

integer

$gid

integer

$type

string

Collect the permissions available for a specific question

actionGetQuestionPermissions( $iQuestionId = null): void
Throws
\CException

Arguments

$iQuestionId

Renders the top bar definition for questions as JSON document

actionGetQuestionTopbar(integer $qid = null): false|null|string|array<mixed,string>
Throws
\CException

Arguments

$qid

integer

Response

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

actionGetQuestionTypeInformation

actionGetQuestionTypeInformation(string $sQuestionType): void
todo

document me.

is this used in frontend somewherer? can't find it

Arguments

$sQuestionType

string

Returns a json document containing the question types

actionGetQuestionTypeList(): void

Update the data set in the FE

actionReloadQuestionData(integer $iQuestionId = null,string $type = null,integer $gid = null,string $question_template = 'core'): void
Throws
\CException

Arguments

$iQuestionId

integer

$type

string

$gid

integer

Group id

$question_template

string

Action called by the FE editor when a save is triggered.

actionSaveQuestionData(integer $sid): void
Throws
\CException

Arguments

$sid

integer

Survey id

Renders the main view for question editor.

actionView(integer $surveyid,integer $gid = null,integer $qid = null,string $landOnSideMenuTab = 'structure'): void

Main view function prepares the necessary global js parts and renders the HTML for the question editor

Throws
\CException

Arguments

$surveyid

integer

$gid

integer

$qid

integer

$landOnSideMenuTab

string

Name of the side menu tab. Default behavior is to land on structure tab.

applyAnswerI10N

applyAnswerI10N(\Answer $oAnswer,\Question $oQuestion,array $dataSet): boolean
todo

document me

Throws
\CHttpException

Arguments

$oAnswer

\Answer

$oQuestion

\Question

$dataSet

array

Response

boolean

applyI10N

applyI10N(\Question &$oQuestion,array $dataSet): boolean
todo

document me

Throws
\CHttpException

Arguments

$oQuestion

\Question

$dataSet

array

Response

boolean

applyI10NSubquestion

applyI10NSubquestion(\Question $oQuestion,array $dataSet): boolean
todo

document me

Throws
\CHttpException

Arguments

$oQuestion

\Question

$dataSet

array

Response

boolean

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

cleanAnsweroptions

cleanAnsweroptions(\Question &$oQuestion,array &$dataSet): void
todo

document me

Arguments

$oQuestion

\Question

$dataSet

array

cleanSubquestions

cleanSubquestions(\Question &$oQuestion,array &$dataSet): void
todo

document me.

PHPDoc description

Arguments

$oQuestion

\Question

$dataSet

array

Copies the default value(s) set for a question

copyDefaultAnswers(\Question $oQuestion,integer $oldQid): boolean
Throws
\CHttpException

Arguments

$oQuestion

\Question

$oldQid

integer

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

It returns a preformatted array of advanced settings.

getAdvancedOptions(integer $iQuestionId = null,string $sQuestionType = null,string $question_template = 'core'): array
Throws
\CException
\Exception

Arguments

$iQuestionId

integer

$sQuestionType

string

$question_template

string

Response

array

getCompiledQuestionData

getCompiledQuestionData(\Question &$oQuestion): array
todo

document me.

move this function somewhere else, this should not be part of controller ... (e.g. model)

Arguments

$oQuestion

\Question

Response

array

todo: this should be moved to model, not a controller function .

getCompiledSurveyInfo( $oQuestion): array

..

Arguments

$oQuestion

Response

array

getGeneralOptions

getGeneralOptions(integer $iQuestionId = null,string $sQuestionType = null,integer $gid = null,string $question_template = 'core'): void|array
todo

document me

Throws
\CException

Arguments

$iQuestionId

integer

$sQuestionType

string

$gid

integer

$question_template

string

Response

void|array

Creates a question object This is either an instance of the placeholder model QuestionCreate for new questions, or of Question for already existing ones

getQuestionObject(integer $iQuestionId = null,string $sQuestionType = null,integer $gid = null): \Question

todo: this should be moved to model ...

Throws
\CException

Arguments

$iQuestionId

integer

$sQuestionType

string

$gid

integer

Response

\Question

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

storeAnswerOptions

storeAnswerOptions(\Question &$oQuestion,array $dataSet,boolean $isCopyProcess = false): boolean
todo

document me

Throws
\CHttpException

Arguments

$oQuestion

\Question

$dataSet

array

$isCopyProcess

boolean

Response

boolean

Method to store and filter questionData for a new question

storeNewQuestionData(array $aQuestionData = null,boolean $subquestion = false): \Question

todo: move to model or service class

Throws
\CHttpException

Arguments

$aQuestionData

array

$subquestion

boolean

Response

\Question

storeSubquestions

storeSubquestions(\Question &$oQuestion,array $dataSet,boolean $isCopyProcess = false): boolean
todo

document me.

Throws
\CHttpException

Arguments

$oQuestion

\Question

$dataSet

array

$isCopyProcess

boolean

Response

boolean

unparseAndSetAdvancedOptions

unparseAndSetAdvancedOptions(\Question &$oQuestion,array $dataSet): boolean
todo

document me

Throws
\CHttpException

Arguments

$oQuestion

\Question

$dataSet

array

Response

boolean

unparseAndSetGeneralOptions

unparseAndSetGeneralOptions(\Question &$oQuestion,array $dataSet): boolean
todo

document me

Throws
\CHttpException

Arguments

$oQuestion

\Question

$dataSet

array

Response

boolean

Method to store and filter questionData for editing a question

updateQuestionData(\Question &$oQuestion,array $aQuestionData): \Question
Throws
\CHttpException

Arguments

$oQuestion

\Question

$aQuestionData

array

Response

\Question

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