Previewing the grade element now takes into account the format chosen
This commit is contained in:
parent
9b77e2734e
commit
45f87bb7c9
2 changed files with 4 additions and 3 deletions
|
@ -84,7 +84,7 @@ class customcert_element_grade extends customcert_element_base {
|
|||
* @param bool $preview true if it is a preview, false otherwise
|
||||
*/
|
||||
public function render($pdf, $preview) {
|
||||
global $USER;
|
||||
global $COURSE, $USER;
|
||||
|
||||
// If there is no element data, we have nothing to display.
|
||||
if (empty($this->element->data)) {
|
||||
|
@ -96,7 +96,8 @@ class customcert_element_grade extends customcert_element_base {
|
|||
|
||||
// If we are previewing this certificate then just show a demonstration grade.
|
||||
if ($preview) {
|
||||
$grade = get_string('previewgrade', 'customcertelement_grade') . ": 50%";
|
||||
$courseitem = grade_item::fetch_course_item($COURSE->id);
|
||||
$grade = grade_format_gradevalue('100', $courseitem, true, $gradeinfo->gradeformat, 2);
|
||||
} else {
|
||||
// Get the grade for the grade item.
|
||||
$grade = self::get_grade($gradeinfo, $USER->id);
|
||||
|
|
|
@ -24,6 +24,6 @@
|
|||
|
||||
defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.');
|
||||
|
||||
$plugin->version = 2013062800;
|
||||
$plugin->version = 2013072600;
|
||||
$plugin->requires = 2013040500; // Requires this Moodle version.
|
||||
$plugin->component = 'customcertelement_grade';
|
||||
|
|
Loading…
Reference in a new issue