LimeSurveyFileManager

Extends \Survey_Common_Action

Filemanagement Controller

This controller is used in the global file management as well as the survey specific

package

LimeSurvey

subpackage

Backend

Methods

__construct

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

Arguments

$controller

$id

Recurses down the folder provided and adds a complete list of folders and files to the parametered arrays !!! Array provided are changed !!!

__recursiveScandir(string $folder,  &$folderlist,  &$filelist) : void

Arguments

$folder

string

$folderlist

$filelist

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

Arguments

$aData

array

_checkFolder

_checkFolder( $sFolderPath,  $iSurveyId = null) 

Arguments

$sFolderPath

$iSurveyId

Creates an array of all possible folders including child folders for access permission checks.

_collectCompleteFolderList(integer|null $iSurveyId = null) : array

Arguments

$iSurveyId

integer|null

Response

array

List of visible folders

Creates a list of files in the selected folder

_collectFileList( $folderPath) : array

Arguments

$folderPath

Response

array

list of files [filename => filepath]

Creates an array of possible folders

_collectFolderList(integer|null $iSurveyId = null) : array

Arguments

$iSurveyId

integer|null

Response

array

List of visible folders

Creates an associative array of the possible folders for the treeview

_collectRecursiveFolderList(integer|null $iSurveyId = null) : array

Arguments

$iSurveyId

integer|null

Response

array

List of visible folders

Get the correct tree array representation including child folders for provided folder

_composeFolderArray(string $folder,  $level = '0') : array

Arguments

$folder

string

$level

Response

array

Naive test for file extension

_extensionAllowed(string $fileExtension,  $purpose = 'show') : boolean
TODO

enhance this for file uploads

Arguments

$fileExtension

string

$purpose

Response

boolean

_filterImportedResources

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

Arguments

$extractdir

string

$destdir

string

Response

array

_fullpagebar

_fullpagebar( $aData) 
inherited

Arguments

$aData

_generaltopbar

_generaltopbar( $aData) 
inherited

Arguments

$aData

_generaltopbarAdditions

_generaltopbarAdditions( $aData) 
inherited

Arguments

$aData

listquestion groups

_listquestiongroups(array $aData) 
inherited

Arguments

$aData

array

_listquestions

_listquestions( $aData) 
inherited
Throws
\CException

Arguments

$aData

Display notifications

_notifications() 
inherited

Show admin menu for question group view

_nquestiongroupbar(array $aData) 
inherited

Arguments

$aData

array

?

Survey summary

_nsurveysummary(array $aData) 
inherited

Arguments

$aData

array

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

_organizequestionbar(array $aData) 
inherited
since 2014-09-30
author

Olle Haerstedt

Arguments

$aData

array

Prints a json document with the data provided as parameter

_printJsonResponse(array $data) : void

Arguments

$data

array

The data that should be transferred

Shows admin menu for question

_questionbar(array $aData) 
inherited

Arguments

$aData

array

_recursiveMkdir

_recursiveMkdir( $folder,  $rights = 493) 

Arguments

$folder

$rights

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.

Sets the internal error object

_setError(string $code, string $message, string|null $title = '',  $debug = null) : void

Arguments

$code

string

$message

string

$title

string|null

$debug

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

_showadminmenu( $aData) : string
inherited
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

Arguments

$aData

array

$sendHTTPHeader

Shows admin menu for surveys

_surveybar(array $aData) 
inherited
deprecated

Arguments

$aData

array

Show side menu for survey view

_surveysidemenu(array $aData) 
inherited

Arguments

$aData

array

all the needed data

Show survey summary

_surveysummary(array $aData) 
inherited

Arguments

$aData

array

_titlebar

_titlebar( $aData) 
inherited

Arguments

$aData

Display the update notification

_updatenotification() 
inherited

Load menu bar of user group controller.

_userGroupBar(array $aData) : void
inherited

Arguments

$aData

array

Returns content from event beforeSideMenuRender

beforeSideMenuRender(array $aData) : string
inherited

Arguments

$aData

array

Response

string

Throw exception if src and dest filename is different.

checkChangedFilename(array $file) : void
Throws
\Exception

Arguments

$file

array

checkTargetExists

checkTargetExists( $fileDestination) 

Arguments

$fileDestination

deleteFile

deleteFile() 

downloadFiles

downloadFiles() 

Get extra menus from plugins that are using event beforeAdminMenuRender

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

Arguments

$aData

array

Response

\array

getAllowedFileExtensions

getAllowedFileExtensions() 

Calls the list of files in the selected folder

getFileList(string $folder, integer|null $iSurveyId = null) : void

Arguments

$folder

string

$iSurveyId

integer|null

getFilesForSurvey

getFilesForSurvey( $surveyid = null) 

Arguments

$surveyid

getFolderList

getFolderList( $iSurveyId = null) 

Arguments

$iSurveyId

getZipFile

getZipFile( $path) 

Arguments

$path

index

index() : void
inherited

Basic index function to call the view

index( $surveyid = null) : void

Arguments

$surveyid

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

Arguments

$aData

array

$success

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

renderQuickmenu(array $aData) : string
inherited

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

Prints a json document with the intercontroller error message

throwError() : void

transitFiles

transitFiles() 

Action to upload a file returns a json document

uploadFile() : void
TODO

Currently a naive extension filter is in place this needs to be secured against executables.

Properties

In controller error storage to have a centralizes error message system

oError : Object
var

Type(s)

Object

globally available directories

globalDirectories : array
TODO

make this a configuration in global config

var

Type(s)

array