LimeSurvey API - Master branch

LSYii_Application extends CWebApplication
in package
Uses LSApplicationTrait

Implements global config

Table of Contents

Properties

$baseUrl  : string
$bootstrap  : TbApi
$clientScript  : CClientScript
$db  : CDbConnection
$language  : string
$log  : CLogRouter
$pluginManager  : PluginManager
$request  : CHttpRequest
$session  : CHttpSession
$twigRenderer  : LSETwigViewRenderer
$user  : CWebUser
$api  : LimesurveyApi
$config  : mixed
$dbVersion  : int|null
The DB version, used to check if setup is all OK
$plugin  : iPlugin
If a plugin action is accessed through the PluginHelper, store it here.
$currentUserId  : mixed

Methods

__construct()  : mixed
Initiates the application
beforeControllerAction()  : bool
The pre-filter for controller actions.
createController()  : mixed
createPublicUrl()  : string
Creates an absolute URL based on the given controller and action information.
getApi()  : mixed
Get the Api object.
getAvailableConfigs()  : array<string|int, mixed>
Returns the array of available configurations
getConfig()  : string
Returns a config variable from the config
getCurrentUserId()  : int|null
get the current id of connected user, check if user exist before return for security
getPlugin()  : object
Return plugin, if any
getPluginManager()  : PluginManager
Get the pluginManager
getPublicBaseUrl()  : string
Returns the relative URL for the application while considering if a "publicurl" config parameter is set to a valid url
getTwigCustomExtensionsConfig()  : mixed
Look for user custom twig extension in upload directory, and add load their manifest in Twig Application and its sandbox TODO: database uploader + admin interface grid view instead of XML parsing.
init()  : mixed
initLanguage()  : mixed
is_file()  : bool
Check if a file (with a full path) is inside a specific directory
loadConfig()  : void
Loads a config from a file
loadHelper()  : void
Loads a helper
loadLibrary()  : void
Loads a library
onError()  : void
onException()  : void
setConfig()  : void
Sets a configuration variable into the config
setConfigs()  : void
Set the LimeSUrvey config array according to files and DB
setFlashMessage()  : LSYii_Application
Set a 'flash message'.
setLanguage()  : void
For future use, cache the language app wise as well.
setPlugin()  : void
Used by PluginHelper to make the controlling plugin available from everywhere, e.g. from the plugin's models.
createControllerFromShortUrl()  : array<string|int, mixed>|null
Create controller from short url if the route matches a survey alias.
setSessionByDB()  : void
Set the session after start, Limited to DbHttpSession

Properties

$clientScript

public CClientScript $clientScript

CClientScript manages JavaScript and CSS stylesheets for views.

$language

public string $language

Returns the language that the user is using and the application should be targeted to.

$dbVersion

The DB version, used to check if setup is all OK

protected int|null $dbVersion

Methods

__construct()

Initiates the application

public __construct([array<string|int, mixed> $aApplicationConfig = null ]) : mixed
Parameters
$aApplicationConfig : array<string|int, mixed> = null
Tags
access

public

beforeControllerAction()

The pre-filter for controller actions.

public beforeControllerAction(CController $controller, CAction $action) : bool

This method is invoked before the currently requested controller action and all its filters are executed. You may override this method with logic that needs to be done before all controller actions.

Parameters
$controller : CController

the controller

$action : CAction

the action

Return values
bool

whether the action should be executed.

createController()

public createController(mixed $route[, mixed $owner = null ]) : mixed
Parameters
$route : mixed
$owner : mixed = null
Tags
inheritdoc

Special handling for SEO friendly URLs

createPublicUrl()

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

public createPublicUrl(string $route[, array<string|int, mixed> $params = array() ][, string $schema = '' ][, string $ampersand = '&' ]) : string
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

getAvailableConfigs()

Returns the array of available configurations

public getAvailableConfigs() : array<string|int, mixed>
Tags
access

public

Return values
array<string|int, mixed>

getConfig()

Returns a config variable from the config

public getConfig(string $name[, bool|mixed $default = false ]) : string
Parameters
$name : string
$default : bool|mixed = false

Value to return when not found, default is false

Tags
access

public

Return values
string

getCurrentUserId()

get the current id of connected user, check if user exist before return for security

public getCurrentUserId() : int|null
Return values
int|null

user id, 0 mean invalid user

getPlugin()

Return plugin, if any

public getPlugin() : object
Return values
object

getPublicBaseUrl()

Returns the relative URL for the application while considering if a "publicurl" config parameter is set to a valid url

public getPublicBaseUrl([bool $absolute = false ]) : string
Parameters
$absolute : bool = false

whether to return an absolute URL. Defaults to false, meaning returning a relative one.

Return values
string

the relative or the configured public URL for the application

getTwigCustomExtensionsConfig()

Look for user custom twig extension in upload directory, and add load their manifest in Twig Application and its sandbox TODO: database uploader + admin interface grid view instead of XML parsing.

public getTwigCustomExtensionsConfig(mixed $sUsertwigextensionrootdir, mixed $aApplicationConfig) : mixed
Parameters
$sUsertwigextensionrootdir : mixed
$aApplicationConfig : mixed

is_file()

Check if a file (with a full path) is inside a specific directory

public is_file(mixed $filePath[, mixed $baseDir = null ][, mixed $throwException = null ]) : bool
Parameters
$filePath : mixed
$baseDir : mixed = null
$throwException : mixed = null
Return values
bool

loadConfig()

Loads a config from a file

public loadConfig(string $file) : void
Parameters
$file : string
Tags
access

public

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

Libraby name

Tags
access

public

setConfig()

Sets a configuration variable into the config

public setConfig(string $name, mixed $value) : void
Parameters
$name : string
$value : mixed
Tags
access

public

setConfigs()

Set the LimeSUrvey config array according to files and DB

public setConfigs() : void

setFlashMessage()

Set a 'flash message'.

public setFlashMessage(string $message[, string $type = 'success' ]) : LSYii_Application

A flahs message will be shown on the next request and can contain a message to tell that the action was successful or not. The message is displayed and cleared when it is shown in the view using the widget: $this->widget('application.extensions.FlashMessage.FlashMessage');

Parameters
$message : string

The message you want to show on next page load

$type : string = 'success'

Type can be 'success','info','warning','danger','error' which relate to the particular bootstrap alert classes - see http://getbootstrap.com/components/#alerts . Note: Option 'error' is synonymous to 'danger'

Return values
LSYii_Application

Provides a fluent interface

setLanguage()

For future use, cache the language app wise as well.

public setLanguage(string $sLanguage) : void
Parameters
$sLanguage : string
Tags
access

public

setPlugin()

Used by PluginHelper to make the controlling plugin available from everywhere, e.g. from the plugin's models.

public setPlugin( $plugin) : void

Corresponds to Yii::app()->getController()

Parameters
$plugin :

createControllerFromShortUrl()

Create controller from short url if the route matches a survey alias.

private createControllerFromShortUrl(string $route) : array<string|int, mixed>|null
Parameters
$route : string

the route of the request.

Return values
array<string|int, mixed>|null

setSessionByDB()

Set the session after start, Limited to DbHttpSession

private setSessionByDB(mixed $aApplicationConfig) : void
Parameters
$aApplicationConfig : mixed

        
On this page

Search results