Merge branch 'MDL-68747-310' of https://github.com/dcai/moodle into MOODLE_310_STABLE

This commit is contained in:
abgreeve 2021-05-07 11:16:46 +08:00 committed by Jake Dallimore
commit 5ed11926a6
2 changed files with 8 additions and 4 deletions

View file

@ -1246,10 +1246,12 @@ class mod_quiz_renderer extends plugin_renderer_base {
* *
* @param \core\chart_base $chart The chart. * @param \core\chart_base $chart The chart.
* @param string $title The title to display above the graph. * @param string $title The title to display above the graph.
* @param array $attrs extra container html attributes.
* @return string HTML fragment for the graph. * @return string HTML fragment for the graph.
*/ */
public function chart(\core\chart_base $chart, $title) { public function chart(\core\chart_base $chart, $title, $attrs = []) {
return $this->heading($title, 3) . html_writer::tag('div', $this->render($chart), array('class' => 'graph')); return $this->heading($title, 3) . html_writer::tag('div',
$this->render($chart), array_merge(['class' => 'graph'], $attrs));
} }
/** /**

View file

@ -225,7 +225,8 @@ class quiz_overview_report extends quiz_attempts_report {
$data = quiz_report_grade_bands($bandwidth, $bands, $quiz->id, $groupstudentsjoins); $data = quiz_report_grade_bands($bandwidth, $bands, $quiz->id, $groupstudentsjoins);
$chart = self::get_chart($labels, $data); $chart = self::get_chart($labels, $data);
$graphname = get_string('overviewreportgraphgroup', 'quiz_overview', groups_get_group_name($currentgroup)); $graphname = get_string('overviewreportgraphgroup', 'quiz_overview', groups_get_group_name($currentgroup));
echo $output->chart($chart, $graphname); // Numerical range data should display in LTR even for RTL languages.
echo $output->chart($chart, $graphname, ['dir' => 'ltr']);
} }
} }
@ -233,7 +234,8 @@ class quiz_overview_report extends quiz_attempts_report {
$data = quiz_report_grade_bands($bandwidth, $bands, $quiz->id, new \core\dml\sql_join()); $data = quiz_report_grade_bands($bandwidth, $bands, $quiz->id, new \core\dml\sql_join());
$chart = self::get_chart($labels, $data); $chart = self::get_chart($labels, $data);
$graphname = get_string('overviewreportgraph', 'quiz_overview'); $graphname = get_string('overviewreportgraph', 'quiz_overview');
echo $output->chart($chart, $graphname); // Numerical range data should display in LTR even for RTL languages.
echo $output->chart($chart, $graphname, ['dir' => 'ltr']);
} }
} }
return true; return true;