I'd like to work with the team to integrate ExpressionManager into the CodeIgniter branch.
It would provide at least the following functions:
(1) Do
all replacements within curly braces (e.g. {INSERTANS:xxxx}, {TOKEN:xxxx}, and all templatereplace() values), supporting recursive substitution and complex conditional formatting.
(2) Support complex conditional calculation, logic, and formatting -- providing a back-end
replacement for both Conditions and Assessments
(3) Enable an "
Equation" question type
(4) Enable "
Relevance", which support arbitrarily complex (and chained) conditional logic to determine which questions or groups are displayed without requiring JavaScript.
Now that it is mostly done (e.g. all of the server-side processing and calculations work, and I'm starting to work on the client-side JavaScript equivalents), I'd like to get it integrated into the CI branch so that the CI release doesn't need to port the legacy approach to dealing with Conditions and Assessments.
Using ExpresionManger, the workflow for navigation is this:
(1) Collect next set of potentially relevant questions (e.g. next group)
(2) Evaluate Relevance equation for each question to determine which questions should be asked/displayed
(3) If no questions are relevant, then skip that group and repeat with step #1. If there are no more potentially relevant questions, then the survey is done.
(4) If a Group has no relevant questions, but does have relevant Equations, evaluate them and store their result in the database before looping to step #1
Once a set of questions to be displayed is identified:
(1) Compose the page based upon the template, inserting the appropriate question and answer types
(2) Do recursive substitution of variables within curly braces (e.g. answers, tokens, equations).
This should simplify the data model and improve performance too. The Conditions and Assessment tables would no longer be needed.
However, since ExpressionManager can support significantly more complex conditions and assessments, we may need to have LimeUser and LimeExpert modes, where LimeUser mode is the GUI that everyone is familiar with, and LimeExpertMode provides access to more complex equations without requiring a GUI (at least until we can build a nice one for it).
If you can point me in the right direction, I can start working on a patch:
(1) Where should I put the core ExpressionManager code (currently in /classes/eval/*)
(2) Which controllers deal with processing templates and doing the replacements (e.g. templatereplace(), insertAnsReplace(), tokenReplace(), dTexts::run())
(3) Which controllers deal with navigation, conditions, and assessments?
I can provide working examples of this functionality in the limesurvey_dev_tms branch (or hosted on my website) if that would help start this dialog.