LimeSurvey API - Master branch

UserRoleController 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
actionApplyEdit()  : string|array<string|int, string>|null
Updates the role itself (name, description).
actionBatchDelete()  : mixed
Batch Delete Massive action for deleting multiple roles at once.
actionBatchExport()  : mixed
Batch Export Massive action to export multiple roles.
actionDelete()  : mixed
Deletes a particular model.
actionEditRoleModal()  : mixed
Returns the modal view for adding/editing a user role
actionImportXML()  : mixed
Imports a role (and the permissions) from a xml-file.
actionIndex()  : mixed
Renders the list of user roles.
actionRenderModalPermissions()  : array<string|int, mixed>|false|mixed|string|array<string|int, string>|void|null
Renders the modal for adding the permissions to the role.
actionRunExport()  : mixed
Creates an xml content/file to export. Opens dialog to save the xml file.
actionSavePermissions()  : array<string|int, mixed>|false|mixed|string|array<string|int, string>|void|null
Save Permissions
actionShowImportXML()  : mixed
Opens modal to import role (xml-file).
actionViewRole()  : array<string|int, mixed>|false|mixed|string|array<string|int, string>|void|null
Displays a particular role.
createAbsoluteUrl()  : string
Returns an absolute URL based on the given controller and action information.
filters()  : array<string|int, mixed>|void
Run filters
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 (not the best way to refactoring, but a temporary solution)
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
applyPermissionFromArray()  : array<string|int, mixed>
Adds permission to a role Needs an array in the form of [PERMISSIONID][PERMISSION]
applyPermissionFromXML()  : array<string|int, mixed>
Apply Permission from XML.
loadModel()  : Permissiontemplates
Returns the data model based on the id. If no entry exists with the given id, then a new model for Permissiontemplates is returned.
renderErrors()  : string
Returns HTML fragment of errors

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

actionApplyEdit()

Updates the role itself (name, description).

public actionApplyEdit() : string|array<string|int, string>|null

Renders a modal view with success/error message.

Tags
throws
CException
throws
CHttpException
Return values
string|array<string|int, string>|null

actionBatchDelete()

Batch Delete Massive action for deleting multiple roles at once.

public actionBatchDelete() : mixed

Renders a modal with deleting results for all roles that should be deleted.

Tags
throws
CDbException
throws
CException

actionBatchExport()

Batch Export Massive action to export multiple roles.

public actionBatchExport() : mixed

Redirects to index.

actionDelete()

Deletes a particular model.

public actionDelete() : mixed

If deletion is successful, the browser will be redirected to the 'admin' page.

actionEditRoleModal()

Returns the modal view for adding/editing a user role

public actionEditRoleModal([int $ptid = 0 ]) : mixed
Parameters
$ptid : int = 0

(optional)

Tags
throws
CException

actionImportXML()

Imports a role (and the permissions) from a xml-file.

public actionImportXML() : mixed

Shows error message in case of

  • file to large
  • wrong file extension
  • error while parsing xml to db Shows success message if role could be imported. Redirects to index in any case.

actionIndex()

Renders the list of user roles.

public actionIndex() : mixed
Tags
throws
CException

actionRenderModalPermissions()

Renders the modal for adding the permissions to the role.

public actionRenderModalPermissions() : array<string|int, mixed>|false|mixed|string|array<string|int, string>|void|null
Tags
throws
CException
Return values
array<string|int, mixed>|false|mixed|string|array<string|int, string>|void|null

actionRunExport()

Creates an xml content/file to export. Opens dialog to save the xml file.

public actionRunExport(int $ptid) : mixed
Parameters
$ptid : int

actionSavePermissions()

Save Permissions

public actionSavePermissions() : array<string|int, mixed>|false|mixed|string|array<string|int, string>|void|null
Tags
throws
CException
Return values
array<string|int, mixed>|false|mixed|string|array<string|int, string>|void|null

actionShowImportXML()

Opens modal to import role (xml-file).

public actionShowImportXML() : mixed
Tags
throws
CException

actionViewRole()

Displays a particular role.

public actionViewRole(int $ptid) : array<string|int, mixed>|false|mixed|string|array<string|int, string>|void|null
Parameters
$ptid : int
Tags
throws
CException
Return values
array<string|int, mixed>|false|mixed|string|array<string|int, string>|void|null

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

filters()

Run filters

public filters() : array<string|int, mixed>|void
Return values
array<string|int, mixed>|void

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 (not the best way to refactoring, but a temporary solution)

protected beforeRender(string $view) : bool

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

Parameters
$view : string
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

applyPermissionFromArray()

Adds permission to a role Needs an array in the form of [PERMISSIONID][PERMISSION]

private applyPermissionFromArray(int $iRoleId, array<string|int, mixed> $aPermissionArray) : array<string|int, mixed>
Parameters
$iRoleId : int
$aPermissionArray : array<string|int, mixed>
Return values
array<string|int, mixed>

applyPermissionFromXML()

Apply Permission from XML.

private applyPermissionFromXML(int $iRoleId, array<string|int, mixed> $oPermissionObject) : array<string|int, mixed>
Parameters
$iRoleId : int

Role ID

$oPermissionObject : array<string|int, mixed>

Permission

Return values
array<string|int, mixed>

loadModel()

Returns the data model based on the id. If no entry exists with the given id, then a new model for Permissiontemplates is returned.

private loadModel(int|null $ptid) : Permissiontemplates
Parameters
$ptid : int|null

the ID of the model to be loaded

Return values
Permissiontemplates

the loaded model

renderErrors()

Returns HTML fragment of errors

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

$errorDiv


        
On this page

Search results