Experienced authors (with appropriate HTML/CSS and JavaScript knowledge) can use Avendoo® API (application programming interface) for creating an interactive question. Thus they can transfer certain parameters to a self created design.
The following table contains the appropriate command and the appropriate description:
Command | Description |
---|---|
window.top. | Because the content of the interactive question is embedded in an Iframe, this has to be before each function, in order to open from the Iframe the function of the Avendoo-API. |
fn_setInteractiveQuestionState(percent,
| The function transfers the following paramters of the interactive question to Avendoo®:
percent = Achieved Points Via the parameter percent the author defines the achievable points per answer. proportionately from the maximum achievable number of points of the question. The parameter useranswer designates the different answers and is an alphanumeric designation, freely allocable by the author (for example: “opt1”, “opt2”, “opt3”). Note: The designations “opt1”, “opt2” etc. have to be signed by double quote top. |
fn_getReshow() | The function detects, if it is a redisplay of the question.
true = Question is redisplayed Example: Example for source code: if(window.top.fn_getReshow()) { var useranswer = window.top.fn_getUserAnswer(); //Via the variable useranswer now the answer should be displayed. For example the setting of the selected radio button of a single choice question } |
fn_getDissolve() | The function detects on basis of the settings in the Knowledge test wizard, if the answer should be displayed or not.
true = Answer should be displayed Example: |
fn_getPoints() | The function calculates the maximum possible points, which were configured in the Question wizard of the interactive question. |
fn_getReachedPoints() | The function calculates the achieved points for this question, which are achieved by the real answer of the user.
Note: |
fn_getUseranswer() | The function detects the question selected by the user.
Note: Example: |
fn_getParameter() | The function detects the parameters, which were entered in the Question wizard of the interactive question under “Question parameters”.![]() Example: You can define for example the texts of the question and the answers in the question parameters. The paramters are read and dynamically written into the interactive question. Thus the flexibility increases and you can create a question template, which is filled by the question parameters always different every time. Consecutively you see the instructions, with which you can fill the texts of the interactive question via the question parameter: {"question": "What weekday was on June 30th 2015?", "answer1": "Monday", "answer2": "Tuesday", "answer3": "Wednesday"} The characteristic names “answer1”, “answer2” etc. have to be noted in double quotes.
var parameter = window.top.fn_getParameter(); var json = JSON.parse(parameter); // Via the designations json-question, json.answer1, json.answer2, json.answer3 you can use the defined question parameters in the interactive question. |