Move timer to top of Quiz Navigation block: Moodle 3.5

Move timer to top of Quiz Navigation block: Moodle 3.5

by Devin Black -
Number of replies: 3

I have a timed quiz with 100 questions. The timer is at the bottom, below the 100 boxes. The students have pointed out that they cannot easily see the timer and have suggested moving it to the yop of the quiz navigation bar.

I have looked at other solutions to this problem, all of which require knowledge in some programming language. Unfortunately, the explanations were not very clear to someone wothout programming experience.

If someone could give the code to copy, and say exactly where to paste it, I am sure many would greatly appreciate it. 

Average of ratings: -
In reply to Devin Black

Re: Move timer to top of Quiz Navigation block: Moodle 3.5

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

Code is in mod/quiz/renderer.php. https://github.com/moodle/moodle/blob/master/mod/quiz/renderer.php#L317

I think you need to move the

$output .= html_writer::tag('div', $panel->render_end_bits($this),
array('class' => 'othernav'));

bit higher up.

Average of ratings: Useful (2)
In reply to Tim Hunt

Re: Move timer to top of Quiz Navigation block: Moodle 3.5

by Devin Black -
Hi Tim,

Thanks for the quick reply. Your assistance worked.

After some tinkering, this is what I did:
1. I opened the renderer.php file
2. I searched for the code you supplied from your repsonse
3. I cut the code
4. I pasted it over this code which was a bit hire up: $output = '';

I went to my Moodle quiz and the timer is now above the little boxes of questions. So, I guess it worked.

My worry is this: Did deleting $output = ''; affect something else?
Average of ratings: Useful (1)
In reply to Devin Black

Re: Move timer to top of Quiz Navigation block: Moodle 3.5

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
It would probably be better to put the $output = ''; line back, just above the bit you moved. (Although, it makes almost no difference - I think the only way to see a difference is to set Debugging to Developer level, and then you would see a warning about using an un-initialised variable, but since a not set variable is treated as an empty string, there is no real problem.)

Also, you you have a custom theme, then there is a technique for getting what you want without editing the standard Moodle code: https://docs.moodle.org/dev/Overriding_a_renderer - I only point that out because changing core code, while a quick win, makes upgrading to a new version of Moodle more tricky.
Average of ratings: Useful (1)