original_string: public static function delete_calendar_events($events) {
          global $DB;
  
          // Parameter validation.
          $params = self::validate_parameters(self:: delete_calendar_events_parameters(), array('events' => $events));
  
          $transaction = $DB->start_delegated_transaction();
  
          foreach ($params['events'] as $event) {
              $eventobj = calendar_event::load($event['eventid']);
  
              // Let's check if the user is allowed to delete an event.
              if (!calendar_delete_event_allowed($eventobj)) {
                  throw new moodle_exception('nopermissions', 'error', '', get_string('deleteevent', 'calendar'));
              }
              // Time to do the magic.
              $eventobj->delete($event['repeat']);
          }
  
          // Everything done smoothly, let's commit.
          $transaction->allow_commit();
  
          return null;
      }
code: public static function delete_calendar_events($events) {
          global $DB;
  
          // Parameter validation.
          $params = self::validate_parameters(self:: delete_calendar_events_parameters(), array('events' => $events));
  
          $transaction = $DB->start_delegated_transaction();
  
          foreach ($params['events'] as $event) {
              $eventobj = calendar_event::load($event['eventid']);
  
              // Let's check if the user is allowed to delete an event.
              if (!calendar_delete_event_allowed($eventobj)) {
                  throw new moodle_exception('nopermissions', 'error', '', get_string('deleteevent', 'calendar'));
              }
              // Time to do the magic.
              $eventobj->delete($event['repeat']);
          }
  
          // Everything done smoothly, let's commit.
          $transaction->allow_commit();
  
          return null;
      }
code_tokens: public static function delete_calendar_events ( $ events ) { global $ DB ; // Parameter validation. $ params = self :: validate_parameters ( self :: delete_calendar_events_parameters ( ) , array ( 'events' => $ events ) ) ; $ transaction = $ DB -> start_delegated_transaction ( ) ; foreach ( $ params [ 'events' ] as $ event ) { $ eventobj = calendar_event :: load ( $ event [ 'eventid' ] ) ; // Let's check if the user is allowed to delete an event. if ( ! calendar_delete_event_allowed ( $ eventobj ) ) { throw new moodle_exception ( 'nopermissions' , 'error' , '' , get_string ( 'deleteevent' , 'calendar' ) ) ; } // Time to do the magic. $ eventobj -> delete ( $ event [ 'repeat' ] ) ; } // Everything done smoothly, let's commit. $ transaction -> allow_commit ( ) ; return null ; }
docstring: Delete Calendar events
  
  @param array $eventids A list of event ids with repeat flag to delete
  @return null
  @since Moodle 2.5
docstring_tokens: Delete Calendar events