I have added new field image in True/false question content type but it does not display in quiz. Is there a way to make it display.

I have looked at demo site in http://knackforge.com/drupal-7-quiz-demo-site and it is possible to have image, videos but just couldn't figure out how to do it.

Comments

ezraw’s picture

This works in 7.x-5.x-dev.

djdevin’s picture

Version: 7.x-4.0-beta2 » 7.x-5.x-dev
Category: Support request » Feature request

Just tested this and it did not. Now when you view the question its fine as expected, but inside of the quiz the fields don't show.

Talked about this briefly at Drupalcon @ the Quiz BOF, we need to render the entity and it will open up a lot more behaviours.

djdevin’s picture

Status: Active » Needs review

  • Commit 5bac050 on 7.x-5.x by djdevin:
    Issue #2268045: build the node content and display it, hard exclude the...
seanenroute’s picture

Issue summary: View changes
StatusFileSize
new9.71 MB

The June 7 version of 7.5 dev looks like it will utilize an image field. I've enclosed a quick demo video of it in action.

For those using 7.4 you can use the Quiz CCK module to bring in images and videos.

  • Commit 5bac050 on 7.x-5.x, 2269219 by djdevin:
    Issue #2268045: build the node content and display it, hard exclude the...

  • Commit 5bac050 on 7.x-5.x, 2269219 by djdevin:
    Issue #2268045: build the node content and display it, hard exclude the...
ezraw’s picture

Status: Needs review » Reviewed & tested by the community

Tested true/false question by adding an image field, creating a quiz, add a t/f question with an image and taking test as an authenticated user. Image appears as expected.

ezraw’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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

yogesh kushwaha’s picture

how to display audio field when user is actually taking the quiz. It shows on the multiple choice content type node, but not when user is actually taking the quiz. is there any available patch or still not fixed? I am still wondering..

Thanks

djdevin’s picture

Make sure you are using the 5.x version of the module.

yogesh kushwaha’s picture

thanks its working now but at result page it display each question score, I need result summary also. How can I do this because my requirement is to display result summary as well as score.

esod’s picture

Status: Closed (fixed) » Needs work
StatusFileSize
new14.45 KB
new18.32 KB

We're using 7.x-5.0-alpha4+72-dev. I've added the image field (field_quiz_icon) to the quiz, multichoice, and truefalse content types. I've added an image to the quiz node on node/11111/edit. I've added an image to the multichoice question through the Manage questions admin interface. node/11111/quiz/questions -> Edit, which takes me to node/22222/edit.

The image appears on the question node (node/22222) and on the quiz node (node/11111). In the quiz itself, field_quiz_icon is empty.







I can node_load(11111) in my hook_form_alter() to get the data:







but that seems expensive. However for our use case node_load() on the quiz will pre-empt administrators having to add the same image to each question. But that's our use case.

Any thoughts?

djdevin’s picture

Are you sure your quiz has the correct revision of the question? That's the only way the field would be empty.

Note that you will have to finish your current result to start a new one with the new revision. Check the "Manage questions" tab to make sure you are on the current revision of the question before doing so.

esod’s picture

Thanks. When I went to Manage questions I noticed that one of the questions (perhaps the one that had the image), needed to be updated. But for us the question becomes moot since we decided that we want to have only one image for the entire quiz print on each question and on the report page. To accomplish that I'm querying the database in my form_alter with:

      // Add the quiz_icon to $form
      $quiz_icon = db_query("SELECT fm.uri FROM {file_managed} fm
        INNER JOIN {file_usage} fu ON fm.fid = fu.fid
        WHERE fu.id = :nid", array(':nid' => arg(1)))->fetchField();

We don't love using arg(), and it's going away in Drupal 8, but for this case we're going with it. I'm sure there's a query that will get the uri without using arg().

If we add another image, this one to the question, I'll comment again.

djdevin’s picture

Status: Needs work » Closed (fixed)

Sure, so this still works.

If you did want to do something special with the way questions render, keep in mind that they are nodes, and they have view modes (Question view mode), so if you were to do something with the template or display suite, the changes would be visible. That is probably better than doing a form alter.

#2371115: Quiz question "take" not rendering using correct template might provide some more insight.

esod’s picture

We are most likely not using display suite. When you say "do something with the template" are you referring to a display suite template? Adding to $form gets the values to our copy of quiz-report-form.tpl.php, but so far we can add elements to the presentation layer by either:

1. using #weight in the elements we are adding; not an ideal solution.
2. adding theme templates whose contents print below the form values.

I might be a little off topic for this issue. I'm just concerned about getting the public facing pages to a place where the front end folks can perform their magic.

neubreed’s picture

It would be good to be able to inert any entity and have it appear on the rendered question. I've tried media which allows for all sorts of file types, which doesn't work unfortunately :(

I want the user to insert either an image or video_embed which works but I don't want them to be able to insert both. So I installed conditional_fields so the user chooses one or the other and nothing appears on the rendered question even though both these types do work.

Is there a hook in the module somewhere so I can override the question rendering to get this to work?

** EDIT ** Sorry worked it out .. I need to delete all the results to see any updates to the questions

vmkazakoff’s picture

not work with private files (