LimeSurvey API - Master branch

export_helper.php

Table of Contents

Functions

stripTagsFull()  : string
Strips html tags and replaces new lines
isNumericExtended()  : bool
Returns true if passed $value is numeric
strSplitUnicode()  : string
Returns splitted unicode string correctly source: http://www.php.net/manual/en/function.str-split.php#107658
quoteSPSS()  : mixed
Quotes a string with surrounding quotes and masking inside quotes by doubling them
SPSSExportData()  : mixed
Exports CSV response data for SPSS and R
SPSSGetValues()  : array<string|int, mixed>|bool
Check it the gives field has a labelset and return it as an array if true
SPSSFieldMap()  : array<string|int, mixed>
Creates a fieldmap with all information necessary to output the fields
SPSSGetQuery()  : CDbCommand
Creates a query string with all fields for the export
buildXMLFromQuery()  : mixed
buildXMLFromQuery() creates a datadump of a table in XML using XMLWriter
surveyGetXMLStructure()  : mixed
from export_structure_xml.php
surveyGetXMLData()  : mixed
from export_structure_xml.php
getXMLDataSingleTable()  : string|bool
Exports a single table to XML
QueXMLCleanup()  : string
from export_structure_quexml.php
QueXMLCreateFree()  : mixed
from export_structure_quexml.php
QueXMLFixedArray()  : mixed
from export_structure_quexml.php
QueXMLSkipTo()  : bool|string
Calculate if this item should have a QueXMLSkipTo element attached to it
QueXMLCreateFixed()  : mixed
from export_structure_quexml.php
quexml_get_lengthth()  : mixed
from export_structure_quexml.php
quexml_create_multi()  : mixed
from export_structure_quexml.php
quexml_create_subQuestions()  : mixed
from export_structure_quexml.php
quexml_set_default_value_rank()  : mixed
Set defaultValue attribute of provided element from response table
quexml_set_default_value()  : mixed
Set defaultValue attribute of provided element from response table
quexml_reformat_date()  : void
Format defaultValue of Date/Time questions according to question date format
quexml_create_question()  : mixed
Create a queXML question element
quexml_export()  : mixed
Export quexml survey.
group_export()  : mixed
groupGetXMLStructure()  : mixed
questionExport()  : mixed
questionGetXMLStructure()  : mixed
tokensExport()  : mixed
CPDBExport()  : mixed
stringSize()  : int
Find the string size according DB size for existing question Column name must be SGQA currently
numericSize()  : string
Find the numeric size according DB size for existing question for SPSS export Column name must be SGQA currently
tsvSurveyExport()  : string
Export survey to TSV format It is using existing XML function to get the same source data as lss format
sortArrayByColumn()  : mixed
Sort array by column name
writeXmlFromArray()  : mixed
Write XML from Associative Array, recursive function
surveyGetThemeConfiguration()  : mixed
Write XML structure for themes
MaskFormula()  : mixed
buildXMLFromArray()  : mixed
buildXMLFromArray() dumps an array to XML using XMLWriter, in the same format as buildXMLFromQuery()

Functions

stripTagsFull()

Strips html tags and replaces new lines

stripTagsFull(string $string[, bool $removeOther = true ]) : string
Parameters
$string : string
$removeOther : bool = true

if 'true', removes '-oth-' from the string.

Return values
string

isNumericExtended()

Returns true if passed $value is numeric

isNumericExtended( $value) : bool
Parameters
$value :
Return values
bool

strSplitUnicode()

Returns splitted unicode string correctly source: http://www.php.net/manual/en/function.str-split.php#107658

strSplitUnicode(string $str[,  $l = 0 ]) : string
Parameters
$str : string
$l : = 0
Return values
string

quoteSPSS()

Quotes a string with surrounding quotes and masking inside quotes by doubling them

quoteSPSS(string $sText, string $sQuoteChar, string $aField) : mixed
Parameters
$sText : string

Text to quote

$sQuoteChar : string

The quote character (Use ' for SPSS and " for R)

$aField : string

General field information from SPSSFieldmap

SPSSExportData()

Exports CSV response data for SPSS and R

SPSSExportData(mixed $iSurveyID, string $iLength[, string $na = '' ][, string $sEmptyAnswerValue = '' ][, string $q = ''' ][, bool $header = false ][, string $sLanguage = '' ]) : mixed
Parameters
$iSurveyID : mixed

The survey ID

$iLength : string

Maximum text lenght data, usually 255 for SPSS <v16 and 16384 for SPSS 16 and later

$na : string = ''

Value for N/A data

$sEmptyAnswerValue : string = ''

Value for empty data ('')

$q : string = '''

sep Quote separator. Use ' for SPSS, " for R

$header : bool = false

logical $header If TRUE, adds SQGA code as column headings (used by export to R)

$sLanguage : string = ''

SPSSGetValues()

Check it the gives field has a labelset and return it as an array if true

SPSSGetValues( $field, mixed $qidattributes, string $language) : array<string|int, mixed>|bool
Parameters
$field :

array field from SPSSFieldMap

$qidattributes : mixed
$language : string
Return values
array<string|int, mixed>|bool

SPSSFieldMap()

Creates a fieldmap with all information necessary to output the fields

SPSSFieldMap(mixed $iSurveyID[,  $prefix = 'V' ][, mixed $sLanguage = '' ]) : array<string|int, mixed>
Parameters
$iSurveyID : mixed
$prefix : = 'V'

string prefix for the variable ID

$sLanguage : mixed = ''
Return values
array<string|int, mixed>

SPSSGetQuery()

Creates a query string with all fields for the export

SPSSGetQuery(mixed $iSurveyID[, mixed $limit = null ][, mixed $offset = null ]) : CDbCommand
Parameters
$iSurveyID : mixed
$limit : mixed = null
$offset : mixed = null
Return values
CDbCommand

buildXMLFromQuery()

buildXMLFromQuery() creates a datadump of a table in XML using XMLWriter

buildXMLFromQuery(mixed $xmlwriter, mixed $Query[, string $tagname = '' ][, array<string|int, string> $excludes = array() ][, mixed $iSurveyID = 0 ]) : mixed
Parameters
$xmlwriter : mixed

The existing XMLWriter object

$Query : mixed

The table query to build from

$tagname : string = ''

If the XML tag of the resulting question should be named differently than the table name set it here

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

array of columnames not to include in export

$iSurveyID : mixed = 0

surveyGetXMLStructure()

from export_structure_xml.php

surveyGetXMLStructure(mixed $iSurveyID, mixed $xmlwriter[, mixed $exclude = array() ]) : mixed
Parameters
$iSurveyID : mixed
$xmlwriter : mixed
$exclude : mixed = array()

surveyGetXMLData()

from export_structure_xml.php

surveyGetXMLData(mixed $iSurveyID[, mixed $exclude = array() ]) : mixed
Parameters
$iSurveyID : mixed
$exclude : mixed = array()

getXMLDataSingleTable()

Exports a single table to XML

getXMLDataSingleTable(int $iSurveyID, string $sTableName, string $sDocType[, string $sXMLTableTagName = '' ][, mixed $sFileName = '' ][, mixed $bSetIndent = true ]) : string|bool
Parameters
$iSurveyID : int

The survey ID

$sTableName : string

The database table name of the table to be export

$sDocType : string

What doctype should be written

$sXMLTableTagName : string = ''

Name of the tag table name in the XML file

$sFileName : mixed = ''
$bSetIndent : mixed = true
Return values
string|bool

XMLWriter object

QueXMLCleanup()

from export_structure_quexml.php

QueXMLCleanup(string|null $string[, string|null $allow = '<p><b><u><i><em>' ]) : string
Parameters
$string : string|null
$allow : string|null = '<p><b><u><i><em>'
Return values
string

QueXMLCreateFree()

from export_structure_quexml.php

QueXMLCreateFree(mixed $f, mixed $len[, mixed $lab = "" ]) : mixed
Parameters
$f : mixed
$len : mixed
$lab : mixed = ""

QueXMLFixedArray()

from export_structure_quexml.php

QueXMLFixedArray(mixed $array) : mixed
Parameters
$array : mixed

QueXMLSkipTo()

Calculate if this item should have a QueXMLSkipTo element attached to it

QueXMLSkipTo(mixed $qid, mixed $value[, mixed $cfieldname = "" ]) : bool|string

from export_structure_quexml.php

Parameters
$qid : mixed
$value : mixed
$cfieldname : mixed = ""
Tags
author

Adam Zammit adam.zammit@acspri.org.au

since
2010-10-28
TODO

Correctly handle conditions in a database agnostic way

Return values
bool|string

Text of item to skip to otherwise false if nothing to skip to

QueXMLCreateFixed()

from export_structure_quexml.php

QueXMLCreateFixed(mixed $qid, mixed $iResponseID, mixed $fieldmap[, mixed $rotate = false ][, mixed $labels = true ][, mixed $scale = 0 ][, mixed $other = false ][, mixed $varname = "" ]) : mixed
Parameters
$qid : mixed
$iResponseID : mixed
$fieldmap : mixed
$rotate : mixed = false
$labels : mixed = true
$scale : mixed = 0
$other : mixed = false
$varname : mixed = ""

quexml_get_lengthth()

from export_structure_quexml.php

quexml_get_lengthth(mixed $qid, mixed $attribute, mixed $default[, mixed $quexmllang = false ]) : mixed
Parameters
$qid : mixed
$attribute : mixed
$default : mixed
$quexmllang : mixed = false

quexml_create_multi()

from export_structure_quexml.php

quexml_create_multi(mixed &$question, mixed $qid, mixed $varname, mixed $iResponseID, mixed $fieldmap[, mixed $scale_id = false ][, mixed $free = false ][, mixed $other = false ][, mixed $yesvalue = "1" ][, mixed $comment = false ]) : mixed
Parameters
$question : mixed
$qid : mixed
$varname : mixed
$iResponseID : mixed
$fieldmap : mixed
$scale_id : mixed = false
$free : mixed = false
$other : mixed = false
$yesvalue : mixed = "1"
$comment : mixed = false

quexml_create_subQuestions()

from export_structure_quexml.php

quexml_create_subQuestions(mixed &$question, mixed $qid, mixed $varname, mixed $iResponseID, mixed $fieldmap[, mixed $use_answers = false ][, mixed $aid = false ][, mixed $scale = false ]) : mixed
Parameters
$question : mixed
$qid : mixed
$varname : mixed
$iResponseID : mixed
$fieldmap : mixed
$use_answers : mixed = false
$aid : mixed = false
$scale : mixed = false

quexml_set_default_value_rank()

Set defaultValue attribute of provided element from response table

quexml_set_default_value_rank(mixed &$element, int $iResponseID, int $qid, int $iSurveyID, array<string|int, mixed> $fieldmap, string $acode) : mixed
Parameters
$element : mixed

DOM element to add attribute to

$iResponseID : int

The response id

$qid : int

The qid of the question

$iSurveyID : int

The survey ID

$fieldmap : array<string|int, mixed>

A mapping of fields to qid

$acode : string

The answer code to search for

quexml_set_default_value()

Set defaultValue attribute of provided element from response table

quexml_set_default_value(mixed &$element, int $iResponseID, int $qid, int $iSurveyID, array<string|int, mixed> $fieldmap[, bool|string $fieldadd = false ][, bool|string $usesqid = false ][, bool|string $usesaid = false ][, mixed $usesscale = false ]) : mixed
Parameters
$element : mixed

DOM element to add attribute to

$iResponseID : int

The response id

$qid : int

The qid of the question

$iSurveyID : int

The survey ID

$fieldmap : array<string|int, mixed>

A mapping of fields to qid

$fieldadd : bool|string = false

Anything additional to search for in the field name

$usesqid : bool|string = false

Search using sqid instead of qid

$usesaid : bool|string = false

Search using aid

$usesscale : mixed = false

quexml_reformat_date()

Format defaultValue of Date/Time questions according to question date format

quexml_reformat_date(mixed $element, int $qid, int $iSurveyID) : void
Parameters
$element : mixed

DOM element with the date to change

$qid : int

The qid of the question

$iSurveyID : int

The survey ID

quexml_create_question()

Create a queXML question element

quexml_create_question(CActiveRecord $RowQ[, bool|string $additional = false ]) : mixed
Parameters
$RowQ : CActiveRecord

Question details in array

$additional : bool|string = false

Any additional question text to append

quexml_export()

Export quexml survey.

quexml_export(mixed $surveyi, mixed $quexmllan[, mixed $iResponseID = false ]) : mixed
Parameters
$surveyi : mixed
$quexmllan : mixed
$iResponseID : mixed = false

group_export()

group_export(string $action, mixed $iSurveyID, mixed $gid) : mixed
Parameters
$action : string
$iSurveyID : mixed
$gid : mixed

groupGetXMLStructure()

groupGetXMLStructure(XMLWriter $xml, mixed $gid) : mixed
Parameters
$xml : XMLWriter
$gid : mixed

questionExport()

questionExport(string $action, mixed $iSurveyID, mixed $gid, mixed $qid) : mixed
Parameters
$action : string
$iSurveyID : mixed
$gid : mixed
$qid : mixed

questionGetXMLStructure()

questionGetXMLStructure(XMLWriter $xml, mixed $gid, mixed $qid) : mixed
Parameters
$xml : XMLWriter
$gid : mixed
$qid : mixed

tokensExport()

tokensExport(int $iSurveyID) : mixed
Parameters
$iSurveyID : int

CPDBExport()

CPDBExport(mixed $data, string $filename) : mixed
Parameters
$data : mixed
$filename : string

stringSize()

Find the string size according DB size for existing question Column name must be SGQA currently

stringSize(string $sColumn) : int
Parameters
$sColumn : string
Return values
int

numericSize()

Find the numeric size according DB size for existing question for SPSS export Column name must be SGQA currently

numericSize(string $sColumn[, bool $decimal = false ]) : string
Parameters
$sColumn : string
$decimal : bool = false

db type as decimal(30,10)

Return values
string

integersize.decimalsize

tsvSurveyExport()

Export survey to TSV format It is using existing XML function to get the same source data as lss format

tsvSurveyExport(mixed $surveyid) : string
Parameters
$surveyid : mixed
Return values
string

sortArrayByColumn()

Sort array by column name

sortArrayByColumn(array<string|int, mixed> $array, string $column_name) : mixed
Parameters
$array : array<string|int, mixed>
$column_name : string

writeXmlFromArray()

Write XML from Associative Array, recursive function

writeXmlFromArray(object $xml, array<string|int, mixed> $aData[, int $sParentKey = '' ]) : mixed
Parameters
$xml : object

XMLWriter Object

$aData : array<string|int, mixed>

Associative Data Array

$sParentKey : int = ''

parent key

surveyGetThemeConfiguration()

Write XML structure for themes

surveyGetThemeConfiguration([int $iSurveyId = null ][, object $oXml = null ][, bool $bInherit = false ][, string $sElementName = 'themes' ]) : mixed
Parameters
$iSurveyId : int = null

Survey ID

$oXml : object = null

XMLWriter Object

$bInherit : bool = false

should theme configuration be inherited?

$sElementName : string = 'themes'

name for XML element

MaskFormula()

MaskFormula(mixed $sValue) : mixed
Parameters
$sValue : mixed

buildXMLFromArray()

buildXMLFromArray() dumps an array to XML using XMLWriter, in the same format as buildXMLFromQuery()

buildXMLFromArray(mixed $xmlwriter, array<string|int, array<string, mixed>> $data, string $tagname[, array<string|int, string> $excludes = [] ]) : mixed
Parameters
$xmlwriter : mixed

The existing XMLWriter object

$data : array<string|int, array<string, mixed>>

The data to dump. Each element of the array must be a key-value pair.

$tagname : string

The name of the XML tag to generate

$excludes : array<string|int, string> = []

array of columnames not to include in export


        
On this page

Search results