original_string: public static function list_templates($sort, $order, $skip, $limit, $context, $includes, $onlyvisible) {
          global $PAGE;
  
          $params = self::validate_parameters(self::list_templates_parameters(), array(
              'sort' => $sort,
              'order' => $order,
              'skip' => $skip,
              'limit' => $limit,
              'context' => $context,
              'includes' => $includes,
              'onlyvisible' => $onlyvisible
          ));
  
          $context = self::get_context_from_params($params['context']);
          self::validate_context($context);
          $output = $PAGE->get_renderer('core');
  
          if ($params['order'] !== '' && $params['order'] !== 'ASC' && $params['order'] !== 'DESC') {
              throw new invalid_parameter_exception('Invalid order param. Must be ASC, DESC or empty.');
          }
  
          $results = api::list_templates($params['sort'],
                                         $params['order'],
                                         $params['skip'],
                                         $params['limit'],
                                         $context,
                                         $params['includes'],
                                         $params['onlyvisible']);
          $records = array();
          foreach ($results as $result) {
              $exporter = new template_exporter($result);
              $record = $exporter->export($output);
              array_push($records, $record);
          }
          return $records;
      }
code: public static function list_templates($sort, $order, $skip, $limit, $context, $includes, $onlyvisible) {
          global $PAGE;
  
          $params = self::validate_parameters(self::list_templates_parameters(), array(
              'sort' => $sort,
              'order' => $order,
              'skip' => $skip,
              'limit' => $limit,
              'context' => $context,
              'includes' => $includes,
              'onlyvisible' => $onlyvisible
          ));
  
          $context = self::get_context_from_params($params['context']);
          self::validate_context($context);
          $output = $PAGE->get_renderer('core');
  
          if ($params['order'] !== '' && $params['order'] !== 'ASC' && $params['order'] !== 'DESC') {
              throw new invalid_parameter_exception('Invalid order param. Must be ASC, DESC or empty.');
          }
  
          $results = api::list_templates($params['sort'],
                                         $params['order'],
                                         $params['skip'],
                                         $params['limit'],
                                         $context,
                                         $params['includes'],
                                         $params['onlyvisible']);
          $records = array();
          foreach ($results as $result) {
              $exporter = new template_exporter($result);
              $record = $exporter->export($output);
              array_push($records, $record);
          }
          return $records;
      }
code_tokens: public static function list_templates ( $ sort , $ order , $ skip , $ limit , $ context , $ includes , $ onlyvisible ) { global $ PAGE ; $ params = self :: validate_parameters ( self :: list_templates_parameters ( ) , array ( 'sort' => $ sort , 'order' => $ order , 'skip' => $ skip , 'limit' => $ limit , 'context' => $ context , 'includes' => $ includes , 'onlyvisible' => $ onlyvisible ) ) ; $ context = self :: get_context_from_params ( $ params [ 'context' ] ) ; self :: validate_context ( $ context ) ; $ output = $ PAGE -> get_renderer ( 'core' ) ; if ( $ params [ 'order' ] !== '' && $ params [ 'order' ] !== 'ASC' && $ params [ 'order' ] !== 'DESC' ) { throw new invalid_parameter_exception ( 'Invalid order param. Must be ASC, DESC or empty.' ) ; } $ results = api :: list_templates ( $ params [ 'sort' ] , $ params [ 'order' ] , $ params [ 'skip' ] , $ params [ 'limit' ] , $ context , $ params [ 'includes' ] , $ params [ 'onlyvisible' ] ) ; $ records = array ( ) ; foreach ( $ results as $ result ) { $ exporter = new template_exporter ( $ result ) ; $ record = $ exporter -> export ( $ output ) ; array_push ( $ records , $ record ) ; } return $ records ; }
docstring: List the existing learning plan templates
  
  @param string $sort Field to sort by.
  @param string $order Sort order.
  @param int $skip Limitstart.
  @param int $limit Number of rows to return.
  @param array $context
  @param bool $includes
  @param bool $onlyvisible
  
  @return array
docstring_tokens: List the existing learning plan templates