Question object types: Difference between revisions
From LimeSurvey Manual
No edit summary |
|||
Line 33: | Line 33: | ||
* SQL and database queries, included extra field the question might define | * SQL and database queries, included extra field the question might define | ||
=== Current implementation | === Current LS3 implementation === | ||
Note, this is the current state and some of these are mostly because it is a refactoring from LS2. | |||
1. Uses an interface. | |||
2. Defines what columns it needs via a fieldname => column type map. | |||
3. Defines what EM expressions apply to it. | |||
4. Defines a render functionality that renders the content. | |||
5. Defines a list of classes that should be in the wrapping div. |
Revision as of 17:31, 12 April 2016
Question object types is about making questions in LS more object-oriented and modular, and letting users create and upload their own object types.
Basically, every place in the code which is doing a switch on question type should be replaced by a polymorphic call to an object, e.g. $object->renderFrontend();
Use-cases
- Colour picker - user click on a picture with colours, and the position in the picture defines the colour.
Features
TODO
Open issues
- Is array it's own object type, or is it a property in a question? E.g., could we have an array of yes/no questions?
- Cross-cutting concerns: What if the user wants to add a comment field to all questions in the survey?
- Composability: Should it be possible to combine two questions into one?
Implementation
Object hierarchy.
Implemented as Yii module, with views, models and controllers (http://www.yiiframework.com/doc/guide/1.1/en/basics.module#creating-module).
Replace switch-cases in:
- Frontend render (render answers)
- Backend render (edit question settings)
- Statistics
- SQL and database queries, included extra field the question might define
Current LS3 implementation
Note, this is the current state and some of these are mostly because it is a refactoring from LS2.
1. Uses an interface.
2. Defines what columns it needs via a fieldname => column type map.
3. Defines what EM expressions apply to it.
4. Defines a render functionality that renders the content.
5. Defines a list of classes that should be in the wrapping div.