當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CRM_Core_BAO_OptionValue::del方法代碼示例

本文整理匯總了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);
 }
開發者ID:hampelm,項目名稱:Ginsberg-CiviDemo,代碼行數:9,代碼來源:Report.php

示例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);
 }
開發者ID:hampelm,項目名稱:Ginsberg-CiviDemo,代碼行數:9,代碼來源:Search.php

示例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']);
    }
}
開發者ID:prashantgajare,項目名稱:civicrm-core,代碼行數:22,代碼來源:OptionValue.php

示例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;
 }
開發者ID:nielosz,項目名稱:civicrm-core,代碼行數:17,代碼來源:Search.php

示例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;
 }
開發者ID:nganivet,項目名稱:civicrm-core,代碼行數:16,代碼來源:Report.php

示例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();
}
開發者ID:vajeevan,項目名稱:org.civicrm.sms.clickatell,代碼行數:18,代碼來源:clickatell.php

示例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');
     }
 }
開發者ID:prashantgajare,項目名稱:civicrm-core,代碼行數:28,代碼來源:SurveyType.php

示例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);
}
開發者ID:peteainsworth,項目名稱:civicrm-4.2.9-drupal,代碼行數:19,代碼來源:ActivityType.php

示例9: _removeExtensionEntry

 private function _removeExtensionEntry()
 {
     CRM_Core_BAO_OptionValue::del($this->id);
     CRM_Core_Session::setStatus(ts('Selected option value has been deleted.'));
 }
開發者ID:hampelm,項目名稱:Ginsberg-CiviDemo,代碼行數:5,代碼來源:Extension.php

示例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');
     }
 }
開發者ID:hguru,項目名稱:224Civi,代碼行數:37,代碼來源:OptionValue.php

示例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();
 }
開發者ID:JoeMurray,項目名稱:civihr,代碼行數:14,代碼來源:HRAbsenceType.php

示例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);
}
開發者ID:ksecor,項目名稱:civicrm,代碼行數:12,代碼來源:ActivityType.php

示例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)));
     }
 }
開發者ID:bhirsch,項目名稱:voipdev,代碼行數:42,代碼來源:Options.php

示例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)));
     }
 }
開發者ID:ksecor,項目名稱:civicrm,代碼行數:35,代碼來源:Options.php

示例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)));
     }
 }
開發者ID:peteainsworth,項目名稱:civicrm-4.2.9-drupal,代碼行數:47,代碼來源:Options.php


注:本文中的CRM_Core_BAO_OptionValue::del方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。