public function get_related_badges(badge $badge) {
        global $DB;
        $arraybadges = array();
        $relatedbadges = $badge->get_related_badges(true);
        if ($relatedbadges) {
            foreach ($relatedbadges as $rb) {
                $url = new moodle_url('/badges/badge_json.php', array('id' => $rb->id));
                $arraybadges[] = array(
                    'id'        => $url->out(false),
                    'version'   => $rb->version,
                    '@language' => $rb->language
                );
            }
        }
        return $arraybadges;
    }