public static function count_competencies($courseid) {
        global $DB;

        $sql = 'SELECT COUNT(comp.id)
                  FROM {' . self::TABLE . '} coursecomp
                  JOIN {' . competency::TABLE . '} comp
                    ON coursecomp.competencyid = comp.id
                 WHERE coursecomp.courseid = ? ';
        $params = array($courseid);

        $results = $DB->count_records_sql($sql, $params);

        return $results;
    }
public static function count_competencies($courseid) {
        global $DB;

        $sql = 'SELECT COUNT(comp.id)
                  FROM {' . self::TABLE . '} coursecomp
                  JOIN {' . competency::TABLE . '} comp
                    ON coursecomp.competencyid = comp.id
                 WHERE coursecomp.courseid = ? ';
        $params = array($courseid);

        $results = $DB->count_records_sql($sql, $params);

        return $results;
    }
public static function count_competencies ( $ courseid ) { global $ DB ; $ sql = 'SELECT COUNT(comp.id)
                  FROM {' . self :: TABLE . '} coursecomp
                  JOIN {' . competency :: TABLE . '} comp
                    ON coursecomp.competencyid = comp.id
                 WHERE coursecomp.courseid = ? ' ; $ params = array ( $ courseid ) ; $ results = $ DB -> count_records_sql ( $ sql , $ params ) ; return $ results ; }
Count the competencies in this course.

@param int $courseid The course id
@return int
Count the competencies in this course .