LimeSurvey API - Master branch

TutorialEntryController extends SurveyCommonAction
in package

Survey Common Action

This controller contains common functions for survey related views.

Table of Contents

Methods

__construct()  : mixed
accessRules()  : array<string|int, mixed>
Specifies the access control rules.
actionAdmin()  : mixed
Manages all models.
actionCreate()  : mixed
Creates a new model.
actionDelete()  : mixed
Deletes a particular model.
actionUpdate()  : mixed
Updates a particular model.
actionView()  : mixed
Displays a particular model.
filters()  : array<string|int, string>
getCreateMenu()  : Menu
REFACTORED in LayoutHelper (necessary to have it here, until all controllers have been refactored...)
index()  : void
index()  : mixed
loadModel()  : TutorialEntry
Returns the data model based on the primary key given in the GET variable.
renderInternal()  : mixed
run()  : mixed
Action classes require them to have a run method. We reroute it to index if called.
runWithParams()  : bool
Override runWithParams() implementation in CAction to help us parse requests with subactions.
view()  : mixed
beforeSideMenuRender()  : string
Returns content from event beforeSideMenuRender
fetchExtraMenus()  : array<string|int, ExtraMenu>
Get extra menus from plugins that are using event beforeAdminMenuRender
listquestiongroups()  : mixed
REFACTORED in LayoutHelper
listquestions()  : mixed
REFACTORED in LayoutHelper
notifications()  : mixed
Display notifications
nsurveysummary()  : mixed
REFACTORED in LayoutHelper
organizequestionbar()  : mixed
Render the save/cancel bar for Organize question groups/questions
performAjaxValidation()  : mixed
Performs the AJAX validation.
renderCentralContents()  : string
Rendering the subviews and views of renderWrappedTemplate
renderJSON()  : void
Method to render an array as a json document
renderQuickmenu()  : string
Render the quick-menu that is shown when side-menu is hidden.
renderWrappedTemplate()  : mixed
Renders template(s) wrapped in header and footer
requirePostRequest()  : mixed
Validates that the request method is POST.
route()  : mixed
Routes the action into correct subaction
showadminmenu()  : string
showadminmenu() function returns html text for the administration button bar
showHeaders()  : mixed
Header
titlebar()  : mixed
REFACTORED in LayoutHelper.php
updatenotification()  : string|void
Display the update notification
addPseudoParams()  : array<string|int, mixed>
Some functions have different parameters, which are just an alias of the usual parameters we're getting in the url. This function just populates those variables so that we don't end up in an error.

Methods

__construct()

public __construct([mixed $controller = null ][, mixed $id = null ]) : mixed
Parameters
$controller : mixed = null
$id : mixed = null

accessRules()

Specifies the access control rules.

public accessRules() : array<string|int, mixed>

This method is used by the 'accessControl' filter.

Return values
array<string|int, mixed>

access control rules

actionCreate()

Creates a new model.

public actionCreate() : mixed

If creation is successful, the browser will be redirected to the 'view' page.

actionDelete()

Deletes a particular model.

public actionDelete(int $id) : mixed

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

Parameters
$id : int

the ID of the model to be deleted

actionUpdate()

Updates a particular model.

public actionUpdate(int $id) : mixed

If update is successful, the browser will be redirected to the 'view' page.

Parameters
$id : int

the ID of the model to be updated

actionView()

Displays a particular model.

public actionView(int $id) : mixed
Parameters
$id : int

the ID of the model to be displayed

filters()

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

action filters

getCreateMenu()

REFACTORED in LayoutHelper (necessary to have it here, until all controllers have been refactored...)

public getCreateMenu() : Menu

Returns extra menu for the new create process (including create, copy, and import survey).

Return values
Menu

loadModel()

Returns the data model based on the primary key given in the GET variable.

public loadModel(int $id) : TutorialEntry

If the data model is not found, an HTTP exception will be raised.

Parameters
$id : int

the ID of the model to be loaded

Tags
throws
CHttpException
Return values
TutorialEntry

the loaded model

renderInternal()

public renderInternal(string $_viewFile_[, mixed $_data_ = null ][, mixed $_return_ = false ]) : mixed
Parameters
$_viewFile_ : string
$_data_ : mixed = null
$_return_ : mixed = false
Tags
inheritdoc

run()

Action classes require them to have a run method. We reroute it to index if called.

public run() : mixed

runWithParams()

Override runWithParams() implementation in CAction to help us parse requests with subactions.

public runWithParams(array<string|int, mixed> $params) : bool
Parameters
$params : array<string|int, mixed>

URL Parameters

Return values
bool

beforeSideMenuRender()

Returns content from event beforeSideMenuRender

protected beforeSideMenuRender(array<string|int, mixed> $aData) : string

REFACTORED in LayoutHelper

Parameters
$aData : array<string|int, mixed>
Return values
string

fetchExtraMenus()

Get extra menus from plugins that are using event beforeAdminMenuRender

protected fetchExtraMenus(array<string|int, mixed> $aData) : array<string|int, ExtraMenu>
Parameters
$aData : array<string|int, mixed>
Return values
array<string|int, ExtraMenu>

listquestiongroups()

REFACTORED in LayoutHelper

protected listquestiongroups(array<string|int, mixed> $aData) : mixed

listquestion groups

Parameters
$aData : array<string|int, mixed>

listquestions()

REFACTORED in LayoutHelper

protected listquestions( $aData) : mixed
Parameters
$aData :
Tags
throws
CException

notifications()

Display notifications

protected notifications() : mixed
  • REFACTORED (in LayoutHelper.php)

nsurveysummary()

REFACTORED in LayoutHelper

protected nsurveysummary(array<string|int, mixed> $aData) : mixed

Survey summary

Parameters
$aData : array<string|int, mixed>

organizequestionbar()

Render the save/cancel bar for Organize question groups/questions

protected organizequestionbar(array<string|int, mixed> $aData) : mixed

REFACTORED in LayoutHelper

Parameters
$aData : array<string|int, mixed>
Tags
since
2014-09-30
author

LimeSurvey GmbH

renderCentralContents()

Rendering the subviews and views of renderWrappedTemplate

protected renderCentralContents(string $sAction, array<string|int, mixed>|string $aViewUrls[, array<string|int, mixed> $aData = [] ]) : string
Parameters
$sAction : string
$aViewUrls : array<string|int, mixed>|string
$aData : array<string|int, mixed> = []
Return values
string

renderJSON()

Method to render an array as a json document

protected renderJSON(array<string|int, mixed> $aData[, mixed $success = true ]) : void

REFACTORED in LSBaseController (this one called by a lot of actions in different controllers)

Parameters
$aData : array<string|int, mixed>
$success : mixed = true

renderQuickmenu()

Render the quick-menu that is shown when side-menu is hidden.

protected renderQuickmenu(array<string|int, mixed> $aData) : string

REFACTORED in LayoutHelper

Only show home-icon for now.

Add support for plugin to attach icon elements using event afterQuickMenuLoad

Parameters
$aData : array<string|int, mixed>
Tags
todo

Make quick-menu user configurable

Return values
string

renderWrappedTemplate()

Renders template(s) wrapped in header and footer

protected renderWrappedTemplate([string $sAction = '' ][, array<string|int, mixed>|string $aViewUrls = array() ][, array<string|int, mixed> $aData = array() ][, string|bool $sRenderFile = false ]) : mixed

Addition of parameters should be avoided if they can be added to $aData

NOTE FROM LOUIS : We want to remove this function, which doesn't respect MVC pattern. The work it's doing should be handle by layout files, and subviews inside views. Eg : for route "admin/survey/sa/listquestiongroups/surveyid/282267" the Group controller should use a main layout (with admin menu bar as a widget), then render the list view, in which the question group bar is called as a subview.

So for now, we try to evacuate all the renderWrappedTemplate logic (if statements, etc.) to subfunctions, then it will be easier to remove. Comments starting with //// indicate how it should work in the future

Parameters
$sAction : string = ''

Current action, the folder to fetch views from

$aViewUrls : array<string|int, mixed>|string = array()

View url(s)

$aData : array<string|int, mixed> = array()

Data to be passed on. Optional.

$sRenderFile : string|bool = false

File to be rendered as a layout. Optional.

Tags
throws
CHttpException

requirePostRequest()

Validates that the request method is POST.

protected requirePostRequest() : mixed

This is intended to be used on subactions. When possible (eg. when refactoring a SurveyCommonAction into an actual controller), use 'postOnly' filter instead.

Tags
throws
CHttpException

with 405 status if the request method is not POST.

route()

Routes the action into correct subaction

protected route(string $sa, array<string|int, string> $get_vars) : mixed
Parameters
$sa : string
$get_vars : array<string|int, string>
Tags
access

protected

showadminmenu()

showadminmenu() function returns html text for the administration button bar

protected showadminmenu( $aData) : string

REFACTORED (in LayoutHelper.php)

Parameters
$aData :
Tags
access

public

global

string $homedir

global

string $scriptname

global

string $surveyid

global

string $setfont

global

string $imageurl

global

int $surveyid

Return values
string

showHeaders()

Header

protected showHeaders(array<string|int, mixed> $aData[, mixed $sendHTTPHeader = true ]) : mixed
  • REFACTORED (in LayoutHelper.php)
Parameters
$aData : array<string|int, mixed>
$sendHTTPHeader : mixed = true

titlebar()

REFACTORED in LayoutHelper.php

protected titlebar( $aData) : mixed
Parameters
$aData :
Tags
throws
CException

updatenotification()

Display the update notification

protected updatenotification() : string|void

REFACTORED (in LayoutHelper.php)

Passes security_update_available and stability_labels to the notification view.

Tags
throws
CException
Return values
string|void

Rendered notification HTML, or void if no update

addPseudoParams()

Some functions have different parameters, which are just an alias of the usual parameters we're getting in the url. This function just populates those variables so that we don't end up in an error.

private addPseudoParams(array<string|int, mixed> $params) : array<string|int, mixed>

This is also used while rendering wrapped template

Parameters
$params : array<string|int, mixed>

Parameters to parse and populate

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

Populated parameters


        
On this page

Search results