LSYii_Application

Extends\CWebApplication

Implements global config

package

Default

Methods

Initiates the application

__construct(array $aApplicationConfig = null)
access

public

Arguments

$aApplicationConfig

array

The pre-filter for controller actions.

beforeControllerAction(\CController $controller,\CAction $action): boolean

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.

Arguments

$controller

\CController

the controller

$action

\CAction

the action

Response

boolean

whether the action should be executed.

createController

createController( $route, $owner = null)
inheritdoc

Special handling for SEO friendly URLs

Arguments

$route

$owner

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

createControllerFromShortUrl(string $route): \array<mixed>|null

Arguments

$route

string

the route of the request.

Response

\array|null

Get the Api object.

getApi()

Returns a config variable from the config

getConfig(string $name,boolean|mixed $default = false): string
access

public

Arguments

$name

string

$default

boolean|mixed

Value to return when not found, default is false

Response

string

Return plugin, if any

getPlugin(): object

Response

object

Get the pluginManager

getPluginManager(): \PluginManager

Response

\PluginManager

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.

getTwigCustomExtensionsConfig( $sUsertwigextensionrootdir, $aApplicationConfig)
var

$baseConfig['usertwigextensionrootdir']

the application configuration

Arguments

$sUsertwigextensionrootdir

$aApplicationConfig

Handles "friendly" exceptions by setting a flash message and redirecting.

handleFriendlyException(\LSUserException $exception): void

If the exception doesn't specify a redirect URL, the referrer is used.

Arguments

$exception

\LSUserException

Handles specific exception cases, like "user friendly" exceptions and exceptions on ajax requests.

handleSpecificExceptions(\CException $exception): void

Arguments

$exception

\CException

init

init()

initLanguage

initLanguage()

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

is_file( $filePath, $baseDir = null, $throwException = null): boolean
var

complete file path

the directory where it must be, default to upload dir

if security issue Throw Exception

Arguments

$filePath

$baseDir

$throwException

Response

boolean

Loads a config from a file

loadConfig(string $file): void
access

public

Arguments

$file

string

Loads a helper

loadHelper(string $helper): void
access

public

Arguments

$helper

string

Loads a library

loadLibrary(string $library): void
access

public

Arguments

$library

string

Libraby name

onException

onException(\CExceptionEvent $event): void
see http://www.yiiframework.com/doc/api/1.1/CApplication#onException-detail

Set surveys/error for 404 error

Arguments

$event

\CExceptionEvent

Outputs an exception as JSON.

outputJsonError(\CHttpException $exception): void

Arguments

$exception

\CHttpException

Sets a configuration variable into the config

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

public

Arguments

$name

string

$value

mixed

Set the LimeSUrvey config array according to files and DB

setConfigs(): void

Set a 'flash message'.

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');

Arguments

$message

string

The message you want to show on next page load

$type

string

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'

Response

\LSYii_Application

Provides a fluent interface

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

setLanguage(string $sLanguage): void
access

public

Arguments

$sLanguage

string

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

setPlugin( $plugin): void

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

Arguments

$plugin

Set the session after start, Limited to DbHttpSession

setSessionByDB( $aApplicationConfig): void

Arguments

$aApplicationConfig

Properties

config

config :

Type(s)

api

api :\LimeSurvey\PluginManager\LimesurveyApi

If a plugin action is accessed through the PluginHelper, store it here.

plugin :\LimeSurvey\PluginManager\iPlugin

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

dbVersion :integer|null
var

Type(s)

integer|null

log

log :\CLogRouter

Log router component.

Type(s)

\CLogRouter

language

language :string

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

Type(s)

string

clientScript

clientScript :\CClientScript

CClientScript manages JavaScript and CSS stylesheets for views.

Type(s)

\CClientScript

request

request :\CHttpRequest

The request component.

Type(s)

\CHttpRequest

db

db :\CDbConnection

The database connection.

Type(s)

\CDbConnection

baseUrl

baseUrl :string

The relative URL for the application.

Type(s)

string

user

user :\CWebUser

The user session information.

Type(s)

\CWebUser

twigRenderer

twigRenderer :\LSETwigViewRenderer

Twig rendering plugin

Type(s)

\LSETwigViewRenderer

pluginManager

pluginManager :\PluginManager

The LimeSurvey Plugin manager

Type(s)

\PluginManager

bootstrap

bootstrap :\TbApi

The bootstrap renderer

Type(s)

\TbApi

session

session :\CHttpSession

The HTTP session

Type(s)

\CHttpSession