function OnPostback() { # Get the item info and store it $id = $this->manager->GetItemId($this->data_object); $this->manager->ReadById(array($id)); $this->data_object = $this->manager->GetFirst(); # Check whether cancel was clicked if (isset($_POST['cancel'])) { $this->Redirect($this->data_object->GetNavigateUrl()); } # Check whether delete was clicked if (isset($_POST['delete'])) { # Check again that the requester has permission to delete this item if ($this->has_permission) { # Delete it $this->manager->Delete(array($id)); # Remove the competition from the search engine $this->SearchIndexer()->DeleteFromIndexById("competition" . $id); $this->SearchIndexer()->CommitChanges(); # Note success $this->deleted = true; } } }