Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:create:functions [23.07.2018 21:47] – [Modify How to Display a Questionnaire Page] adminen:create:functions [04.02.2026 14:56] (current) admin
Line 5: Line 5:
 At the very end of this page will be a helpful information how the documentation of the PHP-functions can be read: [[#function_in_detail|Function in Detail]] At the very end of this page will be a helpful information how the documentation of the PHP-functions can be read: [[#function_in_detail|Function in Detail]]
  
-===== Basic fuctions for filteringquestions and text =====+===== Basic Fuctions for FilteringQuestions and Text =====
  
 See also [[filters|filter questions und filters]]. See also [[filters|filter questions und filters]].
Line 16: Line 16:
   * ''[[:en:create:functions:question|question()]]'' -- Display a question within the questionnaire   * ''[[:en:create:functions:question|question()]]'' -- Display a question within the questionnaire
   * ''[[:en:create:functions:text|text()]]'' -- Display a text element within the questionnaire   * ''[[:en:create:functions:text|text()]]'' -- Display a text element within the questionnaire
 +  * ''[[:en:create:functions:show|show()]]'' -- Display a question, combined question or text or activate a feature element
   * ''[[:en:create:functions:debug|debug()]]'' -- Show content of a data or PHP variable   * ''[[:en:create:functions:debug|debug()]]'' -- Show content of a data or PHP variable
  
Line 24: Line 25:
   * ''[[:en:create:functions:preset|preset()]]'' -- Preset a response for a question   * ''[[:en:create:functions:preset|preset()]]'' -- Preset a response for a question
   * ''[[:en:create:functions:markfail|markFail()]]'' -- Set the marker "response missing" for an input   * ''[[:en:create:functions:markfail|markFail()]]'' -- Set the marker "response missing" for an input
-  * ''[[:en:create:functions:prepare_input|prepare_input()]]'' -- Prepare an input to be shown within another question 
   * ''[[:en:create:functions:html|html()]]'' -- Output of HTML-Code within questionnaire   * ''[[:en:create:functions:html|html()]]'' -- Output of HTML-Code within questionnaire
   * ''[[:en:create:functions:textlink|textlink()]]'' -- Create a hyperlink that shows a text element in a pop-up window   * ''[[:en:create:functions:textlink|textlink()]]'' -- Create a hyperlink that shows a text element in a pop-up window
Line 30: Line 30:
   * ''[[:en:create:functions:buttoncode|buttonCode()]]'' -- Create-HTML-Code for next/back button   * ''[[:en:create:functions:buttoncode|buttonCode()]]'' -- Create-HTML-Code for next/back button
   * ''[[:en:create:functions:buttonhide|buttonHide()]]'' -- Do not show back/next buttons at the page's bottom   * ''[[:en:create:functions:buttonhide|buttonHide()]]'' -- Do not show back/next buttons at the page's bottom
-  * ''[[:en:create:functions:library|library()]]''​ -- Make a JavaScript or PHP library available+  * ''[[:en:create:functions:library|library()]]''​ -- Make a JavaScript or PHP library available
   * ''[[:en:create:functions:pagecss|pageCSS()]]'' -- Add CSS instructions to a single questionnaire page   * ''[[:en:create:functions:pagecss|pageCSS()]]'' -- Add CSS instructions to a single questionnaire page
 +  * ''[[:en:create:functions:pagehead]]'' -- Store meta-information about the questionnaire page
  
  
Line 42: Line 43:
   * ''[[:en:create:functions:random_p|random_p()]]'' -- Random number in correlation to likelihood   * ''[[:en:create:functions:random_p|random_p()]]'' -- Random number in correlation to likelihood
   * ''[[:en:create:functions:random_items|random_items()]]'' -- Randomly select items from a list   * ''[[:en:create:functions:random_items|random_items()]]'' -- Randomly select items from a list
 +  * ''[[:en:create:functions:randomuse]]'' -- Storing slips of paper from a random number generator
   * ''[[:en:create:functions:urndraw|urnDraw()]]'' -- Draw out from urn (random selection without replacement)   * ''[[:en:create:functions:urndraw|urnDraw()]]'' -- Draw out from urn (random selection without replacement)
   * ''[[:en:create:functions:urnputaway|urnPutAway()]]'' -- Put away the chit drawn via ''urnDraw()''   * ''[[:en:create:functions:urnputaway|urnPutAway()]]'' -- Put away the chit drawn via ''urnDraw()''
Line 47: Line 49:
  
  
-===== Advanced programming =====+===== Advanced Programming =====
  
-  * ''[[:en:create:functions:registervariable|registerVariable()]]'' -- Register PHP-Variable for following sites 
-  * ''​[[:​de:​create:​functions:​id|id()]]''​ -- Create a question or variable label from it's components 
   * ''[[:en:create:functions:replace|replace()]]'' -- Prepare a placeholder   * ''[[:en:create:functions:replace|replace()]]'' -- Prepare a placeholder
 +  * ''[[:en:create:functions:registervariable|registerVariable()]]'' -- Register PHP-Variable for following sites
 +  * ''[[:en:create:functions:id|id()]]'' -- Create a question or variable label from it's components
   * ''[[:en:create:functions:getitems|getItems()]]'' -- Order items of question by selected rules   * ''[[:en:create:functions:getitems|getItems()]]'' -- Order items of question by selected rules
   * ''[[:en:create:functions:getquestions|getQuestions()]]'' -- Enlist a section's questions   * ''[[:en:create:functions:getquestions|getQuestions()]]'' -- Enlist a section's questions
Line 57: Line 59:
   * ''[[:en:create:functions:getvaluetext|getValueText()]]'' -- Retrieve the label of a response code/option   * ''[[:en:create:functions:getvaluetext|getValueText()]]'' -- Retrieve the label of a response code/option
   * ''[[:en:create:functions:gettextelement|getTextElement()]]'' -- Retrieve the content of a text element   * ''[[:en:create:functions:gettextelement|getTextElement()]]'' -- Retrieve the content of a text element
 +  * ''[[:en:create:functions:getvariables]]'' -- Return a list of variables from the dataset
 +  * ''[[:en:create:functions:serialcheck|serialCheck()]]'' -- Ask for serial number
 +  * ''[[:en:create:functions:readget|readGET()]]'' -- Read converted variable from link
 +  * ''[[:en:create:functions:sendjson|sendJSON()]]'' -- Send HTTP request in JSON format (REST API)
 +  * ''[[:en:create:functions:sendjson|sendPOST()]]'' -- Send HTTP request in POST format (REST API)
 +  * ''[[:en:create:functions:sendjson|sendXML()]]'' -- Send HTTP request in XML format (REST API)
 +  * ''[[:en:create:functions:setnextpage|setNextPage()]]'' -- Set side for click on ,,go further"
 +  * ''[[:en:create:functions:setpageorder|setPageOrder()]]'' -- Change the order to display subsequent questionnaire pages 
 +  * ''[[:en:create:functions:looppage|loopPage()]]'' -- Show a page multiple times in a loop
 +  * ''[[:en:create:functions:looptopage|loopToPage()]]'' -- Show multiple pages multiple times in a loop
 +  * ''[[:en:create:functions:loopindex]]'' -- Get the ''loopPage()'' or ''setPageOrder()'' page counter
 +  * ''[[:en:create:functions:pagestop|pageStop()]]'' -- Do not show any further contents on the questionnaire page
 +  * ''[[:en:create:functions:setlanguage|setLanguage()]]'' -- Change language
 +  * ''[[:en:create:functions:buttondatacode|buttonDataCode()]]'' -- Add a custom button on the page that sends additional information
 +  * ''[[:en:create:functions:buttondataget|buttonDataGet()]]'' -- Get the data sent via ''buttonDataCode()''
 +  
 +  
 +===== Runtime Information =====
 +
 +  * ''[[:en:create:functions:info]]'' – Meta informationen int the current case or output configuration
 +  * ''[[:en:create:functions:infovars]]'' -- Information on variables in the dataset
   * ''[[:en:create:functions:getroute|getRoute()]]'' -- Tell if the next or back button was hit previously   * ''[[:en:create:functions:getroute|getRoute()]]'' -- Tell if the next or back button was hit previously
   * ''[[:en:create:functions:casenumber|caseNumber()]]'' -- Number of actual interviews   * ''[[:en:create:functions:casenumber|caseNumber()]]'' -- Number of actual interviews
Line 62: Line 85:
   * ''[[:en:create:functions:casetime|caseTime()]]'' -- Show length of stay on one or more sites   * ''[[:en:create:functions:casetime|caseTime()]]'' -- Show length of stay on one or more sites
   * ''[[:en:create:functions:casetoken|caseToken()]]'' -- Identification of interview   * ''[[:en:create:functions:casetoken|caseToken()]]'' -- Identification of interview
 +  * ''[[:de:create:functions:casedata]]'' -- Get all data collected in the current interview
   * ''[[:en:create:functions:reference|reference()]]'' -- Ask for reference (within link to questionnaires)   * ''[[:en:create:functions:reference|reference()]]'' -- Ask for reference (within link to questionnaires)
-  * ''[[:en:create:functions:serialcheck|serialCheck()]]'' -- Ask for serial number 
-  * ''[[:en:create:functions:readget|readGET()]]'' -- Read converted variable from link 
-  * ''[[:en:create:functions:readapi|readAPI()]]'' -- Access a third parties API 
   * ''[[:en:create:functions:getanswermissing|getAnswerMissing()]]'' -- Information for site repeat if questions was obligated   * ''[[:en:create:functions:getanswermissing|getAnswerMissing()]]'' -- Information for site repeat if questions was obligated
   * ''[[:en:create:functions:listfails|listFails()]]'' -- List of not responded obligation questions   * ''[[:en:create:functions:listfails|listFails()]]'' -- List of not responded obligation questions
-  * ''[[:en:create:functions:setnextpage|setNextPage()]]'' -- Set side for click on ,,go further" 
-  * ''[[:en:create:functions:setpageorder|setPageOrder()]]'' -- Change the order to display subsequent questionnaire pages  
-  * ''[[:en:create:functions:looppage|loopPage()]]'' -- Show a page multiple times in a loop 
-  *  ''​[[:​en:​create:​functions:​looptopage|loopToPage()]]''​ -- Show multiple pages multiple times in a loop 
-  * ''[[:en:create:functions:pagestop|pageStop()]]'' -- Do not show any further contents on the questionnaire page 
   * ''[[:en:create:functions:getlanguage|getLanguage()]]'' -- Determine language   * ''[[:en:create:functions:getlanguage|getLanguage()]]'' -- Determine language
-  * ''[[:en:create:functions:setlanguage|setLanguage()]]'' -- Change language+   
 + 
 +===== Coordination of Several Questionnaires ====== 
 + 
 +  * ''[[:en:create:functions:gotoquestionnaire]]'' -- Jump from one Questionaire to the next (once) 
 +  * ''[[:en:create:functions:gotoparent]]'' -- Go back to the formerly Questionaire 
 +  * ''[[:en:create:functions:multileveldown]]'' -- Start a sub-questionaire inside the main questionaire (if necessary also several times) 
 +  * ''[[:en:create:functions:multileveldata]]'' -- Get data specified in ''multiLevelDown()'' 
 +  * ''[[:en:create:functions:multilevelreturn]]'' -- Return from the sub-questionnaire to the main questionnaire   
 +  * ''[[:en:create:functions:multilevelresponse]]'' -- Get data specified in ''multiLevelReturn()''  
 +  * ''[[:en:create:functions:multilevelput]]'' -- Write a value directly into the higher-level record 
 +  * ''[[:en:create:functions:multilevelurl]]'' -- Create a URL for a sub-questionnaire to be used later 
 +  * ''[[:en:create:functions:multilevelprepare]]'' -- Create a sub-case to be used with a [[:en:create:questions:multilevel]] and preset data 
  
 ===== Databank for Contents ===== ===== Databank for Contents =====
Line 80: Line 109:
   * ''[[:en:create:functions:dbget|dbGet()]]'' -- Read data from date base   * ''[[:en:create:functions:dbget|dbGet()]]'' -- Read data from date base
   * ''[[:en:create:functions:dbkeys|dbKeys()]]'' -- List key for data base   * ''[[:en:create:functions:dbkeys|dbKeys()]]'' -- List key for data base
 +  * ''[[:en:create:functions:dbload|dbLoad()]]'' -- Call all entries with defined prefix from the contents database 
 +  * ''[[:en:create:functions:dbretrieve|dbRetrieve()]]'' -- Get data from the data base (associative, nested array)
   * ''[[:en:create:functions:dbset|dbSet()]]'' -- Safe data in data base   * ''[[:en:create:functions:dbset|dbSet()]]'' -- Safe data in data base
 +  * ''[[:en:create:functions:dbstore|dbStore()]]'' -- Store data in the data base (associative, nested array)
   * ''[[:en:create:functions:dbtouch|dbTouch()]]'' -- Refresh time-stamp for data base entry   * ''[[:en:create:functions:dbtouch|dbTouch()]]'' -- Refresh time-stamp for data base entry
 +  * ''[[:en:create:functions:dbdelete]]'' -- Delete entries from the data base, selected by a prefix
 +
 +
 +===== Record Control =====
  
 +  * ''[[:en:create:functions:dropvalue]]'' -- Delete a single variable from the current interview
 +  * ''[[:en:create:functions:dropupload]]'' -- Delete a file uploaded by the respondent
 +  * ''[[:en:create:functions:dropcase]]'' -- Mark the current interview for deletion
 +  * ''[[:en:create:functions:drophistory]]'' -- Delete the page history of the current interview
  
-===== Analysis of all data =====+===== Analyses and Access Further Records =====
  
   * ''[[:en:create:functions:statistic|statistic()]]'' -- Simple statistical analysis of all data   * ''[[:en:create:functions:statistic|statistic()]]'' -- Simple statistical analysis of all data
   * ''[[:en:create:functions:diagram|diagram()]]'' -- Simple diagram (e. g. frequency) for all analyzed data   * ''[[:en:create:functions:diagram|diagram()]]'' -- Simple diagram (e. g. frequency) for all analyzed data
 +  * ''[[:en:create:functions:panelrecords]]'' -- Access other records with the same person ID (SERIAL)
 +
  
 ===== Analyses and Data Handling During an Interview ===== ===== Analyses and Data Handling During an Interview =====
Line 98: Line 140:
   * ''[[:en:create:functions:valuesd|valueSD()]]'' -- Compute standard deviation over scale or variable   * ''[[:en:create:functions:valuesd|valueSD()]]'' -- Compute standard deviation over scale or variable
   * ''[[:en:create:functions:valuevar|valueVar()]]'' -- Compute variance over scale or variable   * ''[[:en:create:functions:valuevar|valueVar()]]'' -- Compute variance over scale or variable
 +  * ''[[:de:create:functions:valuelist]]'' -- Get multiple responses to multiple items in a question as array
   * ''[[:en:create:functions:convertdatetime|convertDateTime()]]'' -- Convert date/time texts (strings) and timestamps   * ''[[:en:create:functions:convertdatetime|convertDateTime()]]'' -- Convert date/time texts (strings) and timestamps
 +  * ''[[:en:create:functions:calc]]'' -- Simple calcuations based on the current interview's responses
 +  * ''[[:en:create:functions:uploadastable|uploadAsTable()]]'' -- Get am Excel or CSV table uploaded by the respondent as array
 +  * ''[[:en:create:functions:uploadrawdata]uploadRawData()]'' -- Get an uploaded file as binary string
  
 ===== Data Visualization ===== ===== Data Visualization =====
  
   * ''[[:en:create:functions:diagram2|diagram2()]]'' -- Create diagram with set data   * ''[[:en:create:functions:diagram2|diagram2()]]'' -- Create diagram with set data
 +  * ''[[:en:create:functions:getqrcodeimage|getQRCodeImage()]]'' -- Integrate QR Code in the questionnaire
   * ''[[:en:create:functions:imagepng_embed|imagepng_embed()]]'' -- Include a PNG graphic without storing it to a file   * ''[[:en:create:functions:imagepng_embed|imagepng_embed()]]'' -- Include a PNG graphic without storing it to a file
  
 ===== Respondent and Mailing Management ===== ===== Respondent and Mailing Management =====
  
-  * ''[[:en:create:functions:mailresume|mailResume()]]'' -- Resume an interview after a given delay +  * ''[[:en:create:functions:mailresume]]'' -- Resume an interview after a given delay 
-  * ''[[:en:create:functions:mailschedule|mailSchedule()]]'' -- Schedule to send a mailing to a single recipient +  * ''[[:en:create:functions:mailschedule]]'' -- Schedule to send a mailing to a single recipient 
-  * ''[[:en:create:functions:mailrevoke|mailRevoke()]]'' -- Cancel a scheduled mailing +  * ''[[:en:create:functions:mailrevoke]]'' -- Cancel a scheduled mailing 
-  * ''[[:en:create:functions:paneldata|panelData()]]'' -- Resolve information on the address record+  * ''[[:en:create:functions:paneldata]]'' -- Resolve information on the address record 
 +  * ''[[:en:create:functions:paneladd|panelAdd()]]'' -- Create a new address record 
 +  * ''[[:en:create:functions:paneldata]]'' -- Get information from an existing address entry 
 +  * ''[[:en:create:functions:panelupdate]]'' -- Update information on the address record 
 +  * ''[[:de:create:functions:paneldelete]]'' -- Delete records from the address list 
 +  * ''[[:de:create:functions:accesscount]]'' -- Limit trial to enter a code 
 +  * ''[[:de:create:functions:setstatus]]'' -- Set the interview status and eventually trigger panel redirects 
 +  
  
 ===== PHP-internal functions ===== ===== PHP-internal functions =====
Line 201: Line 255:
     * [[http://php.net/manual/en/function.md5.php|md5]] - Compute MD5-hash      * [[http://php.net/manual/en/function.md5.php|md5]] - Compute MD5-hash 
  
-===== Detailed functions =====+ 
 +===== Restricted Functions ===== 
 + 
 +Some functions pose a security risk or do not work as expected in the context of the questionnaire. Alternatives are listed below. If you need additional features, please let SoSci Survey know. 
 + 
 +  * ''echo'' 
 +    * ''[[:en:create:functions:html]]'' 
 +    * ''[[:en:create:functions:text]]'' 
 +  * ''mysqld_query()'' 
 +    * ''[[:en:create:databank]]'' 
 +    * ''[[:en:create:functions::datasetretrieve|datasetRetrieve()]]'' 
 + 
 + 
 +===== Detailed Functions =====
  
 Reference-syntax for each function, e.g.: Reference-syntax for each function, e.g.:
en/create/functions.1532375271.txt.gz · Last modified: by admin
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
Driven by DokuWiki