When I create a view of type quiz, the row style for the views shows up as fields. There is no option to change it to node.
Am I missing something? Or this is currently not implemented?

I also tried creating a regular node view with row style set to node, and tried adding relationship to question type.
Here the relation to quiz is available but not to quiz question. The quiz question relation is only available to a view of type quiz.
Is there a way to add the quiz question relationship in a regular view of type node?

I am trying to do this to achieve a full page view of all the questions. The ultimate goal being to make the quiz questions available for download as pdf using the print module. There is no need for the questions to be submittable.

Comments

v-a-1’s picture

Ok, so I've had some progress. I decided to try and modify the quiz.views.inc file to try and expose the answer fields from the multichoice question type. (Find code below).

I think I have the implementation correct, and the relationship of quiz_multichoice_answers table to quiz_node_relationship is also correct. But somehow it doesn't work. However, if I change the join for quiz_multichoice_answers to quiz_node_properties along with relevant changes to the 'left_field', instead of the above stated quiz_node_relationship, I can at least see the group and the fields listing in views UI. However nothing gets returned and the query that is run makes no sense.

Currently, with the following code, there are no fields or the group available in views. Any ideas?

  $data['quiz_multichoice_answers'] = array(
    'table' => array(
      'group' => t('Quiz Questions Answers'),
      'join' => array(
        // This is vid because vid is always more specific. We never work with
        // nid.
        'quiz_node_relationship' => array(
          'left_field' => 'child_vid',
          'field' => 'question_vid',
          'type' => 'INNER',
        ),
      ),
    ),
    //field defs
    'question_vid' => array(
      'title' => t('Quiz Question Node ID'),
      'help' => t('The node id of the quiz question to which the answer is attached.'),
      'field' => array(
        'handler' => 'views_handler_field_numeric',
        'click sortable' => TRUE,
      ),
      'sort' => array(
        'handler' => 'views_handler_sort',
      ),
    ),
    
    'answer' => array(
      'title' => t('Quiz Question Answer'),
      'help' => t('The answer attached to the question node.'),
      'field' => array(
        'handler' => 'views_handler_field',
        'click sortable' => TRUE,
      ),
      'sort' => array('handler' => 'views_handler_sort'),
    ), 
  );

I added the above to the quiz.views.inc just before the return $data line.

v-a-1’s picture

I just found two other issues that are more or less related. Just thought I'd mention it.

http://drupal.org/node/451302#comment-1551482
and
http://drupal.org/node/1115476

sokrplare’s picture

Component: Code - Quiz module » Code - Views
michaelk’s picture

StatusFileSize
new1.45 KB

Hello,

Here is a patch that adds the Quiz Question relationship off of the node table for Views. We are using this code to handle a case similar to the one described in the ticket, so it seems like it should also fix this case.

Please note, this patch is for the 7.x-4.x version of the module.

michaelk’s picture

Version: 6.x-4.1 » 7.x-4.x-dev
Status: Active » Needs review
michaelk’s picture

Here is the patch with the correct attribution.

djdevin’s picture

Issue summary: View changes
Status: Needs review » Closed (outdated)

Fixed in 7.x-5.0 with entity API views support.