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


PHP CRM_Core_BAO_OptionValue::getOptionValuesArray方法代碼示例

本文整理匯總了PHP中CRM_Core_BAO_OptionValue::getOptionValuesArray方法的典型用法代碼示例。如果您正苦於以下問題:PHP CRM_Core_BAO_OptionValue::getOptionValuesArray方法的具體用法?PHP CRM_Core_BAO_OptionValue::getOptionValuesArray怎麽用?PHP CRM_Core_BAO_OptionValue::getOptionValuesArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CRM_Core_BAO_OptionValue的用法示例。


在下文中一共展示了CRM_Core_BAO_OptionValue::getOptionValuesArray方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: checkOptionGroupValues

 /**
  * @return array
  */
 public function checkOptionGroupValues()
 {
     $messages = array();
     $problemValues = array();
     $optionGroups = civicrm_api3('OptionGroup', 'get', array('sequential' => 1, 'data_type' => array('IS NOT NULL' => 1), 'options' => array('limit' => 0)));
     if ($optionGroups['count'] > 0) {
         foreach ($optionGroups['values'] as $optionGroup) {
             $values = CRM_Core_BAO_OptionValue::getOptionValuesArray($optionGroup['id']);
             if (count($values) > 0) {
                 foreach ($values as $value) {
                     $validate = CRM_Utils_Type::validate($value['value'], $optionGroup['data_type'], FALSE);
                     if (!$validate) {
                         $problemValues[] = array('group_name' => $optionGroup['title'], 'value_name' => $value['label']);
                     }
                 }
             }
         }
     }
     if (!empty($problemValues)) {
         $strings = '';
         foreach ($problemValues as $problemValue) {
             $strings .= ts('<tr><td> "%1" </td><td> "%2" </td></tr>', array(1 => $problemValue['group_name'], 2 => $problemValue['value_name']));
         }
         $messages[] = new CRM_Utils_Check_Message(__FUNCTION__, ts('The Following Option Values contain value fields that do not match the Data Type of the Option Group</p>
     <p><table><tbody><th>Option Group</th><th>Option Value</th></tbody><tbody>') . $strings . ts('</tbody></table></p>'), ts('Option Values with problematic Values'), \Psr\Log\LogLevel::NOTICE, 'fa-server');
     }
     return $messages;
 }
開發者ID:nielosz,項目名稱:civicrm-core,代碼行數:31,代碼來源:OptionGroups.php

示例2: getCustomOption

 /**
  * Returns all active options ordered by weight for a given field
  *
  * @param  int      $fieldId         field whose options are needed
  * @param  boolean  $inactiveNeeded  do we need inactive options ?
  *
  * @return array $customOption all active options for fieldId
  * @static
  */
 static function getCustomOption($fieldID, $inactiveNeeded = FALSE)
 {
     $options = array();
     if (!$fieldID) {
         return $options;
     }
     $field = CRM_Core_BAO_CustomField::getFieldObject($fieldID);
     // get the option group id
     $optionGroupID = $field->option_group_id;
     if (!$optionGroupID) {
         return $options;
     }
     $optionValues = CRM_Core_BAO_OptionValue::getOptionValuesArray($optionGroupID);
     foreach ($optionValues as $id => $value) {
         if (!$inactiveNeeded && empty($value['is_active'])) {
             continue;
         }
         $options[$id] = array();
         $options[$id]['id'] = $id;
         $options[$id]['label'] = $value['label'];
         $options[$id]['value'] = $value['value'];
     }
     CRM_Utils_Hook::customFieldOptions($fieldID, $options, TRUE);
     return $options;
 }
開發者ID:archcidburnziso,項目名稱:civicrm-core,代碼行數:34,代碼來源:CustomOption.php

示例3: buildQuickForm

 function buildQuickForm()
 {
     $this->addButtons(array(array('type' => 'next', 'name' => ts('Save'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
     $optionGroupId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', 'hrjc_hours_type', 'id', 'name');
     $optionGroupIds = CRM_Core_BAO_OptionValue::getOptionValuesArray($optionGroupId);
     foreach ($optionGroupIds as $key => $value) {
         $this->_optionValue[$value['value']] = $value['label'];
         $this->_id[$key] = $value['value'];
     }
     $this->assign('optionGroupIds', $optionGroupIds);
     $this->addElement('select', 'hour_type_select', ts('Select Hour Type'), array('' => ts('- select -')) + $this->_optionValue);
     $this->add('text', 'hour_value', ts('Value'));
     $this->addFormRule(array('CRM_Hrjobcontract_Form_EditHourOption', 'formRule'), $this);
 }
開發者ID:JoeMurray,項目名稱:civihr,代碼行數:14,代碼來源:EditHourOption.php


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