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