protected function render_badge_related(badge_related $related) {
        $currentbadge = new badge($related->currentbadgeid);
        $languages = get_string_manager()->get_list_of_languages();
        $paging = new paging_bar($related->totalcount, $related->page, $related->perpage, $this->page->url, 'page');
        $htmlpagingbar = $this->render($paging);
        $table = new html_table();
        $table->attributes['class'] = 'generaltable boxaligncenter boxwidthwide';
        $table->head = array(
            get_string('name'),
            get_string('version', 'badges'),
            get_string('language', 'badges'),
            get_string('type', 'badges')
        );
        if (!$currentbadge->is_active() && !$currentbadge->is_locked()) {
            array_push($table->head, '');
        }

        foreach ($related->badges as $badge) {
            $badgeobject = new badge($badge->id);
            $style = array('title' => $badgeobject->name);
            if (!$badgeobject->is_active()) {
                $style['class'] = 'dimmed';
            }
            $context = ($badgeobject->type == BADGE_TYPE_SITE) ?
                context_system::instance() : context_course::instance($badgeobject->courseid);
            $forlink = print_badge_image($badgeobject, $context) . ' ' .
                html_writer::start_tag('span') . $badgeobject->name . html_writer::end_tag('span');
            $name = html_writer::link(new moodle_url('/badges/overview.php', array('id' => $badgeobject->id)), $forlink, $style);

            $row = array(
                $name,
                $badge->version,
                $badge->language ? $languages[$badge->language] : '',
                $badge->type == BADGE_TYPE_COURSE ? get_string('badgesview', 'badges') : get_string('sitebadges', 'badges')
            );
            if (!$currentbadge->is_active() && !$currentbadge->is_locked()) {
                $action = $this->output->action_icon(
                    new moodle_url('related_action.php',
                        array(
                            'badgeid' => $related->currentbadgeid,
                            'relatedid' => $badge->id,
                            'action' => 'remove'
                        )
                    ), new pix_icon('t/delete', get_string('delete')));
                $actions = html_writer::tag('div', $action, array('class' => 'badge-actions'));
                array_push($row, $actions);
            }
            $table->data[] = $row;
        }
        $htmltable = html_writer::table($table);

        return $htmlpagingbar . $htmltable . $htmlpagingbar;
    }