LimeSurvey API - Master branch

import_helper.php

Table of Contents

Functions

XMLImportGroup()  : mixed
This function imports a LimeSurvey .lsg question group XML file
XMLImportQuestion()  : array<string|int, mixed>
This function imports a LimeSurvey .lsq question XML file
XMLImportLabelsets()  : array<string|int, mixed>
XMLImportLabelsets() Function resp[onsible to import a labelset from XML format.
importSurveyFile()  : mixed
XMLImportSurvey()  : mixed
This function imports a LimeSurvey .lss survey XML file
checkWrongQuestionAttributes()  : mixed
This function checks if there are set wrong values ('Y' or 'N') into table question_attributes. These are set to 1 and 0 if needed.
XMLImportTokens()  : mixed
XMLImportResponses()  : mixed
CSVImportResponses()  : mixed
This function imports a CSV file into the response table CSV file is deleted during process
XMLImportTimings()  : mixed
TSVImportSurvey()  : string
Import survey from an TSV file template that does not require assigning of GID or QID values.
createXMLfromData()  : mixed
importDefaultValues()  : void
Import default values inside $xml, record process in $results Also imports defaultvalue_l10ns.
fileCsvToUtf8()  : resource
Read a csv file and return a tmp resources to same file in utf8 CSV file is deleted during process

Functions

XMLImportGroup()

This function imports a LimeSurvey .lsg question group XML file

XMLImportGroup(string $sFullFilePath, int $iNewSID, bool $bTranslateLinksFields) : mixed
Parameters
$sFullFilePath : string

The full filepath of the uploaded file

$iNewSID : int

The new survey ID - the page will always be added after the last page in the survey

$bTranslateLinksFields : bool

XMLImportQuestion()

This function imports a LimeSurvey .lsq question XML file

XMLImportQuestion(string $sFullFilePath, int $iNewSID,  $iNewGID[, array<string|int, bool> $options = array('autorename' => false, 'translinkfields' => true) ]) : array<string|int, mixed>
Parameters
$sFullFilePath : string

The full filepath of the uploaded file

$iNewSID : int

The new survey ID

$iNewGID :
$options : array<string|int, bool> = array('autorename' => false, 'translinkfields' => true)
Tags
throws
CException
Return values
array<string|int, mixed>

XMLImportLabelsets()

XMLImportLabelsets() Function resp[onsible to import a labelset from XML format.

XMLImportLabelsets(string $sFullFilePath, mixed $options) : array<string|int, mixed>
Parameters
$sFullFilePath : string
$options : mixed
Return values
array<string|int, mixed>

Array with count of imported labelsets, labels, warning, etc.

importSurveyFile()

importSurveyFile(string $sFullFilePath, bool $bTranslateLinksFields[, string $sNewSurveyName = null ][, int $DestSurveyID = null ]) : mixed
Parameters
$sFullFilePath : string
$bTranslateLinksFields : bool
$sNewSurveyName : string = null
$DestSurveyID : int = null

XMLImportSurvey()

This function imports a LimeSurvey .lss survey XML file

XMLImportSurvey(string $sFullFilePath[, string $sXMLdata = null ][, mixed $sNewSurveyName = null ][, mixed $iDesiredSurveyId = null ][, mixed $bTranslateInsertansTags = true ][, mixed $bConvertInvalidQuestionCodes = true ]) : mixed
Parameters
$sFullFilePath : string

The full filepath of the uploaded file

$sXMLdata : string = null
$sNewSurveyName : mixed = null
$iDesiredSurveyId : mixed = null
$bTranslateInsertansTags : mixed = true
$bConvertInvalidQuestionCodes : mixed = true
Tags
todo

Use transactions to prevent orphaned data and clean rollback on errors

checkWrongQuestionAttributes()

This function checks if there are set wrong values ('Y' or 'N') into table question_attributes. These are set to 1 and 0 if needed.

checkWrongQuestionAttributes( $questionId) : mixed
Parameters
$questionId :

XMLImportTokens()

XMLImportTokens(string $sFullFilePath, mixed $iSurveyID[, mixed $sCreateMissingAttributeFields = true ]) : mixed
Parameters
$sFullFilePath : string
$iSurveyID : mixed
$sCreateMissingAttributeFields : mixed = true

XMLImportResponses()

XMLImportResponses(string $sFullFilePath, mixed $iSurveyID[, mixed $aFieldReMap = array() ]) : mixed
Parameters
$sFullFilePath : string
$iSurveyID : mixed
$aFieldReMap : mixed = array()

CSVImportResponses()

This function imports a CSV file into the response table CSV file is deleted during process

CSVImportResponses(string $sFullFilePath, int $iSurveyId[, array<string|int, mixed> $aOptions = array() ]) : mixed
Parameters
$sFullFilePath : string
$iSurveyId : int
$aOptions : array<string|int, mixed> = array()

Return array $result ("errors","warnings","success")

XMLImportTimings()

XMLImportTimings(string $sFullFilePath, mixed $iSurveyID[, mixed $aFieldReMap = array() ]) : mixed
Parameters
$sFullFilePath : string
$iSurveyID : mixed
$aFieldReMap : mixed = array()

TSVImportSurvey()

Import survey from an TSV file template that does not require assigning of GID or QID values.

TSVImportSurvey(string $sFullFilePath) : string

If ID's are presented, they would be respected and used Multilanguage imports are supported Original function is changed to allow generating of XML instead of creating database objects directly Generated XML code is send to existing lss import function

Parameters
$sFullFilePath : string
Tags
author

TMSWhite

Return values
string

XML data

createXMLfromData()

createXMLfromData([mixed $aData = array() ]) : mixed
Parameters
$aData : mixed = array()

importDefaultValues()

Import default values inside $xml, record process in $results Also imports defaultvalue_l10ns.

importDefaultValues(SimpleXMLElement $xml, array<string|int, mixed> $aLanguagesSupported, mixed $aQIDReplacements, array<string|int, mixed> &$results) : void
Parameters
$xml : SimpleXMLElement
$aLanguagesSupported : array<string|int, mixed>
$aQIDReplacements : mixed
$results : array<string|int, mixed>

fileCsvToUtf8()

Read a csv file and return a tmp resources to same file in utf8 CSV file is deleted during process

fileCsvToUtf8(string $fullfilepath[, string $encoding = 'auto' ]) : resource
Parameters
$fullfilepath : string
$encoding : string = 'auto'

from

Return values
resource

        
On this page

Search results