Merge branch 'MDL-34164_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE
This commit is contained in:
@@ -1108,6 +1108,24 @@ class mod_quiz_renderer extends plugin_renderer_base {
|
||||
'id' => $cm->id, 'mode' => quiz_report_default_report($context)));
|
||||
return html_writer::link($url, $summary);
|
||||
}
|
||||
|
||||
/**
|
||||
* Output a graph, or a message saying that GD is required.
|
||||
* @param moodle_url $url the URL of the graph.
|
||||
* @param string $title the title to display above the graph.
|
||||
* @return string HTML fragment for the graph.
|
||||
*/
|
||||
public function graph(moodle_url $url, $title) {
|
||||
global $CFG;
|
||||
|
||||
if (empty($CFG->gdversion)) {
|
||||
$graph = get_string('gdneed');
|
||||
} else {
|
||||
$graph = html_writer::empty_tag('img', array('src' => $url, 'alt' => $title));
|
||||
}
|
||||
|
||||
return $this->heading($title) . html_writer::tag('div', $graph, array('class' => 'graph'));
|
||||
}
|
||||
}
|
||||
|
||||
class mod_quiz_links_to_other_attempts implements renderable {
|
||||
|
||||
@@ -40,7 +40,7 @@ require_once($CFG->dirroot.'/mod/quiz/report/overview/overview_table.php');
|
||||
class quiz_overview_report extends quiz_attempt_report {
|
||||
|
||||
public function display($quiz, $cm, $course) {
|
||||
global $CFG, $COURSE, $DB, $OUTPUT;
|
||||
global $CFG, $COURSE, $DB, $OUTPUT, $PAGE;
|
||||
|
||||
$this->context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
|
||||
@@ -330,30 +330,25 @@ class quiz_overview_report extends quiz_attempt_report {
|
||||
}
|
||||
|
||||
if (!$table->is_downloading() && $this->should_show_grades($quiz)) {
|
||||
$output = $PAGE->get_renderer('mod_quiz');
|
||||
if ($currentgroup && $groupstudents) {
|
||||
list($usql, $params) = $DB->get_in_or_equal($groupstudents);
|
||||
$params[] = $quiz->id;
|
||||
if ($DB->record_exists_select('quiz_grades', "userid $usql AND quiz = ?",
|
||||
$params)) {
|
||||
$imageurl = new moodle_url('/mod/quiz/report/overview/overviewgraph.php',
|
||||
$imageurl = new moodle_url('/mod/quiz/report/overview/overviewgraph.php',
|
||||
array('id' => $quiz->id, 'groupid' => $currentgroup));
|
||||
$graphname = get_string('overviewreportgraphgroup', 'quiz_overview',
|
||||
$graphname = get_string('overviewreportgraphgroup', 'quiz_overview',
|
||||
groups_get_group_name($currentgroup));
|
||||
echo $OUTPUT->heading($graphname);
|
||||
echo html_writer::tag('div', html_writer::empty_tag('img',
|
||||
array('src' => $imageurl, 'alt' => $graphname)),
|
||||
array('class' => 'graph'));
|
||||
echo $output->graph($imageurl, $graphname);
|
||||
}
|
||||
}
|
||||
|
||||
if ($DB->record_exists('quiz_grades', array('quiz'=> $quiz->id))) {
|
||||
$graphname = get_string('overviewreportgraph', 'quiz_overview');
|
||||
$imageurl = new moodle_url('/mod/quiz/report/overview/overviewgraph.php',
|
||||
$imageurl = new moodle_url('/mod/quiz/report/overview/overviewgraph.php',
|
||||
array('id' => $quiz->id));
|
||||
echo $OUTPUT->heading($graphname);
|
||||
echo html_writer::tag('div', html_writer::empty_tag('img',
|
||||
array('src' => $imageurl, 'alt' => $graphname)),
|
||||
array('class' => 'graph'));
|
||||
$graphname = get_string('overviewreportgraph', 'quiz_overview');
|
||||
echo $output->graph($imageurl, $graphname);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -581,18 +581,17 @@ class quiz_statistics_report extends quiz_default_report {
|
||||
* @param int $quizstatsid the id of the statistics to show in the graph.
|
||||
*/
|
||||
protected function output_statistics_graph($quizstatsid, $s) {
|
||||
global $OUTPUT;
|
||||
global $PAGE;
|
||||
|
||||
if ($s == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$output = $PAGE->get_renderer('mod_quiz');
|
||||
$imageurl = new moodle_url('/mod/quiz/report/statistics/statistics_graph.php',
|
||||
array('id' => $quizstatsid));
|
||||
$OUTPUT->heading(get_string('statisticsreportgraph', 'quiz_statistics'));
|
||||
echo html_writer::tag('div', html_writer::empty_tag('img', array('src' => $imageurl,
|
||||
'alt' => get_string('statisticsreportgraph', 'quiz_statistics'))),
|
||||
array('class' => 'graph'));
|
||||
$graphname = get_string('statisticsreportgraph', 'quiz_statistics');
|
||||
echo $output->graph($imageurl, $graphname);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user