public static function get_notes($notes) {
        global $CFG;

        $params = self::validate_parameters(self::get_notes_parameters(), array('notes' => $notes));
        // Check if note system is enabled.
        if (!$CFG->enablenotes) {
            throw new moodle_exception('notesdisabled', 'notes');
        }
        $resultnotes = array();
        foreach ($params['notes'] as $noteid) {
            $resultnote = array();

            $note = note_load($noteid);
            if (isset($note->id)) {
                // Ensure the current user is allowed to run this function.
                $context = context_course::instance($note->courseid);
                self::validate_context($context);
                require_capability('moodle/notes:view', $context);
                list($gotnote['text'], $gotnote['format']) = external_format_text($note->content,
                                                                                  $note->format,
                                                                                  $context->id,
                                                                                  'notes',
                                                                                  '',
                                                                                  '');
                $gotnote['noteid'] = $note->id;
                $gotnote['userid'] = $note->userid;
                $gotnote['publishstate'] = $note->publishstate;
                $gotnote['courseid'] = $note->courseid;
                $resultnotes["notes"][] = $gotnote;
            } else {
                $resultnotes["warnings"][] = array('item' => 'note',
                                                   'itemid' => $noteid,
                                                   'warningcode' => 'badid',
                                                   'message' => 'Note does not exist');
            }
        }
        return $resultnotes;
    }