Make view hook of question (not quiz) not show quiz-taking features when not in quiz context

turadg - July 3, 2009 - 19:58
Project:Quiz
Version:6.x-4.x-dev
Component:Code - Quiz module
Category:feature request
Priority:normal
Assigned:turadg
Status:closed
Description

This was mentioned in http://drupal.org/node/507664#comment-1773092

For now, instead of a big refactoring of Quiz to support varied renderings, let's at least have the question types check whether they're being displayed in a quiz, and if not then not render the navigation controls.

I've done this in quiz_question and multichoice (since that doesn't use the quiz_question OO system yet). I'm committing by CVS but I thought I'd share here the essential logic:

$display_object = menu_get_object();

switch ($display_object->type) {
case 'quiz':
// do quiz stuff
break;
default:
// do non-quiz stuff
}

I made it a switch instead of an if-else because I plan to make a new context, item_collection, that will have different rendering logic.

Sivaji, I think this should allow me to make changes for the item_collection and lone question rendering and functionality without affecting your quiz work. Let me know what you think.

#1

turadg - August 11, 2009 - 22:37
Status:active» fixed

Fixed, though the repeated code throughout the quiz question modules might be worth making an AbstractQuizQuestion class for them to inherit from.

#2

System Message - August 25, 2009 - 22:40
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.