public static function fetch_all_available($courseid) {
        global $CFG, $DB;

        $result = array();
        $params = array($courseid);
        $sql = "SELECT go.*
                  FROM {grade_outcomes} go, {grade_outcomes_courses} goc
                 WHERE go.id = goc.outcomeid AND goc.courseid = ?
              ORDER BY go.id ASC";

        if ($datas = $DB->get_records_sql($sql, $params)) {
            foreach($datas as $data) {
                $instance = new grade_outcome();
                grade_object::set_properties($instance, $data);
                $result[$instance->id] = $instance;
            }
        }
        return $result;
    }