The survey.php file provides the front-end layout and functionality of the OpenCrypt Surveys/Input Forms Add-on.
This article details the basic configuration of the survey interface, and the configuration options available.
The survey.php file can be called with query strings to show the survey of your choice, the format for the query string is as follows:
id= Allows you to determine which survey is displayed, each survey is given a unique ID when you create it in the administration panel, to show the survey with ID 1, you would use /oc/survey.php?id=1
The survey.php file has a number of variables which can be set by editing the survey.php file, and these must be placed at the start of the PHP file. If any of these variables are set as active, the user MUST be logged in to complete the surveys. They are as follows:
$enable_points Allows you to charge points for each survey that a user chooses to complete. To enable points charging, set this to $enable_points = "1", if you do not wish to charge points, set this to $enable_points = "0"
$points_per_survey Allows you to define how many points are charged for each survey, to charge 2 points per survey for example, set this variable to $points_per_survey = "2"
$one_per_user Allows you to define whether each survey can only be submitted once per user. To enable this, set the variable to $one_per_user = "1", if you wish to allow users to complete a survey multiple times, set the variable to $one_per_user = "0"
Look and layout of survey.php
The look and feel of survey.php is taken directly from the configuration used in the header.php and footer.php files, so when these are configured, the articles section will match any other PHP sections of the OpenCrypt frontend.
The layout and format of survey.php can be altered by templates in the OpenCrypt Administration Panel, they are located in the PHP Frontend Templates section, and are prefixed 'survey'
Returning survey results to your users
It is also possible to return your users to a summary of their survey results if desired.
Each survey is given a unique string when a user begins to enter data, this string can be seen in the address bar as part of the query string in the format string=JBYWTEIRMRSF and is also accessible with the variable $form_string
To allow user access to the survey results, call survey_results.php with the following query string:
survey_results.php?id=1&string=JBYWTEIRMRSF where id is the survey ID, and string is the unique string for the survey just completed by the user.