original_string: public static function list_competencies($courseid) {
          global $DB;
  
          $sql = 'SELECT comp.*
                    FROM {' . competency::TABLE . '} comp
                    JOIN {' . self::TABLE . '} coursecomp
                      ON coursecomp.competencyid = comp.id
                   WHERE coursecomp.courseid = ?';
          $params = array($courseid);
  
          $sql .= ' ORDER BY coursecomp.sortorder ASC';
          $results = $DB->get_recordset_sql($sql, $params);
          $instances = array();
          foreach ($results as $result) {
              $comp = new competency(0, $result);
              $instances[$comp->get('id')] = $comp;
          }
          $results->close();
  
          return $instances;
      }
code: public static function list_competencies($courseid) {
          global $DB;
  
          $sql = 'SELECT comp.*
                    FROM {' . competency::TABLE . '} comp
                    JOIN {' . self::TABLE . '} coursecomp
                      ON coursecomp.competencyid = comp.id
                   WHERE coursecomp.courseid = ?';
          $params = array($courseid);
  
          $sql .= ' ORDER BY coursecomp.sortorder ASC';
          $results = $DB->get_recordset_sql($sql, $params);
          $instances = array();
          foreach ($results as $result) {
              $comp = new competency(0, $result);
              $instances[$comp->get('id')] = $comp;
          }
          $results->close();
  
          return $instances;
      }
code_tokens: public static function list_competencies ( $ courseid ) { global $ DB ; $ sql = 'SELECT comp.*
                    FROM {' . competency :: TABLE . '} comp
                    JOIN {' . self :: TABLE . '} coursecomp
                      ON coursecomp.competencyid = comp.id
                   WHERE coursecomp.courseid = ?' ; $ params = array ( $ courseid ) ; $ sql .= ' ORDER BY coursecomp.sortorder ASC' ; $ results = $ DB -> get_recordset_sql ( $ sql , $ params ) ; $ instances = array ( ) ; foreach ( $ results as $ result ) { $ comp = new competency ( 0 , $ result ) ; $ instances [ $ comp -> get ( 'id' ) ] = $ comp ; } $ results -> close ( ) ; return $ instances ; }
docstring: List the competencies in this course.
  
  @param int $courseid The course id
  @return competency[] Indexed by competency ID.
docstring_tokens: List the competencies in this course .