public static function list_courses($competencyid) {
        global $DB;

        $results = $DB->get_records_sql('SELECT course.id, course.visible, course.shortname, course.idnumber,
                                                course.fullname, course.summary, course.summaryformat, course.startdate,
                                                course.enddate, course.category
                                           FROM {course} course
                                           JOIN {' . self::TABLE . '} coursecomp
                                             ON coursecomp.courseid = course.id
                                          WHERE coursecomp.competencyid = ? ', array($competencyid));

        return $results;
    }
public static function list_courses($competencyid) {
        global $DB;

        $results = $DB->get_records_sql('SELECT course.id, course.visible, course.shortname, course.idnumber,
                                                course.fullname, course.summary, course.summaryformat, course.startdate,
                                                course.enddate, course.category
                                           FROM {course} course
                                           JOIN {' . self::TABLE . '} coursecomp
                                             ON coursecomp.courseid = course.id
                                          WHERE coursecomp.competencyid = ? ', array($competencyid));

        return $results;
    }
public static function list_courses ( $ competencyid ) { global $ DB ; $ results = $ DB -> get_records_sql ( 'SELECT course.id, course.visible, course.shortname, course.idnumber,
                                                course.fullname, course.summary, course.summaryformat, course.startdate,
                                                course.enddate, course.category
                                           FROM {course} course
                                           JOIN {' . self :: TABLE . '} coursecomp
                                             ON coursecomp.courseid = course.id
                                          WHERE coursecomp.competencyid = ? ' , array ( $ competencyid ) ) ; return $ results ; }
Return partial course records foreach course that contains this competency.

@param int $competencyid The competency id
@return array[stdClass] Array of course records containg id, visible, shortname, idnumber, fullname
Return partial course records foreach course that contains this competency .