How to move Quiz Timer to the top of the Quiz Navigation block?

How to move Quiz Timer to the top of the Quiz Navigation block?

by Nattapong K -
Number of replies: 5

Hi,

Could anyone advise me how to move Quiz Timer to the top of the Quiz Navigation block? because the timer will not be seen without scrolling down when the quiz have too many questions like 100.

Thank you,

Average of ratings: Useful (1)
In reply to Nattapong K

Re: How to move Quiz Timer to the top of the Quiz Navigation block?

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

You would need to use the technique descrived here: http://docs.moodle.org/dev/Themes_2.0_overriding_a_renderer to override the method mod_quiz_renderer::navigation_panel

Well, that is the theory anyway, the way that method is writted does not really make it very easy to change. sad Probably the way I would tackle this is to override the method as

$output = parent::navigation_panel($panel);
return preg_replace( ... , $output);

Using preg_repace to re-order the HTML is horrible, but probably the easiest option.

In reply to Tim Hunt

Re: How to move Quiz Timer to the top of the Quiz Navigation block?

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Tim "Well, that is the theory anyway, the way that method is writted does not really make it very easy to change."

Hi Tim,

Since your return from the States I seem to notice a degradation of your English grammar standards.wink

Joseph (once a teacher, always a teacher blush)

In reply to Joseph Rézeau

QA testing progress

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

I think we have to blame that on the jet-lag, not the americans wink

Hopefully I have not been that careless when writing the bug-fixes I did since I got back. Well, I know I was one time, but then Dan P spotted the problem during integration.

For anyone wondering how QA testing is going, you need to keep an eye on http://tracker.moodle.org/secure/Dashboard.jspa?selectPageId=11454. In terms of the quiz stuff, it is going well. Out of 73 quiz/question tests, 67 have passed, and 6 are still todo. The todo ones are mostly ones that had failed once, and I have now done a bug-fix.

Overall, out of 651 tests, there are 30 failures awaiting a bug-fix, and 35 ones that need to be (re-)tested. They are still aiming at a 2.3 release on 18th June, but that really depends on how long the last few bugs take.

I will say that having been using 2.3 while fixing bugs, some of the changes are very nice. Partiularly the changes to the Files system, and to the UI for editing the course page.

In reply to Tim Hunt

Re: How to move Quiz Timer to the top of the Quiz Navigation block?

by Nattapong K -

Hi Tim,

Could you please give some guidance to the part of php I am supposed to revise in order to get the timer on top of the block?

I already tried on the renderer.php but nothing changed.

 

Thank you,

In reply to Nattapong K

Re: How to move Quiz Timer to the top of the Quiz Navigation block?

by Nattapong K -

I found the way, it is renderer.php and recode just like this:

 

    public function navigation_panel(quiz_nav_panel_base $panel) {

        $output = '';
  $output .= html_writer::tag('div', $panel->render_end_bits($this),
                array('class' => 'othernav'));
        $userpicture = $panel->user_picture();
        if ($userpicture) {
            $output .= html_writer::tag('div', $this->render($userpicture),
                    array('id' => 'user-picture', 'class' => 'clearfix'));
        }
        $output .= $panel->render_before_button_bits($this);

        $output .= html_writer::start_tag('div', array('class' => 'qn_buttons'));
        foreach ($panel->get_question_buttons() as $button) {
            $output .= $this->render($button);
        }
        $output .= html_writer::end_tag('div');

       

        $this->page->requires->js_init_call('M.mod_quiz.nav.init', null, false,
                quiz_get_js_module());

        return $output;
    }