Commit 3179b000 authored by tjhunt's avatar tjhunt
Browse files

blocklib: MDL-19010 Fix blocks that were relying on ->instance in an unfortunate way

parent bb46a4fa
......@@ -18,15 +18,7 @@ class block_activity_modules extends block_list {
$this->content->icons = array();
$this->content->footer = '';
if ($COURSE->id == $this->instance->pageid) {
$course = $COURSE;
} else {
$course = $DB->get_record('course', array('id'=>$this->instance->pageid));
}
if (empty($course)) {
return '';
}
$course = $this->page->course;
require_once($CFG->dirroot.'/course/lib.php');
......@@ -44,7 +36,7 @@ class block_activity_modules extends block_list {
foreach ($modfullnames as $modname => $modfullname) {
if ($modname != 'label') {
$this->content->items[] = '<a href="'.$CFG->wwwroot.'/mod/'.$modname.'/index.php?id='.$this->instance->pageid.'">'.$modfullname.'</a>';
$this->content->items[] = '<a href="'.$CFG->wwwroot.'/mod/'.$modname.'/index.php?id='.$course->id.'">'.$modfullname.'</a>';
$this->content->icons[] = '<img src="'.$CFG->modpixpath.'/'.$modname.'/icon.gif" class="icon" alt="" />';
}
}
......
......@@ -7,8 +7,7 @@ class block_admin extends block_list {
}
function get_content() {
global $CFG, $USER, $SITE, $COURSE, $DB, $PAGE;
global $CFG, $USER, $DB;
if ($this->content !== NULL) {
return $this->content;
......@@ -19,29 +18,8 @@ class block_admin extends block_list {
$this->content->icons = array();
$this->content->footer = '';
if (empty($this->instance->pageid)) { // sticky
if (!empty($COURSE)) {
$this->instance->pageid = $COURSE->id;
}
}
if (empty($this->instance)) {
return $this->content = '';
} else if ($this->instance->pageid == SITEID) {
// return $this->content = '';
}
if (!empty($this->instance->pageid)) {
$context = get_context_instance(CONTEXT_COURSE, $this->instance->pageid);
if ($COURSE->id == $this->instance->pageid) {
$course = $COURSE;
} else {
$course = $DB->get_record('course', array('id'=>$this->instance->pageid));
}
} else {
$context = get_context_instance(CONTEXT_SYSTEM);
$course = $SITE;
}
$context = $this->page->context;
$course = $this->page->course;
if (!has_capability('moodle/course:view', $context)) { // Just return
return $this->content;
......@@ -54,21 +32,19 @@ class block_admin extends block_list {
}
/// Course editing on/off
if ($course->id !== SITEID and has_capability('moodle/course:update', $context)) {
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/edit.gif" class="icon" alt="" />';
if ($PAGE->user_is_editing()) {
$this->content->items[]='<a href="view.php?id='.$this->instance->pageid.'&amp;edit=off&amp;sesskey='.sesskey().'">'.get_string('turneditingoff').'</a>';
if ($this->page->user_is_editing()) {
$this->content->items[]='<a href="view.php?id='.$course->id.'&amp;edit=off&amp;sesskey='.sesskey().'">'.get_string('turneditingoff').'</a>';
} else {
$this->content->items[]='<a href="view.php?id='.$this->instance->pageid.'&amp;edit=on&amp;sesskey='.sesskey().'">'.get_string('turneditingon').'</a>';
$this->content->items[]='<a href="view.php?id='.$course->id.'&amp;edit=on&amp;sesskey='.sesskey().'">'.get_string('turneditingon').'</a>';
}
$this->content->items[]='<a href="'.$CFG->wwwroot.'/course/edit.php?id='.$this->instance->pageid.'">'.get_string('settings').'</a>';
$this->content->items[]='<a href="'.$CFG->wwwroot.'/course/edit.php?id='.$course->id.'">'.get_string('settings').'</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/settings.gif" class="icon" alt="" />';
}
/// Assign roles to the course
if ($course->id != SITEID) {
if (has_capability('moodle/role:assign', $context)) {
$this->content->items[]='<a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php?contextid='.$context->id.'">'.get_string('assignroles', 'role').'</a>';
......@@ -99,7 +75,7 @@ class block_admin extends block_list {
}
if ($reportavailable) {
$this->content->items[]='<a href="'.$CFG->wwwroot.'/grade/report/index.php?id='.$this->instance->pageid.'">'.get_string('grades').'</a>';
$this->content->items[]='<a href="'.$CFG->wwwroot.'/grade/report/index.php?id='.$course->id.'">'.get_string('grades').'</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/grades.gif" class="icon" alt="" />';
}
}
......@@ -107,7 +83,7 @@ class block_admin extends block_list {
/// Course outcomes (to help give it more prominence because it's important)
if (!empty($CFG->enableoutcomes)) {
if ($course->id!==SITEID and has_capability('moodle/course:update', $context)) {
$this->content->items[]='<a href="'.$CFG->wwwroot.'/grade/edit/outcome/course.php?id='.$this->instance->pageid.'">'.get_string('outcomes', 'grades').'</a>';
$this->content->items[]='<a href="'.$CFG->wwwroot.'/grade/edit/outcome/course.php?id='.$course->id.'">'.get_string('outcomes', 'grades').'</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/outcomes.gif" class="icon" alt="" />';
}
}
......@@ -116,7 +92,7 @@ class block_admin extends block_list {
if ($course->metacourse) {
if (has_capability('moodle/course:managemetacourse', $context)) {
$strchildcourses = get_string('childcourses');
$this->content->items[]='<a href="importstudents.php?id='.$this->instance->pageid.'">'.$strchildcourses.'</a>';
$this->content->items[]='<a href="importstudents.php?id='.$course->id.'">'.$strchildcourses.'</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/course.gif" class="icon" alt="" />';
} else if (has_capability('moodle/role:assign', $context)) {
$strchildcourses = get_string('childcourses');
......@@ -127,41 +103,39 @@ class block_admin extends block_list {
/// Manage groups in this course
if (($course->id!==SITEID) && ($course->groupmode || !$course->groupmodeforce) && has_capability('moodle/course:managegroups', $context)) {
$strgroups = get_string('groups');
$this->content->items[]='<a title="'.$strgroups.'" href="'.$CFG->wwwroot.'/group/index.php?id='.$this->instance->pageid.'">'.$strgroups.'</a>';
$this->content->items[]='<a title="'.$strgroups.'" href="'.$CFG->wwwroot.'/group/index.php?id='.$course->id.'">'.$strgroups.'</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/group.gif" class="icon" alt="" />';
}
/// Backup this course
if ($course->id!==SITEID and has_capability('moodle/site:backup', $context)) {
$this->content->items[]='<a href="'.$CFG->wwwroot.'/backup/backup.php?id='.$this->instance->pageid.'">'.get_string('backup').'</a>';
$this->content->items[]='<a href="'.$CFG->wwwroot.'/backup/backup.php?id='.$course->id.'">'.get_string('backup').'</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/backup.gif" class="icon" alt="" />';
}
/// Restore to this course
if ($course->id !== SITEID and has_capability('moodle/site:restore', $context)) {
$this->content->items[]='<a href="'.$CFG->wwwroot.'/files/index.php?id='.$this->instance->pageid.'&amp;wdir=/backupdata">'.get_string('restore').'</a>';
$this->content->items[]='<a href="'.$CFG->wwwroot.'/files/index.php?id='.$course->id.'&amp;wdir=/backupdata">'.get_string('restore').'</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/restore.gif" class="icon" alt="" />';
}
/// Import data from other courses
if ($course->id !== SITEID and has_capability('moodle/site:import', $context)) {
$this->content->items[]='<a href="'.$CFG->wwwroot.'/course/import.php?id='.$this->instance->pageid.'">'.get_string('import').'</a>';
$this->content->items[]='<a href="'.$CFG->wwwroot.'/course/import.php?id='.$course->id.'">'.get_string('import').'</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/restore.gif" class="icon" alt="" />';
}
/// Reset this course
if ($course->id!==SITEID and has_capability('moodle/course:reset', $context)) {
$this->content->items[]='<a href="'.$CFG->wwwroot.'/course/reset.php?id='.$this->instance->pageid.'">'.get_string('reset').'</a>';
$this->content->items[]='<a href="'.$CFG->wwwroot.'/course/reset.php?id='.$course->id.'">'.get_string('reset').'</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/return.gif" class="icon" alt="" />';
}
/// View course reports
if ($course->id !== SITEID and has_capability('moodle/site:viewreports', $context)) { // basic capability for listing of reports
$this->content->items[]='<a href="'.$CFG->wwwroot.'/course/report.php?id='.$this->instance->pageid.'">'.get_string('reports').'</a>';
$this->content->items[]='<a href="'.$CFG->wwwroot.'/course/report.php?id='.$course->id.'">'.get_string('reports').'</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/stats.gif" class="icon" alt="" />';
}
......@@ -187,7 +161,7 @@ class block_admin extends block_list {
}
if ($questionlink) {
$this->content->items[]='<a href="'.$CFG->wwwroot.'/question/'.$questionlink.
'?courseid='.$this->instance->pageid.'">'.get_string('questions', 'quiz').'</a>';
'?courseid='.$course->id.'">'.get_string('questions', 'quiz').'</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/questions.gif" class="icon" alt="" />';
}
}
......@@ -202,7 +176,7 @@ class block_admin extends block_list {
/// Manage files
if ($course->id !== SITEID and has_capability('moodle/course:managefiles', $context)) {
$this->content->items[]='<a href="'.$CFG->wwwroot.'/files/index.php?id='.$this->instance->pageid.'">'.get_string('files').'</a>';
$this->content->items[]='<a href="'.$CFG->wwwroot.'/files/index.php?id='.$course->id.'">'.get_string('files').'</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/files.gif" class="icon" alt=""/>';
}
......@@ -222,10 +196,10 @@ class block_admin extends block_list {
/// Unenrol link
if (empty($course->metacourse) && ($course->id!==SITEID)) {
if (has_capability('moodle/legacy:guest', $context, NULL, false)) { // Are a guest now
$this->content->items[]='<a href="'.$CFG->wwwroot.'/course/enrol.php?id='.$this->instance->pageid.'">'.get_string('enrolme', '', format_string($course->shortname)).'</a>';
$this->content->items[]='<a href="'.$CFG->wwwroot.'/course/enrol.php?id='.$course->id.'">'.get_string('enrolme', '', format_string($course->shortname)).'</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/user.gif" class="icon" alt="" />';
} else if (has_capability('moodle/role:unassignself', $context, NULL, false) and get_user_roles($context, $USER->id, false)) { // Have some role
$this->content->items[]='<a href="'.$CFG->wwwroot.'/course/unenrol.php?id='.$this->instance->pageid.'">'.get_string('unenrolme', '', format_string($course->shortname)).'</a>';
$this->content->items[]='<a href="'.$CFG->wwwroot.'/course/unenrol.php?id='.$course->id.'">'.get_string('unenrolme', '', format_string($course->shortname)).'</a>';
$this->content->icons[]='<img src="'.$CFG->pixpath.'/i/user.gif" class="icon" alt="" />';
}
}
......
......@@ -39,12 +39,6 @@ class block_blog_menu extends block_base {
$this->content = new stdClass;
$this->content->footer = '';
if (empty($this->instance) /*|| empty($CFG->blog_version)*/) {
// Either we're being asked for content without
// an associated instance of the Blog module has never been installed.
$this->content->text = $output;
return $this->content;
}
//if ( blog_isLoggedIn() && !isguest() ) {
$courseviewlink = '';
......
......@@ -60,11 +60,6 @@ class block_blog_tags extends block_base {
return $this->content;
}
if (empty($this->instance)) {
$this->content = '';
return $this->content;
}
$this->content = new stdClass;
$this->content->text = '';
$this->content->footer = '';
......@@ -140,11 +135,7 @@ class block_blog_tags extends block_base {
case BLOG_COURSE_LEVEL:
$filtertype = 'course';
if (isset($COURSE->id)) {
$filterselect = $COURSE->id;
} else {
$filterselect = $this->instance->pageid;
}
$filterselect = $COURSE->id;
break;
default:
......
......@@ -22,7 +22,6 @@ class block_calendar_upcoming extends block_base {
$this->content->text = '';
if (empty($this->instance)) { // Overrides: use no course at all
$courseshown = false;
$filtercourse = array();
$this->content->footer = '';
......
......@@ -7,8 +7,7 @@ class block_course_summary extends block_base {
}
function specialization() {
global $COURSE;
if($this->instance->pagetype == PAGE_COURSE_VIEW && $COURSE->id != SITEID) {
if($this->page->pagetype == PAGE_COURSE_VIEW && $PAGE->course->id != SITEID) {
$this->title = get_string('coursesummary', 'block_course_summary');
}
}
......
......@@ -24,7 +24,7 @@ class block_html extends block_base {
return $this->content;
}
if (!empty($this->instance->pinned) or $this->instance->pagetype === 'course-view') {
if ($this->content_is_trusted()) {
// fancy html allowed only on course page and in pinned blocks for security reasons
$filteropt = new stdClass;
$filteropt->noclean = true;
......@@ -41,6 +41,10 @@ class block_html extends block_base {
return $this->content;
}
function content_is_trusted() {
return in_array($this->page->context->contextlevel, array(CONTEXT_COURSE, CONTEXT_COURSECAT, CONTEXT_SYSTEM));
}
/**
* Will be called before an instance of this block is backed up, so that any links in
* any links in any HTML fields on config can be encoded.
......
......@@ -2,7 +2,7 @@
$usehtmleditor = can_use_html_editor();
$text = isset($this->config->text) ? $this->config->text : '';
if (empty($this->instance->pinned) and $this->instance->pagetype !== 'course-view') {
if (!$this->content_is_trusted()) {
$text = clean_text($text, FORMAT_HTML);
}
?>
......
......@@ -20,7 +20,7 @@ class block_messages extends block_base {
$this->content = new stdClass;
$this->content->text = '';
$this->content->footer = '';
if (empty($this->instance) or empty($USER->id) or isguest() or empty($CFG->messaging)) {
return $this->content;
}
......
......@@ -71,6 +71,12 @@ class block_base {
*/
var $instance = NULL;
/**
* The page that this block is appearing on.
* @var moodle_page
*/
public $page = NULL;
/**
* An object containing the instance configuration information for the current instance of this block.
* @var stdObject $config
......@@ -297,12 +303,13 @@ class block_base {
*/
function is_empty() {
// TODO
if (empty($this->instance->pinned)) {
$context = get_context_instance(CONTEXT_BLOCK, $this->instance->id);
} else {
$context = get_context_instance(CONTEXT_SYSTEM); // pinned blocks do not have own context
}
if ( !has_capability('moodle/block:view', $context) ) {
return true;
}
......@@ -400,29 +407,22 @@ class block_base {
*/
function _add_edit_controls($options) {
global $CFG, $USER, $PAGE;
// TODO
if (empty($this->instance->pinned)) {
$context = get_context_instance(CONTEXT_BLOCK, $this->instance->id);
} else {
$context = get_context_instance(CONTEXT_SYSTEM); // pinned blocks do not have own context
}
// context for site or course, i.e. participant list etc
// check to see if user can edit site or course blocks.
// blocks can appear on other pages such as mod and blog pages...
switch ($this->instance->pagetype) {
case 'course-view':
if (!has_capability('moodle/site:manageblocks', $context)) {
return null;
}
break;
default:
break;
if (!$this->page->user_can_edit_blocks()) {
return null;
}
if (!isset($this->str)) {
$this->str->delete = get_string('delete');
$this->str->moveup = get_string('moveup');
......@@ -454,24 +454,12 @@ class block_base {
$title = $this->str->show;
}
if (empty($this->instance->pageid)) {
$this->instance->pageid = 0;
}
if (($this->instance->pagetype == $PAGE->pagetype) and $this->instance->pageid == $PAGE->id) {
$page = $PAGE;
} else {
$page = new moodle_page();
$page->set_pagetype($this->instance->pagetype);
$page->pageid = $this->instance->pageid;
}
$page = $this->page;
$script = $page->url->out(array('instanceid' => $this->instance->id, 'sesskey' => sesskey()));
if (empty($this->instance->pinned)) {
$movebuttons .= '<a class="icon roles" title="'. $this->str->assignroles .'" href="'.$CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php?contextid='.$context->id.'">' .
'<img src="'.$CFG->pixpath.'/i/roles.gif" alt="'.$this->str->assignroles.'" /></a>';
}
$movebuttons .= '<a class="icon roles" title="'. $this->str->assignroles .'" href="'.$CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php?contextid='.$context->id.'">' .
'<img src="'.$CFG->pixpath.'/i/roles.gif" alt="'.$this->str->assignroles.'" /></a>';
if ($this->user_can_edit()) {
$movebuttons .= '<a class="icon hide" title="'. $title .'" href="'.$script.'&amp;blockaction=toggle">' .
'<img src="'. $CFG->pixpath.$icon .'" alt="'.$title.'" /></a>';
......@@ -643,7 +631,7 @@ class block_base {
* @param block $instance
* @todo add additional documentation to further explain the format of instance and config
*/
function _load_instance($instance) {
function _load_instance($instance, $page) {
if (!empty($instance->configdata)) {
$this->config = unserialize(base64_decode($instance->configdata));
}
......@@ -653,6 +641,7 @@ class block_base {
// so it won't work correctly. Thus it's commented out.
// unset($instance->configdata);
$this->instance = $instance;
$this->page = $page;
$this->specialization();
}
......@@ -812,12 +801,13 @@ class block_list extends block_base {
function is_empty() {
// TODO
if (empty($this->instance->pinned)) {
$context = get_context_instance(CONTEXT_BLOCK, $this->instance->id);
} else {
$context = get_context_instance(CONTEXT_SYSTEM); // pinned blocks do not have own context
}
if ( !has_capability('moodle/block:view', $context) ) {
return true;
}
......
......@@ -37,6 +37,7 @@ class block_online_users extends block_base {
// Get context so we can check capabilities.
$context = get_context_instance(CONTEXT_COURSE, $COURSE->id);
// TODO
if (empty($this->instance->pinned)) {
$blockcontext = get_context_instance(CONTEXT_BLOCK, $this->instance->id);
} else {
......
......@@ -15,22 +15,14 @@ class block_participants extends block_list {
return $this->content;
}
// the following 3 lines is need to pass _self_test();
if (empty($this->instance->pageid)) {
return '';
}
$this->content = new object();
$this->content->items = array();
$this->content->icons = array();
$this->content->footer = '';
/// MDL-13252 Always get the course context or else the context may be incorrect in the user/index.php
if (!$currentcontext = get_context_instance(CONTEXT_COURSE, $COURSE->id)) {
$this->content = '';
return $this->content;
}
$currentcontext = $this->page->context;
if ($COURSE->id == SITEID) {
if (!has_capability('moodle/site:viewparticipants', get_context_instance(CONTEXT_SYSTEM))) {
$this->content = '';
......
......@@ -32,37 +32,33 @@ class block_quiz_results extends block_base {
return $this->content;
}
if($this->instance->pagetype == 'course-view') {
// We need to see if we are monitoring a quiz
$quizid = empty($this->config->quizid) ? 0 : $this->config->quizid;
$courseid = $this->instance->pageid;
}
else {
// Assuming we are displayed in the quiz view page
$quizid = $this->instance->pageid;
// A trick to take advantage of instance config and save queries
if (empty($this->config->courseid)) {
$modrecord = $DB->get_record('modules', array('name'=>'quiz'));
$cmrecord = $DB->get_record('course_modules', array('module'=>$modrecord->id, 'instance'=>$quizid));
$this->config->courseid = intval($cmrecord->course);
$this->instance_config_commit();
if ($this->page->activityname == 'quiz') {
$quiz = $this->page->activityrecord;
$quizid = $quiz->id;
$courseid = $this->page->course->id;
$inquiz = true;
} else if (!empty($this->config->quizid)) {
$quizid = $this->config->quizid;
$quiz = $DB->get_record('quiz', array('id' => $quizid));
if (empty($quiz)) {
$this->content->text = get_string('error_emptyquizrecord', 'block_quiz_results');
return $this->content;
}
$courseid = $this->config->courseid;
$courseid = $quiz->course;
$inquiz = false;
} else {
$quizid = 0;
}
$context = get_context_instance(CONTEXT_COURSE, $courseid);
$context = $this->page->context;
if (empty($quizid)) {
$this->content->text = get_string('error_emptyquizid', 'block_quiz_results');
return $this->content;
}
// Get the quiz record
$quiz = $DB->get_record('quiz', array('id' => $quizid));
if (empty($quiz)) {
$this->content->text = get_string('error_emptyquizrecord', 'block_quiz_results');
if (empty($this->config->showbest) && empty($this->config->showworst)) {
$this->content->text = get_string('configuredtoshownothing', 'block_quiz_results');
return $this->content;
}
......@@ -75,20 +71,23 @@ class block_quiz_results extends block_base {
return $this->content;
}
if (empty($this->config->showbest) && empty($this->config->showworst)) {
$this->content->text = get_string('configuredtoshownothing', 'block_quiz_results');
return $this->content;
}
$groupmode = NOGROUPS;
$best = array();
$worst = array();
$nameformat = intval(empty($this->config->nameformat) ? B_QUIZRESULTS_NAME_FORMAT_FULL : $this->config->nameformat);
if (!empty($this->config->nameformat)) {
$nameformat = $this->config->nameformat;
} else {
$nameformat = B_QUIZRESULTS_NAME_FORMAT_FULL;
}
if(!empty($this->config->usegroups)) {
$groupmode = groups_get_activity_groupmode(
get_coursemodule_from_instance('quiz', $quizid, $courseid), $courseid);
if (!empty($this->config->usegroups)) {
if ($inquiz) {
$cm = $this->page->cm;
} else {
$cm = get_coursemodule_from_instance('quiz', $quizid, $courseid);
}
$groupmode = groups_get_activity_groupmode($cm);
}
if (has_capability('moodle/site:accessallgroups', $context) && $groupmode == SEPARATEGROUPS) {
......@@ -96,7 +95,7 @@ class block_quiz_results extends block_base {
$groupmode = VISIBLEGROUPS;
}
switch($groupmode) {
switch ($groupmode) {
case VISIBLEGROUPS:
// Display group-mode results
$groups = groups_get_all_groups($courseid);
......@@ -110,7 +109,7 @@ class block_quiz_results extends block_base {
// Find out all the userids which have a submitted grade
$userids = array();
$gradeforuser = array();
foreach($grades as $grade) {
foreach ($grades as $grade) {
$userids[] = $grade->userid;
$gradeforuser[$grade->userid] = (float)$grade->grade;
}
......@@ -152,14 +151,14 @@ class block_quiz_results extends block_base {
// Collect all the group results we are going to use in $best and $worst
$remaining = $numbest;
$groupgrade = end($groupgrades);
while($remaining--) {
while ($remaining--) {
$best[key($groupgrades)] = $groupgrade['average'];
$groupgrade = prev($groupgrades);
}
$remaining = $numworst;
$groupgrade = reset($groupgrades);
while($remaining--) {
while ($remaining--) {
$worst[key($groupgrades)] = $groupgrade['average'];
$groupgrade = next($groupgrades);
}
......@@ -167,7 +166,7 @@ class block_quiz_results extends block_base {
// Ready for output!
$gradeformat = intval(empty($this->config->gradeformat) ? B_QUIZRESULTS_GRADE_FORMAT_PCT : $this->config->gradeformat);
if($this->instance->pagetype != 'mod-quiz-view') {
if (!$inquiz) {
// Don't show header and link to the quiz if we ARE at the quiz...
$this->content->text .= '<h1><a href="'.$CFG->wwwroot.'/mod/quiz/view.php?q='.$quizid.'">'.$quiz->name.'</a></h1>';
}
......@@ -319,7 +318,7 @@ class block_quiz_results extends block_base {
$gradeformat = intval(empty($this->config->gradeformat) ? B_QUIZRESULTS_GRADE_FORMAT_PCT : $this->config->gradeformat);