Take results from a multiple choice test

Forums: 

Hi everyone.

I want to take H5P content result(such as right or wrong answer, date, e.t.c) in a .txt

I have create a logger.php file and i try to put the logger in some .php files in drupal folder structure to take values from a varieble

I create a looger.php file and  this line to put it somewhere in the code of a php file   logger("/var/www/html/logger.txt","$example");

Does anybody know where i must put this line to get values from a varieble

otacke's picture

Hi Alex!

I think you have two simple choices.

1) The answers are evaluated in JavaScript and the results are emitted using the xAPI standard. You could catch the xAPI events, use AJAX to bring them to the server level and then log them. See https://h5p.org/documentation/x-api for details on using xAPI with H5P or https://github.com/otacke/h5pxapikatchu for an implementation that makes use of this idea.

2) Probably simpler if you don't require all the xAPI information: Choose your host system, install the mods plugin and implement the alter_user_result hook that gives you data and some ids as variables.

Best,

Oliver 

Thanks Oliver

I will follow the first advice

Thanks Oliver

I will follow the first advice