original_string: public static function get_allowed_event_types($courseid = 0) {
  
          $params = self::validate_parameters(self::get_allowed_event_types_parameters(), ['courseid' => $courseid]);
  
          if (empty($params['courseid']) || $params['courseid'] == SITEID) {
              $context = \context_system::instance();
          } else {
              $context = \context_course::instance($params['courseid']);
          }
  
          self::validate_context($context);
  
          $allowedeventtypes = array_filter(calendar_get_allowed_event_types($params['courseid']));
  
          return [
              'allowedeventtypes' => array_keys($allowedeventtypes),
              'warnings' => [],
          ];
      }
code: public static function get_allowed_event_types($courseid = 0) {
  
          $params = self::validate_parameters(self::get_allowed_event_types_parameters(), ['courseid' => $courseid]);
  
          if (empty($params['courseid']) || $params['courseid'] == SITEID) {
              $context = \context_system::instance();
          } else {
              $context = \context_course::instance($params['courseid']);
          }
  
          self::validate_context($context);
  
          $allowedeventtypes = array_filter(calendar_get_allowed_event_types($params['courseid']));
  
          return [
              'allowedeventtypes' => array_keys($allowedeventtypes),
              'warnings' => [],
          ];
      }
code_tokens: public static function get_allowed_event_types ( $ courseid = 0 ) { $ params = self :: validate_parameters ( self :: get_allowed_event_types_parameters ( ) , [ 'courseid' => $ courseid ] ) ; if ( empty ( $ params [ 'courseid' ] ) || $ params [ 'courseid' ] == SITEID ) { $ context = \ context_system :: instance ( ) ; } else { $ context = \ context_course :: instance ( $ params [ 'courseid' ] ) ; } self :: validate_context ( $ context ) ; $ allowedeventtypes = array_filter ( calendar_get_allowed_event_types ( $ params [ 'courseid' ] ) ) ; return [ 'allowedeventtypes' => array_keys ( $ allowedeventtypes ) , 'warnings' => [ ] , ] ; }
docstring: Get the type of events a user can create in the given course.
  
  @param int $courseid Course to check, empty for site.
  @return array The types allowed
  @throws moodle_exception
  @since  Moodle 3.7
docstring_tokens: Get the type of events a user can create in the given course .