当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Core_BAO_CustomField::customOptionGroup方法代码示例

本文整理汇总了PHP中CRM_Core_BAO_CustomField::customOptionGroup方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_CustomField::customOptionGroup方法的具体用法?PHP CRM_Core_BAO_CustomField::customOptionGroup怎么用?PHP CRM_Core_BAO_CustomField::customOptionGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRM_Core_BAO_CustomField的用法示例。


在下文中一共展示了CRM_Core_BAO_CustomField::customOptionGroup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: buildQuickForm

 /**
  * Function to actually build the form
  *
  * @param null
  *
  * @return void
  * @access public
  */
 public function buildQuickForm()
 {
     if ($this->_gid) {
         $this->_title = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $this->_gid, 'title');
         CRM_Utils_System::setTitle($this->_title . ' - ' . ts('Custom Fields'));
     }
     // lets trim all the whitespace
     $this->applyFilter('__ALL__', 'trim');
     $attributes = CRM_Core_DAO::getAttribute('CRM_Core_DAO_CustomField');
     // label
     $this->add('text', 'label', ts('Field Label'), $attributes['label'], TRUE);
     $dt =& self::$_dataTypeValues;
     $it = array();
     foreach ($dt as $key => $value) {
         $it[$key] = self::$_dataToLabels[$key];
     }
     $sel =& $this->addElement('hierselect', 'data_type', ts('Data and Input Field Type'), 'onclick="clearSearchBoxes();custom_option_html_type(this.form)"; onBlur="custom_option_html_type(this.form)";', '   ');
     $sel->setOptions(array($dt, $it));
     if ($this->_action == CRM_Core_Action::UPDATE) {
         $this->freeze('data_type');
     }
     $includeFieldIds = NULL;
     if ($this->_action == CRM_Core_Action::UPDATE) {
         $includeFieldIds = $this->_values['id'];
     }
     $optionGroups = CRM_Core_BAO_CustomField::customOptionGroup($includeFieldIds);
     $emptyOptGroup = FALSE;
     if (empty($optionGroups)) {
         $emptyOptGroup = TRUE;
         $optionTypes = array('1' => ts('Create a new set of options'));
     } else {
         $optionTypes = array('1' => ts('Create a new set of options'), '2' => ts('Reuse an existing set'));
         $this->add('select', 'option_group_id', ts('Multiple Choice Option Sets'), array('' => ts('- select -')) + $optionGroups);
     }
     $element =& $this->addRadio('option_type', ts('Option Type'), $optionTypes, array('onclick' => "showOptionSelect();"), '<br/>');
     $contactGroups = CRM_Core_PseudoConstant::group();
     asort($contactGroups);
     $this->add('select', 'group_id', ts('Limit List to Group'), $contactGroups, FALSE, array('multiple' => 'multiple'));
     $this->add('text', 'filter', ts('Advanced Filter'), $attributes['filter']);
     $this->add('hidden', 'filter_selected', 'Group', array('id' => 'filter_selected'));
     //if empty option group freeze the option type.
     if ($emptyOptGroup) {
         $element->freeze();
     }
     // form fields of Custom Option rows
     $defaultOption = array();
     $_showHide = new CRM_Core_ShowHideBlocks('', '');
     for ($i = 1; $i <= self::NUM_OPTION; $i++) {
         //the show hide blocks
         $showBlocks = 'optionField_' . $i;
         if ($i > 2) {
             $_showHide->addHide($showBlocks);
             if ($i == self::NUM_OPTION) {
                 $_showHide->addHide('additionalOption');
             }
         } else {
             $_showHide->addShow($showBlocks);
         }
         $optionAttributes = CRM_Core_DAO::getAttribute('CRM_Core_DAO_OptionValue');
         // label
         $this->add('text', 'option_label[' . $i . ']', ts('Label'), $optionAttributes['label']);
         // value
         $this->add('text', 'option_value[' . $i . ']', ts('Value'), $optionAttributes['value']);
         // weight
         $this->add('text', "option_weight[{$i}]", ts('Order'), $optionAttributes['weight']);
         // is active ?
         $this->add('checkbox', "option_status[{$i}]", ts('Active?'));
         $defaultOption[$i] = $this->createElement('radio', NULL, NULL, NULL, $i);
         //for checkbox handling of default option
         $this->add('checkbox', "default_checkbox_option[{$i}]", NULL);
     }
     //default option selection
     $this->addGroup($defaultOption, 'default_option');
     $_showHide->addToTemplate();
     // text length for alpha numeric data types
     $this->add('text', 'text_length', ts('Database field length'), $attributes['text_length'], FALSE);
     $this->addRule('text_length', ts('Value should be a positive number'), 'integer');
     $this->add('text', 'start_date_years', ts('Dates may be up to'), $attributes['start_date_years'], FALSE);
     $this->add('text', 'end_date_years', ts('Dates may be up to'), $attributes['end_date_years'], FALSE);
     $this->addRule('start_date_years', ts('Value should be a positive number'), 'integer');
     $this->addRule('end_date_years', ts('Value should be a positive number'), 'integer');
     $this->add('select', 'date_format', ts('Date Format'), array('' => ts('- select -')) + CRM_Core_SelectValues::getDatePluginInputFormats());
     $this->add('select', 'time_format', ts('Time'), array('' => ts('- none -')) + CRM_Core_SelectValues::getTimeFormats());
     // for Note field
     $this->add('text', 'note_columns', ts('Width (columns)') . ' ', $attributes['note_columns'], FALSE);
     $this->add('text', 'note_rows', ts('Height (rows)') . ' ', $attributes['note_rows'], FALSE);
     $this->add('text', 'note_length', ts('Maximum length') . ' ', $attributes['text_length'], FALSE);
     $this->addRule('note_columns', ts('Value should be a positive number'), 'positiveInteger');
     $this->addRule('note_rows', ts('Value should be a positive number'), 'positiveInteger');
     $this->addRule('note_length', ts('Value should be a positive number'), 'positiveInteger');
     // weight
     $this->add('text', 'weight', ts('Order'), $attributes['weight'], TRUE);
//.........这里部分代码省略.........
开发者ID:hguru,项目名称:224Civi,代码行数:101,代码来源:Field.php


注:本文中的CRM_Core_BAO_CustomField::customOptionGroup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。