本文整理汇总了PHP中CRM_Core_BAO_OptionValue::del方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_OptionValue::del方法的具体用法?PHP CRM_Core_BAO_OptionValue::del怎么用?PHP CRM_Core_BAO_OptionValue::del使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_OptionValue
的用法示例。
在下文中一共展示了CRM_Core_BAO_OptionValue::del方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: uninstall
public function uninstall()
{
// if( !array_key_exists( $this->ext->key, $this->customReports ) ) {
// CRM_Core_Error::fatal( 'This report is not registered.' );
// }
$cr = CRM_Core_OptionGroup::values(self::REPORT_GROUP_NAME, false, false, false, null, 'id', false);
$id = $cr[$this->customReports[$this->ext->key]];
$optionValue = CRM_Core_BAO_OptionValue::del($id);
}
示例2: uninstall
public function uninstall()
{
if (!array_key_exists($this->ext->key, $this->customSearches)) {
CRM_Core_Error::fatal('This custom search is not registered.');
}
$cs = CRM_Core_OptionGroup::values(self::CUSTOM_SEARCH_GROUP_NAME, false, false, false, null, 'id', false);
$id = $cs[$this->customSearches[$this->ext->key]];
$optionValue = CRM_Core_BAO_OptionValue::del($id);
}
示例3: civicrm_api3_option_value_delete
/**
* Deletes an existing OptionValue
*
* @param array $params
*
* {@example OptionValueDelete.php 0}
*
* @return array Api result
* {@getfields OptionValue_create}
* @access public
*/
function civicrm_api3_option_value_delete($params)
{
// we will get the option group id before deleting so we can flush pseudoconstants
$optionGroupID = civicrm_api('option_value', 'getvalue', array('version' => 3, 'id' => $params['id'], 'return' => 'option_group_id'));
if (CRM_Core_BAO_OptionValue::del((int) $params['id'])) {
civicrm_api('option_value', 'getfields', array('version' => 3, 'cache_clear' => 1, 'option_group_id' => $optionGroupID));
return civicrm_api3_create_success();
} else {
civicrm_api3_create_error('Could not delete OptionValue ' . $params['id']);
}
}
示例4: onPreUninstall
/**
* @param CRM_Extension_Info $info
*
* @return bool
* @throws Exception
*/
public function onPreUninstall(CRM_Extension_Info $info)
{
$customSearchesByName = $this->getCustomSearchesByName();
if (!array_key_exists($info->key, $customSearchesByName)) {
CRM_Core_Error::fatal('This custom search is not registered.');
}
$cs = $this->getCustomSearchesById();
$id = $cs[$customSearchesByName[$info->key]];
$optionValue = CRM_Core_BAO_OptionValue::del($id);
return TRUE;
}
示例5: onPreUninstall
/**
* @param CRM_Extension_Info $info
*
* @return bool
*/
public function onPreUninstall(CRM_Extension_Info $info)
{
// if( !array_key_exists( $info->key, $this->customReports ) ) {
// CRM_Core_Error::fatal( 'This report is not registered.' );
// }
$customReports = $this->getCustomReportsByName();
$cr = $this->getCustomReportsById();
$id = $cr[$customReports[$info->key]];
$optionValue = CRM_Core_BAO_OptionValue::del($id);
return $optionValue ? TRUE : FALSE;
}
示例6: clickatell_civicrm_uninstall
/**
* Implementation of hook_civicrm_uninstall
*/
function clickatell_civicrm_uninstall()
{
$optionID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionValue', 'clickatell', 'id', 'name');
if ($optionID) {
CRM_Core_BAO_OptionValue::del($optionID);
}
$filter = array('name' => 'org.civicrm.sms.clickatell');
$Providers = CRM_SMS_BAO_Provider::getProviders(False, $filter, False);
if ($Providers) {
foreach ($Providers as $key => $value) {
CRM_SMS_BAO_Provider::del($value['id']);
}
}
return _clickatell_civix_civicrm_uninstall();
}
示例7: postProcess
/**
* Function to process the form
*
* @access public
*
* @return void
*/
public function postProcess()
{
if ($this->_action & CRM_Core_Action::DELETE) {
$fieldValues = array('option_group_id' => $this->_gid);
$wt = CRM_Utils_Weight::delWeight('CRM_Core_DAO_OptionValue', $this->_id, $fieldValues);
if (CRM_Core_BAO_OptionValue::del($this->_id)) {
CRM_Core_Session::setStatus(ts('Selected Survey type has been deleted.'), ts('Record Deleted'), 'success');
}
} else {
$params = $ids = array();
$params = $this->exportValues();
// set db value of filter in params if filter is non editable
if ($this->_id && !array_key_exists('filter', $params)) {
$params['filter'] = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionValue', $this->_id, 'filter', 'id');
}
$groupParams = array('name' => $this->_gName);
$params['component_id'] = CRM_Core_Component::getComponentID('CiviCampaign');
$optionValue = CRM_Core_OptionValue::addOptionValue($params, $groupParams, $this->_action, $this->_id);
CRM_Core_Session::setStatus(ts('The Survey type \'%1\' has been saved.', array(1 => $optionValue->label)), ts('Saved'), 'success');
}
}
示例8: civicrm_api3_activity_type_delete
/**
* Function to delete activity type
*
* @param activityTypeId int activity type id to delete
*
* @return boolen
*
* @access public
*
* @deprecated - we will introduce OptionValue Delete- plse consider helping with this if not done
* {@example ActivityTypeDelete.php 0}
*/
function civicrm_api3_activity_type_delete($params)
{
civicrm_api3_verify_mandatory($params, NULL, array('activity_type_id'));
$activityTypeId = $params['activity_type_id'];
require_once 'CRM/Core/BAO/OptionValue.php';
return CRM_Core_BAO_OptionValue::del($activityTypeId);
}
示例9: _removeExtensionEntry
private function _removeExtensionEntry()
{
CRM_Core_BAO_OptionValue::del($this->id);
CRM_Core_Session::setStatus(ts('Selected option value has been deleted.'));
}
示例10: postProcess
/**
* Function to process the form
*
* @access public
*
* @return None
*/
public function postProcess()
{
CRM_Utils_System::flushCache();
$params = $this->exportValues();
if ($this->_action & CRM_Core_Action::DELETE) {
CRM_Core_BAO_OptionValue::del($this->_id);
CRM_Core_Session::setStatus(ts('Selected option value has been deleted.'), ts('Record Deleted'), 'success');
} else {
$params = $ids = array();
// store the submitted values in an array
$params = $this->exportValues();
$params['option_group_id'] = $this->_gid;
if ($this->_action & CRM_Core_Action::UPDATE) {
$ids['optionValue'] = $this->_id;
}
//set defaultGreeting option in params to save default value as per contactOption-defaultValue mapping
if (CRM_Utils_Array::value('contactOptions', $params)) {
$params['filter'] = CRM_Utils_Array::value('contactOptions', $params);
$params['defaultGreeting'] = 1;
}
$optionValue = CRM_Core_BAO_OptionValue::add($params, $ids);
// CRM-11516
if (CRM_Utils_Array::value('financial_account_id', $params)) {
$relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Asset Account is' "));
$params = array('entity_table' => 'civicrm_option_value', 'entity_id' => $optionValue->id, 'account_relationship' => $relationTypeId, 'financial_account_id' => $params['financial_account_id']);
CRM_Financial_BAO_FinancialTypeAccount::add($params);
}
CRM_Core_Session::setStatus(ts('The Option Value \'%1\' has been saved.', array(1 => $optionValue->label)), ts('Saved'), 'success');
}
}
示例11: del
public static function del($absenceTypeId)
{
$absenceType = new CRM_HRAbsence_DAO_HRAbsenceType();
$absenceType->id = $absenceTypeId;
$absenceType->find(TRUE);
$absenceActivities = CRM_Core_OptionGroup::values('activity_type', FALSE, FALSE, FALSE, " AND grouping = 'Timesheet'", 'id');
if ($absenceType->debit_activity_type_id && ($id = CRM_Utils_Array::value($absenceType->debit_activity_type_id, $absenceActivities))) {
CRM_Core_BAO_OptionValue::del($id);
}
if ($absenceType->credit_activity_type_id && ($id = CRM_Utils_Array::value($absenceType->credit_activity_type_id, $absenceActivities))) {
CRM_Core_BAO_OptionValue::del($id);
}
$absenceType->delete();
}
示例12: civicrm_activity_type_delete
/**
* Function to delete activity type
* @param activityTypeId int activity type id to delete
* @return boolen
*
* @access public
*/
function civicrm_activity_type_delete($activityTypeId)
{
require_once 'CRM/Core/BAO/OptionValue.php';
return CRM_Core_BAO_OptionValue::del($activityTypeId);
}
示例13: postProcess
/**
* Function to process the form
*
* @access public
* @return None
*/
public function postProcess()
{
if ($this->_action & CRM_Core_Action::DELETE) {
$fieldValues = array('option_group_id' => $this->_gid);
$wt = CRM_Utils_Weight::delWeight('CRM_Core_DAO_OptionValue', $this->_id, $fieldValues);
if (CRM_Core_BAO_OptionValue::del($this->_id)) {
if ($this->_gName == 'phone_type') {
require_once 'CRM/Core/BAO/Phone.php';
CRM_Core_BAO_Phone::setOptionToNull(CRM_Utils_Array::value('value', $this->_defaultValues));
}
CRM_Core_Session::setStatus(ts('Selected %1 type has been deleted.', array(1 => $this->_GName)));
} else {
CRM_Core_Session::setStatus(ts('Selected %1 type has not been deleted.', array(1 => $this->_GName)));
CRM_Utils_Weight::correctDuplicateWeights('CRM_Core_DAO_OptionValue', $fieldValues);
}
} else {
$params = $ids = array();
$params = $this->exportValues();
// allow multiple defaults within group.
$allowMultiDefaults = array('email_greeting', 'postal_greeting', 'addressee', 'from_email_address');
if (CRM_Utils_Array::value('is_default', $params) && in_array($this->_gName, $allowMultiDefaults)) {
if ($this->_gName == 'from_email_address') {
$params['reset_default_for'] = array('domain_id' => CRM_Core_Config::domainID());
} else {
if ($filter = CRM_Utils_Array::value('contactOptions', $params)) {
$params['filter'] = $filter;
$params['reset_default_for'] = array('filter' => "0, " . $params['filter']);
}
}
}
$groupParams = array('name' => $this->_gName);
require_once 'CRM/Core/OptionValue.php';
$optionValue = CRM_Core_OptionValue::addOptionValue($params, $groupParams, $this->_action, $this->_id);
CRM_Core_Session::setStatus(ts('The %1 \'%2\' has been saved.', array(1 => $this->_GName, 2 => $optionValue->label)));
}
}
示例14: postProcess
/**
* Function to process the form
*
* @access public
* @return None
*/
public function postProcess()
{
if ($this->_action & CRM_Core_Action::DELETE) {
$fieldValues = array('option_group_id' => $this->_gid);
$wt = CRM_Utils_Weight::delWeight('CRM_Core_DAO_OptionValue', $this->_id, $fieldValues);
if (CRM_Core_BAO_OptionValue::del($this->_id)) {
if ($this->_gName == 'phone_type') {
require_once 'CRM/Core/BAO/Phone.php';
CRM_Core_BAO_Phone::setOptionToNull(CRM_Utils_Array::value('value', $this->_defaultValues));
}
CRM_Core_Session::setStatus(ts('Selected %1 type has been deleted.', array(1 => $this->_GName)));
} else {
CRM_Core_Session::setStatus(ts('Selected %1 type has not been deleted.', array(1 => $this->_GName)));
CRM_Utils_Weight::correctDuplicateWeights('CRM_Core_DAO_OptionValue', $fieldValues);
}
} else {
$params = $ids = array();
$params = $this->exportValues();
//set defaultGreeting option in params as per contact type
if (CRM_Utils_Array::value('contactOptions', $params)) {
$params['filter'] = CRM_Utils_Array::value('contactOptions', $params);
$params['defaultGreeting'] = 1;
}
$groupParams = array('name' => $this->_gName);
require_once 'CRM/Core/OptionValue.php';
$optionValue = CRM_Core_OptionValue::addOptionValue($params, $groupParams, $this->_action, $this->_id);
CRM_Core_Session::setStatus(ts('The %1 \'%2\' has been saved.', array(1 => $this->_GName, 2 => $optionValue->label)));
}
}
示例15: postProcess
/**
* Function to process the form
*
* @access public
*
* @return None
*/
public function postProcess()
{
if ($this->_action & CRM_Core_Action::DELETE) {
$fieldValues = array('option_group_id' => $this->_gid);
$wt = CRM_Utils_Weight::delWeight('CRM_Core_DAO_OptionValue', $this->_id, $fieldValues);
if (CRM_Core_BAO_OptionValue::del($this->_id)) {
if ($this->_gName == 'phone_type') {
CRM_Core_BAO_Phone::setOptionToNull(CRM_Utils_Array::value('value', $this->_defaultValues));
}
CRM_Core_Session::setStatus(ts('Selected %1 type has been deleted.', array(1 => $this->_GName)));
} else {
CRM_Core_Session::setStatus(ts('Selected %1 type has not been deleted.', array(1 => $this->_GName)));
CRM_Utils_Weight::correctDuplicateWeights('CRM_Core_DAO_OptionValue', $fieldValues);
}
} else {
$params = $ids = array();
$params = $this->exportValues();
// allow multiple defaults within group.
$allowMultiDefaults = array('email_greeting', 'postal_greeting', 'addressee', 'from_email_address');
if (in_array($this->_gName, $allowMultiDefaults)) {
if ($this->_gName == 'from_email_address') {
$params['reset_default_for'] = array('domain_id' => CRM_Core_Config::domainID());
} elseif ($filter = CRM_Utils_Array::value('contactOptions', $params)) {
$params['filter'] = $filter;
$params['reset_default_for'] = array('filter' => "0, " . $params['filter']);
}
//make sure we should has to have space, CRM-6977
if ($this->_gName == 'from_email_address') {
$params['label'] = str_replace('"<', '" <', $params['label']);
}
}
// set db value of filter in params if filter is non editable
if ($this->_id && !array_key_exists('filter', $params) && !$this->_gName == 'participant_role') {
$params['filter'] = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionValue', $this->_id, 'filter', 'id');
}
$groupParams = array('name' => $this->_gName);
$optionValue = CRM_Core_OptionValue::addOptionValue($params, $groupParams, $this->_action, $this->_id);
CRM_Core_Session::setStatus(ts('The %1 \'%2\' has been saved.', array(1 => $this->_GName, 2 => $optionValue->label)));
}
}