/** * Process the form when submitted. */ public function postProcess() { $participant = new CRM_Event_DAO_Participant(); $participant->event_id = $this->_id; if ($participant->find()) { $searchURL = CRM_Utils_System::url('civicrm/event/search', 'reset=1'); CRM_Core_Session::setStatus(ts('This event cannot be deleted because there are participant records linked to it. If you want to delete this event, you must first find the participants linked to this event and delete them. You can use use <a href=\'%1\'> CiviEvent >> Find Participants page </a>.', array(1 => $searchURL)), ts('Deletion Error'), 'error'); return; } CRM_Event_BAO_Event::del($this->_id); if ($this->_isTemplate) { CRM_Core_Session::setStatus(ts("'%1' has been deleted.", array(1 => $this->_title)), ts('Template Deleted'), 'success'); CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/admin/eventTemplate', 'reset=1')); } else { CRM_Core_Session::setStatus(ts("'%1' has been deleted.", array(1 => $this->_title)), ts('Event Deleted'), 'success'); } }
/** * Deletes an existing event * * This API is used for deleting a event * * @param Int $eventID ID of event to be deleted * * @return null if successfull, object of CRM_Core_Error otherwise * @access public */ function &crm_delete_event($eventID) { if (!$eventID) { return _crm_error('Invalid value for eventID'); } require_once 'CRM/Event/BAO/Event.php'; return CRM_Event_BAO_Event::del($eventID); }
/** * Helper function to delete an Event * * @param int $eventID id of the event to delete * @return boolean true if event deleted, false otherwise * */ static function delete($eventId) { return CRM_Event_BAO_Event::del($eventId); }
/** * Deletes an existing event * * This API is used for deleting a event * * @param Array $params array containing event_id to be deleted * * @return boolean true if success, error otherwise * @access public * note API has legacy support for 'event_id' * {@getfields event_delete} */ function civicrm_api3_event_delete($params) { return CRM_Event_BAO_Event::del($params['id']) ? civicrm_api3_create_success() : civicrm_api3_create_error(ts('Error while deleting event')); }
/** * Deletes an existing event * * This API is used for deleting a event * * @param Array $params array containing event_id to be deleted * * @return boolean true if success, error otherwise * @access public */ function civicrm_event_delete(&$params) { if (empty($params)) { return civicrm_create_error(ts('No input parameters present')); } $eventID = null; $eventID = CRM_Utils_Array::value('event_id', $params); if (!isset($eventID)) { return civicrm_create_error(ts('Invalid value for eventID')); } require_once 'CRM/Event/BAO/Event.php'; return CRM_Event_BAO_Event::del($eventID) ? civicrm_create_success() : civicrm_create_error(ts('Error while deleting event')); }