/** * 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 * * @return void * @access public */ function postProcess() { // get the submitted form values. $params = $this->controller->exportValues($this->_name); $params['entity_id'] = $this->_id; $params['entity_table'] = 'civicrm_contribution_page'; $dao = new CRM_Contribute_DAO_PCPBlock(); $dao->entity_table = 'civicrm_contribution_page'; $dao->entity_id = $this->_id; $dao->find(true); $params['id'] = $dao->id; $params['is_active'] = CRM_Utils_Array::value('is_active', $params, false); $params['is_approval_needed'] = CRM_Utils_Array::value('is_approval_needed', $params, false); $params['is_tellfriend_enabled'] = CRM_Utils_Array::value('is_tellfriend_enabled', $params, false); require_once 'CRM/Contribute/BAO/PCP.php'; $dao = CRM_Contribute_BAO_PCP::add($params); }