You are here

DEVELOPER.txt in Quiz 7.6

NOTES ON DEVELOPING EXTENSIONS FOR QUIZ
=======================================

Hooks for interacting with a quiz:
 - hook_quiz_begin($quiz, $result_id): This hook is called when a user first begins a quiz.
 - hook_quiz_finished($quiz, $score, $result_id): This hook is called immediately after a user finishes taking a quiz.
 - hook_quiz_scored($quiz, $score, $result_id): This is called when a quiz score is updated. See http://drupal.org/node/460456
 - hook_<entity_type>_<op>: These hooks are called for any entity operations. See quiz_entity_info for all the possible types you can interact with.


DEVELOPING NEW QUESTION TYPES:

You need to create a new module that extends the existing
question type core. The multichoice question type provides a precise example.

Here are the steps:

1. Create a new module
2. Use your module's .install file to create the necessary tables
3. Make sure you module implements hook_quiz_question_info()
4. Define classes that extends QuizQuestion and QuizQuestionResponse.
   For a complete example, see multichoice.classes.inc.

File

DEVELOPER.txt
View source
  1. NOTES ON DEVELOPING EXTENSIONS FOR QUIZ
  2. =======================================
  3. Hooks for interacting with a quiz:
  4. - hook_quiz_begin($quiz, $result_id): This hook is called when a user first begins a quiz.
  5. - hook_quiz_finished($quiz, $score, $result_id): This hook is called immediately after a user finishes taking a quiz.
  6. - hook_quiz_scored($quiz, $score, $result_id): This is called when a quiz score is updated. See http://drupal.org/node/460456
  7. - hook__: These hooks are called for any entity operations. See quiz_entity_info for all the possible types you can interact with.
  8. DEVELOPING NEW QUESTION TYPES:
  9. You need to create a new module that extends the existing
  10. question type core. The multichoice question type provides a precise example.
  11. Here are the steps:
  12. 1. Create a new module
  13. 2. Use your module's .install file to create the necessary tables
  14. 3. Make sure you module implements hook_quiz_question_info()
  15. 4. Define classes that extends QuizQuestion and QuizQuestionResponse.
  16. For a complete example, see multichoice.classes.inc.