function delete($params) { require_once 'api/v2/UFGroup.php'; $resulProfile = civicrm_uf_group_delete($params['profileId']); require_once 'CRM/Contribute/DAO/PCPBlock.php'; $dao =& new CRM_Contribute_DAO_PCPBlock(); $dao->id = $params['blockId']; if ($dao->find(true)) { $resultBlock = $dao->delete(); } if ($id = CRM_Utils_Array::value('pcpId', $params)) { require_once 'CRM/Contribute/BAO/PCP.php'; CRM_Contribute_BAO_PCP::delete($id); } if ($resulProfile && $resultBlock) { return true; } return false; }
/** * Helper function to delete a PCP related stuff viz. Profile, PCP Block Entry * * @param array key value pair * pcpBlockId - id of the PCP Block Id, profileID - id of Supporter Profile * to be deleted * @return boolean true if success, false otherwise * */ function delete($params) { $delete_params = array('id' => $params['profileId']); $resulProfile = civicrm_api('uf_group', 'delete', $delete_params); require_once 'CRM/Contribute/DAO/PCPBlock.php'; $dao = new CRM_Contribute_DAO_PCPBlock(); $dao->id = $params['blockId']; if ($dao->find(TRUE)) { $resultBlock = $dao->delete(); } if ($id = CRM_Utils_Array::value('pcpId', $params)) { require_once 'CRM/Contribute/BAO/PCP.php'; CRM_Contribute_BAO_PCP::delete($id); } if ($resulProfile && $resultBlock) { return TRUE; } return FALSE; }
/** * Process the form * * @param null * * @return void * @access public */ public function postProcess() { if ($this->_action & CRM_Core_Action::DELETE) { require_once 'CRM/Contribute/BAO/PCP.php'; CRM_Contribute_BAO_PCP::delete($this->_id); CRM_Core_Session::setStatus(ts("The Campaign Page '%1' has been deleted.", array(1 => $this->_title))); } else { $params = $this->controller->exportValues($this->_name); $parent = $this->controller->getParent(); if (!empty($params)) { $fields = array('status_id', 'contribution_page_id'); foreach ($fields as $field) { if (isset($params[$field]) && !CRM_Utils_System::isNull($params[$field])) { $parent->set($field, $params[$field]); } else { $parent->set($field, null); } } } } }