original_string: public static function list_competencies($filters, $sort, $order, $skip, $limit) {
          global $PAGE;
  
          $params = self::validate_parameters(self::list_competencies_parameters(), array(
              'filters' => $filters,
              'sort' => $sort,
              'order' => $order,
              'skip' => $skip,
              'limit' => $limit
          ));
  
          if ($params['order'] !== '' && $params['order'] !== 'ASC' && $params['order'] !== 'DESC') {
              throw new invalid_parameter_exception('Invalid order param. Must be ASC, DESC or empty.');
          }
  
          $safefilters = array();
          $validcolumns = array('id', 'shortname', 'description', 'sortorder', 'idnumber',
              'parentid', 'competencyframeworkid');
          foreach ($params['filters'] as $filter) {
              if (!in_array($filter['column'], $validcolumns)) {
                  throw new invalid_parameter_exception('Filter column was invalid');
              }
              $safefilters[$filter['column']] = $filter['value'];
          }
  
          $context = null;
          if (isset($safefilters['competencyframeworkid'])) {
              $framework = api::read_framework($safefilters['competencyframeworkid']);
              $context = $framework->get_context();
          } else {
              $context = context_system::instance();
          }
  
          self::validate_context($context);
          $output = $PAGE->get_renderer('core');
  
          $results = api::list_competencies(
              $safefilters,
              $params['sort'],
              $params['order'],
              $params['skip'],
              $params['limit']
          );
  
          $records = array();
          foreach ($results as $result) {
              $exporter = new competency_exporter($result, array('context' => $context));
              $record = $exporter->export($output);
              array_push($records, $record);
          }
          return $records;
      }
code: public static function list_competencies($filters, $sort, $order, $skip, $limit) {
          global $PAGE;
  
          $params = self::validate_parameters(self::list_competencies_parameters(), array(
              'filters' => $filters,
              'sort' => $sort,
              'order' => $order,
              'skip' => $skip,
              'limit' => $limit
          ));
  
          if ($params['order'] !== '' && $params['order'] !== 'ASC' && $params['order'] !== 'DESC') {
              throw new invalid_parameter_exception('Invalid order param. Must be ASC, DESC or empty.');
          }
  
          $safefilters = array();
          $validcolumns = array('id', 'shortname', 'description', 'sortorder', 'idnumber',
              'parentid', 'competencyframeworkid');
          foreach ($params['filters'] as $filter) {
              if (!in_array($filter['column'], $validcolumns)) {
                  throw new invalid_parameter_exception('Filter column was invalid');
              }
              $safefilters[$filter['column']] = $filter['value'];
          }
  
          $context = null;
          if (isset($safefilters['competencyframeworkid'])) {
              $framework = api::read_framework($safefilters['competencyframeworkid']);
              $context = $framework->get_context();
          } else {
              $context = context_system::instance();
          }
  
          self::validate_context($context);
          $output = $PAGE->get_renderer('core');
  
          $results = api::list_competencies(
              $safefilters,
              $params['sort'],
              $params['order'],
              $params['skip'],
              $params['limit']
          );
  
          $records = array();
          foreach ($results as $result) {
              $exporter = new competency_exporter($result, array('context' => $context));
              $record = $exporter->export($output);
              array_push($records, $record);
          }
          return $records;
      }
code_tokens: public static function list_competencies ( $ filters , $ sort , $ order , $ skip , $ limit ) { global $ PAGE ; $ params = self :: validate_parameters ( self :: list_competencies_parameters ( ) , array ( 'filters' => $ filters , 'sort' => $ sort , 'order' => $ order , 'skip' => $ skip , 'limit' => $ limit ) ) ; if ( $ params [ 'order' ] !== '' && $ params [ 'order' ] !== 'ASC' && $ params [ 'order' ] !== 'DESC' ) { throw new invalid_parameter_exception ( 'Invalid order param. Must be ASC, DESC or empty.' ) ; } $ safefilters = array ( ) ; $ validcolumns = array ( 'id' , 'shortname' , 'description' , 'sortorder' , 'idnumber' , 'parentid' , 'competencyframeworkid' ) ; foreach ( $ params [ 'filters' ] as $ filter ) { if ( ! in_array ( $ filter [ 'column' ] , $ validcolumns ) ) { throw new invalid_parameter_exception ( 'Filter column was invalid' ) ; } $ safefilters [ $ filter [ 'column' ] ] = $ filter [ 'value' ] ; } $ context = null ; if ( isset ( $ safefilters [ 'competencyframeworkid' ] ) ) { $ framework = api :: read_framework ( $ safefilters [ 'competencyframeworkid' ] ) ; $ context = $ framework -> get_context ( ) ; } else { $ context = context_system :: instance ( ) ; } self :: validate_context ( $ context ) ; $ output = $ PAGE -> get_renderer ( 'core' ) ; $ results = api :: list_competencies ( $ safefilters , $ params [ 'sort' ] , $ params [ 'order' ] , $ params [ 'skip' ] , $ params [ 'limit' ] ) ; $ records = array ( ) ; foreach ( $ results as $ result ) { $ exporter = new competency_exporter ( $ result , array ( 'context' => $ context ) ) ; $ record = $ exporter -> export ( $ output ) ; array_push ( $ records , $ record ) ; } return $ records ; }
docstring: List the existing competency.
  
  @param string $filters
  @param int $sort
  @param string $order
  @param string $skip
  @param int $limit
  
  @return array
  @throws \required_capability_exception
  @throws invalid_parameter_exception
docstring_tokens: List the existing competency .