Export

Extends\SurveyCommonAction

Export Action

This controller performs export actions

package

LimeSurvey

subpackage

Backend

Methods

__construct

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

Arguments

$controller

$id

Add Headers

addHeaders(string $filename,string $content_type,string $expires): void

Arguments

$filename

string

$content_type

string

$expires

string

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 SurveyCommonAction::renderWrappedTemplate()

Throws
\CHttpException

Arguments

$params

array

Parameters to parse and populate

Response

array

Populated parameters

Add to zip

addToZip(\PclZip $zip,string $name,string $full_name)

Arguments

$zip

\PclZip

$name

string

$full_name

string

Returns content from event beforeSideMenuRender

beforeSideMenuRender(array $aData): string
inherited

REFACTORED in LayoutHelper

Arguments

$aData

array

Response

string

Download an archive file

downloadZip(string $sZip)

Arguments

$sZip

string

name of zip file to download (will be downloaded as "surveys_archive.zip")

Dump Label

dumplabel()

Exports a archive (ZIP) of the current survey (structure, responses, timings, tokens)

exportarchive(integer $iSurveyID,boolean $bSendToBrowser = true): string

Arguments

$iSurveyID

integer

The ID of the survey to export

$bSendToBrowser

boolean

If TRUE (default) then the ZIP file is sent to the browser

Response

string

Full path of the ZIP filename if $bSendToBrowser is set to TRUE, otherwise no return value

Export multiple surveys archives. Called via ajax from surveys list massive action

exportMultipleArchiveSurveys()

Export multiple surveys structure. Called via ajax from surveys list massive action

exportMultiplePrintableSurveys()

Export multiple surveys structure. Called via ajax from surveys list massive action

exportMultipleStructureSurveys()

Export Multiple Surveys

exportMultipleSurveys(string $sSurveys,string $sExportType): array

Arguments

$sSurveys

string

$sExportType

string

Response

array

Get a the printable html questionnaire in specified language and store the file in the specified directory

exportPrintableHtml(\Survey $oSurvey,string $language,string $tempdir): string

Arguments

$oSurvey

\Survey

$language

string

$tempdir

string

the directory the file will be stored in

Response

string

File name where the data is stored

Get a Zipped version of survey print version in all languages (including the template html assets)

exportPrintableHtmls(integer $iSurveyID,boolean $readFile = true): string

Arguments

$iSurveyID

integer

Survey ID

$readFile

boolean

Whether we read the file for direct download (or not as in massive actions)

Response

string

Export Results

exportresults()

The SPSS DATA LIST / BEGIN DATA parser is rather simple minded, the number after the type specifier identifies the field width (maximum number of characters to scan) It will stop short of that number of characters, honouring quote delimited space separated strings, however if the width is too small the remaining data in the current line becomes part of the next column. Since we want to restrict this script to ONE scan of the data (scan & output at same time), the information needed to construct the DATA LIST is held in the $fields array, while the actual data is written to a to a temporary location, updating length (size) values in the $fields array as the tmp file is generated (uses @fwrite's return value rather than strlen).

exportspss()

Final output renders $fields to a DATA LIST, and then stitches in the tmp file data.

Optimization opportunities remain in the VALUE LABELS section, which runs a query / column

Generate an TSV (tab-separated value) file for the survey structure

exporttsv(integer $surveyid): void

Arguments

$surveyid

integer

Get extra menus from plugins that are using event beforeAdminMenuRender

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

Arguments

$aData

array

Response

\array

filterImportedResources

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

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

Arguments

$extractdir

string

$destdir

string

Response

array

Renders the fullpager bar That's the white bar with action buttons example: 'Back' Button

fullpagebar(array $aData)
inherited
Throws
\CException

Arguments

$aData

array

REFACTORED in LayoutHelper

generaltopbar( $aData)
inherited
Throws
\CException

Arguments

$aData

Export Group

group()

index

index(): void
inherited

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

LimeSurvey GmbH

Arguments

$aData

array

Export Question

question()

Shows admin menu for question

questionbar(array $aData)
inherited
deprecated

not in use anymore

Arguments

$aData

array

Generate a queXML PDF document with provided styles/settings

quexml(integer $iSurveyID): void

Arguments

$iSurveyID

integer

Clear queXML settings from settings table

quexmlclear(integer $iSurveyID): void

Arguments

$iSurveyID

integer

Return a list of queXML settings

quexmlsettings(): array<mixed,string>

Response

array<mixed,string>

queXML settings

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

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, 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

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.

Validates that the request method is POST.

requirePostRequest()
inherited

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

Throws
\CHttpException

with 405 status if the request method is not POST.

Resources Export

resources()

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

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

Export Survey

survey()

This function exports a ZIP archives of several ZIP archives - it is used in the listSurvey controller The SIDs are read from session flashdata.

surveyarchives()

Shows admin menu for surveys

surveybar(array $aData)
inherited
deprecated

Arguments

$aData

array

Survey export

surveyexport(string $action,integer $iSurveyID): void

Arguments

$action

string

$iSurveyID

integer

Renders the green bar with page title Also called SurveyManagerBar

surveyManagerBar(array $aData)
inherited
todo

Needs to be removed later. Duplication in LayoutHelper.

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.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

VV Export

vvexport()

XML to JSON

xmlToJson(string $fileContents): string

Arguments

$fileContents

string

Response

string