0

I think I'm doing something silly... I've been following the tutorial on overriding renderers and had a google but can't work it out. (I was hopeful when I found this other stackoverflow question but it hasn't helped)

I'm trying to override the renderer for a module (studentquiz) but it doesn't seem to be working.

Below is what I've done so far... I've just copy and pasted a function in and then deleted a few lines from it - expecting to see the changes after purging the caches but nothing is happening. Have tried various setups but nothing is working.

Any help would be greatly appreciated!

Many thanks

Ollie


/theme/THEMENAME/config.php has the line:

$THEME->rendererfactory = 'theme_overridden_renderer_factory';

/theme/THEMENAME/renderers.php is as follows:

<?php

defined('MOODLE_INTERNAL') || die;

include_once($CFG->dirroot . "/mod/studentquiz/renderer.php");

class theme_THEMENAME_mod_studentquiz_renderer extends mod_studentquiz_renderer {

   // place your overridden methods (functions) here.

   public function render_stat_block($report) {

      ...

   }

}

I'm deleting the following lines from the function:

    . html_writer::div($this->render_progress_bar($info2), '', array('style' => 'width:inherit'))
    . html_writer::div(get_string('statistic_block_approvals', 'studentquiz')
        .html_writer::span('<b>' .$userstats->questions_approved .'</b>', '',
            array('style' => 'float: right;color:#28A745;')))
    . html_writer::div(get_string('statistic_block_created', 'studentquiz')
        .html_writer::span('<b>' .$userstats->questions_created .'</b>', '',
            array('style' => 'float: right;')))

To demove the last progress bar and two lines from this: enter image description here

1 Answer 1

0

Change the renderer factory in config.php to:

$THEME->rendererfactory = 'theme_THEMENAME_renderer_factory';

It will need to reflect the frankenstyle name of your theme

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.