Incorporate a progress bar inside a quiz

Incorporate a progress bar inside a quiz

by Peter Onyx -
Number of replies: 6

I use Moodle 3.0 and I want to incorporate a progress bar inside my quiz module so that while the user is going on through the quiz they can see the progress in a graphical way. I found a block named Level up but it disappears when the quiz starts. I want to know how I can keep the block still on and if possible incorporate the block inside the quiz area above the question maybe. Thanks. 

Average of ratings: -
In reply to Peter Onyx

Re: Incorporate a progress bar inside a quiz

by John Provasnik -
Picture of Particularly helpful Moodlers Picture of Testers

Tim's suggestion should be what you are looking for.

The Level Up block would not provide any useful function inside the quiz module, but to get it to appear you would need to go to into your quiz settings, click on Appearance, (possibly click on "show more") - then choose "yes" to Show Blocks During Quiz attempt) --> I don't recommend this as it will clutter your quiz page up with unneeded blocks. 


Do you have your quiz questions all on one page spread over several pages? I don't believe the colors of the boxes change until your students save their attempts. (Am I wrong Tim?). So you may want to put one question per page to see the color change as you take the quiz and answer each question:



In reply to John Provasnik

Re: Incorporate a progress bar inside a quiz

by Peter Onyx -

Hi Tim and John, thanks for replying. Yes the quiz navigation does the trick. The blocks change their color as the participant keeps answering the questions. I want to somehow change how it looks like and put a progress bar which also denotes the progress of the quiz and I want to put it in the same block as the quiz just above the question. I think it will look better. But I dont know if thats possible. Please help 

Attachment something like this.PNG
In reply to Peter Onyx

Re: Incorporate a progress bar inside a quiz

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

The general technique for customising Moodle's interface is known as 'overriding a renderer'. See https://docs.moodle.org/dev/Overriding_a_renderer

That only works for parts of Moodle where the output is generated by renderers, but for the quiz it is.

So, the renderer you probably want to override is https://github.com/moodle/moodle/blob/master/mod/quiz/renderer.php#L420. Add a bit to display the progress bar. $attemptobj should contain all the data you need.

Average of ratings: Useful (1)
In reply to John Provasnik

Re: Incorporate a progress bar inside a quiz

by Peter Onyx -

I got it to appear but I want it not on the side of the page where blocks normally appear but inside the quiz content area where questions appear and the progress bar appears above the question. I show one question per page of the quiz. 

In reply to Peter Onyx

Re: Incorporate a progress bar inside a quiz

by Peter Onyx -
I added a picture of what exactly I want to make. The progress bar at the top and then the questions and then below it will be the next button. Is it possible?
Attachment 20151211_151032.jpg