Themes
extends SurveyCommonAction
in package
templates
Tags
Table of Contents
Methods
- __construct() : mixed
- brokentemplatezip() : void
- Exports a broken theme
- delete() : void
- Function responsible to delete a template while inside the theme editor
- deleteAvailableTheme() : void
- Deletes a survey theme from the "Available survey themes", after it has been uninstalled TemplateConfig::uninstall.
- deleteBrokenTheme() : mixed
- deprecatedtemplatezip() : void
- Exports a deprecated template
- findConfigXml() : string|null
- index() : void
- index() : void
- Load default view screen of template controller.
- questionbar() : mixed
- Shows admin menu for question
- 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.
- surveybar() : mixed
- Shows admin menu for surveys
- templatecopy() : void
- Function responsible to copy a template.
- templatefiledelete() : void
- Function responsible to delete a template file.
- templaterename() : void
- Function responsible to rename a template(folder).
- templatesavechanges() : void
- Function responsible to save the changes made in CodemMirror editor.
- templatezip() : void
- Exports a template
- tmp() : mixed
- Retrieves a temporary template file from disk
- upload() : void
- Responsible to import a template archive.
- uploadfile() : void
- Responsible to import a template file.
- beforeSideMenuRender() : string
- Returns content from event beforeSideMenuRender
- checkDemoMode() : void
- Redirects if demo mode is set.
- checkDestDir() : void
- Redirect back if $destdir is not writable or already exists.
- checkFileSizeError() : void
- Redirect if file size is too big.
- fetchExtraMenus() : array<string|int, ExtraMenu>
- Get extra menus from plugins that are using event beforeAdminMenuRender
- filterImportedResources() : array<string|int, mixed>
- getNewDirectoryName() : string
- Get directory name for $themeType in zip file $src based on <metadata><name> tag
- initialise() : void
- Function that initialises all data and call other functions to load default view.
- 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
- 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
- showIntroNotification() : void
- First time user visits template editor, show a notification about manual and forum.
- stripExt() : string
- Strips file extension
- surveysidemenu() : mixed
- Show side menu for survey view
- templatebar() : void
- Load menu bar related to a template.
- templatesummary() : array<string|int, mixed>
- Load CodeMirror editor and various files information.
- titlebar() : mixed
- REFACTORED in LayoutHelper.php
- updatenotification() : mixed
- Display the update notification
- uploadTemplate() : array<string|int, mixed>
- Upload template/theme/question theme.
- uploadTemplateImageFile() : bool
- 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.
- folderzip() : void
- 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() )
- getQuestionThemeInstaller() : QuestionThemeInstaller
Methods
__construct()
public
__construct([mixed $controller = null ][, mixed $id = null ]) : mixed
Parameters
- $controller : mixed = null
- $id : mixed = null
brokentemplatezip()
Exports a broken theme
public
brokentemplatezip(string $templatename) : void
Parameters
- $templatename : string
Tags
delete()
Function responsible to delete a template while inside the theme editor
public
delete() : void
Tags
deleteAvailableTheme()
Deletes a survey theme from the "Available survey themes", after it has been uninstalled TemplateConfig::uninstall.
public
deleteAvailableTheme() : void
This will delete all local files.
Tags
deleteBrokenTheme()
public
deleteBrokenTheme() : mixed
deprecatedtemplatezip()
Exports a deprecated template
public
deprecatedtemplatezip(string $templatename) : void
Parameters
- $templatename : string
Tags
findConfigXml()
public
findConfigXml(ZipArchive $zip) : string|null
Parameters
- $zip : ZipArchive
Return values
string|nullindex()
public
index() : void
index()
Load default view screen of template controller.
public
index([string $editfile = '' ][, string $screenname = 'welcome' ][, string $templatename = '' ]) : void
Parameters
- $editfile : string = ''
- $screenname : string = 'welcome'
- $templatename : string = ''
Tags
questionbar()
Shows admin menu for question
public
questionbar(array<string|int, mixed> $aData) : mixed
Parameters
- $aData : array<string|int, mixed>
Tags
renderInternal()
public
renderInternal(string $_viewFile_[, mixed $_data_ = null ][, mixed $_return_ = false ]) : mixed
Parameters
- $_viewFile_ : string
- $_data_ : mixed = null
- $_return_ : mixed = false
Tags
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(mixed $params) : bool
Parameters
- $params : mixed
-
URL Parameters
Return values
boolsurveybar()
Shows admin menu for surveys
public
surveybar(array<string|int, mixed> $aData) : mixed
Parameters
- $aData : array<string|int, mixed>
Tags
templatecopy()
Function responsible to copy a template.
public
templatecopy() : void
Tags
templatefiledelete()
Function responsible to delete a template file.
public
templatefiledelete() : void
Tags
templaterename()
Function responsible to rename a template(folder).
public
templaterename() : void
Tags
templatesavechanges()
Function responsible to save the changes made in CodemMirror editor.
public
templatesavechanges() : void
Tags
templatezip()
Exports a template
public
templatezip(string $templatename) : void
Parameters
- $templatename : string
Tags
tmp()
Retrieves a temporary template file from disk
public
tmp(mixed $id) : mixed
Parameters
- $id : mixed
-
ID of the template file
upload()
Responsible to import a template archive.
public
upload() : void
Tags
uploadfile()
Responsible to import a template file.
public
uploadfile() : void
Tags
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
stringcheckDemoMode()
Redirects if demo mode is set.
protected
checkDemoMode() : void
checkDestDir()
Redirect back if $destdir is not writable or already exists.
protected
checkDestDir(string $destdir, string $sNewDirectoryName, string $themeType) : void
Parameters
- $destdir : string
- $sNewDirectoryName : string
- $themeType : string
-
checkFileSizeError()
Redirect if file size is too big.
protected
checkFileSizeError([mixed $uploadName = 'the_file' ]) : void
Parameters
- $uploadName : mixed = 'the_file'
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>filterImportedResources()
protected
filterImportedResources(string $extractdir, string $destdir) : array<string|int, mixed>
Parameters
- $extractdir : string
- $destdir : string
Tags
Return values
array<string|int, mixed>getNewDirectoryName()
Get directory name for $themeType in zip file $src based on <metadata><name> tag
protected
getNewDirectoryName(string $themeType, string $src) : string
Parameters
- $themeType : string
-
'question' or 'survey'
- $src : string
Tags
Return values
stringinitialise()
Function that initialises all data and call other functions to load default view.
protected
initialise(string $templatename, string $screenname, string $editfile[, bool $showsummary = true ]) : void
Parameters
- $templatename : string
- $screenname : string
- $editfile : string
- $showsummary : bool = true
Tags
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
Tags
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
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
stringrenderJSON()
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
Return values
stringrenderWrappedTemplate()
Renders template(s) wrapped in header and footer
protected
renderWrappedTemplate([string $sAction = 'themes' ][, string|array<string|int, mixed> $aViewUrls = array() ][, array<string|int, mixed> $aData = array() ][, mixed $sRenderFile = false ]) : mixed
Parameters
- $sAction : string = 'themes'
-
Current action, the folder to fetch views from
- $aViewUrls : string|array<string|int, mixed> = array()
-
View url(s)
- $aData : array<string|int, mixed> = array()
-
Data to be passed on. Optional.
- $sRenderFile : mixed = false
-
File to be rendered as a layout. Optional.
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
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
showadminmenu()
showadminmenu() function returns html text for the administration button bar
protected
showadminmenu( $aData) : string
REFACTORED (in LayoutHelper.php)
Parameters
Tags
Return values
stringshowHeaders()
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
showIntroNotification()
First time user visits template editor, show a notification about manual and forum.
protected
showIntroNotification() : void
stripExt()
Strips file extension
protected
stripExt(string $name) : string
Parameters
- $name : string
Tags
Return values
stringsurveysidemenu()
Show side menu for survey view
protected
surveysidemenu(array<string|int, mixed> $aData) : mixed
REFACTORED in LayoutHelper.php
Parameters
- $aData : array<string|int, mixed>
-
all the needed data
templatebar()
Load menu bar related to a template.
protected
templatebar(string $screenname, string $editfile, string $screens, string $tempdir, string $templatename) : void
Parameters
- $screenname : string
- $editfile : string
- $screens : string
- $tempdir : string
- $templatename : string
Tags
templatesummary()
Load CodeMirror editor and various files information.
protected
templatesummary(string $templatename, string $screenname, string $editfile, mixed $relativePathEditfile, string $templates, string $files, string $cssfiles, mixed $jsfiles, array<string|int, mixed> $otherfiles, array<string|int, mixed> $myoutput) : array<string|int, mixed>
Parameters
- $templatename : string
- $screenname : string
- $editfile : string
- $relativePathEditfile : mixed
- $templates : string
- $files : string
- $cssfiles : string
- $jsfiles : mixed
- $otherfiles : array<string|int, mixed>
- $myoutput : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>titlebar()
REFACTORED in LayoutHelper.php
protected
titlebar( $aData) : mixed
Parameters
Tags
updatenotification()
Display the update notification
protected
updatenotification() : mixed
REFACTORED (in LayoutHelper.php)
Tags
uploadTemplate()
Upload template/theme/question theme.
protected
uploadTemplate() : array<string|int, mixed>
Return values
array<string|int, mixed> —$aData
uploadTemplateImageFile()
protected
uploadTemplateImageFile(string $sTemplateName) : bool
Parameters
- $sTemplateName : string
Return values
booladdPseudoParams()
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>
Parameters
- $params : array<string|int, mixed>
-
Parameters to parse and populate
Tags
Return values
array<string|int, mixed> —Populated parameters
folderzip()
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() )
private
folderzip(string $templatename, mixed $templatePath) : void
Parameters
- $templatename : string
- $templatePath : mixed
Tags
getQuestionThemeInstaller()
private
getQuestionThemeInstaller() : QuestionThemeInstaller