Delete event page. You may only delete an event if you were the creator or you are an
    administrator. Confirmation page if not POST.

    id: event id
191973
def delete_event_view(request, id):
    
    event = get_object_or_404(Event, id=id)
    if not request.user.has_admin_permission('events'):
        raise exceptions.PermissionDenied

    if request.method == "POST":
        try:
            event.delete()
            messages.success(request, "Successfully deleted event.")
        except Event.DoesNotExist:
            pass

        return redirect("events")
    else:
        return render(request, "events/delete.html", {"event": event})
1261444
public function delete_post( $id ) {

		$post = get_post( $id );

		if ( empty( $post ) ) {
			return;
		}

		$id        = $post->ID;
		$post_type = $post->post_type;

		return $this->delete_object( 'post_type', $id, $post_type );
	}
1211300
public function deleteAction(Request $request, $id)
    {
        $this->init($request);
        /* @var Node $node */
        $node = $this->em->getRepository('KunstmaanNodeBundle:Node')->find($id);

        $this->denyAccessUnlessGranted(PermissionMap::PERMISSION_DELETE, $node);

        $nodeTranslation = $node->getNodeTranslation($this->locale, true);
        $nodeVersion = $nodeTranslation->getPublicNodeVersion();
        $page = $nodeVersion->getRef($this->em);

        $this->get('event_dispatcher')->dispatch(
            Events::PRE_DELETE,
            new NodeEvent($node, $nodeTranslation, $nodeVersion, $page)
        );

        $node->setDeleted(true);
        $this->em->persist($node);

        $children = $node->getChildren();
        $this->deleteNodeChildren($this->em, $this->user, $this->locale, $children);
        $this->em->flush();

        $event = new NodeEvent($node, $nodeTranslation, $nodeVersion, $page);
        $this->get('event_dispatcher')->dispatch(Events::POST_DELETE, $event);
        if (null === $response = $event->getResponse()) {
            $nodeParent = $node->getParent();
            // Check if we have a parent. Otherwise redirect to pages overview.
            if ($nodeParent) {
                $url = $this->get('router')->generate(
                    'KunstmaanNodeBundle_nodes_edit',
                    array('id' => $nodeParent->getId())
                );
            } else {
                $url = $this->get('router')->generate(
                    'KunstmaanNodeBundle_nodes'
                );
            }
            $response = new RedirectResponse($url);
        }

        $this->addFlash(
            FlashTypes::SUCCESS,
            $this->get('translator')->trans('kuma_node.admin.delete.flash.success')
        );

        return $response;
    }
336191
def delete_eventtype(self, test_type_str=None):
        """"""
        if test_type_str:
            answer = test_type_str, True
        else:
            answer = QInputDialog.getText(self, 'Delete Event Type',
                                          'Enter event\'s name to delete')
        if answer[1]:
            self.annot.remove_event_type(answer[0])
            self.display_eventtype()
            self.update_annotations()
569231
def remove(self, id):
        

        # find prefix
        c.prefix = Prefix.get(int(id))

        if 'confirmed' not in request.params:
            return render('/prefix_remove_confirm.html')

        c.prefix.remove()
        redirect(url(controller='prefix', action='list'))
751360
function remove(event) {
    //
    // Current event is not set as trigger (e.g. mouse click vs. hover).
    //
    if (!this.trigger(event)) return false;
    if ('preventDefault' in event) event.preventDefault();

    clearTimeout(this.timer);
    var id = document.getElementById('tooltip');
    return id ? !!document.body.removeChild(id) : false;
  }
717121
def cancel(self):
    
    if not self.id:
      raise TypeError(u"You can't delete an event that hasn't been created yet.")

    self.refresh_change_key()
    self.service.send(soap_request.delete_event(self))
    # TODO rsanders high - check return status to make sure it was actually sent
    return None
162919
public function cmdDeletePage()
    {
        $id = $this->getParam(0);
        $all = $this->getParam('all');
        $blog = $this->getParam('blog');

        if (empty($id) && empty($all) && empty($blog)) {
            $this->errorAndExit($this->text('Invalid command'));
        }

        if (isset($id) && (empty($id) || !is_numeric($id))) {
            $this->errorAndExit($this->text('Invalid argument'));
        }

        $options = null;

        if (isset($id)) {

            if ($this->getParam('store')) {
                $options = array('store_id' => $id);
            } else if ($this->getParam('category')) {
                $options = array('category_id' => $id);
            } else if ($this->getParam('user')) {
                $options = array('user_id' => $id);
            }

        } else if ($blog) {
            $options = array('blog_post' => true);
        } else if ($all) {
            $options = array();
        }

        if (isset($options)) {

            $deleted = $count = 0;
            foreach ($this->page->getList($options) as $item) {
                $count++;
                $deleted += (int) $this->page->delete($item['page_id']);
            }

            $result = $count && $count == $deleted;

        } else {
            $result = $this->page->delete($id);
        }

        if (empty($result)) {
            $this->errorAndExit($this->text('Unexpected result'));
        }

        $this->output();
    }
615576
def on_tab_close_clicked(self, event, state_m):
        
        [page, state_identifier] = self.find_page_of_state_m(state_m)
        if page:
            self.close_page(state_identifier, delete=False)
1246988
def remove_page(self, process_id, wit_ref_name, page_id):
        
        route_values = {}
        if process_id is not None:
            route_values['processId'] = self._serialize.url('process_id', process_id, 'str')
        if wit_ref_name is not None:
            route_values['witRefName'] = self._serialize.url('wit_ref_name', wit_ref_name, 'str')
        if page_id is not None:
            route_values['pageId'] = self._serialize.url('page_id', page_id, 'str')
        self._send(http_method='DELETE',
                   location_id='1cc7b29f-6697-4d9d-b0a1-2650d3e1d584',
                   version='5.0-preview.1',
                   route_values=route_values)
1360623
public function delete($_type = null, $id = null)
    {
        // setting up an event for the delete
        $_event = new Event('Controller.PostTypes.beforeDelete.' . $this->_type, $this, [
            'id' => $id,
        ]);
        $this->eventManager()->dispatch($_event);

        $postType = $this->Model->get($id);
        
        $this->request->allowMethod(['post', 'delete']);
        
        if ($this->Model->delete($postType)) {
            // setting up an event for the delete
            $_event = new Event('Controller.PostTypes.afterDelete.' . $this->_type, $this, [
                'id' => $id,
            ]);
            $this->eventManager()->dispatch($_event);
            
            $this->Flash->success(__('The {0} has been deleted.', [$this->Settings['type']]));
            
            return $this->redirect(['action' => 'index', 'type' => $this->_type]);
        } else {
            $this->Flash->error(__('The {0} could not be deleted. Please, try again.', [$this->Settings['type']]));
            return $this->redirect(['action' => 'index', 'type' => $this->_type]);
        }
    }
753243
public function eventAfterDelete()
    {
        $this->updateNavItemTimesamp();
        if (!empty($this->_olds)) {
            $this->reindex($this->_olds['nav_item_page_id'], $this->_olds['placeholder_var'], $this->_olds['prev_id']);
        }
    }
68091
public function delete()
    {
        $cID = $this->getCollectionID();

        if ($this->isAliasPage()) {
            $this->removeThisAlias();

            return;
        }

        if ($cID < 1 || $cID == static::getHomePageID()) {
            return false;
        }

        $db = Database::connection();

        // run any internal event we have for page deletion
        $pe = new DeletePageEvent($this);
        Events::dispatch('on_page_delete', $pe);

        if (!$pe->proceed()) {
            return false;
        }

        $app = Facade::getFacadeApplication();
        $logger = $app->make('log/factory')->createLogger(Channels::CHANNEL_SITE_ORGANIZATION);
        $logger->notice(t('Page "%s" at path "%s" deleted',
            $this->getCollectionName(),
            $this->getCollectionPath()
        ));

        parent::delete();

        $cID = $this->getCollectionID();

        // Now that all versions are gone, we can delete the collection information
        $q = "delete from PagePaths where cID = '{$cID}'";
        $r = $db->query($q);

        // remove all pages where the pointer is this cID
        $r = $db->executeQuery('select cID from Pages where cPointerID = ?', [$cID]);
        while ($row = $r->fetchRow()) {
            PageStatistics::decrementParents($row['cID']);
            $db->executeQuery('DELETE FROM PagePaths WHERE cID=?', [$row['cID']]);
        }

        // Update cChildren for cParentID
        PageStatistics::decrementParents($cID);

        $db->executeQuery('delete from PagePermissionAssignments where cID = ?', [$cID]);

        $db->executeQuery('delete from Pages where cID = ?', [$cID]);

        $db->executeQuery('delete from MultilingualPageRelations where cID = ?', [$cID]);

        $db->executeQuery('delete from SiblingPageRelations where cID = ?', [$cID]);

        $db->executeQuery('delete from Pages where cPointerID = ?', [$cID]);

        $db->executeQuery('delete from Areas WHERE cID = ?', [$cID]);

        $db->executeQuery('delete from PageSearchIndex where cID = ?', [$cID]);

        $r = $db->executeQuery('select cID from Pages where cParentID = ?', [$cID]);
        if ($r) {
            while ($row = $r->fetchRow()) {
                if ($row['cID'] > 0) {
                    $nc = self::getByID($row['cID']);
                    $nc->delete();
                }
            }
        }

        if (\Core::make('multilingual/detector')->isEnabled()) {
            Section::unregisterPage($this);
        }

        $cache = PageCache::getLibrary();
        $cache->purge($this);
    }
277297
public function deleteAction($id)
    {
        /** @var Menus_Entity_Table_Menu $table */
        $table = ORM::getTable($this->plugin, 'Menu');
        /** @var Menus_Entity_Menu $menu */
        $menu = $table->find($id);

        if (!is_null($menu))
        {
            $table->delete($menu);
        }
        HTTP::redirect(str_replace('&amp;', '&', $this->ui->url()));
    }
28028
def conclude_course(self, id, event):
        
        path = {}
        data = {}
        params = {}

        # REQUIRED - PATH - id
        """ID"""
        path["id"] = id

        # REQUIRED - event
        """The action to take on the course."""
        self._validate_enum(event, ["delete", "conclude"])
        params["event"] = event

        self.logger.debug("DELETE /api/v1/courses/{id} with query params: {params} and form data: {data}".format(params=params, data=data, **path))
        return self.generic_request("DELETE", "/api/v1/courses/{id}".format(**path), data=data, params=params, no_data=True)
248460
private void safePostEvent(Event event) {
        EventAdmin ea = eventAdminRef.getService();
        if (ea != null) {
            ea.postEvent(event);
        } else if (tc.isEventEnabled()) {
            Tr.event(tc, "The EventAdmin service is unavailable. Unable to post the Event: " + event);
        }
    }
545951
def delete_event_subscription(self, url):
        
        params = {'callbackUrl': url}
        response = self._do_request('DELETE', '/v2/eventSubscriptions', params)
        return response.json()