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