themes

Extends\Survey_Common_Action

templates

This controller contains common functions for survey related views.

package

LimeSurvey

author
copyright

2011

Methods

__construct

__construct( $controller = null, $id = null)
inherited

Arguments

$controller

$id

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.

_addPseudoParams(array $params): array
inherited

This is also used while rendering wrapped template Survey_Common_Action::_renderWrappedTemplate()

Throws
\CHttpException

Arguments

$params

array

Parameters to parse and populate

Response

array

Populated parameters

Browse Menu Bar

_browsemenubar(array $aData)
inherited

DEPRECATED ??? Never used...

Arguments

$aData

array

_filterImportedResources

_filterImportedResources(string $extractdir,string $destdir): array
inherited
deprecated

use ServiceClass FilterImportedResources instead ... (models/services/)

Arguments

$extractdir

string

$destdir

string

Response

array

_fullpagebar

_fullpagebar( $aData)
inherited

Arguments

$aData

REFACTORED in LayoutHelper

_generaltopbar( $aData)
inherited
Throws
\CException

Arguments

$aData

REFACTORED in LayoutHelper

_generaltopbarAdditions( $aData)
inherited
Throws
\CException

Arguments

$aData

Function that initialises all data and call other functions to load default view.

_initialise(string $templatename,string $screenname,string $editfile,boolean $showsummary = true): 
access

protected

Arguments

$templatename

string

$screenname

string

$editfile

string

$showsummary

boolean

Response

REFACTORED in LayoutHelper

_listquestiongroups(array $aData)
inherited

listquestion groups

Arguments

$aData

array

REFACTORED in LayoutHelper

_listquestions( $aData)
inherited
Throws
\CException

Arguments

$aData

Display notifications

_notifications()
inherited
  • REFACTORED (in LayoutHelper.php)

Show admin menu for question group view

_nquestiongroupbar(array $aData)
inherited

Arguments

$aData

array

?

REFACTORED in LayoutHelper

_nsurveysummary(array $aData)
inherited

Survey summary

Arguments

$aData

array

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

_organizequestionbar(array $aData)
inherited

REFACTORED in LayoutHelper

since 2014-09-30
author

Olle Haerstedt

Arguments

$aData

array

Shows admin menu for question

_questionbar(array $aData)
inherited
deprecated

not in use anymore

Arguments

$aData

array

Renders template(s) wrapped in header and footer

_renderWrappedTemplate(string $sAction = '',array|string $aViewUrls = array(),array $aData = array(),string|boolean $sRenderFile = false)
inherited

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

NOTE FROM LOUIS : We want to remove this function, wich 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 wich 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

Throws
\CHttpException

Arguments

$sAction

string

Current action, the folder to fetch views from

$aViewUrls

array|string

View url(s)

$aData

array

Data to be passed on. Optional.

$sRenderFile

string|boolean

File to be rendered as a layout. Optional.

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

_showadminmenu( $aData): string
inherited

REFACTORED (in LayoutHelper.php)

access

public

global

string $homedir

string $scriptname

string $surveyid

string $setfont

string $imageurl

int $surveyid

Arguments

$aData

Response

string

Header

_showHeaders(array $aData, $sendHTTPHeader = true)
inherited
  • REFACTORED (in LayoutHelper.php)

Arguments

$aData

array

$sendHTTPHeader

Strips file extension

_strip_ext(string $name): string
access

protected

Arguments

$name

string

Response

string

Shows admin menu for surveys

_surveybar(array $aData)
inherited
deprecated

Arguments

$aData

array

Show side menu for survey view

_surveysidemenu(array $aData)
inherited

REFACTORED in LayoutHelper.php

Arguments

$aData

array

all the needed data

REFACTORED in LayoutHelper

_surveysummary(array $aData)
inherited

Show survey summary

Arguments

$aData

array

Load menu bar related to a template.

_templatebar(string $screenname,string $editfile,string $screens,string $tempdir,string $templatename): void
access

protected

deprecated

? 151005

Arguments

$screenname

string

$editfile

string

$screens

string

$tempdir

string

$templatename

string

Load CodeMirror editor and various files information.

_templatesummary(string $templatename,string $screenname,string $editfile, $relativePathEditfile,string $templates,string $files,string $cssfiles, $jsfiles,array $otherfiles,array $myoutput): array
access

protected

Arguments

$templatename

string

$screenname

string

$editfile

string

$relativePathEditfile

$templates

string

$files

string

$cssfiles

string

$jsfiles

$otherfiles

array

$myoutput

array

Response

array

REFACTORED in LayoutHelper.php

_titlebar( $aData)
inherited
Throws
\CException

Arguments

$aData

Display the update notification

_updatenotification()
inherited

REFACTORED (in LayoutHelper.php)

Load menu bar of user group controller.

_userGroupBar(array $aData): void
inherited

REFACTORED (it's in UserGroupController and uses function from Layouthelper->renderMenuBar())

Arguments

$aData

array

Returns content from event beforeSideMenuRender

beforeSideMenuRender(array $aData): string
inherited

REFACTORED in LayoutHelper

Arguments

$aData

array

Response

string

Exports a broken theme

brokentemplatezip(string $templatename): void
access

public

Arguments

$templatename

string

Redirects if demo mode is set.

checkDemoMode(): void

Redirect back if $destdir is not writable or already exists.

checkDestDir(string $destdir,string $sNewDirectoryName,string $themeType): void

Arguments

$destdir

string

$sNewDirectoryName

string

$themeType

string

*

Redirect if file size is too big.

checkFileSizeError( $uploadName = 'the_file'): void

Arguments

$uploadName

Function responsible to delete a template.

delete(): void
access

public

deleteAvailableTheme

deleteAvailableTheme()

deleteBrokenTheme

deleteBrokenTheme()

Exports a deprecated template

deprecatedtemplatezip(string $templatename): void
access

public

Arguments

$templatename

string

Get extra menus from plugins that are using event beforeAdminMenuRender

fetchExtraMenus(array $aData): \array<ExtraMenu>
inherited

Arguments

$aData

array

Response

\array

findConfigXml

findConfigXml(\ZipArchive $zip): string|null

Arguments

$zip

\ZipArchive

Response

string|null

Exports a theme folder NOTE: This function must remain private !!! it doesn't sanitize the $templatePath This should be done by the proxy function (eg: deprecatedtemplatezip(), brokentemplatezip() )

folderzip(string $templatename, $templatePath): void
access

public

Arguments

$templatename

string

$templatePath

Get directory name for $themeType in zip file $src based on <metadata><name> tag

getNewDirectoryName(string $themeType,string $src): string
todo

Move to service class

Same logic for survey theme

Throws
\Exception

Arguments

$themeType

string

'question' or 'survey'

$src

string

Response

string

index

index(): void
inherited

Load default view screen of template controller.

index(string $editfile = '',string $screenname = 'welcome',string $templatename = ''): void
access

public

Arguments

$editfile

string

$screenname

string

$templatename

string

Rendering the subviews and views of _renderWrappedTemplate

renderCentralContents(string $sAction,array|string $aViewUrls,array $aData = array()): string
inherited

Arguments

$sAction

string

$aViewUrls

array|string

$aData

array

Response

string

renderInternal

renderInternal(string $_viewFile_, $_data_ = null, $_return_ = false)
inherited
inheritdoc

Arguments

$_viewFile_

string

$_data_

$_return_

Method to render an array as a json document

renderJSON(array $aData, $success = true): void
inherited

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

Arguments

$aData

array

$success

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

renderQuickmenu(array $aData): string
inherited

REFACTORED in LayoutHelper

Only show home-icon for now.

Add support for plugin to attach icon elements using event afterQuickMenuLoad

todo

Make quick-menu user configurable

Arguments

$aData

array

Response

string

Routes the action into correct subaction

route(string $sa,array<mixed,string> $get_vars): mixed
inherited
access

protected

Arguments

$sa

string

$get_vars

array<mixed,string>

Response

mixed

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

run()
inherited

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

runWithParams(array $params): boolean
inherited

Arguments

$params

array

URL Parameters

Response

boolean

First time user visits template editor, show a notification about manual and forum.

showIntroNotification(): void

Function responsible to copy a template.

templatecopy(): void
access

public

Function responsible to delete a template file.

templatefiledelete(): void
access

public

Function responsible to rename a template(folder).

templaterename(): void
access

public

Function responsible to save the changes made in CodemMirror editor.

templatesavechanges(): void
access

public

Exports a template

templatezip(string $templatename): void
access

public

Arguments

$templatename

string

Retrieves a temporary template file from disk

tmp(mixed $id)

Arguments

$id

mixed

ID of the template file

Responsible to import a template archive.

upload(): void
access

public

Responsible to import a template file.

uploadfile(): void
access

public

Upload template/theme/question theme.

uploadTemplate(): array

Response

array

$aData

uploadTemplateImageFile

uploadTemplateImageFile(string $sTemplateName): boolean

Arguments

$sTemplateName

string

Response

boolean