I am using the rate_course block in a Moodle 3.0 site, but there is a problem.


I added the block manually to the site and installed it without any problems. The block displays fine, but falls over when trying to give the course a rating.

The problem is the build_navigation() method that is called from the rate.php page.


The fix I used to get around the problem was to comment out the block of code that builds the page header and insert my own code.

//$context = get_context_instance(CONTEXT_COURSE, $courseid);
//$PAGE->set_url('/blocks/rate_course/rate.php', array('courseid'=>$courseid));
//$title = get_string('giverating', 'block_rate_course');
//$link[] = array('name' => $title, 'link' => '', 'type' => 'misc');
//print_header_simple($title, $title, $link);
/* START */
$context = context_course::instance($courseid);
$url = new moodle_url('/blocks/rate_course/rate.php', array('courseid'=>$courseid));
if ($action) {
 $url->param('action', $action);
// Page info.
$PAGE->set_title(get_string('giverating', 'block_rate_course'));
echo $OUTPUT->header();
/* FIN */

Hopefully this may help someone else when migrating an old block for Moodle 3.0


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s