Documentation
From PHP Online Survey Infrastructure
POSI is very poorly documented. Good luck.
Contents |
Admin notes
Inserting new questions
When inserting a new question before the end of the survey, the question table and the branching table must be updated in various ways.
In the following SQL statements:
- X = qnum of the new question,
- Y = number of datapoints in new question
- UPDATE (survey table) SET qnum=qnum+Y WHERE qnum>=X;
- UPDATE (branching table) SET question=question+Y WHERE question>=X;
- UPDATE (branching table) SET skip_begin=skip_begin+Y WHERE skip_begin>=X;
- UPDATE (branching table) SET skip_end=skip_end+Y WHERE skip_end>=X;
[abi] Note: new version of POSI may label field branch_begin instead of skip_begin (ben i updated your sql statement which had said use question_begin)
[ben] Any more?
MySQL Logging
One is highly encouraged to turn on query logging on the SQL server.
Installation
- Existing POSI installations
- If you have an existing installation of posi at the same location, ensure it's directory name is not 'posi' or it will get overwritten when untarring *
- incompatibility with older version databases as field names changed (field css_class removed from _survey table; skip_begin and skip_end changed to branch_begin and branch_end in _branching table; history_next added to _results table)
- Download and untar (at prompt type tar -xzvf posi-date.tar.gz)
- need instructions for multiple surveys ie can share /includes directory but each need their own config.php and /admin?
- Update include/config.php
- Update SURVEY_TITLE, and turn display to true
- Define admin email
- Define MYSQL connection settings (host, user, password and database)
- Need to comment out MSG_SURVEY_CLOSED define line
- Browse to posi/admin/ and use the web admin to create the question and branching tables.
- update the .htaccess file for your system
- Add questions and branching.
- Create results table.
Background
DB and File Structure
There are three tables for POSI
- {name}_branching = contains all instructions for question movement and skipping
- {name}_survey = contains all the questions text, answer values, header text
- {name}_results = contains a field for each datapoint in the survey
There are three main files for POSI
- class_admin.php
- class_question.php
- class_survey.php
Survey Table
There are several types of questions utilized by POSI:
- list_check
- list_radio
- mc_radio
- mc_check
- number
- other
- text
- textarea
- display
scale_heading
The field scale_heading adds a "scale" above a list of answers. Typically it is used on list_radio and list_check questions, but can also be used on mc_radio and mc_check where answer_column_newrow=0.
It is a series of php arrays, seperated by two semi-colins (;;).
- text => heading
- colspan => 1 or more
- align => left/center/right
So like:
array( text => "extremely flexible", colspan => "2", align => "left");;array( text => "no changes permitted", colspan => "3", align => "right")
javascript
example:
onClick="if (this.value==3 || this.value==4) { hideshow('s49','visible'); } else { hideshow('s49','hidden'); }"
Results Table
There are two field definitions:
- smallint(5)unsigned binary - list radio, mc_radio, list_checkbox, mc_checkbox
- varchar(255) - textarea, display
Branching Table
Bugs
See Bugs.
CHANGELOG
See CHANGELOG.
