Skip to content

I have a need to display gradebook items on the certificate #268

@goose2000

Description

@goose2000

Describe the solution you'd like
I would like to add a new token for {GRADEITEMS} in the certificate. Currently it only will show graded module activities. I many time would like to show these other items like Lab - 90, Museum - 100, Breakout Session 1 - 70

I believe this is done in the locallib.php file. I can see where it filters out only 'mod' type grades:

`
protected function get_user_results($userid = null) {
global $USER;

    if (empty($userid)) {
        $userid = $USER->id;
    }

    $items = grade_item::fetch_all(array('courseid' => $this->course->id));
    if (empty($items)) {
        return '';
    }

    // Sorting grade itens by sortorder.
    usort($items, function($a, $b) {
        $asortorder = $a->sortorder;
        $bsortorder = $b->sortorder;
        if ($asortorder == $bsortorder) {
            return 0;
        }
        return ($asortorder < $bsortorder) ? -1 : 1;
    });

    $retval = '';
    foreach ($items as $id => $item) {
        // Do not include grades for course itens.
        
	if ($item->itemtype != 'mod') {
            continue;
        }
		
        $cm = get_coursemodule_from_instance($item->itemmodule, $item->iteminstance);
        $usergrade = $this->get_formated_grade($this->get_mod_grade($cm->id, $userid));
        $retval = $item->itemname . ": $usergrade<br>" . $retval;
    }
    return $retval;
}`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions