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

Oliver Trampleasure
  • 3,293
  • 1
  • 10
  • 25

1 Answers1

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

johnok
  • 31
  • 6